From 3a6b5ba2aa9ed06335e72b136083ed146eae6f37 Mon Sep 17 00:00:00 2001 From: Rex Date: Mon, 11 Nov 2024 12:09:26 +0800 Subject: [PATCH] export plugins --- dist/rexaiospinner.js | 45 + dist/rexaiospinner.min.js | 2 +- dist/rexarrowspinner.js | 45 + dist/rexarrowspinner.min.js | 2 +- dist/rexboxspinner.js | 45 + dist/rexboxspinner.min.js | 2 +- dist/rexcheckbox.js | 45 + dist/rexcheckbox.min.js | 2 +- dist/rexcheckboxplugin.js | 45 + dist/rexcheckboxplugin.min.js | 2 +- dist/rexcircularprogress.js | 45 + dist/rexcircularprogress.min.js | 2 +- dist/rexcircularprogressplugin.js | 45 + dist/rexcircularprogressplugin.min.js | 2 +- dist/rexcolorcomponents.js | 45 + dist/rexcolorcomponents.min.js | 4 +- dist/rexcolorinput.js | 45 + dist/rexcolorinput.min.js | 4 +- dist/rexconfirmdialog.js | 45 + dist/rexconfirmdialog.min.js | 4 +- dist/rexcustomprogress.js | 45 + dist/rexcustomprogress.min.js | 2 +- dist/rexcustomprogressplugin.js | 45 + dist/rexcustomprogressplugin.min.js | 2 +- dist/rexcustomshapes.js | 45 + dist/rexcustomshapes.min.js | 2 +- dist/rexcustomshapesplugin.js | 45 + dist/rexcustomshapesplugin.min.js | 2 +- dist/rexcustomspinner.js | 45 + dist/rexcustomspinner.min.js | 2 +- dist/rexdropdownlist.js | 45 + dist/rexdropdownlist.min.js | 2 +- dist/rexgameobjectshellplugin.js | 45 + dist/rexgameobjectshellplugin.min.js | 6 +- dist/rexgridtable.js | 45 + dist/rexgridtable.min.js | 2 +- dist/rexheartsspinner.js | 45 + dist/rexheartsspinner.min.js | 2 +- dist/rexlineprogress.js | 45 + dist/rexlineprogress.min.js | 2 +- dist/rexlineprogressplugin.js | 45 + dist/rexlineprogressplugin.min.js | 2 +- dist/rexlineshapeplugin.js | 1799 +++++++++++++++++++ dist/rexlineshapeplugin.min.js | 1 + dist/rexmdscenario.js | 45 + dist/rexmdscenario.min.js | 4 +- dist/rexmdscenarioplugin.js | 45 + dist/rexmdscenarioplugin.min.js | 4 +- dist/rexnameinputdialog.js | 45 + dist/rexnameinputdialog.min.js | 4 +- dist/rexnumberbar.js | 45 + dist/rexnumberbar.min.js | 2 +- dist/rexradiospinner.js | 45 + dist/rexradiospinner.min.js | 2 +- dist/rexroundrectangleprogress.js | 45 + dist/rexroundrectangleprogress.min.js | 2 +- dist/rexroundrectangleprogressplugin.js | 45 + dist/rexroundrectangleprogressplugin.min.js | 2 +- dist/rexscrollablepanel.js | 45 + dist/rexscrollablepanel.min.js | 2 +- dist/rexscrollbar.js | 45 + dist/rexscrollbar.min.js | 2 +- dist/rexsimpledropdownlist.js | 45 + dist/rexsimpledropdownlist.min.js | 4 +- dist/rexsimplelabel.js | 45 + dist/rexsimplelabel.min.js | 4 +- dist/rexslider.js | 45 + dist/rexslider.min.js | 2 +- dist/rexspinnerplugin.js | 45 + dist/rexspinnerplugin.min.js | 2 +- dist/rextextarea.js | 45 + dist/rextextarea.min.js | 2 +- dist/rextextareainput.js | 45 + dist/rextextareainput.min.js | 2 +- dist/rextoggleswitch.js | 38 + dist/rextoggleswitch.min.js | 4 +- dist/rextoggleswitchplugin.js | 38 + dist/rextoggleswitchplugin.min.js | 4 +- dist/rextransitionimagepackplugin.js | 45 + dist/rextransitionimagepackplugin.min.js | 2 +- dist/rextrees.js | 45 + dist/rextrees.min.js | 4 +- dist/rextriangle.js | 45 + dist/rextriangle.min.js | 2 +- dist/rextriangleplugin.js | 45 + dist/rextriangleplugin.min.js | 2 +- dist/rextweaker.js | 45 + dist/rextweaker.min.js | 6 +- dist/rexuiplugin.js | 45 + dist/rexuiplugin.min.js | 4 +- plugin-list.js | 1 + 91 files changed, 3827 insertions(+), 60 deletions(-) create mode 100644 dist/rexlineshapeplugin.js create mode 100644 dist/rexlineshapeplugin.min.js diff --git a/dist/rexaiospinner.js b/dist/rexaiospinner.js index cf7d7f3415..90361d49f5 100644 --- a/dist/rexaiospinner.js +++ b/dist/rexaiospinner.js @@ -1725,6 +1725,32 @@ return pathData; }; + //import CatmullRomInterpolation from '../../utils/math/interpolation/CatmullRomInterpolation.js'; + + const CatmullRomInterpolation = Phaser.Math.Interpolation.CatmullRom; + + var CatmullRomTo = function (points, iterations, pathData) { + var pathDataCnt = pathData.length; + var p0x = pathData[pathDataCnt - 2]; + var p0y = pathData[pathDataCnt - 1]; + + var xList = [p0x]; + var yList = [p0y]; + for (var i = 0, cnt = points.length; i < cnt; i += 2) { + xList.push(points[i]); + yList.push(points[i + 1]); + } + + for (var i = 1, last = iterations - 1; i <= last; i++) { + var t = i / last; + pathData.push( + CatmullRomInterpolation(xList, t), + CatmullRomInterpolation(yList, t) + ); + } + return pathData; + }; + var DuplicateLast = function (pathData) { var len = pathData.length; if (len < 2) { @@ -1836,6 +1862,18 @@ return this; }, + catmullRomTo(...points) { + CatmullRomTo( + points, + this.iterations, + this.pathData + ); + + this.lastPointX = points[points.length-2]; + this.lastPointY = points[points.length-1]; + return this; + }, + close() { // Line to first point var startX = this.pathData[0], @@ -2273,6 +2311,13 @@ return this; } + catmullRomTo(...points) { + this.builder.catmullRomTo(...points); + + this.dirty = true; + return this; + } + close() { this.builder.close(); diff --git a/dist/rexaiospinner.min.js b/dist/rexaiospinner.min.js index 7aae51f660..38ad624c79 100644 --- a/dist/rexaiospinner.min.js +++ b/dist/rexaiospinner.min.js @@ -1 +1 @@ -var t,e;t=void 0,e=function(){const t=Phaser.GameObjects.GetCalcMatrix,e=Phaser.Renderer.Canvas.SetTransform;var s={renderWebGL:function(e,s,i,a){s.updateData(),i.addToRenderList(s);var h=e.pipelines.set(s.pipeline),r=t(s,i,a),n=h.calcMatrix.copyFrom(r.calc),o=s._displayOriginX,l=s._displayOriginY,u=i.alpha*s.alpha;e.pipelines.preBatch(s);for(var d,p=s.geom,c=0,v=p.length;c0?-this.delay:0,this.state=this.nowTime>=0?k:T,this.repeatCounter=0,this}stop(){return this.state=_,this}update(t,e){this.state!==_&&this.state!==A&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=w)):(this.nowTime=this.duration,this.state=A):this.nowTime>=0&&(this.state=k))}get t(){var t;switch(this.state){case _:case T:case w:t=0;break;case k:t=this.nowTime/this.duration;break;case A:t=1}return D(t,0,1)}set t(t){(t=D(t,-1,1))<0?(this.state=T,this.nowTime=-this.delay*t):(this.state=k,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===_}get isDelay(){return this.state===T}get isCountDown(){return this.state===k}get isRunning(){return this.state===T||this.state===k}get isDone(){return this.state===A}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const _=0,T=1,k=2,w=3,A=-1;class M extends m{constructor(t,e){super(t,e),this.timer=new b}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const E=Phaser.Utils.Objects.GetValue,C=Phaser.Utils.Objects.GetAdvancedValue,R=Phaser.Tweens.Builders.GetEaseFunction;class x extends M{resetFromJSON(t){return this.timer.resetFromJSON(E(t,"timer")),this.setEnable(E(t,"enable",!0)),this.setTarget(E(t,"target",this.parent)),this.setDelay(C(t,"delay",0)),this.setDuration(C(t,"duration",1e3)),this.setEase(E(t,"ease","Linear")),this.setRepeat(E(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=R(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var s=this.target,i=this.timer;return i.update(t,e),i.isDelay||this.updateTarget(s,i),this.emit("update",s,this),i.isDone&&this.complete(),this}updateTarget(t,e){}}const X=Phaser.Utils.Objects.GetValue,Y=Phaser.Math.Linear;class L extends x{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=X(t,"key","value");var s=e[this.propertyKey];return this.fromValue=X(t,"from",s),this.toValue=X(t,"to",s),this.setEase(X(t,"ease",this.ease)),this.setDuration(X(t,"duration",this.duration)),this.setRepeat(X(t,"repeat",0)),this.setDelay(X(t,"delay",0)),this.setRepeatDelay(X(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var s=e.t;s=this.easeFn(s),t[this.propertyKey]=Y(this.fromValue,this.toValue,s)}}var V={start:function(t){return this.easeValueTask||(this.easeValueTask=new L(this,{eventEmitter:null})),void 0!==t&&(this.duration=t,this.easeValueTask.stop()),this.easeValueTask.isRunning||(this.easeValueTask.restart({key:"value",from:0,to:1,duration:this.duration,ease:this.ease,repeat:-1,delay:this.delay,repeatDelay:this.repeatDelay}),this.setDirty()),this},stop:function(){return this.easeValueTask?(this.easeValueTask.stop(),this.setDirty(),this):this},pause:function(){return this.easeValueTask?(this.easeValueTask.pause(),this.setDirty(),this):this},resume:function(){return this.easeValueTask?(this.easeValueTask.pause(),this.setDirty(),this):this}};const z=Phaser.Utils.Objects.GetValue;class I extends r{constructor(t,e){super(t,z(e,"x",0),z(e,"y",0),z(e,"width",64),z(e,"height",64)),this.resetFromConfig(e,!0),this.buildShapes(e),z(e,"start",!0)&&this.start()}resetFromConfig(t,e){var s;return void 0===e&&(e=!1),s=e?1e3:this.duration,this.setDuration(z(t,"duration",s)),s=e?"Linear":this.ease,this.setEase(z(t,"ease",s)),s=e?0:this.delay,this.setDelay(z(t,"delay",s)),s=e?0:this.repeatDelay,this.setRepeatDelay(z(t,"repeatDelay",s)),s=e?16777215:this.color,this.setColor(z(t,"color",s)),s=e?0:this.value,this.setValue(z(t,"value",s)),this}buildShapes(){}get centerX(){return this.width/2}get centerY(){return this.height/2}get radius(){return Math.min(this.centerX,this.centerY)}get color(){return this._color}set color(t){this.isColorChanged=this.isColorChanged||this._color!==t,this.dirty=this.dirty||this.isColorChanged,this._color=t,this.setShapesColor(t)}setColor(t){return this.color=t,this}setShapesColor(t){}get value(){return this._value}set value(t){t=Phaser.Math.Clamp(t,0,1),this.dirty=this.dirty||this._value!=t,this._value=t}setValue(t){return this.value=t,this}setDuration(t){return this.duration=t,this}setDelay(t){return this.delay=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return this.ease=t,this}get isRunning(){return!!this.tweenTask&&this.tweenTask.isRunning}}Object.assign(I.prototype,V);var O={fillStyle:function(t,e){return null==t?this.isFilled=!1:(void 0===e&&(e=1),this.isFilled=!0,this.fillColor=t,this.fillAlpha=e),this},lineStyle:function(t,e,s){return null==t||null==e?this.isStroked=!1:(void 0===s&&(s=1),this.isStroked=!0,this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=s),this}},N={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var s=t;for(t in s)this.data[t]=s[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:function(t,e,s){if(!t||"number"==typeof t)return s;if("string"==typeof e){if(t.hasOwnProperty(e))return t[e];if(-1===e.indexOf("."))return s;e=e.split(".")}for(var i=e,a=t,h=s,r=0;r>>16,n=(65280&a)>>>8,o=255&a;t.fillStyle="rgba("+r+","+n+","+o+","+h+")"},W=function(t,e,s,i){var a=s||e.strokeColor,h=i||e.strokeAlpha,r=(16711680&a)>>>16,n=(65280&a)>>>8,o=255&a;t.strokeStyle="rgba("+r+","+n+","+o+","+h+")",t.lineWidth=e.lineWidth};const H=Phaser.Geom.Polygon.Earcut;class U extends j{constructor(){super(),this.pathData=[],this.pathIndexes=[],this.closePath=!1}updateData(){return this.pathIndexes=H(this.pathData),super.updateData(),this}webglRender(t,e,s,i,a){this.isFilled&&function(t,e,s,i,a,h){for(var r=F.getTintAppendFloatAlpha(s.fillColor,s.fillAlpha*i),n=s.pathData,o=s.pathIndexes,l=0;l=2){var a=s[i-2],h=s[i-1];if(t===a&&e===h)return s}return s.push(t,e),s};const K=Phaser.Math.DegToRad;var q=function(t,e,s,i,a,h,r,n,o){r&&h>a?h-=360:!r&&h0,r=0,n=e.length;rthis.value)for(var u=0;uthis.value&&(t+=1));for(var a=this.getShapes(),h=0,r=a.length;h0?-this.delay:0,this.state=this.nowTime>=0?k:_,this.repeatCounter=0,this}stop(){return this.state=T,this}update(t,e){this.state!==T&&this.state!==A&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=w)):(this.nowTime=this.duration,this.state=A):this.nowTime>=0&&(this.state=k))}get t(){var t;switch(this.state){case T:case _:case w:t=0;break;case k:t=this.nowTime/this.duration;break;case A:t=1}return D(t,0,1)}set t(t){(t=D(t,-1,1))<0?(this.state=_,this.nowTime=-this.delay*t):(this.state=k,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===T}get isDelay(){return this.state===_}get isCountDown(){return this.state===k}get isRunning(){return this.state===_||this.state===k}get isDone(){return this.state===A}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const T=0,_=1,k=2,w=3,A=-1;class M extends m{constructor(t,e){super(t,e),this.timer=new b}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const E=Phaser.Utils.Objects.GetValue,R=Phaser.Utils.Objects.GetAdvancedValue,C=Phaser.Tweens.Builders.GetEaseFunction;class x extends M{resetFromJSON(t){return this.timer.resetFromJSON(E(t,"timer")),this.setEnable(E(t,"enable",!0)),this.setTarget(E(t,"target",this.parent)),this.setDelay(R(t,"delay",0)),this.setDuration(R(t,"duration",1e3)),this.setEase(E(t,"ease","Linear")),this.setRepeat(E(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=C(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var s=this.target,i=this.timer;return i.update(t,e),i.isDelay||this.updateTarget(s,i),this.emit("update",s,this),i.isDone&&this.complete(),this}updateTarget(t,e){}}const X=Phaser.Utils.Objects.GetValue,Y=Phaser.Math.Linear;class L extends x{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=X(t,"key","value");var s=e[this.propertyKey];return this.fromValue=X(t,"from",s),this.toValue=X(t,"to",s),this.setEase(X(t,"ease",this.ease)),this.setDuration(X(t,"duration",this.duration)),this.setRepeat(X(t,"repeat",0)),this.setDelay(X(t,"delay",0)),this.setRepeatDelay(X(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var s=e.t;s=this.easeFn(s),t[this.propertyKey]=Y(this.fromValue,this.toValue,s)}}var V={start:function(t){return this.easeValueTask||(this.easeValueTask=new L(this,{eventEmitter:null})),void 0!==t&&(this.duration=t,this.easeValueTask.stop()),this.easeValueTask.isRunning||(this.easeValueTask.restart({key:"value",from:0,to:1,duration:this.duration,ease:this.ease,repeat:-1,delay:this.delay,repeatDelay:this.repeatDelay}),this.setDirty()),this},stop:function(){return this.easeValueTask?(this.easeValueTask.stop(),this.setDirty(),this):this},pause:function(){return this.easeValueTask?(this.easeValueTask.pause(),this.setDirty(),this):this},resume:function(){return this.easeValueTask?(this.easeValueTask.pause(),this.setDirty(),this):this}};const z=Phaser.Utils.Objects.GetValue;class I extends r{constructor(t,e){super(t,z(e,"x",0),z(e,"y",0),z(e,"width",64),z(e,"height",64)),this.resetFromConfig(e,!0),this.buildShapes(e),z(e,"start",!0)&&this.start()}resetFromConfig(t,e){var s;return void 0===e&&(e=!1),s=e?1e3:this.duration,this.setDuration(z(t,"duration",s)),s=e?"Linear":this.ease,this.setEase(z(t,"ease",s)),s=e?0:this.delay,this.setDelay(z(t,"delay",s)),s=e?0:this.repeatDelay,this.setRepeatDelay(z(t,"repeatDelay",s)),s=e?16777215:this.color,this.setColor(z(t,"color",s)),s=e?0:this.value,this.setValue(z(t,"value",s)),this}buildShapes(){}get centerX(){return this.width/2}get centerY(){return this.height/2}get radius(){return Math.min(this.centerX,this.centerY)}get color(){return this._color}set color(t){this.isColorChanged=this.isColorChanged||this._color!==t,this.dirty=this.dirty||this.isColorChanged,this._color=t,this.setShapesColor(t)}setColor(t){return this.color=t,this}setShapesColor(t){}get value(){return this._value}set value(t){t=Phaser.Math.Clamp(t,0,1),this.dirty=this.dirty||this._value!=t,this._value=t}setValue(t){return this.value=t,this}setDuration(t){return this.duration=t,this}setDelay(t){return this.delay=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return this.ease=t,this}get isRunning(){return!!this.tweenTask&&this.tweenTask.isRunning}}Object.assign(I.prototype,V);var O={fillStyle:function(t,e){return null==t?this.isFilled=!1:(void 0===e&&(e=1),this.isFilled=!0,this.fillColor=t,this.fillAlpha=e),this},lineStyle:function(t,e,s){return null==t||null==e?this.isStroked=!1:(void 0===s&&(s=1),this.isStroked=!0,this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=s),this}},N={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var s=t;for(t in s)this.data[t]=s[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:function(t,e,s){if(!t||"number"==typeof t)return s;if("string"==typeof e){if(t.hasOwnProperty(e))return t[e];if(-1===e.indexOf("."))return s;e=e.split(".")}for(var i=e,a=t,h=s,r=0;r>>16,n=(65280&a)>>>8,o=255&a;t.fillStyle="rgba("+r+","+n+","+o+","+h+")"},W=function(t,e,s,i){var a=s||e.strokeColor,h=i||e.strokeAlpha,r=(16711680&a)>>>16,n=(65280&a)>>>8,o=255&a;t.strokeStyle="rgba("+r+","+n+","+o+","+h+")",t.lineWidth=e.lineWidth};const H=Phaser.Geom.Polygon.Earcut;class U extends j{constructor(){super(),this.pathData=[],this.pathIndexes=[],this.closePath=!1}updateData(){return this.pathIndexes=H(this.pathData),super.updateData(),this}webglRender(t,e,s,i,a){this.isFilled&&function(t,e,s,i,a,h){for(var r=F.getTintAppendFloatAlpha(s.fillColor,s.fillAlpha*i),n=s.pathData,o=s.pathIndexes,l=0;l=2){var a=s[i-2],h=s[i-1];if(t===a&&e===h)return s}return s.push(t,e),s};const K=Phaser.Math.DegToRad;var q=function(t,e,s,i,a,h,r,n,o){r&&h>a?h-=360:!r&&h0,r=0,n=e.length;rthis.value)for(var u=0;uthis.value&&(t+=1));for(var a=this.getShapes(),h=0,r=a.length;h0?-this.delay:0,this.state=this.nowTime>=0?E:k,this.repeatCounter=0,this}stop(){return this.state=T,this}update(t,e){this.state!==T&&this.state!==w&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=_)):(this.nowTime=this.duration,this.state=w):this.nowTime>=0&&(this.state=E))}get t(){var t;switch(this.state){case T:case k:case _:t=0;break;case E:t=this.nowTime/this.duration;break;case w:t=1}return S(t,0,1)}set t(t){(t=S(t,-1,1))<0?(this.state=k,this.nowTime=-this.delay*t):(this.state=E,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===T}get isDelay(){return this.state===k}get isCountDown(){return this.state===E}get isRunning(){return this.state===k||this.state===E}get isDone(){return this.state===w}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const T=0,k=1,E=2,_=3,w=-1;class C extends f{constructor(t,e){super(t,e),this.timer=new b}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const R=Phaser.Utils.Objects.GetValue,A=Phaser.Utils.Objects.GetAdvancedValue,M=Phaser.Tweens.Builders.GetEaseFunction;class L extends C{resetFromJSON(t){return this.timer.resetFromJSON(R(t,"timer")),this.setEnable(R(t,"enable",!0)),this.setTarget(R(t,"target",this.parent)),this.setDelay(A(t,"delay",0)),this.setDuration(A(t,"duration",1e3)),this.setEase(R(t,"ease","Linear")),this.setRepeat(R(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=M(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const x=Phaser.Utils.Objects.GetValue,O=Phaser.Math.Linear;class V extends L{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=x(t,"key","value");var i=e[this.propertyKey];return this.fromValue=x(t,"from",i),this.toValue=x(t,"to",i),this.setEase(x(t,"ease",this.ease)),this.setDuration(x(t,"duration",this.duration)),this.setRepeat(x(t,"repeat",0)),this.setDelay(x(t,"delay",0)),this.setRepeatDelay(x(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=O(this.fromValue,this.toValue,i)}}var F={start:function(t){return this.easeValueTask||(this.easeValueTask=new V(this,{eventEmitter:null})),void 0!==t&&(this.duration=t,this.easeValueTask.stop()),this.easeValueTask.isRunning||(this.easeValueTask.restart({key:"value",from:0,to:1,duration:this.duration,ease:this.ease,repeat:-1,delay:this.delay,repeatDelay:this.repeatDelay}),this.setDirty()),this},stop:function(){return this.easeValueTask?(this.easeValueTask.stop(),this.setDirty(),this):this},pause:function(){return this.easeValueTask?(this.easeValueTask.pause(),this.setDirty(),this):this},resume:function(){return this.easeValueTask?(this.easeValueTask.pause(),this.setDirty(),this):this}};const X=Phaser.Utils.Objects.GetValue;class Y extends a{constructor(t,e){super(t,X(e,"x",0),X(e,"y",0),X(e,"width",64),X(e,"height",64)),this.resetFromConfig(e,!0),this.buildShapes(e),X(e,"start",!0)&&this.start()}resetFromConfig(t,e){var i;return void 0===e&&(e=!1),i=e?1e3:this.duration,this.setDuration(X(t,"duration",i)),i=e?"Linear":this.ease,this.setEase(X(t,"ease",i)),i=e?0:this.delay,this.setDelay(X(t,"delay",i)),i=e?0:this.repeatDelay,this.setRepeatDelay(X(t,"repeatDelay",i)),i=e?16777215:this.color,this.setColor(X(t,"color",i)),i=e?0:this.value,this.setValue(X(t,"value",i)),this}buildShapes(){}get centerX(){return this.width/2}get centerY(){return this.height/2}get radius(){return Math.min(this.centerX,this.centerY)}get color(){return this._color}set color(t){this.isColorChanged=this.isColorChanged||this._color!==t,this.dirty=this.dirty||this.isColorChanged,this._color=t,this.setShapesColor(t)}setColor(t){return this.color=t,this}setShapesColor(t){}get value(){return this._value}set value(t){t=Phaser.Math.Clamp(t,0,1),this.dirty=this.dirty||this._value!=t,this._value=t}setValue(t){return this.value=t,this}setDuration(t){return this.duration=t,this}setDelay(t){return this.delay=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return this.ease=t,this}get isRunning(){return!!this.tweenTask&&this.tweenTask.isRunning}}Object.assign(Y.prototype,F);var j={fillStyle:function(t,e){return null==t?this.isFilled=!1:(void 0===e&&(e=1),this.isFilled=!0,this.fillColor=t,this.fillAlpha=e),this},lineStyle:function(t,e,i){return null==t||null==e?this.isStroked=!1:(void 0===i&&(i=1),this.isStroked=!0,this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i),this}},z={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:function(t,e,i){if(!t||"number"==typeof t)return i;if("string"==typeof e){if(t.hasOwnProperty(e))return t[e];if(-1===e.indexOf("."))return i;e=e.split(".")}for(var s=e,r=t,h=i,a=0;a>>16,n=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+a+","+n+","+o+","+h+")"}(t,this),t.fill()),this.isStroked&&(function(t,e,i,s){var r=i||e.strokeColor,h=s||e.strokeAlpha,a=(16711680&r)>>>16,n=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+a+","+n+","+o+","+h+")",t.lineWidth=e.lineWidth}(t,this),t.stroke())}}var U=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],h=i[s-1];if(t===r&&e===h)return i}return i.push(t,e),i};const J=Phaser.Math.DegToRad,K=Phaser.Math.Interpolation.QuadraticBezier,q=Phaser.Math.Interpolation.CubicBezier;var H=function(t){var e=t.length;if(e<2)return t;var i=t[e-2],s=t[e-1];return t.push(i),t.push(s),t},Q={clear(){return this.start(),this},start(){return this.startAt(),this},startAt(t,e){return this.restorePathData(),this.accumulationLengths=void 0,function(t,e,i){i.length=0,null!=t&&i.push(t,e)}(t,e,this.pathData),this.firstPointX=t,this.firstPointY=e,this.lastPointX=t,this.lastPointY=e,this},lineTo(t,e,i){return void 0===i&&(i=!1),i&&(t+=this.lastPointX,e+=this.lastPointY),U(t,e,this.pathData),this.lastPointX=t,this.lastPointY=e,this},verticalLineTo(t,e){return this.lineTo(t,this.lastPointY,e),this},horizontalLineTo(t,e){return this.lineTo(this.lastPointX,t,e),this},ellipticalArc(t,e,i,s,r,h,a){return void 0===a&&(a=!1),function(t,e,i,s,r,h,a,n,o){a&&h>r?h-=360:!a&&h0,a=0,n=e.length;a0?-this.delay:0,this.state=this.nowTime>=0?E:k,this.repeatCounter=0,this}stop(){return this.state=T,this}update(t,e){this.state!==T&&this.state!==w&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=_)):(this.nowTime=this.duration,this.state=w):this.nowTime>=0&&(this.state=E))}get t(){var t;switch(this.state){case T:case k:case _:t=0;break;case E:t=this.nowTime/this.duration;break;case w:t=1}return b(t,0,1)}set t(t){(t=b(t,-1,1))<0?(this.state=k,this.nowTime=-this.delay*t):(this.state=E,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===T}get isDelay(){return this.state===k}get isCountDown(){return this.state===E}get isRunning(){return this.state===k||this.state===E}get isDone(){return this.state===w}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const T=0,k=1,E=2,_=3,w=-1;class C extends f{constructor(t,e){super(t,e),this.timer=new S}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const R=Phaser.Utils.Objects.GetValue,A=Phaser.Utils.Objects.GetAdvancedValue,M=Phaser.Tweens.Builders.GetEaseFunction;class L extends C{resetFromJSON(t){return this.timer.resetFromJSON(R(t,"timer")),this.setEnable(R(t,"enable",!0)),this.setTarget(R(t,"target",this.parent)),this.setDelay(A(t,"delay",0)),this.setDuration(A(t,"duration",1e3)),this.setEase(R(t,"ease","Linear")),this.setRepeat(R(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=M(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const x=Phaser.Utils.Objects.GetValue,O=Phaser.Math.Linear;class V extends L{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=x(t,"key","value");var i=e[this.propertyKey];return this.fromValue=x(t,"from",i),this.toValue=x(t,"to",i),this.setEase(x(t,"ease",this.ease)),this.setDuration(x(t,"duration",this.duration)),this.setRepeat(x(t,"repeat",0)),this.setDelay(x(t,"delay",0)),this.setRepeatDelay(x(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=O(this.fromValue,this.toValue,i)}}var X={start:function(t){return this.easeValueTask||(this.easeValueTask=new V(this,{eventEmitter:null})),void 0!==t&&(this.duration=t,this.easeValueTask.stop()),this.easeValueTask.isRunning||(this.easeValueTask.restart({key:"value",from:0,to:1,duration:this.duration,ease:this.ease,repeat:-1,delay:this.delay,repeatDelay:this.repeatDelay}),this.setDirty()),this},stop:function(){return this.easeValueTask?(this.easeValueTask.stop(),this.setDirty(),this):this},pause:function(){return this.easeValueTask?(this.easeValueTask.pause(),this.setDirty(),this):this},resume:function(){return this.easeValueTask?(this.easeValueTask.pause(),this.setDirty(),this):this}};const Y=Phaser.Utils.Objects.GetValue;class F extends a{constructor(t,e){super(t,Y(e,"x",0),Y(e,"y",0),Y(e,"width",64),Y(e,"height",64)),this.resetFromConfig(e,!0),this.buildShapes(e),Y(e,"start",!0)&&this.start()}resetFromConfig(t,e){var i;return void 0===e&&(e=!1),i=e?1e3:this.duration,this.setDuration(Y(t,"duration",i)),i=e?"Linear":this.ease,this.setEase(Y(t,"ease",i)),i=e?0:this.delay,this.setDelay(Y(t,"delay",i)),i=e?0:this.repeatDelay,this.setRepeatDelay(Y(t,"repeatDelay",i)),i=e?16777215:this.color,this.setColor(Y(t,"color",i)),i=e?0:this.value,this.setValue(Y(t,"value",i)),this}buildShapes(){}get centerX(){return this.width/2}get centerY(){return this.height/2}get radius(){return Math.min(this.centerX,this.centerY)}get color(){return this._color}set color(t){this.isColorChanged=this.isColorChanged||this._color!==t,this.dirty=this.dirty||this.isColorChanged,this._color=t,this.setShapesColor(t)}setColor(t){return this.color=t,this}setShapesColor(t){}get value(){return this._value}set value(t){t=Phaser.Math.Clamp(t,0,1),this.dirty=this.dirty||this._value!=t,this._value=t}setValue(t){return this.value=t,this}setDuration(t){return this.duration=t,this}setDelay(t){return this.delay=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return this.ease=t,this}get isRunning(){return!!this.tweenTask&&this.tweenTask.isRunning}}Object.assign(F.prototype,X);var j={fillStyle:function(t,e){return null==t?this.isFilled=!1:(void 0===e&&(e=1),this.isFilled=!0,this.fillColor=t,this.fillAlpha=e),this},lineStyle:function(t,e,i){return null==t||null==e?this.isStroked=!1:(void 0===i&&(i=1),this.isStroked=!0,this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i),this}},z={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:function(t,e,i){if(!t||"number"==typeof t)return i;if("string"==typeof e){if(t.hasOwnProperty(e))return t[e];if(-1===e.indexOf("."))return i;e=e.split(".")}for(var s=e,r=t,h=i,a=0;a>>16,n=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+a+","+n+","+o+","+h+")"}(t,this),t.fill()),this.isStroked&&(function(t,e,i,s){var r=i||e.strokeColor,h=s||e.strokeAlpha,a=(16711680&r)>>>16,n=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+a+","+n+","+o+","+h+")",t.lineWidth=e.lineWidth}(t,this),t.stroke())}}var U=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],h=i[s-1];if(t===r&&e===h)return i}return i.push(t,e),i};const J=Phaser.Math.DegToRad,K=Phaser.Math.Interpolation.QuadraticBezier,q=Phaser.Math.Interpolation.CubicBezier,H=Phaser.Math.Interpolation.CatmullRom;var Q=function(t){var e=t.length;if(e<2)return t;var i=t[e-2],s=t[e-1];return t.push(i),t.push(s),t},Z={clear(){return this.start(),this},start(){return this.startAt(),this},startAt(t,e){return this.restorePathData(),this.accumulationLengths=void 0,function(t,e,i){i.length=0,null!=t&&i.push(t,e)}(t,e,this.pathData),this.firstPointX=t,this.firstPointY=e,this.lastPointX=t,this.lastPointY=e,this},lineTo(t,e,i){return void 0===i&&(i=!1),i&&(t+=this.lastPointX,e+=this.lastPointY),U(t,e,this.pathData),this.lastPointX=t,this.lastPointY=e,this},verticalLineTo(t,e){return this.lineTo(t,this.lastPointY,e),this},horizontalLineTo(t,e){return this.lineTo(this.lastPointX,t,e),this},ellipticalArc(t,e,i,s,r,h,a){return void 0===a&&(a=!1),function(t,e,i,s,r,h,a,n,o){a&&h>r?h-=360:!a&&h0,a=0,n=e.length;a0?-this.delay:0,this.state=this.nowTime>=0?_:k,this.repeatCounter=0,this}stop(){return this.state=T,this}update(t,e){this.state!==T&&this.state!==w&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=E)):(this.nowTime=this.duration,this.state=w):this.nowTime>=0&&(this.state=_))}get t(){var t;switch(this.state){case T:case k:case E:t=0;break;case _:t=this.nowTime/this.duration;break;case w:t=1}return S(t,0,1)}set t(t){(t=S(t,-1,1))<0?(this.state=k,this.nowTime=-this.delay*t):(this.state=_,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===T}get isDelay(){return this.state===k}get isCountDown(){return this.state===_}get isRunning(){return this.state===k||this.state===_}get isDone(){return this.state===w}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const T=0,k=1,_=2,E=3,w=-1;class C extends f{constructor(t,e){super(t,e),this.timer=new b}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const R=Phaser.Utils.Objects.GetValue,A=Phaser.Utils.Objects.GetAdvancedValue,L=Phaser.Tweens.Builders.GetEaseFunction;class O extends C{resetFromJSON(t){return this.timer.resetFromJSON(R(t,"timer")),this.setEnable(R(t,"enable",!0)),this.setTarget(R(t,"target",this.parent)),this.setDelay(A(t,"delay",0)),this.setDuration(A(t,"duration",1e3)),this.setEase(R(t,"ease","Linear")),this.setRepeat(R(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=L(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const x=Phaser.Utils.Objects.GetValue,V=Phaser.Math.Linear;class j extends O{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=x(t,"key","value");var i=e[this.propertyKey];return this.fromValue=x(t,"from",i),this.toValue=x(t,"to",i),this.setEase(x(t,"ease",this.ease)),this.setDuration(x(t,"duration",this.duration)),this.setRepeat(x(t,"repeat",0)),this.setDelay(x(t,"delay",0)),this.setRepeatDelay(x(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=V(this.fromValue,this.toValue,i)}}var F={start:function(t){return this.easeValueTask||(this.easeValueTask=new j(this,{eventEmitter:null})),void 0!==t&&(this.duration=t,this.easeValueTask.stop()),this.easeValueTask.isRunning||(this.easeValueTask.restart({key:"value",from:0,to:1,duration:this.duration,ease:this.ease,repeat:-1,delay:this.delay,repeatDelay:this.repeatDelay}),this.setDirty()),this},stop:function(){return this.easeValueTask?(this.easeValueTask.stop(),this.setDirty(),this):this},pause:function(){return this.easeValueTask?(this.easeValueTask.pause(),this.setDirty(),this):this},resume:function(){return this.easeValueTask?(this.easeValueTask.pause(),this.setDirty(),this):this}};const X=Phaser.Utils.Objects.GetValue;class Y extends a{constructor(t,e){super(t,X(e,"x",0),X(e,"y",0),X(e,"width",64),X(e,"height",64)),this.resetFromConfig(e,!0),this.buildShapes(e),X(e,"start",!0)&&this.start()}resetFromConfig(t,e){var i;return void 0===e&&(e=!1),i=e?1e3:this.duration,this.setDuration(X(t,"duration",i)),i=e?"Linear":this.ease,this.setEase(X(t,"ease",i)),i=e?0:this.delay,this.setDelay(X(t,"delay",i)),i=e?0:this.repeatDelay,this.setRepeatDelay(X(t,"repeatDelay",i)),i=e?16777215:this.color,this.setColor(X(t,"color",i)),i=e?0:this.value,this.setValue(X(t,"value",i)),this}buildShapes(){}get centerX(){return this.width/2}get centerY(){return this.height/2}get radius(){return Math.min(this.centerX,this.centerY)}get color(){return this._color}set color(t){this.isColorChanged=this.isColorChanged||this._color!==t,this.dirty=this.dirty||this.isColorChanged,this._color=t,this.setShapesColor(t)}setColor(t){return this.color=t,this}setShapesColor(t){}get value(){return this._value}set value(t){t=Phaser.Math.Clamp(t,0,1),this.dirty=this.dirty||this._value!=t,this._value=t}setValue(t){return this.value=t,this}setDuration(t){return this.duration=t,this}setDelay(t){return this.delay=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return this.ease=t,this}get isRunning(){return!!this.tweenTask&&this.tweenTask.isRunning}}Object.assign(Y.prototype,F);var z={fillStyle:function(t,e){return null==t?this.isFilled=!1:(void 0===e&&(e=1),this.isFilled=!0,this.fillColor=t,this.fillAlpha=e),this},lineStyle:function(t,e,i){return null==t||null==e?this.isStroked=!1:(void 0===i&&(i=1),this.isStroked=!0,this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i),this}},M={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:function(t,e,i){if(!t||"number"==typeof t)return i;if("string"==typeof e){if(t.hasOwnProperty(e))return t[e];if(-1===e.indexOf("."))return i;e=e.split(".")}for(var s=e,h=t,r=i,a=0;a>>16,n=(65280&h)>>>8,o=255&h;t.fillStyle="rgba("+a+","+n+","+o+","+r+")"}(t,this),t.fill()),this.isStroked&&(function(t,e,i,s){var h=i||e.strokeColor,r=s||e.strokeAlpha,a=(16711680&h)>>>16,n=(65280&h)>>>8,o=255&h;t.strokeStyle="rgba("+a+","+n+","+o+","+r+")",t.lineWidth=e.lineWidth}(t,this),t.stroke())}}var U=function(t,e,i){var s=i.length;if(s>=2){var h=i[s-2],r=i[s-1];if(t===h&&e===r)return i}return i.push(t,e),i};const J=Phaser.Math.DegToRad,K=Phaser.Math.Interpolation.QuadraticBezier,q=Phaser.Math.Interpolation.CubicBezier;var H=function(t){var e=t.length;if(e<2)return t;var i=t[e-2],s=t[e-1];return t.push(i),t.push(s),t},Q={clear(){return this.start(),this},start(){return this.startAt(),this},startAt(t,e){return this.restorePathData(),this.accumulationLengths=void 0,function(t,e,i){i.length=0,null!=t&&i.push(t,e)}(t,e,this.pathData),this.firstPointX=t,this.firstPointY=e,this.lastPointX=t,this.lastPointY=e,this},lineTo(t,e,i){return void 0===i&&(i=!1),i&&(t+=this.lastPointX,e+=this.lastPointY),U(t,e,this.pathData),this.lastPointX=t,this.lastPointY=e,this},verticalLineTo(t,e){return this.lineTo(t,this.lastPointY,e),this},horizontalLineTo(t,e){return this.lineTo(this.lastPointX,t,e),this},ellipticalArc(t,e,i,s,h,r,a){return void 0===a&&(a=!1),function(t,e,i,s,h,r,a,n,o){a&&r>h?r-=360:!a&&r0,a=0,n=e.length;a0?-this.delay:0,this.state=this.nowTime>=0?_:k,this.repeatCounter=0,this}stop(){return this.state=b,this}update(t,e){this.state!==b&&this.state!==w&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=E)):(this.nowTime=this.duration,this.state=w):this.nowTime>=0&&(this.state=_))}get t(){var t;switch(this.state){case b:case k:case E:t=0;break;case _:t=this.nowTime/this.duration;break;case w:t=1}return S(t,0,1)}set t(t){(t=S(t,-1,1))<0?(this.state=k,this.nowTime=-this.delay*t):(this.state=_,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===b}get isDelay(){return this.state===k}get isCountDown(){return this.state===_}get isRunning(){return this.state===k||this.state===_}get isDone(){return this.state===w}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const b=0,k=1,_=2,E=3,w=-1;class C extends f{constructor(t,e){super(t,e),this.timer=new T}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const R=Phaser.Utils.Objects.GetValue,A=Phaser.Utils.Objects.GetAdvancedValue,L=Phaser.Tweens.Builders.GetEaseFunction;class O extends C{resetFromJSON(t){return this.timer.resetFromJSON(R(t,"timer")),this.setEnable(R(t,"enable",!0)),this.setTarget(R(t,"target",this.parent)),this.setDelay(A(t,"delay",0)),this.setDuration(A(t,"duration",1e3)),this.setEase(R(t,"ease","Linear")),this.setRepeat(R(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=L(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const x=Phaser.Utils.Objects.GetValue,V=Phaser.Math.Linear;class j extends O{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=x(t,"key","value");var i=e[this.propertyKey];return this.fromValue=x(t,"from",i),this.toValue=x(t,"to",i),this.setEase(x(t,"ease",this.ease)),this.setDuration(x(t,"duration",this.duration)),this.setRepeat(x(t,"repeat",0)),this.setDelay(x(t,"delay",0)),this.setRepeatDelay(x(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=V(this.fromValue,this.toValue,i)}}var F={start:function(t){return this.easeValueTask||(this.easeValueTask=new j(this,{eventEmitter:null})),void 0!==t&&(this.duration=t,this.easeValueTask.stop()),this.easeValueTask.isRunning||(this.easeValueTask.restart({key:"value",from:0,to:1,duration:this.duration,ease:this.ease,repeat:-1,delay:this.delay,repeatDelay:this.repeatDelay}),this.setDirty()),this},stop:function(){return this.easeValueTask?(this.easeValueTask.stop(),this.setDirty(),this):this},pause:function(){return this.easeValueTask?(this.easeValueTask.pause(),this.setDirty(),this):this},resume:function(){return this.easeValueTask?(this.easeValueTask.pause(),this.setDirty(),this):this}};const X=Phaser.Utils.Objects.GetValue;class Y extends a{constructor(t,e){super(t,X(e,"x",0),X(e,"y",0),X(e,"width",64),X(e,"height",64)),this.resetFromConfig(e,!0),this.buildShapes(e),X(e,"start",!0)&&this.start()}resetFromConfig(t,e){var i;return void 0===e&&(e=!1),i=e?1e3:this.duration,this.setDuration(X(t,"duration",i)),i=e?"Linear":this.ease,this.setEase(X(t,"ease",i)),i=e?0:this.delay,this.setDelay(X(t,"delay",i)),i=e?0:this.repeatDelay,this.setRepeatDelay(X(t,"repeatDelay",i)),i=e?16777215:this.color,this.setColor(X(t,"color",i)),i=e?0:this.value,this.setValue(X(t,"value",i)),this}buildShapes(){}get centerX(){return this.width/2}get centerY(){return this.height/2}get radius(){return Math.min(this.centerX,this.centerY)}get color(){return this._color}set color(t){this.isColorChanged=this.isColorChanged||this._color!==t,this.dirty=this.dirty||this.isColorChanged,this._color=t,this.setShapesColor(t)}setColor(t){return this.color=t,this}setShapesColor(t){}get value(){return this._value}set value(t){t=Phaser.Math.Clamp(t,0,1),this.dirty=this.dirty||this._value!=t,this._value=t}setValue(t){return this.value=t,this}setDuration(t){return this.duration=t,this}setDelay(t){return this.delay=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return this.ease=t,this}get isRunning(){return!!this.tweenTask&&this.tweenTask.isRunning}}Object.assign(Y.prototype,F);var M={fillStyle:function(t,e){return null==t?this.isFilled=!1:(void 0===e&&(e=1),this.isFilled=!0,this.fillColor=t,this.fillAlpha=e),this},lineStyle:function(t,e,i){return null==t||null==e?this.isStroked=!1:(void 0===i&&(i=1),this.isStroked=!0,this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i),this}},z={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:function(t,e,i){if(!t||"number"==typeof t)return i;if("string"==typeof e){if(t.hasOwnProperty(e))return t[e];if(-1===e.indexOf("."))return i;e=e.split(".")}for(var s=e,h=t,r=i,a=0;a>>16,n=(65280&h)>>>8,o=255&h;t.fillStyle="rgba("+a+","+n+","+o+","+r+")"}(t,this),t.fill()),this.isStroked&&(function(t,e,i,s){var h=i||e.strokeColor,r=s||e.strokeAlpha,a=(16711680&h)>>>16,n=(65280&h)>>>8,o=255&h;t.strokeStyle="rgba("+a+","+n+","+o+","+r+")",t.lineWidth=e.lineWidth}(t,this),t.stroke())}}var U=function(t,e,i){var s=i.length;if(s>=2){var h=i[s-2],r=i[s-1];if(t===h&&e===r)return i}return i.push(t,e),i};const J=Phaser.Math.DegToRad,K=Phaser.Math.Interpolation.QuadraticBezier,q=Phaser.Math.Interpolation.CubicBezier,H=Phaser.Math.Interpolation.CatmullRom;var Q=function(t){var e=t.length;if(e<2)return t;var i=t[e-2],s=t[e-1];return t.push(i),t.push(s),t},Z={clear(){return this.start(),this},start(){return this.startAt(),this},startAt(t,e){return this.restorePathData(),this.accumulationLengths=void 0,function(t,e,i){i.length=0,null!=t&&i.push(t,e)}(t,e,this.pathData),this.firstPointX=t,this.firstPointY=e,this.lastPointX=t,this.lastPointY=e,this},lineTo(t,e,i){return void 0===i&&(i=!1),i&&(t+=this.lastPointX,e+=this.lastPointY),U(t,e,this.pathData),this.lastPointX=t,this.lastPointY=e,this},verticalLineTo(t,e){return this.lineTo(t,this.lastPointY,e),this},horizontalLineTo(t,e){return this.lineTo(this.lastPointX,t,e),this},ellipticalArc(t,e,i,s,h,r,a){return void 0===a&&(a=!1),function(t,e,i,s,h,r,a,n,o){a&&r>h?r-=360:!a&&r0,a=0,n=e.length;a>>16,n=(65280&h)>>>8,o=255&h;t.fillStyle="rgba("+a+","+n+","+o+","+r+")"}(t,this),t.fill()),this.isStroked&&(function(t,e,i,s){var h=i||e.strokeColor,r=s||e.strokeAlpha,a=(16711680&h)>>>16,n=(65280&h)>>>8,o=255&h;t.strokeStyle="rgba("+a+","+n+","+o+","+r+")",t.lineWidth=e.lineWidth}(t,this),t.stroke())}}var y=function(t,e,i){var s=i.length;if(s>=2){var h=i[s-2],r=i[s-1];if(t===h&&e===r)return i}return i.push(t,e),i};const m=Phaser.Math.DegToRad;var k=function(t,e,i,s,h,r,a,n,o){a&&r>h?r-=360:!a&&r0,a=0,n=e.length;a0;this.dirty=this.dirty||this._radiusTL!==t||this._convexTL!==e,this._convexTL=e,this._radiusTL=Math.abs(t)}get radiusTR(){return this._radiusTR}set radiusTR(t){var e=t>0;this.dirty=this.dirty||this._radiusTR!==t||this._convexTR!==e,this._convexTR=e,this._radiusTR=Math.abs(t)}get radiusBL(){return this._radiusBL}set radiusBL(t){var e=t>0;this.dirty=this.dirty||this._radiusBL!==t||this._convexBL!==e,this._convexBL=e,this._radiusBL=Math.abs(t)}get radiusBR(){return this._radiusBR}set radiusBR(t){var e=t>0;this.dirty=this.dirty||this._radiusBR!==t||this._convexBR!==e,this._convexBR=e,this._radiusBR=Math.abs(t)}get radius(){return Math.max(this.radiusTL,this.radiusTR,this.radiusBL,this.radiusBR)}set radius(t){"number"==typeof t?(this.radiusTL=t,this.radiusTR=t,this.radiusBL=t,this.radiusBR=t):(this.radiusTL=W(t,"tl",0),this.radiusTR=W(t,"tr",0),this.radiusBL=W(t,"bl",0),this.radiusBR=W(t,"br",0))}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}get iterations(){return this._iterations}set iterations(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t}setIterations(t){return this.iterations=t,this}updateData(){var t=this.pathData;t.length=0;var e,i=this.width,s=this.height,h=this.iterations+1;return(e=this.radiusTL)>0?this._convexTL?k(e,e,e,e,180,270,!1,h,t):k(0,0,e,e,90,0,!0,h,t):y(0,0,t),(e=this.radiusTR)>0?this._convexTR?k(i-e,e,e,e,270,360,!1,h,t):k(i,0,e,e,180,90,!0,h,t):y(i,0,t),(e=this.radiusBR)>0?this._convexBR?k(i-e,s-e,e,e,0,90,!1,h,t):k(i,s,e,e,270,180,!0,h,t):y(i,s,t),(e=this.radiusBL)>0?this._convexBL?k(e,s-e,e,e,90,180,!1,h,t):k(0,s,e,e,360,270,!0,h,t):y(0,s,t),t.push(t[0],t[1]),_(this.x,this.y,t),super.updateData(),this}}Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlpha;var Y={buildShapes(){this.addShape((new X).setName("box")).addShape((new V).setName("checker"))},updateShapes(){var t=this.width/2,e=this.height/2,i=Math.min(t,e),s=2*i,h=t-i,r=e-i,a=this.boxLineWidth,n=Math.max(s/10,2),o=this.getShape("box"),l=this.getShape("checker");if(this.isSizeChanged){var u=s*(1-this.boxSize)/2,d=a/2,c=s*this.boxSize-a;o.setTopLeftPosition(h+d+u,r+d+u).setSize(c,c),this.isCircleShape?o.setRadius(c/2):o.setRadius(0),u=s*(1-this.checkerSize)/2;var p=s*this.checkerSize/4,v=1*p,g=2*p,y=3*p;l.startAt(v,g).lineTo(g,y).lineTo(y,v).offset(h+u,r+u).end()}this.checked?(o.fillStyle(this.boxFillColor,this.boxFillAlpha).lineStyle(a,this.boxStrokeColor,this.boxStrokeAlpha),l.lineStyle(n,this.checkerColor)):(o.fillStyle(this.uncheckedBoxFillColor,this.uncheckedBoxFillAlpha).lineStyle(a,this.uncheckedBoxStrokeColor,this.uncheckedBoxStrokeAlpha),l.lineStyle()),this.checked&&l.setDisplayPathSegment(this.checkerAnimProgress)}},G={setEventEmitter(t,e){return void 0===e&&(e=Phaser.Events.EventEmitter),this._privateEE=!0===t||void 0===t,this._eventEmitter=this._privateEE?new e:t,this},destroyEventEmitter(){return this._eventEmitter&&this._privateEE&&this._eventEmitter.shutdown(),this},getEventEmitter(){return this._eventEmitter},on(){return this._eventEmitter&&this._eventEmitter.on.apply(this._eventEmitter,arguments),this},once(){return this._eventEmitter&&this._eventEmitter.once.apply(this._eventEmitter,arguments),this},off(){return this._eventEmitter&&this._eventEmitter.off.apply(this._eventEmitter,arguments),this},emit(t){return this._eventEmitter&&t&&this._eventEmitter.emit.apply(this._eventEmitter,arguments),this},addListener(){return this._eventEmitter&&this._eventEmitter.addListener.apply(this._eventEmitter,arguments),this},removeListener(){return this._eventEmitter&&this._eventEmitter.removeListener.apply(this._eventEmitter,arguments),this},removeAllListeners(){return this._eventEmitter&&this._eventEmitter.removeAllListeners.apply(this._eventEmitter,arguments),this},listenerCount(){return this._eventEmitter?this._eventEmitter.listenerCount.apply(this._eventEmitter,arguments):0},listeners(){return this._eventEmitter?this._eventEmitter.listeners.apply(this._eventEmitter,arguments):[]},eventNames(){return this._eventEmitter?this._eventEmitter.eventNames.apply(this._eventEmitter,arguments):[]}};const I=Phaser.Scene;var U=function(t){return t instanceof I};const N=Phaser.Game;var J=function(t){return t instanceof N};const K=Phaser.Utils.Objects.GetValue;class q{constructor(t,e){this.setParent(t),this.isShutdown=!1,this.setEventEmitter(K(e,"eventEmitter",!0)),this.parent&&(this.parent===this.scene?this.scene.sys.events.once("shutdown",this.onEnvDestroy,this):this.parent===this.game?this.game.events.once("shutdown",this.onEnvDestroy,this):this.parent.once&&this.parent.once("destroy",this.onParentDestroy,this))}shutdown(t){this.isShutdown||(this.parent&&(this.parent===this.scene?this.scene.sys.events.off("shutdown",this.onEnvDestroy,this):this.parent===this.game?this.game.events.off("shutdown",this.onEnvDestroy,this):this.parent.once&&this.parent.off("destroy",this.onParentDestroy,this)),this.destroyEventEmitter(),this.parent=void 0,this.scene=void 0,this.game=void 0,this.isShutdown=!0)}destroy(t){this.shutdown(t)}onEnvDestroy(){this.destroy(!0)}onParentDestroy(t,e){this.destroy(e)}setParent(t){var e;return this.parent=t,this.scene=null==(e=t)||"object"!=typeof e?null:U(e)?e:e.scene&&U(e.scene)?e.scene:e.parent&&e.parent.scene&&U(e.parent.scene)?e.parent.scene:null,this.game=function(t){return null==t||"object"!=typeof t?null:J(t)?t:J(t.game)?t.game:U(t)?t.sys.game:U(t.scene)?t.scene.sys.game:void 0}(t),this}}Object.assign(q.prototype,G);const H=Phaser.Utils.Objects.GetValue;class Q extends q{constructor(t,e){super(t,e),this._isRunning=!1,this.isPaused=!1,this.tickingState=!1,this.setTickingMode(H(e,"tickingMode",1))}boot(){2!==this.tickingMode||this.tickingState||this.startTicking()}shutdown(t){this.isShutdown||(this.stop(),this.tickingState&&this.stopTicking(),super.shutdown(t))}setTickingMode(t){"string"==typeof t&&(t=Z[t]),this.tickingMode=t}startTicking(){this.tickingState=!0}stopTicking(){this.tickingState=!1}get isRunning(){return this._isRunning}set isRunning(t){this._isRunning!==t&&(this._isRunning=t,1===this.tickingMode&&t!=this.tickingState&&(t?this.startTicking():this.stopTicking()))}start(){return this.isPaused=!1,this.isRunning=!0,this}pause(){return this.isRunning&&(this.isPaused=!0,this.isRunning=!1),this}resume(){return this.isPaused&&(this.isPaused=!1,this.isRunning=!0),this}stop(){return this.isPaused=!1,this.isRunning=!1,this}complete(){this.isPaused=!1,this.isRunning=!1,this.emit("complete",this.parent,this)}}const Z={no:0,lazy:1,always:2},$=Phaser.Utils.Objects.GetValue;class tt extends Q{constructor(t,e){super(t,e);var i=this.scene?"update":"step";this.tickEventName=$(e,"tickEventName",i),this.isSceneTicker=!et(this.tickEventName)}startTicking(){super.startTicking(),this.isSceneTicker?this.scene.sys.events.on(this.tickEventName,this.update,this):this.game.events.on(this.tickEventName,this.update,this)}stopTicking(){super.stopTicking(),this.isSceneTicker&&this.scene?this.scene.sys.events.off(this.tickEventName,this.update,this):this.game&&this.game.events.off(this.tickEventName,this.update,this)}}var et=function(t){return"step"===t||"poststep"===t};const it=Phaser.Utils.Objects.GetValue,st=Phaser.Math.Clamp;class ht{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){this.state=it(t,"state",rt),this.timeScale=it(t,"timeScale",1),this.delay=it(t,"delay",0),this.repeat=it(t,"repeat",0),this.repeatCounter=it(t,"repeatCounter",0),this.repeatDelay=it(t,"repeatDelay",0),this.duration=it(t,"duration",0),this.nowTime=it(t,"nowTime",0),this.justRestart=it(t,"justRestart",!1)}toJSON(){return{state:this.state,timeScale:this.timeScale,delay:this.delay,repeat:this.repeat,repeatCounter:this.repeatCounter,repeatDelay:this.repeatDelay,duration:this.duration,nowTime:this.nowTime,justRestart:this.justRestart}}destroy(){}setTimeScale(t){return this.timeScale=t,this}setDelay(t){return void 0===t&&(t=0),this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatInfinity(){return this.repeat=-1,this}setRepeatDelay(t){return this.repeatDelay=t,this}start(){return this.nowTime=this.delay>0?-this.delay:0,this.state=this.nowTime>=0?nt:at,this.repeatCounter=0,this}stop(){return this.state=rt,this}update(t,e){this.state!==rt&&this.state!==lt&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=ot)):(this.nowTime=this.duration,this.state=lt):this.nowTime>=0&&(this.state=nt))}get t(){var t;switch(this.state){case rt:case at:case ot:t=0;break;case nt:t=this.nowTime/this.duration;break;case lt:t=1}return st(t,0,1)}set t(t){(t=st(t,-1,1))<0?(this.state=at,this.nowTime=-this.delay*t):(this.state=nt,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===rt}get isDelay(){return this.state===at}get isCountDown(){return this.state===nt}get isRunning(){return this.state===at||this.state===nt}get isDone(){return this.state===lt}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const rt=0,at=1,nt=2,ot=3,lt=-1;class ut extends tt{constructor(t,e){super(t,e),this.timer=new ht}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const dt=Phaser.Utils.Objects.GetValue,ct=Phaser.Utils.Objects.GetAdvancedValue,pt=Phaser.Tweens.Builders.GetEaseFunction;class vt extends ut{resetFromJSON(t){return this.timer.resetFromJSON(dt(t,"timer")),this.setEnable(dt(t,"enable",!0)),this.setTarget(dt(t,"target",this.parent)),this.setDelay(ct(t,"delay",0)),this.setDuration(ct(t,"duration",1e3)),this.setEase(dt(t,"ease","Linear")),this.setRepeat(dt(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=pt(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const gt=Phaser.Utils.Objects.GetValue,yt=Phaser.Math.Linear;class mt extends vt{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=gt(t,"key","value");var i=e[this.propertyKey];return this.fromValue=gt(t,"from",i),this.toValue=gt(t,"to",i),this.setEase(gt(t,"ease",this.ease)),this.setDuration(gt(t,"duration",this.duration)),this.setRepeat(gt(t,"repeat",0)),this.setDelay(gt(t,"delay",0)),this.setRepeatDelay(gt(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=yt(this.fromValue,this.toValue,i)}}var kt={setCheckerAnimationDuration(t){return void 0===t&&(t=0),this.checkerAnimDuration=t,this},playCheckerAnimation(){return void 0===this.checkerAnimProgressTask&&(this.checkerAnimProgressTask=new mt(this,{eventEmitter:null})),this.checkerAnimProgressTask.restart({key:"checkerAnimProgress",from:0,to:1,duration:this.checkerAnimDuration}),this},stopCheckerAnimation(){return void 0===this.checkerAnimProgressTask||this.checkerAnimProgressTask.stop(),this}},ft={};Object.assign(ft,n,o,Y,kt);const bt=23730,St=Phaser.Utils.Objects.GetValue,Pt=Phaser.Utils.Objects.IsPlainObject;class Dt extends a{constructor(t,e,i,s,h,r,a){Pt(e)?(e=St(a=e,"x",0),i=St(a,"y",0),s=St(a,"width",2),h=St(a,"height",2),r=St(a,"color",bt)):Pt(r)&&(r=St(a=r,"color",bt)),super(t,e,i,s,h),this.type="rexCheckbox",void 0===r&&(r=bt),this.setBoxShape(St(a,"circleBox",!1)),this.setBoxFillStyle(r,St(a,"boxFillAlpha",1)),this.setUncheckedBoxFillStyle(St(a,"uncheckedColor",null),St(a,"uncheckedBoxFillAlpha",1)),this.setBoxStrokeStyle(St(a,"boxLineWidth",4),St(a,"boxStrokeColor",r),St(a,"boxStrokeAlpha",1)),this.setUncheckedBoxStrokeStyle(this.boxLineWidth,St(a,"uncheckedBoxStrokeColor",this.boxStrokeColor),St(a,"uncheckedBoxStrokeAlpha",this.boxStrokeAlpha)),this.setCheckerStyle(St(a,"checkerColor",16777215),St(a,"checkerAlpha",1)),this.setBoxSize(St(a,"boxSize",1)),this.setCheckerSize(St(a,"checkerSize",1)),this.setCheckerAnimationDuration(St(a,"animationDuration",150)),this.buildShapes();var n=St(a,"checked");void 0===n&&(n=St(a,"value",!1)),this.setValue(n)}get value(){return this._value}set value(t){t=!!t,this._value!==t&&(this.dirty=!0,this._value=t,t?this.playCheckerAnimation():this.stopCheckerAnimation(),this.emit("valuechange",t))}setValue(t){return this.value=t,this}toggleValue(){return this.setValue(!this.value),this}get checked(){return this.value}set checked(t){this.value=t}setChecked(t){return void 0===t&&(t=!0),this.setValue(t),this}toggleChecked(){return this.toggleValue(),this}get checkerAnimProgress(){return this._checkerAnimProgress}set checkerAnimProgress(t){this._checkerAnimProgress!==t&&(this._checkerAnimProgress=t,this.dirty=!0)}}Object.assign(Dt.prototype,ft);const _t=Phaser.Utils.Objects.GetValue;class Tt extends q{constructor(t,e){super(t,e),this._enable=void 0,t.setInteractive(_t(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.isDown=!1,this.isOver=!1,this.setEnable(_t(t,"enable",!0)),this.setMode(_t(t,"mode",1)),this.setClickInterval(_t(t,"clickInterval",100)),this.setDragThreshold(_t(t,"threshold",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPress,this),t.on("pointerup",this.onRelease,this),t.on("pointerout",this.onPointOut,this),t.on("pointermove",this.onMove,this),t.on("pointerover",this.onOver,this),t.on("pointerout",this.onOut,this)}shutdown(t){this.isShutdown||(this.pointer=null,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=xt[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}onPress(t,e,i,s){void 0===this.pointer&&(this.pointer=t,this.isDown=!0,this.emit("down",this,this.parent,t,s),0===this.mode&&this.click(t.downTime,t,s))}onRelease(t,e,i,s){this.pointer===t&&(this.isDown=!1,this.emit("up",this,this.parent,t,s),1===this.mode&&this.click(t.upTime,t,s),this.pointer=void 0)}onPointOut(t,e){this.pointer===t&&this.cancel()}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&t.getDistance()>=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const xt={press:0,pointerdown:0,release:1,pointerup:1},At=Phaser.Utils.Objects.GetValue,Ct=Phaser.Utils.Objects.IsPlainObject;return class extends Dt{constructor(t,e,i,s,h,r,a){Ct(e)?(e=At(a=e,"x",0),i=At(a,"y",0),s=At(a,"width",2),h=At(a,"height",2),r=At(a,"color",bt)):Ct(r)&&(r=At(a=r,"color",bt)),super(t,e,i,s,h,r,a),this._click=new Tt(this,At(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(At(a,"readOnly",!1))}get readOnly(){return!this._click.enable}set readOnly(t){this._click.enable=!t}setReadOnly(t){return void 0===t&&(t=!0),this.readOnly=t,this}}},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rexcheckbox=e(); +var t,e;t=void 0,e=function(){const t=Phaser.GameObjects.GetCalcMatrix,e=Phaser.Renderer.Canvas.SetTransform;var i={renderWebGL:function(e,i,s,h){i.updateData(),s.addToRenderList(i);var r=e.pipelines.set(i.pipeline),a=t(i,s,h),n=r.calcMatrix.copyFrom(a.calc),o=i._displayOriginX,l=i._displayOriginY,u=s.alpha*i.alpha;e.pipelines.preBatch(i);for(var d,c=i.geom,p=0,v=c.length;p>>16,n=(65280&h)>>>8,o=255&h;t.fillStyle="rgba("+a+","+n+","+o+","+r+")"}(t,this),t.fill()),this.isStroked&&(function(t,e,i,s){var h=i||e.strokeColor,r=s||e.strokeAlpha,a=(16711680&h)>>>16,n=(65280&h)>>>8,o=255&h;t.strokeStyle="rgba("+a+","+n+","+o+","+r+")",t.lineWidth=e.lineWidth}(t,this),t.stroke())}}var y=function(t,e,i){var s=i.length;if(s>=2){var h=i[s-2],r=i[s-1];if(t===h&&e===r)return i}return i.push(t,e),i};const m=Phaser.Math.DegToRad;var k=function(t,e,i,s,h,r,a,n,o){a&&r>h?r-=360:!a&&r0,a=0,n=e.length;a0;this.dirty=this.dirty||this._radiusTL!==t||this._convexTL!==e,this._convexTL=e,this._radiusTL=Math.abs(t)}get radiusTR(){return this._radiusTR}set radiusTR(t){var e=t>0;this.dirty=this.dirty||this._radiusTR!==t||this._convexTR!==e,this._convexTR=e,this._radiusTR=Math.abs(t)}get radiusBL(){return this._radiusBL}set radiusBL(t){var e=t>0;this.dirty=this.dirty||this._radiusBL!==t||this._convexBL!==e,this._convexBL=e,this._radiusBL=Math.abs(t)}get radiusBR(){return this._radiusBR}set radiusBR(t){var e=t>0;this.dirty=this.dirty||this._radiusBR!==t||this._convexBR!==e,this._convexBR=e,this._radiusBR=Math.abs(t)}get radius(){return Math.max(this.radiusTL,this.radiusTR,this.radiusBL,this.radiusBR)}set radius(t){"number"==typeof t?(this.radiusTL=t,this.radiusTR=t,this.radiusBL=t,this.radiusBR=t):(this.radiusTL=V(t,"tl",0),this.radiusTR=V(t,"tr",0),this.radiusBL=V(t,"bl",0),this.radiusBR=V(t,"br",0))}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}get iterations(){return this._iterations}set iterations(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t}setIterations(t){return this.iterations=t,this}updateData(){var t=this.pathData;t.length=0;var e,i=this.width,s=this.height,h=this.iterations+1;return(e=this.radiusTL)>0?this._convexTL?k(e,e,e,e,180,270,!1,h,t):k(0,0,e,e,90,0,!0,h,t):y(0,0,t),(e=this.radiusTR)>0?this._convexTR?k(i-e,e,e,e,270,360,!1,h,t):k(i,0,e,e,180,90,!0,h,t):y(i,0,t),(e=this.radiusBR)>0?this._convexBR?k(i-e,s-e,e,e,0,90,!1,h,t):k(i,s,e,e,270,180,!0,h,t):y(i,s,t),(e=this.radiusBL)>0?this._convexBL?k(e,s-e,e,e,90,180,!1,h,t):k(0,s,e,e,360,270,!0,h,t):y(0,s,t),t.push(t[0],t[1]),T(this.x,this.y,t),super.updateData(),this}}Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlpha;var I={buildShapes(){this.addShape((new W).setName("box")).addShape((new Y).setName("checker"))},updateShapes(){var t=this.width/2,e=this.height/2,i=Math.min(t,e),s=2*i,h=t-i,r=e-i,a=this.boxLineWidth,n=Math.max(s/10,2),o=this.getShape("box"),l=this.getShape("checker");if(this.isSizeChanged){var u=s*(1-this.boxSize)/2,d=a/2,c=s*this.boxSize-a;o.setTopLeftPosition(h+d+u,r+d+u).setSize(c,c),this.isCircleShape?o.setRadius(c/2):o.setRadius(0),u=s*(1-this.checkerSize)/2;var p=s*this.checkerSize/4,v=1*p,g=2*p,y=3*p;l.startAt(v,g).lineTo(g,y).lineTo(y,v).offset(h+u,r+u).end()}this.checked?(o.fillStyle(this.boxFillColor,this.boxFillAlpha).lineStyle(a,this.boxStrokeColor,this.boxStrokeAlpha),l.lineStyle(n,this.checkerColor)):(o.fillStyle(this.uncheckedBoxFillColor,this.uncheckedBoxFillAlpha).lineStyle(a,this.uncheckedBoxStrokeColor,this.uncheckedBoxStrokeAlpha),l.lineStyle()),this.checked&&l.setDisplayPathSegment(this.checkerAnimProgress)}},G={setEventEmitter(t,e){return void 0===e&&(e=Phaser.Events.EventEmitter),this._privateEE=!0===t||void 0===t,this._eventEmitter=this._privateEE?new e:t,this},destroyEventEmitter(){return this._eventEmitter&&this._privateEE&&this._eventEmitter.shutdown(),this},getEventEmitter(){return this._eventEmitter},on(){return this._eventEmitter&&this._eventEmitter.on.apply(this._eventEmitter,arguments),this},once(){return this._eventEmitter&&this._eventEmitter.once.apply(this._eventEmitter,arguments),this},off(){return this._eventEmitter&&this._eventEmitter.off.apply(this._eventEmitter,arguments),this},emit(t){return this._eventEmitter&&t&&this._eventEmitter.emit.apply(this._eventEmitter,arguments),this},addListener(){return this._eventEmitter&&this._eventEmitter.addListener.apply(this._eventEmitter,arguments),this},removeListener(){return this._eventEmitter&&this._eventEmitter.removeListener.apply(this._eventEmitter,arguments),this},removeAllListeners(){return this._eventEmitter&&this._eventEmitter.removeAllListeners.apply(this._eventEmitter,arguments),this},listenerCount(){return this._eventEmitter?this._eventEmitter.listenerCount.apply(this._eventEmitter,arguments):0},listeners(){return this._eventEmitter?this._eventEmitter.listeners.apply(this._eventEmitter,arguments):[]},eventNames(){return this._eventEmitter?this._eventEmitter.eventNames.apply(this._eventEmitter,arguments):[]}};const U=Phaser.Scene;var N=function(t){return t instanceof U};const J=Phaser.Game;var K=function(t){return t instanceof J};const q=Phaser.Utils.Objects.GetValue;class H{constructor(t,e){this.setParent(t),this.isShutdown=!1,this.setEventEmitter(q(e,"eventEmitter",!0)),this.parent&&(this.parent===this.scene?this.scene.sys.events.once("shutdown",this.onEnvDestroy,this):this.parent===this.game?this.game.events.once("shutdown",this.onEnvDestroy,this):this.parent.once&&this.parent.once("destroy",this.onParentDestroy,this))}shutdown(t){this.isShutdown||(this.parent&&(this.parent===this.scene?this.scene.sys.events.off("shutdown",this.onEnvDestroy,this):this.parent===this.game?this.game.events.off("shutdown",this.onEnvDestroy,this):this.parent.once&&this.parent.off("destroy",this.onParentDestroy,this)),this.destroyEventEmitter(),this.parent=void 0,this.scene=void 0,this.game=void 0,this.isShutdown=!0)}destroy(t){this.shutdown(t)}onEnvDestroy(){this.destroy(!0)}onParentDestroy(t,e){this.destroy(e)}setParent(t){var e;return this.parent=t,this.scene=null==(e=t)||"object"!=typeof e?null:N(e)?e:e.scene&&N(e.scene)?e.scene:e.parent&&e.parent.scene&&N(e.parent.scene)?e.parent.scene:null,this.game=function(t){return null==t||"object"!=typeof t?null:K(t)?t:K(t.game)?t.game:N(t)?t.sys.game:N(t.scene)?t.scene.sys.game:void 0}(t),this}}Object.assign(H.prototype,G);const Q=Phaser.Utils.Objects.GetValue;class Z extends H{constructor(t,e){super(t,e),this._isRunning=!1,this.isPaused=!1,this.tickingState=!1,this.setTickingMode(Q(e,"tickingMode",1))}boot(){2!==this.tickingMode||this.tickingState||this.startTicking()}shutdown(t){this.isShutdown||(this.stop(),this.tickingState&&this.stopTicking(),super.shutdown(t))}setTickingMode(t){"string"==typeof t&&(t=$[t]),this.tickingMode=t}startTicking(){this.tickingState=!0}stopTicking(){this.tickingState=!1}get isRunning(){return this._isRunning}set isRunning(t){this._isRunning!==t&&(this._isRunning=t,1===this.tickingMode&&t!=this.tickingState&&(t?this.startTicking():this.stopTicking()))}start(){return this.isPaused=!1,this.isRunning=!0,this}pause(){return this.isRunning&&(this.isPaused=!0,this.isRunning=!1),this}resume(){return this.isPaused&&(this.isPaused=!1,this.isRunning=!0),this}stop(){return this.isPaused=!1,this.isRunning=!1,this}complete(){this.isPaused=!1,this.isRunning=!1,this.emit("complete",this.parent,this)}}const $={no:0,lazy:1,always:2},tt=Phaser.Utils.Objects.GetValue;class et extends Z{constructor(t,e){super(t,e);var i=this.scene?"update":"step";this.tickEventName=tt(e,"tickEventName",i),this.isSceneTicker=!it(this.tickEventName)}startTicking(){super.startTicking(),this.isSceneTicker?this.scene.sys.events.on(this.tickEventName,this.update,this):this.game.events.on(this.tickEventName,this.update,this)}stopTicking(){super.stopTicking(),this.isSceneTicker&&this.scene?this.scene.sys.events.off(this.tickEventName,this.update,this):this.game&&this.game.events.off(this.tickEventName,this.update,this)}}var it=function(t){return"step"===t||"poststep"===t};const st=Phaser.Utils.Objects.GetValue,ht=Phaser.Math.Clamp;class rt{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){this.state=st(t,"state",at),this.timeScale=st(t,"timeScale",1),this.delay=st(t,"delay",0),this.repeat=st(t,"repeat",0),this.repeatCounter=st(t,"repeatCounter",0),this.repeatDelay=st(t,"repeatDelay",0),this.duration=st(t,"duration",0),this.nowTime=st(t,"nowTime",0),this.justRestart=st(t,"justRestart",!1)}toJSON(){return{state:this.state,timeScale:this.timeScale,delay:this.delay,repeat:this.repeat,repeatCounter:this.repeatCounter,repeatDelay:this.repeatDelay,duration:this.duration,nowTime:this.nowTime,justRestart:this.justRestart}}destroy(){}setTimeScale(t){return this.timeScale=t,this}setDelay(t){return void 0===t&&(t=0),this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatInfinity(){return this.repeat=-1,this}setRepeatDelay(t){return this.repeatDelay=t,this}start(){return this.nowTime=this.delay>0?-this.delay:0,this.state=this.nowTime>=0?ot:nt,this.repeatCounter=0,this}stop(){return this.state=at,this}update(t,e){this.state!==at&&this.state!==ut&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=lt)):(this.nowTime=this.duration,this.state=ut):this.nowTime>=0&&(this.state=ot))}get t(){var t;switch(this.state){case at:case nt:case lt:t=0;break;case ot:t=this.nowTime/this.duration;break;case ut:t=1}return ht(t,0,1)}set t(t){(t=ht(t,-1,1))<0?(this.state=nt,this.nowTime=-this.delay*t):(this.state=ot,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===at}get isDelay(){return this.state===nt}get isCountDown(){return this.state===ot}get isRunning(){return this.state===nt||this.state===ot}get isDone(){return this.state===ut}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const at=0,nt=1,ot=2,lt=3,ut=-1;class dt extends et{constructor(t,e){super(t,e),this.timer=new rt}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const ct=Phaser.Utils.Objects.GetValue,pt=Phaser.Utils.Objects.GetAdvancedValue,vt=Phaser.Tweens.Builders.GetEaseFunction;class gt extends dt{resetFromJSON(t){return this.timer.resetFromJSON(ct(t,"timer")),this.setEnable(ct(t,"enable",!0)),this.setTarget(ct(t,"target",this.parent)),this.setDelay(pt(t,"delay",0)),this.setDuration(pt(t,"duration",1e3)),this.setEase(ct(t,"ease","Linear")),this.setRepeat(ct(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=vt(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const yt=Phaser.Utils.Objects.GetValue,mt=Phaser.Math.Linear;class kt extends gt{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=yt(t,"key","value");var i=e[this.propertyKey];return this.fromValue=yt(t,"from",i),this.toValue=yt(t,"to",i),this.setEase(yt(t,"ease",this.ease)),this.setDuration(yt(t,"duration",this.duration)),this.setRepeat(yt(t,"repeat",0)),this.setDelay(yt(t,"delay",0)),this.setRepeatDelay(yt(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=mt(this.fromValue,this.toValue,i)}}var ft={setCheckerAnimationDuration(t){return void 0===t&&(t=0),this.checkerAnimDuration=t,this},playCheckerAnimation(){return void 0===this.checkerAnimProgressTask&&(this.checkerAnimProgressTask=new kt(this,{eventEmitter:null})),this.checkerAnimProgressTask.restart({key:"checkerAnimProgress",from:0,to:1,duration:this.checkerAnimDuration}),this},stopCheckerAnimation(){return void 0===this.checkerAnimProgressTask||this.checkerAnimProgressTask.stop(),this}},bt={};Object.assign(bt,n,o,I,ft);const St=23730,Pt=Phaser.Utils.Objects.GetValue,Dt=Phaser.Utils.Objects.IsPlainObject;class _t extends a{constructor(t,e,i,s,h,r,a){Dt(e)?(e=Pt(a=e,"x",0),i=Pt(a,"y",0),s=Pt(a,"width",2),h=Pt(a,"height",2),r=Pt(a,"color",St)):Dt(r)&&(r=Pt(a=r,"color",St)),super(t,e,i,s,h),this.type="rexCheckbox",void 0===r&&(r=St),this.setBoxShape(Pt(a,"circleBox",!1)),this.setBoxFillStyle(r,Pt(a,"boxFillAlpha",1)),this.setUncheckedBoxFillStyle(Pt(a,"uncheckedColor",null),Pt(a,"uncheckedBoxFillAlpha",1)),this.setBoxStrokeStyle(Pt(a,"boxLineWidth",4),Pt(a,"boxStrokeColor",r),Pt(a,"boxStrokeAlpha",1)),this.setUncheckedBoxStrokeStyle(this.boxLineWidth,Pt(a,"uncheckedBoxStrokeColor",this.boxStrokeColor),Pt(a,"uncheckedBoxStrokeAlpha",this.boxStrokeAlpha)),this.setCheckerStyle(Pt(a,"checkerColor",16777215),Pt(a,"checkerAlpha",1)),this.setBoxSize(Pt(a,"boxSize",1)),this.setCheckerSize(Pt(a,"checkerSize",1)),this.setCheckerAnimationDuration(Pt(a,"animationDuration",150)),this.buildShapes();var n=Pt(a,"checked");void 0===n&&(n=Pt(a,"value",!1)),this.setValue(n)}get value(){return this._value}set value(t){t=!!t,this._value!==t&&(this.dirty=!0,this._value=t,t?this.playCheckerAnimation():this.stopCheckerAnimation(),this.emit("valuechange",t))}setValue(t){return this.value=t,this}toggleValue(){return this.setValue(!this.value),this}get checked(){return this.value}set checked(t){this.value=t}setChecked(t){return void 0===t&&(t=!0),this.setValue(t),this}toggleChecked(){return this.toggleValue(),this}get checkerAnimProgress(){return this._checkerAnimProgress}set checkerAnimProgress(t){this._checkerAnimProgress!==t&&(this._checkerAnimProgress=t,this.dirty=!0)}}Object.assign(_t.prototype,bt);const Tt=Phaser.Utils.Objects.GetValue;class xt extends H{constructor(t,e){super(t,e),this._enable=void 0,t.setInteractive(Tt(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.isDown=!1,this.isOver=!1,this.setEnable(Tt(t,"enable",!0)),this.setMode(Tt(t,"mode",1)),this.setClickInterval(Tt(t,"clickInterval",100)),this.setDragThreshold(Tt(t,"threshold",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPress,this),t.on("pointerup",this.onRelease,this),t.on("pointerout",this.onPointOut,this),t.on("pointermove",this.onMove,this),t.on("pointerover",this.onOver,this),t.on("pointerout",this.onOut,this)}shutdown(t){this.isShutdown||(this.pointer=null,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=At[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}onPress(t,e,i,s){void 0===this.pointer&&(this.pointer=t,this.isDown=!0,this.emit("down",this,this.parent,t,s),0===this.mode&&this.click(t.downTime,t,s))}onRelease(t,e,i,s){this.pointer===t&&(this.isDown=!1,this.emit("up",this,this.parent,t,s),1===this.mode&&this.click(t.upTime,t,s),this.pointer=void 0)}onPointOut(t,e){this.pointer===t&&this.cancel()}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&t.getDistance()>=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const At={press:0,pointerdown:0,release:1,pointerup:1},Ct=Phaser.Utils.Objects.GetValue,Rt=Phaser.Utils.Objects.IsPlainObject;return class extends _t{constructor(t,e,i,s,h,r,a){Rt(e)?(e=Ct(a=e,"x",0),i=Ct(a,"y",0),s=Ct(a,"width",2),h=Ct(a,"height",2),r=Ct(a,"color",St)):Rt(r)&&(r=Ct(a=r,"color",St)),super(t,e,i,s,h,r,a),this._click=new xt(this,Ct(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(Ct(a,"readOnly",!1))}get readOnly(){return!this._click.enable}set readOnly(t){this._click.enable=!t}setReadOnly(t){return void 0===t&&(t=!0),this.readOnly=t,this}}},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rexcheckbox=e(); diff --git a/dist/rexcheckboxplugin.js b/dist/rexcheckboxplugin.js index 4ca3da90dd..60c50885ef 100644 --- a/dist/rexcheckboxplugin.js +++ b/dist/rexcheckboxplugin.js @@ -854,6 +854,32 @@ return pathData; }; + //import CatmullRomInterpolation from '../../utils/math/interpolation/CatmullRomInterpolation.js'; + + const CatmullRomInterpolation = Phaser.Math.Interpolation.CatmullRom; + + var CatmullRomTo = function (points, iterations, pathData) { + var pathDataCnt = pathData.length; + var p0x = pathData[pathDataCnt - 2]; + var p0y = pathData[pathDataCnt - 1]; + + var xList = [p0x]; + var yList = [p0y]; + for (var i = 0, cnt = points.length; i < cnt; i += 2) { + xList.push(points[i]); + yList.push(points[i + 1]); + } + + for (var i = 1, last = iterations - 1; i <= last; i++) { + var t = i / last; + pathData.push( + CatmullRomInterpolation(xList, t), + CatmullRomInterpolation(yList, t) + ); + } + return pathData; + }; + var DuplicateLast = function (pathData) { var len = pathData.length; if (len < 2) { @@ -965,6 +991,18 @@ return this; }, + catmullRomTo(...points) { + CatmullRomTo( + points, + this.iterations, + this.pathData + ); + + this.lastPointX = points[points.length-2]; + this.lastPointY = points[points.length-1]; + return this; + }, + close() { // Line to first point var startX = this.pathData[0], @@ -1402,6 +1440,13 @@ return this; } + catmullRomTo(...points) { + this.builder.catmullRomTo(...points); + + this.dirty = true; + return this; + } + close() { this.builder.close(); diff --git a/dist/rexcheckboxplugin.min.js b/dist/rexcheckboxplugin.min.js index a168e22909..127b00a3e6 100644 --- a/dist/rexcheckboxplugin.min.js +++ b/dist/rexcheckboxplugin.min.js @@ -1 +1 @@ -var t,e;t=void 0,e=function(){const t=Phaser.GameObjects.GetCalcMatrix,e=Phaser.Renderer.Canvas.SetTransform;var i={renderWebGL:function(e,i,s,h){i.updateData(),s.addToRenderList(i);var r=e.pipelines.set(i.pipeline),a=t(i,s,h),n=r.calcMatrix.copyFrom(a.calc),o=i._displayOriginX,l=i._displayOriginY,u=s.alpha*i.alpha;e.pipelines.preBatch(i);for(var d,c=i.geom,p=0,v=c.length;p>>16,n=(65280&h)>>>8,o=255&h;t.fillStyle="rgba("+a+","+n+","+o+","+r+")"}(t,this),t.fill()),this.isStroked&&(function(t,e,i,s){var h=i||e.strokeColor,r=s||e.strokeAlpha,a=(16711680&h)>>>16,n=(65280&h)>>>8,o=255&h;t.strokeStyle="rgba("+a+","+n+","+o+","+r+")",t.lineWidth=e.lineWidth}(t,this),t.stroke())}}var y=function(t,e,i){var s=i.length;if(s>=2){var h=i[s-2],r=i[s-1];if(t===h&&e===r)return i}return i.push(t,e),i};const m=Phaser.Math.DegToRad;var k=function(t,e,i,s,h,r,a,n,o){a&&r>h?r-=360:!a&&r0,a=0,n=e.length;a0;this.dirty=this.dirty||this._radiusTL!==t||this._convexTL!==e,this._convexTL=e,this._radiusTL=Math.abs(t)}get radiusTR(){return this._radiusTR}set radiusTR(t){var e=t>0;this.dirty=this.dirty||this._radiusTR!==t||this._convexTR!==e,this._convexTR=e,this._radiusTR=Math.abs(t)}get radiusBL(){return this._radiusBL}set radiusBL(t){var e=t>0;this.dirty=this.dirty||this._radiusBL!==t||this._convexBL!==e,this._convexBL=e,this._radiusBL=Math.abs(t)}get radiusBR(){return this._radiusBR}set radiusBR(t){var e=t>0;this.dirty=this.dirty||this._radiusBR!==t||this._convexBR!==e,this._convexBR=e,this._radiusBR=Math.abs(t)}get radius(){return Math.max(this.radiusTL,this.radiusTR,this.radiusBL,this.radiusBR)}set radius(t){"number"==typeof t?(this.radiusTL=t,this.radiusTR=t,this.radiusBL=t,this.radiusBR=t):(this.radiusTL=V(t,"tl",0),this.radiusTR=V(t,"tr",0),this.radiusBL=V(t,"bl",0),this.radiusBR=V(t,"br",0))}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}get iterations(){return this._iterations}set iterations(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t}setIterations(t){return this.iterations=t,this}updateData(){var t=this.pathData;t.length=0;var e,i=this.width,s=this.height,h=this.iterations+1;return(e=this.radiusTL)>0?this._convexTL?k(e,e,e,e,180,270,!1,h,t):k(0,0,e,e,90,0,!0,h,t):y(0,0,t),(e=this.radiusTR)>0?this._convexTR?k(i-e,e,e,e,270,360,!1,h,t):k(i,0,e,e,180,90,!0,h,t):y(i,0,t),(e=this.radiusBR)>0?this._convexBR?k(i-e,s-e,e,e,0,90,!1,h,t):k(i,s,e,e,270,180,!0,h,t):y(i,s,t),(e=this.radiusBL)>0?this._convexBL?k(e,s-e,e,e,90,180,!1,h,t):k(0,s,e,e,360,270,!0,h,t):y(0,s,t),t.push(t[0],t[1]),_(this.x,this.y,t),super.updateData(),this}}Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlpha;var X={buildShapes(){this.addShape((new W).setName("box")).addShape((new M).setName("checker"))},updateShapes(){var t=this.width/2,e=this.height/2,i=Math.min(t,e),s=2*i,h=t-i,r=e-i,a=this.boxLineWidth,n=Math.max(s/10,2),o=this.getShape("box"),l=this.getShape("checker");if(this.isSizeChanged){var u=s*(1-this.boxSize)/2,d=a/2,c=s*this.boxSize-a;o.setTopLeftPosition(h+d+u,r+d+u).setSize(c,c),this.isCircleShape?o.setRadius(c/2):o.setRadius(0),u=s*(1-this.checkerSize)/2;var p=s*this.checkerSize/4,v=1*p,g=2*p,y=3*p;l.startAt(v,g).lineTo(g,y).lineTo(y,v).offset(h+u,r+u).end()}this.checked?(o.fillStyle(this.boxFillColor,this.boxFillAlpha).lineStyle(a,this.boxStrokeColor,this.boxStrokeAlpha),l.lineStyle(n,this.checkerColor)):(o.fillStyle(this.uncheckedBoxFillColor,this.uncheckedBoxFillAlpha).lineStyle(a,this.uncheckedBoxStrokeColor,this.uncheckedBoxStrokeAlpha),l.lineStyle()),this.checked&&l.setDisplayPathSegment(this.checkerAnimProgress)}},Y={setEventEmitter(t,e){return void 0===e&&(e=Phaser.Events.EventEmitter),this._privateEE=!0===t||void 0===t,this._eventEmitter=this._privateEE?new e:t,this},destroyEventEmitter(){return this._eventEmitter&&this._privateEE&&this._eventEmitter.shutdown(),this},getEventEmitter(){return this._eventEmitter},on(){return this._eventEmitter&&this._eventEmitter.on.apply(this._eventEmitter,arguments),this},once(){return this._eventEmitter&&this._eventEmitter.once.apply(this._eventEmitter,arguments),this},off(){return this._eventEmitter&&this._eventEmitter.off.apply(this._eventEmitter,arguments),this},emit(t){return this._eventEmitter&&t&&this._eventEmitter.emit.apply(this._eventEmitter,arguments),this},addListener(){return this._eventEmitter&&this._eventEmitter.addListener.apply(this._eventEmitter,arguments),this},removeListener(){return this._eventEmitter&&this._eventEmitter.removeListener.apply(this._eventEmitter,arguments),this},removeAllListeners(){return this._eventEmitter&&this._eventEmitter.removeAllListeners.apply(this._eventEmitter,arguments),this},listenerCount(){return this._eventEmitter?this._eventEmitter.listenerCount.apply(this._eventEmitter,arguments):0},listeners(){return this._eventEmitter?this._eventEmitter.listeners.apply(this._eventEmitter,arguments):[]},eventNames(){return this._eventEmitter?this._eventEmitter.eventNames.apply(this._eventEmitter,arguments):[]}};const U=Phaser.Scene;var I=function(t){return t instanceof U};const N=Phaser.Game;var J=function(t){return t instanceof N};const K=Phaser.Utils.Objects.GetValue;class q{constructor(t,e){this.setParent(t),this.isShutdown=!1,this.setEventEmitter(K(e,"eventEmitter",!0)),this.parent&&(this.parent===this.scene?this.scene.sys.events.once("shutdown",this.onEnvDestroy,this):this.parent===this.game?this.game.events.once("shutdown",this.onEnvDestroy,this):this.parent.once&&this.parent.once("destroy",this.onParentDestroy,this))}shutdown(t){this.isShutdown||(this.parent&&(this.parent===this.scene?this.scene.sys.events.off("shutdown",this.onEnvDestroy,this):this.parent===this.game?this.game.events.off("shutdown",this.onEnvDestroy,this):this.parent.once&&this.parent.off("destroy",this.onParentDestroy,this)),this.destroyEventEmitter(),this.parent=void 0,this.scene=void 0,this.game=void 0,this.isShutdown=!0)}destroy(t){this.shutdown(t)}onEnvDestroy(){this.destroy(!0)}onParentDestroy(t,e){this.destroy(e)}setParent(t){var e;return this.parent=t,this.scene=null==(e=t)||"object"!=typeof e?null:I(e)?e:e.scene&&I(e.scene)?e.scene:e.parent&&e.parent.scene&&I(e.parent.scene)?e.parent.scene:null,this.game=function(t){return null==t||"object"!=typeof t?null:J(t)?t:J(t.game)?t.game:I(t)?t.sys.game:I(t.scene)?t.scene.sys.game:void 0}(t),this}}Object.assign(q.prototype,Y);const H=Phaser.Utils.Objects.GetValue;class Q extends q{constructor(t,e){super(t,e),this._isRunning=!1,this.isPaused=!1,this.tickingState=!1,this.setTickingMode(H(e,"tickingMode",1))}boot(){2!==this.tickingMode||this.tickingState||this.startTicking()}shutdown(t){this.isShutdown||(this.stop(),this.tickingState&&this.stopTicking(),super.shutdown(t))}setTickingMode(t){"string"==typeof t&&(t=Z[t]),this.tickingMode=t}startTicking(){this.tickingState=!0}stopTicking(){this.tickingState=!1}get isRunning(){return this._isRunning}set isRunning(t){this._isRunning!==t&&(this._isRunning=t,1===this.tickingMode&&t!=this.tickingState&&(t?this.startTicking():this.stopTicking()))}start(){return this.isPaused=!1,this.isRunning=!0,this}pause(){return this.isRunning&&(this.isPaused=!0,this.isRunning=!1),this}resume(){return this.isPaused&&(this.isPaused=!1,this.isRunning=!0),this}stop(){return this.isPaused=!1,this.isRunning=!1,this}complete(){this.isPaused=!1,this.isRunning=!1,this.emit("complete",this.parent,this)}}const Z={no:0,lazy:1,always:2},$=Phaser.Utils.Objects.GetValue;class tt extends Q{constructor(t,e){super(t,e);var i=this.scene?"update":"step";this.tickEventName=$(e,"tickEventName",i),this.isSceneTicker=!et(this.tickEventName)}startTicking(){super.startTicking(),this.isSceneTicker?this.scene.sys.events.on(this.tickEventName,this.update,this):this.game.events.on(this.tickEventName,this.update,this)}stopTicking(){super.stopTicking(),this.isSceneTicker&&this.scene?this.scene.sys.events.off(this.tickEventName,this.update,this):this.game&&this.game.events.off(this.tickEventName,this.update,this)}}var et=function(t){return"step"===t||"poststep"===t};const it=Phaser.Utils.Objects.GetValue,st=Phaser.Math.Clamp;class ht{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){this.state=it(t,"state",rt),this.timeScale=it(t,"timeScale",1),this.delay=it(t,"delay",0),this.repeat=it(t,"repeat",0),this.repeatCounter=it(t,"repeatCounter",0),this.repeatDelay=it(t,"repeatDelay",0),this.duration=it(t,"duration",0),this.nowTime=it(t,"nowTime",0),this.justRestart=it(t,"justRestart",!1)}toJSON(){return{state:this.state,timeScale:this.timeScale,delay:this.delay,repeat:this.repeat,repeatCounter:this.repeatCounter,repeatDelay:this.repeatDelay,duration:this.duration,nowTime:this.nowTime,justRestart:this.justRestart}}destroy(){}setTimeScale(t){return this.timeScale=t,this}setDelay(t){return void 0===t&&(t=0),this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatInfinity(){return this.repeat=-1,this}setRepeatDelay(t){return this.repeatDelay=t,this}start(){return this.nowTime=this.delay>0?-this.delay:0,this.state=this.nowTime>=0?nt:at,this.repeatCounter=0,this}stop(){return this.state=rt,this}update(t,e){this.state!==rt&&this.state!==lt&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=ot)):(this.nowTime=this.duration,this.state=lt):this.nowTime>=0&&(this.state=nt))}get t(){var t;switch(this.state){case rt:case at:case ot:t=0;break;case nt:t=this.nowTime/this.duration;break;case lt:t=1}return st(t,0,1)}set t(t){(t=st(t,-1,1))<0?(this.state=at,this.nowTime=-this.delay*t):(this.state=nt,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===rt}get isDelay(){return this.state===at}get isCountDown(){return this.state===nt}get isRunning(){return this.state===at||this.state===nt}get isDone(){return this.state===lt}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const rt=0,at=1,nt=2,ot=3,lt=-1;class ut extends tt{constructor(t,e){super(t,e),this.timer=new ht}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const dt=Phaser.Utils.Objects.GetValue,ct=Phaser.Utils.Objects.GetAdvancedValue,pt=Phaser.Tweens.Builders.GetEaseFunction;class vt extends ut{resetFromJSON(t){return this.timer.resetFromJSON(dt(t,"timer")),this.setEnable(dt(t,"enable",!0)),this.setTarget(dt(t,"target",this.parent)),this.setDelay(ct(t,"delay",0)),this.setDuration(ct(t,"duration",1e3)),this.setEase(dt(t,"ease","Linear")),this.setRepeat(dt(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=pt(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const gt=Phaser.Utils.Objects.GetValue,yt=Phaser.Math.Linear;class mt extends vt{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=gt(t,"key","value");var i=e[this.propertyKey];return this.fromValue=gt(t,"from",i),this.toValue=gt(t,"to",i),this.setEase(gt(t,"ease",this.ease)),this.setDuration(gt(t,"duration",this.duration)),this.setRepeat(gt(t,"repeat",0)),this.setDelay(gt(t,"delay",0)),this.setRepeatDelay(gt(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=yt(this.fromValue,this.toValue,i)}}var kt={setCheckerAnimationDuration(t){return void 0===t&&(t=0),this.checkerAnimDuration=t,this},playCheckerAnimation(){return void 0===this.checkerAnimProgressTask&&(this.checkerAnimProgressTask=new mt(this,{eventEmitter:null})),this.checkerAnimProgressTask.restart({key:"checkerAnimProgress",from:0,to:1,duration:this.checkerAnimDuration}),this},stopCheckerAnimation(){return void 0===this.checkerAnimProgressTask||this.checkerAnimProgressTask.stop(),this}},ft={};Object.assign(ft,n,o,X,kt);const bt=23730,St=Phaser.Utils.Objects.GetValue,Pt=Phaser.Utils.Objects.IsPlainObject;class Dt extends a{constructor(t,e,i,s,h,r,a){Pt(e)?(e=St(a=e,"x",0),i=St(a,"y",0),s=St(a,"width",2),h=St(a,"height",2),r=St(a,"color",bt)):Pt(r)&&(r=St(a=r,"color",bt)),super(t,e,i,s,h),this.type="rexCheckbox",void 0===r&&(r=bt),this.setBoxShape(St(a,"circleBox",!1)),this.setBoxFillStyle(r,St(a,"boxFillAlpha",1)),this.setUncheckedBoxFillStyle(St(a,"uncheckedColor",null),St(a,"uncheckedBoxFillAlpha",1)),this.setBoxStrokeStyle(St(a,"boxLineWidth",4),St(a,"boxStrokeColor",r),St(a,"boxStrokeAlpha",1)),this.setUncheckedBoxStrokeStyle(this.boxLineWidth,St(a,"uncheckedBoxStrokeColor",this.boxStrokeColor),St(a,"uncheckedBoxStrokeAlpha",this.boxStrokeAlpha)),this.setCheckerStyle(St(a,"checkerColor",16777215),St(a,"checkerAlpha",1)),this.setBoxSize(St(a,"boxSize",1)),this.setCheckerSize(St(a,"checkerSize",1)),this.setCheckerAnimationDuration(St(a,"animationDuration",150)),this.buildShapes();var n=St(a,"checked");void 0===n&&(n=St(a,"value",!1)),this.setValue(n)}get value(){return this._value}set value(t){t=!!t,this._value!==t&&(this.dirty=!0,this._value=t,t?this.playCheckerAnimation():this.stopCheckerAnimation(),this.emit("valuechange",t))}setValue(t){return this.value=t,this}toggleValue(){return this.setValue(!this.value),this}get checked(){return this.value}set checked(t){this.value=t}setChecked(t){return void 0===t&&(t=!0),this.setValue(t),this}toggleChecked(){return this.toggleValue(),this}get checkerAnimProgress(){return this._checkerAnimProgress}set checkerAnimProgress(t){this._checkerAnimProgress!==t&&(this._checkerAnimProgress=t,this.dirty=!0)}}Object.assign(Dt.prototype,ft);const _t=Phaser.Utils.Objects.GetValue;class xt extends q{constructor(t,e){super(t,e),this._enable=void 0,t.setInteractive(_t(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.isDown=!1,this.isOver=!1,this.setEnable(_t(t,"enable",!0)),this.setMode(_t(t,"mode",1)),this.setClickInterval(_t(t,"clickInterval",100)),this.setDragThreshold(_t(t,"threshold",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPress,this),t.on("pointerup",this.onRelease,this),t.on("pointerout",this.onPointOut,this),t.on("pointermove",this.onMove,this),t.on("pointerover",this.onOver,this),t.on("pointerout",this.onOut,this)}shutdown(t){this.isShutdown||(this.pointer=null,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Tt[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}onPress(t,e,i,s){void 0===this.pointer&&(this.pointer=t,this.isDown=!0,this.emit("down",this,this.parent,t,s),0===this.mode&&this.click(t.downTime,t,s))}onRelease(t,e,i,s){this.pointer===t&&(this.isDown=!1,this.emit("up",this,this.parent,t,s),1===this.mode&&this.click(t.upTime,t,s),this.pointer=void 0)}onPointOut(t,e){this.pointer===t&&this.cancel()}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&t.getDistance()>=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const Tt={press:0,pointerdown:0,release:1,pointerup:1},At=Phaser.Utils.Objects.GetValue,Ct=Phaser.Utils.Objects.IsPlainObject;class wt extends Dt{constructor(t,e,i,s,h,r,a){Ct(e)?(e=At(a=e,"x",0),i=At(a,"y",0),s=At(a,"width",2),h=At(a,"height",2),r=At(a,"color",bt)):Ct(r)&&(r=At(a=r,"color",bt)),super(t,e,i,s,h,r,a),this._click=new xt(this,At(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(At(a,"readOnly",!1))}get readOnly(){return!this._click.enable}set readOnly(t){this._click.enable=!t}setReadOnly(t){return void 0===t&&(t=!0),this.readOnly=t,this}}function Rt(t,e,i,s,h,r){var a=new wt(this.scene,t,e,i,s,h,r);return this.scene.add.existing(a),a}const Et=Phaser.Utils.Objects.GetAdvancedValue,Lt=Phaser.GameObjects.BuildGameObject;function Bt(t,e){void 0===t&&(t={}),void 0!==e&&(t.add=e);var i=Et(t,"width",void 0),s=Et(t,"height",i),h=Et(t,"color",23730),r=new wt(this.scene,0,0,i,s,h,t);return Lt(this.scene,r,t),r}function Ot(t,e,i,s,h,r){var a=new Dt(this.scene,t,e,i,s,h,r);return this.scene.add.existing(a),a}const jt=Phaser.Utils.Objects.GetAdvancedValue,Ft=Phaser.GameObjects.BuildGameObject;function zt(t,e){void 0===t&&(t={}),void 0!==e&&(t.add=e);var i=jt(t,"width",void 0),s=jt(t,"height",i),h=jt(t,"color",23730),r=new Dt(this.scene,0,0,i,s,h,t);return Ft(this.scene,r,t),r}var Gt=function(t){return null==t||""===t||0===t.length},Mt=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(Gt(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var h=e.pop(),r=function(t,e,i){var s=t;if(Gt(e));else{var h;"string"==typeof e&&(e=e.split("."));for(var r=0,a=e.length;r>>16,n=(65280&h)>>>8,o=255&h;t.fillStyle="rgba("+a+","+n+","+o+","+r+")"}(t,this),t.fill()),this.isStroked&&(function(t,e,i,s){var h=i||e.strokeColor,r=s||e.strokeAlpha,a=(16711680&h)>>>16,n=(65280&h)>>>8,o=255&h;t.strokeStyle="rgba("+a+","+n+","+o+","+r+")",t.lineWidth=e.lineWidth}(t,this),t.stroke())}}var y=function(t,e,i){var s=i.length;if(s>=2){var h=i[s-2],r=i[s-1];if(t===h&&e===r)return i}return i.push(t,e),i};const m=Phaser.Math.DegToRad;var k=function(t,e,i,s,h,r,a,n,o){a&&r>h?r-=360:!a&&r0,a=0,n=e.length;a0;this.dirty=this.dirty||this._radiusTL!==t||this._convexTL!==e,this._convexTL=e,this._radiusTL=Math.abs(t)}get radiusTR(){return this._radiusTR}set radiusTR(t){var e=t>0;this.dirty=this.dirty||this._radiusTR!==t||this._convexTR!==e,this._convexTR=e,this._radiusTR=Math.abs(t)}get radiusBL(){return this._radiusBL}set radiusBL(t){var e=t>0;this.dirty=this.dirty||this._radiusBL!==t||this._convexBL!==e,this._convexBL=e,this._radiusBL=Math.abs(t)}get radiusBR(){return this._radiusBR}set radiusBR(t){var e=t>0;this.dirty=this.dirty||this._radiusBR!==t||this._convexBR!==e,this._convexBR=e,this._radiusBR=Math.abs(t)}get radius(){return Math.max(this.radiusTL,this.radiusTR,this.radiusBL,this.radiusBR)}set radius(t){"number"==typeof t?(this.radiusTL=t,this.radiusTR=t,this.radiusBL=t,this.radiusBR=t):(this.radiusTL=X(t,"tl",0),this.radiusTR=X(t,"tr",0),this.radiusBL=X(t,"bl",0),this.radiusBR=X(t,"br",0))}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}get iterations(){return this._iterations}set iterations(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t}setIterations(t){return this.iterations=t,this}updateData(){var t=this.pathData;t.length=0;var e,i=this.width,s=this.height,h=this.iterations+1;return(e=this.radiusTL)>0?this._convexTL?k(e,e,e,e,180,270,!1,h,t):k(0,0,e,e,90,0,!0,h,t):y(0,0,t),(e=this.radiusTR)>0?this._convexTR?k(i-e,e,e,e,270,360,!1,h,t):k(i,0,e,e,180,90,!0,h,t):y(i,0,t),(e=this.radiusBR)>0?this._convexBR?k(i-e,s-e,e,e,0,90,!1,h,t):k(i,s,e,e,270,180,!0,h,t):y(i,s,t),(e=this.radiusBL)>0?this._convexBL?k(e,s-e,e,e,90,180,!1,h,t):k(0,s,e,e,360,270,!0,h,t):y(0,s,t),t.push(t[0],t[1]),x(this.x,this.y,t),super.updateData(),this}}Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlpha;var W={buildShapes(){this.addShape((new Y).setName("box")).addShape((new V).setName("checker"))},updateShapes(){var t=this.width/2,e=this.height/2,i=Math.min(t,e),s=2*i,h=t-i,r=e-i,a=this.boxLineWidth,n=Math.max(s/10,2),o=this.getShape("box"),l=this.getShape("checker");if(this.isSizeChanged){var u=s*(1-this.boxSize)/2,d=a/2,c=s*this.boxSize-a;o.setTopLeftPosition(h+d+u,r+d+u).setSize(c,c),this.isCircleShape?o.setRadius(c/2):o.setRadius(0),u=s*(1-this.checkerSize)/2;var p=s*this.checkerSize/4,v=1*p,g=2*p,y=3*p;l.startAt(v,g).lineTo(g,y).lineTo(y,v).offset(h+u,r+u).end()}this.checked?(o.fillStyle(this.boxFillColor,this.boxFillAlpha).lineStyle(a,this.boxStrokeColor,this.boxStrokeAlpha),l.lineStyle(n,this.checkerColor)):(o.fillStyle(this.uncheckedBoxFillColor,this.uncheckedBoxFillAlpha).lineStyle(a,this.uncheckedBoxStrokeColor,this.uncheckedBoxStrokeAlpha),l.lineStyle()),this.checked&&l.setDisplayPathSegment(this.checkerAnimProgress)}},I={setEventEmitter(t,e){return void 0===e&&(e=Phaser.Events.EventEmitter),this._privateEE=!0===t||void 0===t,this._eventEmitter=this._privateEE?new e:t,this},destroyEventEmitter(){return this._eventEmitter&&this._privateEE&&this._eventEmitter.shutdown(),this},getEventEmitter(){return this._eventEmitter},on(){return this._eventEmitter&&this._eventEmitter.on.apply(this._eventEmitter,arguments),this},once(){return this._eventEmitter&&this._eventEmitter.once.apply(this._eventEmitter,arguments),this},off(){return this._eventEmitter&&this._eventEmitter.off.apply(this._eventEmitter,arguments),this},emit(t){return this._eventEmitter&&t&&this._eventEmitter.emit.apply(this._eventEmitter,arguments),this},addListener(){return this._eventEmitter&&this._eventEmitter.addListener.apply(this._eventEmitter,arguments),this},removeListener(){return this._eventEmitter&&this._eventEmitter.removeListener.apply(this._eventEmitter,arguments),this},removeAllListeners(){return this._eventEmitter&&this._eventEmitter.removeAllListeners.apply(this._eventEmitter,arguments),this},listenerCount(){return this._eventEmitter?this._eventEmitter.listenerCount.apply(this._eventEmitter,arguments):0},listeners(){return this._eventEmitter?this._eventEmitter.listeners.apply(this._eventEmitter,arguments):[]},eventNames(){return this._eventEmitter?this._eventEmitter.eventNames.apply(this._eventEmitter,arguments):[]}};const U=Phaser.Scene;var N=function(t){return t instanceof U};const J=Phaser.Game;var K=function(t){return t instanceof J};const q=Phaser.Utils.Objects.GetValue;class H{constructor(t,e){this.setParent(t),this.isShutdown=!1,this.setEventEmitter(q(e,"eventEmitter",!0)),this.parent&&(this.parent===this.scene?this.scene.sys.events.once("shutdown",this.onEnvDestroy,this):this.parent===this.game?this.game.events.once("shutdown",this.onEnvDestroy,this):this.parent.once&&this.parent.once("destroy",this.onParentDestroy,this))}shutdown(t){this.isShutdown||(this.parent&&(this.parent===this.scene?this.scene.sys.events.off("shutdown",this.onEnvDestroy,this):this.parent===this.game?this.game.events.off("shutdown",this.onEnvDestroy,this):this.parent.once&&this.parent.off("destroy",this.onParentDestroy,this)),this.destroyEventEmitter(),this.parent=void 0,this.scene=void 0,this.game=void 0,this.isShutdown=!0)}destroy(t){this.shutdown(t)}onEnvDestroy(){this.destroy(!0)}onParentDestroy(t,e){this.destroy(e)}setParent(t){var e;return this.parent=t,this.scene=null==(e=t)||"object"!=typeof e?null:N(e)?e:e.scene&&N(e.scene)?e.scene:e.parent&&e.parent.scene&&N(e.parent.scene)?e.parent.scene:null,this.game=function(t){return null==t||"object"!=typeof t?null:K(t)?t:K(t.game)?t.game:N(t)?t.sys.game:N(t.scene)?t.scene.sys.game:void 0}(t),this}}Object.assign(H.prototype,I);const Q=Phaser.Utils.Objects.GetValue;class Z extends H{constructor(t,e){super(t,e),this._isRunning=!1,this.isPaused=!1,this.tickingState=!1,this.setTickingMode(Q(e,"tickingMode",1))}boot(){2!==this.tickingMode||this.tickingState||this.startTicking()}shutdown(t){this.isShutdown||(this.stop(),this.tickingState&&this.stopTicking(),super.shutdown(t))}setTickingMode(t){"string"==typeof t&&(t=$[t]),this.tickingMode=t}startTicking(){this.tickingState=!0}stopTicking(){this.tickingState=!1}get isRunning(){return this._isRunning}set isRunning(t){this._isRunning!==t&&(this._isRunning=t,1===this.tickingMode&&t!=this.tickingState&&(t?this.startTicking():this.stopTicking()))}start(){return this.isPaused=!1,this.isRunning=!0,this}pause(){return this.isRunning&&(this.isPaused=!0,this.isRunning=!1),this}resume(){return this.isPaused&&(this.isPaused=!1,this.isRunning=!0),this}stop(){return this.isPaused=!1,this.isRunning=!1,this}complete(){this.isPaused=!1,this.isRunning=!1,this.emit("complete",this.parent,this)}}const $={no:0,lazy:1,always:2},tt=Phaser.Utils.Objects.GetValue;class et extends Z{constructor(t,e){super(t,e);var i=this.scene?"update":"step";this.tickEventName=tt(e,"tickEventName",i),this.isSceneTicker=!it(this.tickEventName)}startTicking(){super.startTicking(),this.isSceneTicker?this.scene.sys.events.on(this.tickEventName,this.update,this):this.game.events.on(this.tickEventName,this.update,this)}stopTicking(){super.stopTicking(),this.isSceneTicker&&this.scene?this.scene.sys.events.off(this.tickEventName,this.update,this):this.game&&this.game.events.off(this.tickEventName,this.update,this)}}var it=function(t){return"step"===t||"poststep"===t};const st=Phaser.Utils.Objects.GetValue,ht=Phaser.Math.Clamp;class rt{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){this.state=st(t,"state",at),this.timeScale=st(t,"timeScale",1),this.delay=st(t,"delay",0),this.repeat=st(t,"repeat",0),this.repeatCounter=st(t,"repeatCounter",0),this.repeatDelay=st(t,"repeatDelay",0),this.duration=st(t,"duration",0),this.nowTime=st(t,"nowTime",0),this.justRestart=st(t,"justRestart",!1)}toJSON(){return{state:this.state,timeScale:this.timeScale,delay:this.delay,repeat:this.repeat,repeatCounter:this.repeatCounter,repeatDelay:this.repeatDelay,duration:this.duration,nowTime:this.nowTime,justRestart:this.justRestart}}destroy(){}setTimeScale(t){return this.timeScale=t,this}setDelay(t){return void 0===t&&(t=0),this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatInfinity(){return this.repeat=-1,this}setRepeatDelay(t){return this.repeatDelay=t,this}start(){return this.nowTime=this.delay>0?-this.delay:0,this.state=this.nowTime>=0?ot:nt,this.repeatCounter=0,this}stop(){return this.state=at,this}update(t,e){this.state!==at&&this.state!==ut&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=lt)):(this.nowTime=this.duration,this.state=ut):this.nowTime>=0&&(this.state=ot))}get t(){var t;switch(this.state){case at:case nt:case lt:t=0;break;case ot:t=this.nowTime/this.duration;break;case ut:t=1}return ht(t,0,1)}set t(t){(t=ht(t,-1,1))<0?(this.state=nt,this.nowTime=-this.delay*t):(this.state=ot,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===at}get isDelay(){return this.state===nt}get isCountDown(){return this.state===ot}get isRunning(){return this.state===nt||this.state===ot}get isDone(){return this.state===ut}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const at=0,nt=1,ot=2,lt=3,ut=-1;class dt extends et{constructor(t,e){super(t,e),this.timer=new rt}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const ct=Phaser.Utils.Objects.GetValue,pt=Phaser.Utils.Objects.GetAdvancedValue,vt=Phaser.Tweens.Builders.GetEaseFunction;class gt extends dt{resetFromJSON(t){return this.timer.resetFromJSON(ct(t,"timer")),this.setEnable(ct(t,"enable",!0)),this.setTarget(ct(t,"target",this.parent)),this.setDelay(pt(t,"delay",0)),this.setDuration(pt(t,"duration",1e3)),this.setEase(ct(t,"ease","Linear")),this.setRepeat(ct(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=vt(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const yt=Phaser.Utils.Objects.GetValue,mt=Phaser.Math.Linear;class kt extends gt{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=yt(t,"key","value");var i=e[this.propertyKey];return this.fromValue=yt(t,"from",i),this.toValue=yt(t,"to",i),this.setEase(yt(t,"ease",this.ease)),this.setDuration(yt(t,"duration",this.duration)),this.setRepeat(yt(t,"repeat",0)),this.setDelay(yt(t,"delay",0)),this.setRepeatDelay(yt(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=mt(this.fromValue,this.toValue,i)}}var ft={setCheckerAnimationDuration(t){return void 0===t&&(t=0),this.checkerAnimDuration=t,this},playCheckerAnimation(){return void 0===this.checkerAnimProgressTask&&(this.checkerAnimProgressTask=new kt(this,{eventEmitter:null})),this.checkerAnimProgressTask.restart({key:"checkerAnimProgress",from:0,to:1,duration:this.checkerAnimDuration}),this},stopCheckerAnimation(){return void 0===this.checkerAnimProgressTask||this.checkerAnimProgressTask.stop(),this}},bt={};Object.assign(bt,n,o,W,ft);const Pt=23730,St=Phaser.Utils.Objects.GetValue,Dt=Phaser.Utils.Objects.IsPlainObject;class _t extends a{constructor(t,e,i,s,h,r,a){Dt(e)?(e=St(a=e,"x",0),i=St(a,"y",0),s=St(a,"width",2),h=St(a,"height",2),r=St(a,"color",Pt)):Dt(r)&&(r=St(a=r,"color",Pt)),super(t,e,i,s,h),this.type="rexCheckbox",void 0===r&&(r=Pt),this.setBoxShape(St(a,"circleBox",!1)),this.setBoxFillStyle(r,St(a,"boxFillAlpha",1)),this.setUncheckedBoxFillStyle(St(a,"uncheckedColor",null),St(a,"uncheckedBoxFillAlpha",1)),this.setBoxStrokeStyle(St(a,"boxLineWidth",4),St(a,"boxStrokeColor",r),St(a,"boxStrokeAlpha",1)),this.setUncheckedBoxStrokeStyle(this.boxLineWidth,St(a,"uncheckedBoxStrokeColor",this.boxStrokeColor),St(a,"uncheckedBoxStrokeAlpha",this.boxStrokeAlpha)),this.setCheckerStyle(St(a,"checkerColor",16777215),St(a,"checkerAlpha",1)),this.setBoxSize(St(a,"boxSize",1)),this.setCheckerSize(St(a,"checkerSize",1)),this.setCheckerAnimationDuration(St(a,"animationDuration",150)),this.buildShapes();var n=St(a,"checked");void 0===n&&(n=St(a,"value",!1)),this.setValue(n)}get value(){return this._value}set value(t){t=!!t,this._value!==t&&(this.dirty=!0,this._value=t,t?this.playCheckerAnimation():this.stopCheckerAnimation(),this.emit("valuechange",t))}setValue(t){return this.value=t,this}toggleValue(){return this.setValue(!this.value),this}get checked(){return this.value}set checked(t){this.value=t}setChecked(t){return void 0===t&&(t=!0),this.setValue(t),this}toggleChecked(){return this.toggleValue(),this}get checkerAnimProgress(){return this._checkerAnimProgress}set checkerAnimProgress(t){this._checkerAnimProgress!==t&&(this._checkerAnimProgress=t,this.dirty=!0)}}Object.assign(_t.prototype,bt);const xt=Phaser.Utils.Objects.GetValue;class Tt extends H{constructor(t,e){super(t,e),this._enable=void 0,t.setInteractive(xt(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.isDown=!1,this.isOver=!1,this.setEnable(xt(t,"enable",!0)),this.setMode(xt(t,"mode",1)),this.setClickInterval(xt(t,"clickInterval",100)),this.setDragThreshold(xt(t,"threshold",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPress,this),t.on("pointerup",this.onRelease,this),t.on("pointerout",this.onPointOut,this),t.on("pointermove",this.onMove,this),t.on("pointerover",this.onOver,this),t.on("pointerout",this.onOut,this)}shutdown(t){this.isShutdown||(this.pointer=null,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=At[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}onPress(t,e,i,s){void 0===this.pointer&&(this.pointer=t,this.isDown=!0,this.emit("down",this,this.parent,t,s),0===this.mode&&this.click(t.downTime,t,s))}onRelease(t,e,i,s){this.pointer===t&&(this.isDown=!1,this.emit("up",this,this.parent,t,s),1===this.mode&&this.click(t.upTime,t,s),this.pointer=void 0)}onPointOut(t,e){this.pointer===t&&this.cancel()}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&t.getDistance()>=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const At={press:0,pointerdown:0,release:1,pointerup:1},Ct=Phaser.Utils.Objects.GetValue,wt=Phaser.Utils.Objects.IsPlainObject;class Rt extends _t{constructor(t,e,i,s,h,r,a){wt(e)?(e=Ct(a=e,"x",0),i=Ct(a,"y",0),s=Ct(a,"width",2),h=Ct(a,"height",2),r=Ct(a,"color",Pt)):wt(r)&&(r=Ct(a=r,"color",Pt)),super(t,e,i,s,h,r,a),this._click=new Tt(this,Ct(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(Ct(a,"readOnly",!1))}get readOnly(){return!this._click.enable}set readOnly(t){this._click.enable=!t}setReadOnly(t){return void 0===t&&(t=!0),this.readOnly=t,this}}function Et(t,e,i,s,h,r){var a=new Rt(this.scene,t,e,i,s,h,r);return this.scene.add.existing(a),a}const Lt=Phaser.Utils.Objects.GetAdvancedValue,Bt=Phaser.GameObjects.BuildGameObject;function Ot(t,e){void 0===t&&(t={}),void 0!==e&&(t.add=e);var i=Lt(t,"width",void 0),s=Lt(t,"height",i),h=Lt(t,"color",23730),r=new Rt(this.scene,0,0,i,s,h,t);return Bt(this.scene,r,t),r}function jt(t,e,i,s,h,r){var a=new _t(this.scene,t,e,i,s,h,r);return this.scene.add.existing(a),a}const Ft=Phaser.Utils.Objects.GetAdvancedValue,zt=Phaser.GameObjects.BuildGameObject;function Mt(t,e){void 0===t&&(t={}),void 0!==e&&(t.add=e);var i=Ft(t,"width",void 0),s=Ft(t,"height",i),h=Ft(t,"color",23730),r=new _t(this.scene,0,0,i,s,h,t);return zt(this.scene,r,t),r}var Gt=function(t){return null==t||""===t||0===t.length},Vt=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(Gt(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var h=e.pop(),r=function(t,e,i){var s=t;if(Gt(e));else{var h;"string"==typeof e&&(e=e.split("."));for(var r=0,a=e.length;r0?-this.delay:0,this.state=this.nowTime>=0?A:E,this.repeatCounter=0,this}stop(){return this.state=C,this}update(t,e){this.state!==C&&this.state!==R&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=w)):(this.nowTime=this.duration,this.state=R):this.nowTime>=0&&(this.state=A))}get t(){var t;switch(this.state){case C:case E:case w:t=0;break;case A:t=this.nowTime/this.duration;break;case R:t=1}return S(t,0,1)}set t(t){(t=S(t,-1,1))<0?(this.state=E,this.nowTime=-this.delay*t):(this.state=A,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===C}get isDelay(){return this.state===E}get isCountDown(){return this.state===A}get isRunning(){return this.state===E||this.state===A}get isDone(){return this.state===R}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const C=0,E=1,A=2,w=3,R=-1;class V extends k{constructor(t,e){super(t,e),this.timer=new T}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const L=Phaser.Utils.Objects.GetValue,x=Phaser.Utils.Objects.GetAdvancedValue,M=Phaser.Tweens.Builders.GetEaseFunction;class O extends V{resetFromJSON(t){return this.timer.resetFromJSON(L(t,"timer")),this.setEnable(L(t,"enable",!0)),this.setTarget(L(t,"target",this.parent)),this.setDelay(x(t,"delay",0)),this.setDuration(x(t,"duration",1e3)),this.setEase(L(t,"ease","Linear")),this.setRepeat(L(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=M(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const F=Phaser.Utils.Objects.GetValue,X=Phaser.Math.Linear;class Y extends O{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=F(t,"key","value");var i=e[this.propertyKey];return this.fromValue=F(t,"from",i),this.toValue=F(t,"to",i),this.setEase(F(t,"ease",this.ease)),this.setDuration(F(t,"duration",this.duration)),this.setRepeat(F(t,"repeat",0)),this.setDelay(F(t,"delay",0)),this.setRepeatDelay(F(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=X(this.fromValue,this.toValue,i)}}const j=Phaser.Math.Percent;var z={setEaseValuePropName:function(t){return this.easeValuePropName=t,this},setEaseValueDuration:function(t){return this.easeValueDuration=t,this},setEaseValueFunction:function(t){return this.easeFunction=t,this},stopEaseValue:function(){return this.easeValueTask&&this.easeValueTask.stop(),this},easeValueTo:function(t,e,i){return null==t||(void 0!==e&&(t=j(t,e,i)),void 0===this.easeValueTask&&(this.easeValueTask=new Y(this,{eventEmitter:null})),this.easeValueTask.restart({key:this.easeValuePropName,to:t,duration:this.easeValueDuration,ease:this.easeFunction})),this},easeValueRepeat:function(t,e,i,s){return void 0===i&&(i=-1),void 0===s&&(s=0),void 0===this.easeValueTask&&(this.easeValueTask=new Y(this,{eventEmitter:null})),this.easeValueTask.restart({key:this.easeValuePropName,from:t,to:e,duration:this.easeValueDuration,ease:this.easeFunction,repeat:i,repeatDelay:s}),this}};const N=Phaser.Utils.Objects.GetValue,G=Phaser.Math.Clamp;var I={fillStyle:function(t,e){return null==t?this.isFilled=!1:(void 0===e&&(e=1),this.isFilled=!0,this.fillColor=t,this.fillAlpha=e),this},lineStyle:function(t,e,i){return null==t||null==e?this.isStroked=!1:(void 0===i&&(i=1),this.isStroked=!0,this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i),this}},B={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:function(t,e,i){if(!t||"number"==typeof t)return i;if("string"==typeof e){if(t.hasOwnProperty(e))return t[e];if(-1===e.indexOf("."))return i;e=e.split(".")}for(var s=e,r=t,a=i,h=0;h>>16,n=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+h+","+n+","+o+","+a+")"},q=function(t,e,i,s){var r=i||e.strokeColor,a=s||e.strokeAlpha,h=(16711680&r)>>>16,n=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+h+","+n+","+o+","+a+")",t.lineWidth=e.lineWidth};const H=Phaser.Geom.Polygon.Earcut;class Q extends W{constructor(){super(),this.pathData=[],this.pathIndexes=[],this.closePath=!1}updateData(){return this.pathIndexes=H(this.pathData),super.updateData(),this}webglRender(t,e,i,s,r){this.isFilled&&function(t,e,i,s,r,a){for(var h=U.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),n=i.pathData,o=i.pathIndexes,l=0;l=2){var r=i[s-2],a=i[s-1];if(t===r&&e===a)return i}return i.push(t,e),i};const $=Phaser.Math.DegToRad;var tt=function(t,e,i,s,r,a,h,n,o){h&&a>r?a-=360:!h&&a0,h=0,n=e.length;h0&&t.arc(e,i,r,h,a,!n)),t.close(),t},Et={buildShapes(){var t=this.iterations;this.addShape((new bt).setIterations(t).setName("track")).addShape((new bt).setIterations(t).setName("bar")).addShape((new st).setIterations(t).setName("center"))},updateShapes(){var t=this.radius,e=this.thickness*this.radius,i=this.radius,s=i-e,r=this.getShape("track");null!=this.trackColor&&this.thickness>0?(r.fillStyle(this.trackColor),Ct(r,t,t,i,s,0,360,!1)):r.reset();var a,h,n,o=this.getShape("bar");null!=this.barColor&&this.thickness>0?(1===this.value?(a=!1,h=0,n=360):(a=this.anticlockwise,h=St(this.startAngle),n=360*(a?1-this.value:this.value)+h),o.fillStyle(this.barColor),Ct(o,t,t,i+1,s-1,h,n,!1)):o.reset();var l=this.getShape("center");this.centerColor&&s>0?l.setCenterPosition(t,t).setRadius(s).fillStyle(this.centerColor):l.reset()}};const At=Phaser.Utils.Objects.GetValue,wt=Phaser.Utils.Objects.IsPlainObject,Rt=Phaser.Math.Clamp,Vt=Phaser.Math.DegToRad(270);class Lt extends(function(t){class e extends t{bootProgressBase(t){this.eventEmitter=N(t,"eventEmitter",this);var e=N(t,"valuechangeCallback",null);if(null!==e){var i=N(t,"valuechangeCallbackScope",void 0);this.eventEmitter.on("valuechange",e,i)}return this.setEaseValuePropName("value").setEaseValueDuration(N(t,"easeValue.duration",0)).setEaseValueFunction(N(t,"easeValue.ease","Linear")),this}get value(){return this._value}set value(t){t=G(t,0,1);var e=this._value,i=e!=t;this.dirty=this.dirty||i,this._value=t,i&&this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter)}}return Object.assign(e.prototype,l,z),e}(h)){constructor(t,e,i,s,r,a,h){wt(e)&&(e=At(h=e,"x",0),i=At(h,"y",0),s=At(h,"radius",1),r=At(h,"barColor",void 0),a=At(h,"value",0)),void 0===s&&(s=1);var n=2*s;super(t,e,i,n,n),this.type="rexCircularProgress",this.bootProgressBase(h),this.setRadius(s),this.setTrackColor(At(h,"trackColor",void 0)),this.setBarColor(r),this.setCenterColor(At(h,"centerColor",void 0)),this.setThickness(At(h,"thickness",.2)),this.setStartAngle(At(h,"startAngle",Vt)),this.setAnticlockwise(At(h,"anticlockwise",!1)),this.iterations=At(h,"iterations",128),this.buildShapes(),this.setValue(a)}resize(t,e){return(t=Math.floor(Math.min(t,e)))===this.width||(super.resize(t,t),this.setRadius(t/2)),this}get radius(){return this._radius}set radius(t){this.dirty=this.dirty||this._radius!=t,this._radius=t;var e=2*t;this.resize(e,e)}setRadius(t){return this.radius=t,this}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get startAngle(){return this._startAngle}set startAngle(t){this.dirty=this.dirty||this._startAngle!=t,this._startAngle=t}setStartAngle(t){return this.startAngle=t,this}get anticlockwise(){return this._anticlockwise}set anticlockwise(t){this.dirty=this.dirty||this._anticlockwise!=t,this._anticlockwise=t}setAnticlockwise(t){return void 0===t&&(t=!0),this.anticlockwise=t,this}get thickness(){return this._thickness}set thickness(t){t=Rt(t,0,1),this.dirty=this.dirty||this._thickness!=t,this._thickness=t}setThickness(t){return this.thickness=t,this}get centerColor(){return this._centerColor}set centerColor(t){this.dirty=this.dirty||this._centerColor!=t,this._centerColor=t}setCenterColor(t){return this.centerColor=t,this}}return Object.assign(Lt.prototype,Et),Lt},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rexcircularprogress=e(); +var t,e;t=void 0,e=function(){const t=Phaser.GameObjects.GetCalcMatrix,e=Phaser.Renderer.Canvas.SetTransform;var i={renderWebGL:function(e,i,s,r){i.updateData(),s.addToRenderList(i);var a=e.pipelines.set(i.pipeline),h=t(i,s,r),n=a.calcMatrix.copyFrom(h.calc),o=i._displayOriginX,l=i._displayOriginY,u=s.alpha*i.alpha;e.pipelines.preBatch(i);for(var d,p=i.geom,c=0,v=p.length;c0?-this.delay:0,this.state=this.nowTime>=0?A:E,this.repeatCounter=0,this}stop(){return this.state=C,this}update(t,e){this.state!==C&&this.state!==R&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=w)):(this.nowTime=this.duration,this.state=R):this.nowTime>=0&&(this.state=A))}get t(){var t;switch(this.state){case C:case E:case w:t=0;break;case A:t=this.nowTime/this.duration;break;case R:t=1}return S(t,0,1)}set t(t){(t=S(t,-1,1))<0?(this.state=E,this.nowTime=-this.delay*t):(this.state=A,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===C}get isDelay(){return this.state===E}get isCountDown(){return this.state===A}get isRunning(){return this.state===E||this.state===A}get isDone(){return this.state===R}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const C=0,E=1,A=2,w=3,R=-1;class V extends k{constructor(t,e){super(t,e),this.timer=new T}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const L=Phaser.Utils.Objects.GetValue,M=Phaser.Utils.Objects.GetAdvancedValue,x=Phaser.Tweens.Builders.GetEaseFunction;class O extends V{resetFromJSON(t){return this.timer.resetFromJSON(L(t,"timer")),this.setEnable(L(t,"enable",!0)),this.setTarget(L(t,"target",this.parent)),this.setDelay(M(t,"delay",0)),this.setDuration(M(t,"duration",1e3)),this.setEase(L(t,"ease","Linear")),this.setRepeat(L(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=x(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const F=Phaser.Utils.Objects.GetValue,X=Phaser.Math.Linear;class Y extends O{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=F(t,"key","value");var i=e[this.propertyKey];return this.fromValue=F(t,"from",i),this.toValue=F(t,"to",i),this.setEase(F(t,"ease",this.ease)),this.setDuration(F(t,"duration",this.duration)),this.setRepeat(F(t,"repeat",0)),this.setDelay(F(t,"delay",0)),this.setRepeatDelay(F(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=X(this.fromValue,this.toValue,i)}}const j=Phaser.Math.Percent;var z={setEaseValuePropName:function(t){return this.easeValuePropName=t,this},setEaseValueDuration:function(t){return this.easeValueDuration=t,this},setEaseValueFunction:function(t){return this.easeFunction=t,this},stopEaseValue:function(){return this.easeValueTask&&this.easeValueTask.stop(),this},easeValueTo:function(t,e,i){return null==t||(void 0!==e&&(t=j(t,e,i)),void 0===this.easeValueTask&&(this.easeValueTask=new Y(this,{eventEmitter:null})),this.easeValueTask.restart({key:this.easeValuePropName,to:t,duration:this.easeValueDuration,ease:this.easeFunction})),this},easeValueRepeat:function(t,e,i,s){return void 0===i&&(i=-1),void 0===s&&(s=0),void 0===this.easeValueTask&&(this.easeValueTask=new Y(this,{eventEmitter:null})),this.easeValueTask.restart({key:this.easeValuePropName,from:t,to:e,duration:this.easeValueDuration,ease:this.easeFunction,repeat:i,repeatDelay:s}),this}};const N=Phaser.Utils.Objects.GetValue,G=Phaser.Math.Clamp;var I={fillStyle:function(t,e){return null==t?this.isFilled=!1:(void 0===e&&(e=1),this.isFilled=!0,this.fillColor=t,this.fillAlpha=e),this},lineStyle:function(t,e,i){return null==t||null==e?this.isStroked=!1:(void 0===i&&(i=1),this.isStroked=!0,this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i),this}},B={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:function(t,e,i){if(!t||"number"==typeof t)return i;if("string"==typeof e){if(t.hasOwnProperty(e))return t[e];if(-1===e.indexOf("."))return i;e=e.split(".")}for(var s=e,r=t,a=i,h=0;h>>16,n=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+h+","+n+","+o+","+a+")"},q=function(t,e,i,s){var r=i||e.strokeColor,a=s||e.strokeAlpha,h=(16711680&r)>>>16,n=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+h+","+n+","+o+","+a+")",t.lineWidth=e.lineWidth};const H=Phaser.Geom.Polygon.Earcut;class Q extends W{constructor(){super(),this.pathData=[],this.pathIndexes=[],this.closePath=!1}updateData(){return this.pathIndexes=H(this.pathData),super.updateData(),this}webglRender(t,e,i,s,r){this.isFilled&&function(t,e,i,s,r,a){for(var h=U.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),n=i.pathData,o=i.pathIndexes,l=0;l=2){var r=i[s-2],a=i[s-1];if(t===r&&e===a)return i}return i.push(t,e),i};const $=Phaser.Math.DegToRad;var tt=function(t,e,i,s,r,a,h,n,o){h&&a>r?a-=360:!h&&a0,h=0,n=e.length;h0&&t.arc(e,i,r,h,a,!n)),t.close(),t},At={buildShapes(){var t=this.iterations;this.addShape((new St).setIterations(t).setName("track")).addShape((new St).setIterations(t).setName("bar")).addShape((new st).setIterations(t).setName("center"))},updateShapes(){var t=this.radius,e=this.thickness*this.radius,i=this.radius,s=i-e,r=this.getShape("track");null!=this.trackColor&&this.thickness>0?(r.fillStyle(this.trackColor),Et(r,t,t,i,s,0,360,!1)):r.reset();var a,h,n,o=this.getShape("bar");null!=this.barColor&&this.thickness>0?(1===this.value?(a=!1,h=0,n=360):(a=this.anticlockwise,h=Tt(this.startAngle),n=360*(a?1-this.value:this.value)+h),o.fillStyle(this.barColor),Et(o,t,t,i+1,s-1,h,n,!1)):o.reset();var l=this.getShape("center");this.centerColor&&s>0?l.setCenterPosition(t,t).setRadius(s).fillStyle(this.centerColor):l.reset()}};const wt=Phaser.Utils.Objects.GetValue,Rt=Phaser.Utils.Objects.IsPlainObject,Vt=Phaser.Math.Clamp,Lt=Phaser.Math.DegToRad(270);class Mt extends(function(t){class e extends t{bootProgressBase(t){this.eventEmitter=N(t,"eventEmitter",this);var e=N(t,"valuechangeCallback",null);if(null!==e){var i=N(t,"valuechangeCallbackScope",void 0);this.eventEmitter.on("valuechange",e,i)}return this.setEaseValuePropName("value").setEaseValueDuration(N(t,"easeValue.duration",0)).setEaseValueFunction(N(t,"easeValue.ease","Linear")),this}get value(){return this._value}set value(t){t=G(t,0,1);var e=this._value,i=e!=t;this.dirty=this.dirty||i,this._value=t,i&&this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter)}}return Object.assign(e.prototype,l,z),e}(h)){constructor(t,e,i,s,r,a,h){Rt(e)&&(e=wt(h=e,"x",0),i=wt(h,"y",0),s=wt(h,"radius",1),r=wt(h,"barColor",void 0),a=wt(h,"value",0)),void 0===s&&(s=1);var n=2*s;super(t,e,i,n,n),this.type="rexCircularProgress",this.bootProgressBase(h),this.setRadius(s),this.setTrackColor(wt(h,"trackColor",void 0)),this.setBarColor(r),this.setCenterColor(wt(h,"centerColor",void 0)),this.setThickness(wt(h,"thickness",.2)),this.setStartAngle(wt(h,"startAngle",Lt)),this.setAnticlockwise(wt(h,"anticlockwise",!1)),this.iterations=wt(h,"iterations",128),this.buildShapes(),this.setValue(a)}resize(t,e){return(t=Math.floor(Math.min(t,e)))===this.width||(super.resize(t,t),this.setRadius(t/2)),this}get radius(){return this._radius}set radius(t){this.dirty=this.dirty||this._radius!=t,this._radius=t;var e=2*t;this.resize(e,e)}setRadius(t){return this.radius=t,this}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get startAngle(){return this._startAngle}set startAngle(t){this.dirty=this.dirty||this._startAngle!=t,this._startAngle=t}setStartAngle(t){return this.startAngle=t,this}get anticlockwise(){return this._anticlockwise}set anticlockwise(t){this.dirty=this.dirty||this._anticlockwise!=t,this._anticlockwise=t}setAnticlockwise(t){return void 0===t&&(t=!0),this.anticlockwise=t,this}get thickness(){return this._thickness}set thickness(t){t=Vt(t,0,1),this.dirty=this.dirty||this._thickness!=t,this._thickness=t}setThickness(t){return this.thickness=t,this}get centerColor(){return this._centerColor}set centerColor(t){this.dirty=this.dirty||this._centerColor!=t,this._centerColor=t}setCenterColor(t){return this.centerColor=t,this}}return Object.assign(Mt.prototype,At),Mt},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rexcircularprogress=e(); diff --git a/dist/rexcircularprogressplugin.js b/dist/rexcircularprogressplugin.js index cd3bac7a70..3c609ce2a3 100644 --- a/dist/rexcircularprogressplugin.js +++ b/dist/rexcircularprogressplugin.js @@ -1900,6 +1900,32 @@ return pathData; }; + //import CatmullRomInterpolation from '../../utils/math/interpolation/CatmullRomInterpolation.js'; + + const CatmullRomInterpolation = Phaser.Math.Interpolation.CatmullRom; + + var CatmullRomTo = function (points, iterations, pathData) { + var pathDataCnt = pathData.length; + var p0x = pathData[pathDataCnt - 2]; + var p0y = pathData[pathDataCnt - 1]; + + var xList = [p0x]; + var yList = [p0y]; + for (var i = 0, cnt = points.length; i < cnt; i += 2) { + xList.push(points[i]); + yList.push(points[i + 1]); + } + + for (var i = 1, last = iterations - 1; i <= last; i++) { + var t = i / last; + pathData.push( + CatmullRomInterpolation(xList, t), + CatmullRomInterpolation(yList, t) + ); + } + return pathData; + }; + var DuplicateLast = function (pathData) { var len = pathData.length; if (len < 2) { @@ -2011,6 +2037,18 @@ return this; }, + catmullRomTo(...points) { + CatmullRomTo( + points, + this.iterations, + this.pathData + ); + + this.lastPointX = points[points.length-2]; + this.lastPointY = points[points.length-1]; + return this; + }, + close() { // Line to first point var startX = this.pathData[0], @@ -2448,6 +2486,13 @@ return this; } + catmullRomTo(...points) { + this.builder.catmullRomTo(...points); + + this.dirty = true; + return this; + } + close() { this.builder.close(); diff --git a/dist/rexcircularprogressplugin.min.js b/dist/rexcircularprogressplugin.min.js index 05e09b620b..a96257955b 100644 --- a/dist/rexcircularprogressplugin.min.js +++ b/dist/rexcircularprogressplugin.min.js @@ -1 +1 @@ -var t,e;t=void 0,e=function(){const t=Phaser.GameObjects.GetCalcMatrix,e=Phaser.Renderer.Canvas.SetTransform;var i={renderWebGL:function(e,i,s,r){i.updateData(),s.addToRenderList(i);var a=e.pipelines.set(i.pipeline),h=t(i,s,r),n=a.calcMatrix.copyFrom(h.calc),o=i._displayOriginX,l=i._displayOriginY,u=s.alpha*i.alpha;e.pipelines.preBatch(i);for(var d,c=i.geom,p=0,v=c.length;p0?-this.delay:0,this.state=this.nowTime>=0?A:E,this.repeatCounter=0,this}stop(){return this.state=C,this}update(t,e){this.state!==C&&this.state!==R&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=w)):(this.nowTime=this.duration,this.state=R):this.nowTime>=0&&(this.state=A))}get t(){var t;switch(this.state){case C:case E:case w:t=0;break;case A:t=this.nowTime/this.duration;break;case R:t=1}return S(t,0,1)}set t(t){(t=S(t,-1,1))<0?(this.state=E,this.nowTime=-this.delay*t):(this.state=A,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===C}get isDelay(){return this.state===E}get isCountDown(){return this.state===A}get isRunning(){return this.state===E||this.state===A}get isDone(){return this.state===R}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const C=0,E=1,A=2,w=3,R=-1;class V extends k{constructor(t,e){super(t,e),this.timer=new T}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const x=Phaser.Utils.Objects.GetValue,O=Phaser.Utils.Objects.GetAdvancedValue,L=Phaser.Tweens.Builders.GetEaseFunction;class M extends V{resetFromJSON(t){return this.timer.resetFromJSON(x(t,"timer")),this.setEnable(x(t,"enable",!0)),this.setTarget(x(t,"target",this.parent)),this.setDelay(O(t,"delay",0)),this.setDuration(O(t,"duration",1e3)),this.setEase(x(t,"ease","Linear")),this.setRepeat(x(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=L(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const j=Phaser.Utils.Objects.GetValue,F=Phaser.Math.Linear;class X extends M{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=j(t,"key","value");var i=e[this.propertyKey];return this.fromValue=j(t,"from",i),this.toValue=j(t,"to",i),this.setEase(j(t,"ease",this.ease)),this.setDuration(j(t,"duration",this.duration)),this.setRepeat(j(t,"repeat",0)),this.setDelay(j(t,"delay",0)),this.setRepeatDelay(j(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=F(this.fromValue,this.toValue,i)}}const Y=Phaser.Math.Percent;var z={setEaseValuePropName:function(t){return this.easeValuePropName=t,this},setEaseValueDuration:function(t){return this.easeValueDuration=t,this},setEaseValueFunction:function(t){return this.easeFunction=t,this},stopEaseValue:function(){return this.easeValueTask&&this.easeValueTask.stop(),this},easeValueTo:function(t,e,i){return null==t||(void 0!==e&&(t=Y(t,e,i)),void 0===this.easeValueTask&&(this.easeValueTask=new X(this,{eventEmitter:null})),this.easeValueTask.restart({key:this.easeValuePropName,to:t,duration:this.easeValueDuration,ease:this.easeFunction})),this},easeValueRepeat:function(t,e,i,s){return void 0===i&&(i=-1),void 0===s&&(s=0),void 0===this.easeValueTask&&(this.easeValueTask=new X(this,{eventEmitter:null})),this.easeValueTask.restart({key:this.easeValuePropName,from:t,to:e,duration:this.easeValueDuration,ease:this.easeFunction,repeat:i,repeatDelay:s}),this}};const G=Phaser.Utils.Objects.GetValue,N=Phaser.Math.Clamp;var B={fillStyle:function(t,e){return null==t?this.isFilled=!1:(void 0===e&&(e=1),this.isFilled=!0,this.fillColor=t,this.fillAlpha=e),this},lineStyle:function(t,e,i){return null==t||null==e?this.isStroked=!1:(void 0===i&&(i=1),this.isStroked=!0,this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i),this}},I={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:function(t,e,i){if(!t||"number"==typeof t)return i;if("string"==typeof e){if(t.hasOwnProperty(e))return t[e];if(-1===e.indexOf("."))return i;e=e.split(".")}for(var s=e,r=t,a=i,h=0;h>>16,n=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+h+","+n+","+o+","+a+")"},q=function(t,e,i,s){var r=i||e.strokeColor,a=s||e.strokeAlpha,h=(16711680&r)>>>16,n=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+h+","+n+","+o+","+a+")",t.lineWidth=e.lineWidth};const H=Phaser.Geom.Polygon.Earcut;class Q extends W{constructor(){super(),this.pathData=[],this.pathIndexes=[],this.closePath=!1}updateData(){return this.pathIndexes=H(this.pathData),super.updateData(),this}webglRender(t,e,i,s,r){this.isFilled&&function(t,e,i,s,r,a){for(var h=U.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),n=i.pathData,o=i.pathIndexes,l=0;l=2){var r=i[s-2],a=i[s-1];if(t===r&&e===a)return i}return i.push(t,e),i};const $=Phaser.Math.DegToRad;var tt=function(t,e,i,s,r,a,h,n,o){h&&a>r?a-=360:!h&&a0,h=0,n=e.length;h0&&t.arc(e,i,r,h,a,!n)),t.close(),t},Et={buildShapes(){var t=this.iterations;this.addShape((new bt).setIterations(t).setName("track")).addShape((new bt).setIterations(t).setName("bar")).addShape((new st).setIterations(t).setName("center"))},updateShapes(){var t=this.radius,e=this.thickness*this.radius,i=this.radius,s=i-e,r=this.getShape("track");null!=this.trackColor&&this.thickness>0?(r.fillStyle(this.trackColor),Ct(r,t,t,i,s,0,360,!1)):r.reset();var a,h,n,o=this.getShape("bar");null!=this.barColor&&this.thickness>0?(1===this.value?(a=!1,h=0,n=360):(a=this.anticlockwise,h=St(this.startAngle),n=360*(a?1-this.value:this.value)+h),o.fillStyle(this.barColor),Ct(o,t,t,i+1,s-1,h,n,!1)):o.reset();var l=this.getShape("center");this.centerColor&&s>0?l.setCenterPosition(t,t).setRadius(s).fillStyle(this.centerColor):l.reset()}};const At=Phaser.Utils.Objects.GetValue,wt=Phaser.Utils.Objects.IsPlainObject,Rt=Phaser.Math.Clamp,Vt=Phaser.Math.DegToRad(270);class xt extends(function(t){class e extends t{bootProgressBase(t){this.eventEmitter=G(t,"eventEmitter",this);var e=G(t,"valuechangeCallback",null);if(null!==e){var i=G(t,"valuechangeCallbackScope",void 0);this.eventEmitter.on("valuechange",e,i)}return this.setEaseValuePropName("value").setEaseValueDuration(G(t,"easeValue.duration",0)).setEaseValueFunction(G(t,"easeValue.ease","Linear")),this}get value(){return this._value}set value(t){t=N(t,0,1);var e=this._value,i=e!=t;this.dirty=this.dirty||i,this._value=t,i&&this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter)}}return Object.assign(e.prototype,l,z),e}(h)){constructor(t,e,i,s,r,a,h){wt(e)&&(e=At(h=e,"x",0),i=At(h,"y",0),s=At(h,"radius",1),r=At(h,"barColor",void 0),a=At(h,"value",0)),void 0===s&&(s=1);var n=2*s;super(t,e,i,n,n),this.type="rexCircularProgress",this.bootProgressBase(h),this.setRadius(s),this.setTrackColor(At(h,"trackColor",void 0)),this.setBarColor(r),this.setCenterColor(At(h,"centerColor",void 0)),this.setThickness(At(h,"thickness",.2)),this.setStartAngle(At(h,"startAngle",Vt)),this.setAnticlockwise(At(h,"anticlockwise",!1)),this.iterations=At(h,"iterations",128),this.buildShapes(),this.setValue(a)}resize(t,e){return(t=Math.floor(Math.min(t,e)))===this.width||(super.resize(t,t),this.setRadius(t/2)),this}get radius(){return this._radius}set radius(t){this.dirty=this.dirty||this._radius!=t,this._radius=t;var e=2*t;this.resize(e,e)}setRadius(t){return this.radius=t,this}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get startAngle(){return this._startAngle}set startAngle(t){this.dirty=this.dirty||this._startAngle!=t,this._startAngle=t}setStartAngle(t){return this.startAngle=t,this}get anticlockwise(){return this._anticlockwise}set anticlockwise(t){this.dirty=this.dirty||this._anticlockwise!=t,this._anticlockwise=t}setAnticlockwise(t){return void 0===t&&(t=!0),this.anticlockwise=t,this}get thickness(){return this._thickness}set thickness(t){t=Rt(t,0,1),this.dirty=this.dirty||this._thickness!=t,this._thickness=t}setThickness(t){return this.thickness=t,this}get centerColor(){return this._centerColor}set centerColor(t){this.dirty=this.dirty||this._centerColor!=t,this._centerColor=t}setCenterColor(t){return this.centerColor=t,this}}function Ot(t,e,i,s,r,a){var h=new xt(this.scene,t,e,i,s,r,a);return this.scene.add.existing(h),h}Object.assign(xt.prototype,Et);const Lt=Phaser.GameObjects.BuildGameObject;function Mt(t,e){void 0===t&&(t={}),void 0!==e&&(t.add=e);var i=new xt(this.scene,t);return Lt(this.scene,i,t),i}var jt=function(t){return null==t||""===t||0===t.length};class Ft extends Phaser.Plugins.BasePlugin{constructor(t){super(t),t.registerGameObject("rexCircularProgress",Ot,Mt)}start(){this.game.events.on("destroy",this.destroy,this)}}return function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t)if(jt(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),a=function(t,e,i){var s=t;if(jt(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var a=0,h=e.length;a0?-this.delay:0,this.state=this.nowTime>=0?A:E,this.repeatCounter=0,this}stop(){return this.state=C,this}update(t,e){this.state!==C&&this.state!==R&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=w)):(this.nowTime=this.duration,this.state=R):this.nowTime>=0&&(this.state=A))}get t(){var t;switch(this.state){case C:case E:case w:t=0;break;case A:t=this.nowTime/this.duration;break;case R:t=1}return S(t,0,1)}set t(t){(t=S(t,-1,1))<0?(this.state=E,this.nowTime=-this.delay*t):(this.state=A,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===C}get isDelay(){return this.state===E}get isCountDown(){return this.state===A}get isRunning(){return this.state===E||this.state===A}get isDone(){return this.state===R}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const C=0,E=1,A=2,w=3,R=-1;class V extends k{constructor(t,e){super(t,e),this.timer=new T}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const x=Phaser.Utils.Objects.GetValue,O=Phaser.Utils.Objects.GetAdvancedValue,L=Phaser.Tweens.Builders.GetEaseFunction;class M extends V{resetFromJSON(t){return this.timer.resetFromJSON(x(t,"timer")),this.setEnable(x(t,"enable",!0)),this.setTarget(x(t,"target",this.parent)),this.setDelay(O(t,"delay",0)),this.setDuration(O(t,"duration",1e3)),this.setEase(x(t,"ease","Linear")),this.setRepeat(x(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=L(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const j=Phaser.Utils.Objects.GetValue,F=Phaser.Math.Linear;class X extends M{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=j(t,"key","value");var i=e[this.propertyKey];return this.fromValue=j(t,"from",i),this.toValue=j(t,"to",i),this.setEase(j(t,"ease",this.ease)),this.setDuration(j(t,"duration",this.duration)),this.setRepeat(j(t,"repeat",0)),this.setDelay(j(t,"delay",0)),this.setRepeatDelay(j(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=F(this.fromValue,this.toValue,i)}}const Y=Phaser.Math.Percent;var z={setEaseValuePropName:function(t){return this.easeValuePropName=t,this},setEaseValueDuration:function(t){return this.easeValueDuration=t,this},setEaseValueFunction:function(t){return this.easeFunction=t,this},stopEaseValue:function(){return this.easeValueTask&&this.easeValueTask.stop(),this},easeValueTo:function(t,e,i){return null==t||(void 0!==e&&(t=Y(t,e,i)),void 0===this.easeValueTask&&(this.easeValueTask=new X(this,{eventEmitter:null})),this.easeValueTask.restart({key:this.easeValuePropName,to:t,duration:this.easeValueDuration,ease:this.easeFunction})),this},easeValueRepeat:function(t,e,i,s){return void 0===i&&(i=-1),void 0===s&&(s=0),void 0===this.easeValueTask&&(this.easeValueTask=new X(this,{eventEmitter:null})),this.easeValueTask.restart({key:this.easeValuePropName,from:t,to:e,duration:this.easeValueDuration,ease:this.easeFunction,repeat:i,repeatDelay:s}),this}};const G=Phaser.Utils.Objects.GetValue,N=Phaser.Math.Clamp;var B={fillStyle:function(t,e){return null==t?this.isFilled=!1:(void 0===e&&(e=1),this.isFilled=!0,this.fillColor=t,this.fillAlpha=e),this},lineStyle:function(t,e,i){return null==t||null==e?this.isStroked=!1:(void 0===i&&(i=1),this.isStroked=!0,this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i),this}},I={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:function(t,e,i){if(!t||"number"==typeof t)return i;if("string"==typeof e){if(t.hasOwnProperty(e))return t[e];if(-1===e.indexOf("."))return i;e=e.split(".")}for(var s=e,r=t,a=i,h=0;h>>16,n=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+h+","+n+","+o+","+a+")"},q=function(t,e,i,s){var r=i||e.strokeColor,a=s||e.strokeAlpha,h=(16711680&r)>>>16,n=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+h+","+n+","+o+","+a+")",t.lineWidth=e.lineWidth};const H=Phaser.Geom.Polygon.Earcut;class Q extends W{constructor(){super(),this.pathData=[],this.pathIndexes=[],this.closePath=!1}updateData(){return this.pathIndexes=H(this.pathData),super.updateData(),this}webglRender(t,e,i,s,r){this.isFilled&&function(t,e,i,s,r,a){for(var h=U.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),n=i.pathData,o=i.pathIndexes,l=0;l=2){var r=i[s-2],a=i[s-1];if(t===r&&e===a)return i}return i.push(t,e),i};const $=Phaser.Math.DegToRad;var tt=function(t,e,i,s,r,a,h,n,o){h&&a>r?a-=360:!h&&a0,h=0,n=e.length;h0&&t.arc(e,i,r,h,a,!n)),t.close(),t},At={buildShapes(){var t=this.iterations;this.addShape((new St).setIterations(t).setName("track")).addShape((new St).setIterations(t).setName("bar")).addShape((new st).setIterations(t).setName("center"))},updateShapes(){var t=this.radius,e=this.thickness*this.radius,i=this.radius,s=i-e,r=this.getShape("track");null!=this.trackColor&&this.thickness>0?(r.fillStyle(this.trackColor),Et(r,t,t,i,s,0,360,!1)):r.reset();var a,h,n,o=this.getShape("bar");null!=this.barColor&&this.thickness>0?(1===this.value?(a=!1,h=0,n=360):(a=this.anticlockwise,h=Tt(this.startAngle),n=360*(a?1-this.value:this.value)+h),o.fillStyle(this.barColor),Et(o,t,t,i+1,s-1,h,n,!1)):o.reset();var l=this.getShape("center");this.centerColor&&s>0?l.setCenterPosition(t,t).setRadius(s).fillStyle(this.centerColor):l.reset()}};const wt=Phaser.Utils.Objects.GetValue,Rt=Phaser.Utils.Objects.IsPlainObject,Vt=Phaser.Math.Clamp,xt=Phaser.Math.DegToRad(270);class Ot extends(function(t){class e extends t{bootProgressBase(t){this.eventEmitter=G(t,"eventEmitter",this);var e=G(t,"valuechangeCallback",null);if(null!==e){var i=G(t,"valuechangeCallbackScope",void 0);this.eventEmitter.on("valuechange",e,i)}return this.setEaseValuePropName("value").setEaseValueDuration(G(t,"easeValue.duration",0)).setEaseValueFunction(G(t,"easeValue.ease","Linear")),this}get value(){return this._value}set value(t){t=N(t,0,1);var e=this._value,i=e!=t;this.dirty=this.dirty||i,this._value=t,i&&this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter)}}return Object.assign(e.prototype,l,z),e}(h)){constructor(t,e,i,s,r,a,h){Rt(e)&&(e=wt(h=e,"x",0),i=wt(h,"y",0),s=wt(h,"radius",1),r=wt(h,"barColor",void 0),a=wt(h,"value",0)),void 0===s&&(s=1);var n=2*s;super(t,e,i,n,n),this.type="rexCircularProgress",this.bootProgressBase(h),this.setRadius(s),this.setTrackColor(wt(h,"trackColor",void 0)),this.setBarColor(r),this.setCenterColor(wt(h,"centerColor",void 0)),this.setThickness(wt(h,"thickness",.2)),this.setStartAngle(wt(h,"startAngle",xt)),this.setAnticlockwise(wt(h,"anticlockwise",!1)),this.iterations=wt(h,"iterations",128),this.buildShapes(),this.setValue(a)}resize(t,e){return(t=Math.floor(Math.min(t,e)))===this.width||(super.resize(t,t),this.setRadius(t/2)),this}get radius(){return this._radius}set radius(t){this.dirty=this.dirty||this._radius!=t,this._radius=t;var e=2*t;this.resize(e,e)}setRadius(t){return this.radius=t,this}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get startAngle(){return this._startAngle}set startAngle(t){this.dirty=this.dirty||this._startAngle!=t,this._startAngle=t}setStartAngle(t){return this.startAngle=t,this}get anticlockwise(){return this._anticlockwise}set anticlockwise(t){this.dirty=this.dirty||this._anticlockwise!=t,this._anticlockwise=t}setAnticlockwise(t){return void 0===t&&(t=!0),this.anticlockwise=t,this}get thickness(){return this._thickness}set thickness(t){t=Vt(t,0,1),this.dirty=this.dirty||this._thickness!=t,this._thickness=t}setThickness(t){return this.thickness=t,this}get centerColor(){return this._centerColor}set centerColor(t){this.dirty=this.dirty||this._centerColor!=t,this._centerColor=t}setCenterColor(t){return this.centerColor=t,this}}function Lt(t,e,i,s,r,a){var h=new Ot(this.scene,t,e,i,s,r,a);return this.scene.add.existing(h),h}Object.assign(Ot.prototype,At);const Mt=Phaser.GameObjects.BuildGameObject;function jt(t,e){void 0===t&&(t={}),void 0!==e&&(t.add=e);var i=new Ot(this.scene,t);return Mt(this.scene,i,t),i}var Ft=function(t){return null==t||""===t||0===t.length};class Xt extends Phaser.Plugins.BasePlugin{constructor(t){super(t),t.registerGameObject("rexCircularProgress",Lt,jt)}start(){this.game.events.on("destroy",this.destroy,this)}}return function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t)if(Ft(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),a=function(t,e,i){var s=t;if(Ft(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var a=0,h=e.length;a=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const T=Phaser.Math.DegToRad;var _={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=T(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},k={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=O(t.scaleX,i.scaleX),e.scaleY=O(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},E={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=O(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},L={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},D={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},A={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(t){void 0===t&&(t=!1);var e=this;return this._mask=null,this.setChildMaskVisible(this),this.children.forEach((function(t){t.clearMask&&t.clearMask(!1),t.hasOwnProperty("isRexContainerLite")||e.setChildMaskVisible(t)})),t&&this.mask&&this.mask.destroy(),this}},Y=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},z=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const j=Phaser.Utils.Array;var I={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},ke=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const Ee=/(\S+)\[(\d+)\]/i,Me=Phaser.Utils.Objects.GetValue;var Re=function(t,e){return void 0===e?t:t[e]},Le=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Me(e,"left",0),t.right=Me(e,"right",0),t.top=Me(e,"top",0),t.bottom=Me(e,"bottom",0)),t},De={getInnerPadding(t){return Re(this.space,t)},setInnerPadding(t,e){return Le(this.space,t,e),this},getOuterPadding(t){return Re(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Le(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Re(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Le(this.getSizerConfig(t).padding,e,i),this}},Ae=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Ye=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Xe=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},We=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},ze=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},Fe=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},je={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Ie=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?mi:fi,this.repeatCounter=0,this}stop(){return this.state=gi,this}update(t,e){this.state!==gi&&this.state!==xi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=yi)):(this.nowTime=this.duration,this.state=xi):this.nowTime>=0&&(this.state=mi))}get t(){var t;switch(this.state){case gi:case fi:case yi:t=0;break;case mi:t=this.nowTime/this.duration;break;case xi:t=1}return pi(t,0,1)}set t(t){(t=pi(t,-1,1))<0?(this.state=fi,this.nowTime=-this.delay*t):(this.state=mi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===gi}get isDelay(){return this.state===fi}get isCountDown(){return this.state===mi}get isRunning(){return this.state===fi||this.state===mi}get isDone(){return this.state===xi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const gi=0,fi=1,mi=2,yi=3,xi=-1;class bi extends di{constructor(t,e){super(t,e),this.timer=new vi}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const Ci=Phaser.Utils.Objects.GetValue,wi=Phaser.Utils.Objects.GetAdvancedValue,Si=Phaser.Tweens.Builders.GetEaseFunction;class Oi extends bi{resetFromJSON(t){return this.timer.resetFromJSON(Ci(t,"timer")),this.setEnable(Ci(t,"enable",!0)),this.setTarget(Ci(t,"target",this.parent)),this.setDelay(wi(t,"delay",0)),this.setDuration(wi(t,"duration",1e3)),this.setEase(Ci(t,"ease","Linear")),this.setRepeat(Ci(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Si(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Pi=Phaser.Utils.Objects.GetValue,Ti=Phaser.Utils.Objects.GetAdvancedValue,_i=Phaser.Math.Linear;let ki=class extends Oi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Pi(t,"mode",0)),this.setScaleRange(Ti(t,"start",void 0),Ti(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ei[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Ti(t,"x",this.parent.scaleX),this.startY=Ti(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Ti(e,"x",void 0),this.endY=Ti(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=_i(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=_i(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const Ei={stop:0,destroy:1,yoyo:2};var Mi=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new ki(t,a):r.resetFromJSON(a),r.restart(),r},Ri=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof ki&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new ki(t,h):n.resetFromJSON(h),n.restart(),n},Li=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Di=function(t){return Li(t,"complete")};const Ai=Phaser.Utils.Objects.IsPlainObject;var Yi={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Ai(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Mi(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Di(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Ai(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Ri(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Di(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Di(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Ai(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new ki(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Di(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Xi={};Object.assign(Xi,Yi),Xi.onInitScale=function(){Yi.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=be.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Wi=Phaser.Utils.Objects.GetValue,zi=Phaser.Utils.Objects.GetAdvancedValue,Fi=Phaser.Math.Linear;class ji extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Wi(t,"mode",0)),this.setAlphaRange(zi(t,"start",this.parent.alpha),zi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ii[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Fi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ii={stop:0,destroy:1,yoyo:2},Bi=Phaser.Utils.Objects.IsPlainObject;var Hi=function(t,e,i,s){var r,n;Bi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new ji(t,h):s.resetFromJSON(h),s.restart(),s},Ni=function(t,e,i,s){i instanceof ji&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new ji(t,r):s.resetFromJSON(r),s.restart(),s};const Gi=Phaser.Utils.Objects.IsPlainObject;var Vi={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Gi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Hi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Di(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Gi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Ni(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Di(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Di(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Ui={};Object.assign(Ui,Vi),Ui.onInitFade=function(){Vi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=be.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const $i=Phaser.Utils.Objects.GetValue,Ji=Phaser.Utils.Objects.GetAdvancedValue,Ki=Phaser.Math.Linear;class qi extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode($i(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ji(t,"x",void 0),i=Ji(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Zi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Ji(i,"startX",void 0),this.startY=Ji(i,"startY",void 0),this.endX=Ji(i,"endX",void 0),this.endY=Ji(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Ki(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ki(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Zi={stop:0,destroy:1,yoyo:2};var Qi=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const ts=Phaser.Utils.Objects.IsPlainObject,es=Phaser.Math.Distance.Between;var is={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(ts(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*es(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof qi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=Qi(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=Qi(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new qi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Di(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Di(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(ts(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*es(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof qi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=Qi(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=Qi(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new qi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Di(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Di(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},ss={};Object.assign(ss,is),ss.onInitEaseMove=function(){is.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=be.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const rs=Phaser.Utils.Objects.GetValue;class ns extends ai{constructor(t,e){super(t,e),this.timer=new vi,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(rs(t,"timer")),this.setEnable(rs(t,"enable",!0)),this.setMode(rs(t,"mode",1)),this.isRunning=rs(t,"isRunning",!1),this.setMagnitudeMode(rs(t,"magnitudeMode",1)),this.setAxisMode(rs(t,"axis",0)),this.setDuration(rs(t,"duration",500)),this.setMagnitude(rs(t,"magnitude",10)),this.ox=rs(t,"ox",void 0),this.oy=rs(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=hs[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=os[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=as[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=rs(i,"magnitude",void 0),t=rs(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const hs={effect:0,behavior:1},as={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},os={constant:0,decay:1},ls=Phaser.Utils.Objects.IsPlainObject;var ds={shake(t,e,i){if(ls(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new ns(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Di(this._shake)}};const cs=Phaser.Utils.Objects.GetValue,us=Phaser.Math.Linear;class ps extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=cs(t,"key","value");var i=e[this.propertyKey];return this.fromValue=cs(t,"from",i),this.toValue=cs(t,"to",i),this.setEase(cs(t,"ease",this.ease)),this.setDuration(cs(t,"duration",this.duration)),this.setRepeat(cs(t,"repeat",0)),this.setDelay(cs(t,"delay",0)),this.setRepeatDelay(cs(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=us(this.fromValue,this.toValue,i)}}const vs=Phaser.Utils.Objects.IsPlainObject;class gs extends ii{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new ps(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(vs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(vs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var fs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new gs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Li(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},ms=Phaser.Utils.Array.Remove,ys={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var Ds={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=qe(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},As={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=Wt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=Wt),this.transitOutCallback=t,this}},Ys={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Xs={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Ws={};Object.assign(Ws,Ds,As,Ys,Xs);const zs=Phaser.Utils.Objects.GetValue;class Fs extends ii{constructor(t,e){super(t,e),this.setTransitInTime(zs(e,"duration.in",200)),this.setTransitOutTime(zs(e,"duration.out",200)),this.setTransitInCallback(zs(e,"transitIn")),this.setTransitOutCallback(zs(e,"transitOut")),this.oneShotMode=zs(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Ls(this,{eventEmitter:!1,initState:zs(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Fs.prototype,Ws);var js=function(t){if(t.parentContainer)return js(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?js(e):t};class Is extends ii{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=js(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Bs=Phaser.GameObjects.Rectangle;let Hs=class extends Bs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Is(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}};const Ns=Phaser.Utils.Objects.GetValue;class Gs extends ii{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Ns(t,"hitAreaMode",0)),this.setEnable(Ns(t,"enable",!0)),this.setStopMode(Ns(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Vs[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Vs={default:0,fullWindow:1};const Us=Phaser.Utils.Objects.GetValue;class $s extends Hs{constructor(t,e){super(t,Us(e,"color",0),Us(e,"alpha",.8)),this.touchEventStop=new Gs(this,{hitAreaMode:1})}}var Js={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Mi(t,e)},scaleDown(t,e){Ri(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Hi(t,e)},fadeOut(t,e){Ni(t,e,!1)}},Ks=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Hi(t,e,t.alpha)},qs=function(t,e){Ni(t,e,!1)},Zs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!nt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Qs=Phaser.Utils.Objects.GetValue;let tr=class extends Fs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=er.popUp),null==e.transitOut&&(e.transitOut=er.scaleDown),e.destroy=Qs(e,"destroy",!0),super(t,e);var i=Qs(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new $s(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Qs(i,"transitIn",Ks)),this.setCoverTransitOutCallback(Qs(i,"transitOut",qs)));var s=Qs(e,"touchOutsideClose",!1),r=Qs(e,"duration.hold",-1),n=Qs(e,"timeOutClose",r>=0),h=Qs(e,"anyTouchClose",!1);Qs(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Qs(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Zs(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=er[t]),t){case er.popUp:t=Js.popUp;break;case er.fadeIn:t=Js.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=er[t]),t){case er.scaleDown:t=Js.scaleDown;break;case er.fadeOut:t=Js.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const er={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var ir=function(t){return t&&"function"==typeof t},sr={modal(t,e){return ir(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new tr(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},rr=function(t,e,i,s,r){ir(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},nr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return rr.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return rr.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return rr.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return rr.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return rr.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return rr.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return rr.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return rr.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return rr.call(this,"shutdown",t,e,i,s),this}},hr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=ar),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},ar={},or=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?Zs(t,e.x,e.y,i,s):!!(r=hr(e,n,!0))&&Zs(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const xr={press:0,pointerdown:0,release:1,pointerup:1};var br={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new yr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},Cr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!wr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return Sr.length=0,!0;return Sr.length=0,!1},Sr=[];const Or=Phaser.Utils.Objects.GetValue;class Pr extends ii{constructor(t,e){super(t,e),this._enable=void 0;var i=Or(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Or(t,"enable",!0)),this.setMode(Or(t,"mode",1)),this.setClickInterval(Or(t,"clickInterval",100)),this.setDragThreshold(Or(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Tr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?Cr:or)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Tr={press:0,pointerdown:0,release:1,pointerup:1};var _r={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Pr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class kr extends Rs{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Er=Phaser.Utils.Objects.GetValue;class Mr extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new kr,this.parent.setInteractive(Er(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Er(t,"enable",!0)),this.setCooldown(Er(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Rr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&or(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Mr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Mr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Lr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Dr=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Jr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Kr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Jr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=qr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&or(t,s,e,i)}}const Jr=0,Kr=1,qr="IDLE",Zr=Phaser.Utils.Objects.GetValue,Qr=Phaser.Math.Distance.Between;class tn extends $r{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=en},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Zr(t,"time",250)),this.setTapInterval(Zr(t,"tapInterval",200)),this.setDragThreshold(Zr(t,"threshold",9)),this.setTapOffset(Zr(t,"tapOffset",10));var e=Zr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Zr(t,"maxTaps",void 0)),this.setMinTaps(Zr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case en:this.state=sn;break;case sn:var t=this.lastPointer;Qr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=rn,this.state=sn);break;case rn:this.state=sn}}onDragEnd(){this.state===sn&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=rn))}onDrag(){this.state!==en&&this.pointer.getDistance()>this.dragThreshold&&(this.state=en)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===sn){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=en):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=rn:this.state=en)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===rn&&(this.state=en)}get isTapped(){return this.state===rn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const en="IDLE",sn="BEGIN",rn="RECOGNIZED",nn=Phaser.Utils.Objects.GetValue;class hn extends $r{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=an},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(nn(t,"threshold",9)),this.setHoldTime(nn(t,"time",251)),this}onDragStart(){this.state=on,0===this.holdTime&&(this.state=ln)}onDragEnd(){this.state=an}onDrag(){this.state!==an&&this.pointer.getDistance()>this.dragThreshold&&(this.state=an)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===on&&t-this.pointer.downTime>=this.holdTime&&(this.state=ln)}get isPressed(){return this.state===ln}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const an="IDLE",on="BEGIN",ln="RECOGNIZED";Phaser.Utils.Objects.GetValue;var dn=function(t){return ti(t).loop.delta};const cn=Phaser.Math.Distance.Between,un=Phaser.Math.Angle.Between;var pn={getDt:function(){return dn(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return cn(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return un(e.x,e.y,t.x,t.y)}},vn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},gn={};const fn=Phaser.Utils.Objects.GetValue,mn=Phaser.Math.RadToDeg;class yn extends $r{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=xn},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(fn(t,"threshold",10)),this.setVelocityThreshold(fn(t,"velocityThreshold",1e3)),this.setDirectionMode(fn(t,"dir","8dir")),this}onDragStart(){this.state=bn}onDragEnd(){this.state=xn}onDrag(){this.state===bn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=Cn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Cn&&(this.state=xn)}get isSwiped(){return this.state===Cn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=vn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=gn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(mn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(yn.prototype,pn);const xn="IDLE",bn="BEGIN",Cn="RECOGNIZED",wn=Phaser.Utils.Objects.GetValue,Sn=Phaser.Utils.Array.SpliceOne,On=Phaser.Math.Distance.Between,Pn=Phaser.Math.Angle.Between;class Tn{constructor(t,e){var i=qe(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(wn(e,"inputConfig",void 0)),this.setEventEmitter(wn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(wn(t,"enable",!0)),this.bounds=wn(t,"bounds",void 0),this.tracerState=kn,this.pointers.length=0,ft(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,ft(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case kn:this.tracerState=En,this.onDrag1Start();break;case En:this.tracerState=Mn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],Sn(this.pointers,e),this.tracerState){case En:this.tracerState=kn,this.onDrag1End();break;case Mn:this.tracerState=En,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case En:this.onDrag1();break;case Mn:this.onDrag2()}}}dragCancel(){return this.tracerState===Mn&&this.onDrag2End(),this.pointers.length=0,ft(this.movedState),this.tracerState=kn,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0],e=this.pointers[1];return On(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0],e=this.pointers[1];return Pn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;_n.x=e.x-i.x,_n.y=e.y-i.y}else _n.x=0,_n.y=0;return _n}get centerX(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Mn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Mn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Rn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&or(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&or(t,s,e,i)}}Object.assign(Tn.prototype,$e);var _n={};const kn=0,En=1,Mn=2,Rn="IDLE";Phaser.Utils.Objects.GetValue;const Ln=Phaser.Math.RotateAround;var Dn=function(t,e,i,s){return Ln(t,e,i,s),t.rotation+=s,t},An={};const Yn=Phaser.Utils.Objects.GetValue,Xn=Phaser.Math.Angle.WrapDegrees,Wn=Phaser.Math.Angle.ShortestBetween,zn=Phaser.Math.RadToDeg,Fn=Phaser.Math.DegToRad;var jn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=An),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Xn(zn(this.angleBetween));this.angle=Wn(this.prevAngle,t),this.prevAngle=t,this.state=Hn}break;case Hn:t=Xn(zn(this.angleBetween)),this.angle=Wn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Hn}get rotation(){return Fn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,jn);const In="IDLE",Bn="BEGIN",Hn="RECOGNIZED",Nn=Phaser.Utils.Objects.GetValue;var Gn=function(t){var e=Nn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new tn(this,e),this._tap.on("tap",(function(t,e,s){Ar(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Ar(i.eventEmitter,`${i.eventNamePrefix}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Vn=Phaser.Utils.Objects.GetValue;var Un=function(t){var e=Vn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new hn(this,e),this._press.on("pressstart",(function(t,e,s){Ar(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this).on("pressend",(function(t,e,s){Ar(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const $n=Phaser.Utils.Objects.GetValue;var Jn=function(t){var e=$n(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new yn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Ar(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Ar(i.eventEmitter,`${i.eventNamePrefix}swipe`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Kn=Phaser.Utils.Objects.GetValue;var qn=function(t,e){return t.setInteractive(),Kn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Kn(e,"targets",[t]),targetMode:Kn(e,"targetMode","parent"),eventEmitter:Kn(e,"eventEmitter",t),eventNamePrefix:Kn(e,"inputEventPrefix","child.")},Xr.call(t,e),Fr.call(t,e),Br.call(t,e),Vr.call(t,e),Gn.call(t,e),Un.call(t,e),Jn.call(t,e),t},Zn={getSizerConfig:function(t){return void 0===t&&(t=this),Mt(t)},getChildPrevState:function(t){var e=Mt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Dt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=oe(e,"color"),s=oe(e,"lineWidth");var o=oe(e,"name",!1);o&&(r=oe(o,"createTextCallback",ce),n=oe(o,"createTextCallbackScope",void 0),"string"==typeof(h=oe(o,"align","left-top"))&&(h=Xt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new le(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}var d,c,u=this.getAllShownChildren([this]);ue(u,u);for(var p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const ah=Phaser.Utils.Objects.IsPlainObject,oh=Phaser.Utils.Objects.GetValue,lh=Phaser.Display.Align.CENTER,dh={min:0,full:-1};var ch=function(t,e,i,s,r,n,h,a,o,l){var d,c,u,p;me.call(this,t);var v=t.isRexSpace,g=typeof e;if(null===e)return this;if("number"===g);else if("string"===g)e=dh[e];else if(ah(e)){var f;e=oh(f=e,"proportion",void 0),i=oh(f,"align",lh),s=oh(f,"padding",0),r=oh(f,"expand",!1),n=oh(f,"key",void 0),h=oh(f,"index",void 0),t.isRexSizer||(a=oh(f,"minWidth",void 0),o=oh(f,"minHeight",void 0)),l=oh(f,"fitRatio",0),d=oh(f,"offsetX",0),c=oh(f,"offsetY",0),u=oh(f,"offsetOriginX",0),p=oh(f,"offsetOriginY",0)}return"string"==typeof i&&(i=Xt[i]),void 0===e&&(e=v?1:0),void 0===i&&(i=lh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(v?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(v?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),(f=this.getSizerConfig(t)).proportion=e,f.align=i,f.padding=ge(s),f.expand=r,f.fitRatio=0===e?l:0,f.alignOffsetX=d,f.alignOffsetY=c,f.alignOffsetOriginX=u,f.alignOffsetOriginY=p,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},uh={add:ch,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),ch.call(this,new nh(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return ah(i)&&(i.index=t),ch.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=hh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const ph=Et.prototype.clear;var vh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),ph.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,vh.call(this,t),this}},mh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=Xt[e]),this.getSizerConfig(t).align=e,this}},yh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},xh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},bh={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},Ch={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Ne(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Ie.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d,c,u=this.sizerChildren,p=this.innerLeft,v=this.innerTop,g=this.innerWidth,f=this.innerHeight,m=p,y=v,x=this.startChildIndex,b=0,C=u.length;b0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=We.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Ye.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&sh.call(this,t,void 0),Xe.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||ze.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&sh.call(this,void 0,t),Fe.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(Ch,uh,fh,mh,yh,xh,bh);var wh=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},Sh={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const Oh=Phaser.Utils.Objects.IsPlainObject,Ph=Phaser.Utils.Objects.GetValue;class Th extends th{constructor(t,e,i,s,r,n,h){Oh(e)?(e=Ph(h=e,"x",0),i=Ph(h,"y",0),s=Ph(h,"width",void 0),r=Ph(h,"height",void 0),n=Ph(h,"orientation",0)):Oh(s)?(s=Ph(h=s,"width",void 0),r=Ph(h,"height",void 0),n=Ph(h,"orientation",0)):Oh(n)&&(n=Ph(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Ph(h,"space.item",0)),this.setStartChildIndex(Ph(h,"startChildIndex",0)),this.setRTL(Ph(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=Sh[t]),t}(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=wh.call(this)),this._childrenProportion}}Object.assign(Th.prototype,Ch);var _h=function(t,e,i){if(t){var s=null==e,r=null==i;return s&&r||(s||(t.displayWidth=e),r||(t.displayHeight=i),s&&(t.scaleX=t.scaleY),r&&(t.scaleY=t.scaleX)),t}},kh=function(t,e){var i;return t||0===t||(t=""),void 0===e&&(e=!0),Array.isArray(t)&&(t=t.join("\n")),(i=e?`${this.text}\n${t}`:`${this.text}${t}`)!=this.text&&this.setText(i),this},Eh={appendText:kh,resetDisplayContent:function(t){void 0===t?t={}:"string"==typeof t&&(t={text:t});var e=t.text||"";this.setText(e);var i=this.childrenMap.icon;if(i){t.icon?this.show(i):this.hide(i);var s=t.iconSize;s&&(this.setChildDisplaySize(i,s,s),void 0!==this.iconWidth&&this.setIconSize(s)),!0!==t.icon&&this.setIconTexture(t.icon,t.iconFrame)}var r=this.childrenMap.action;if(r){t.action?this.show(r):this.hide(r);var n=t.actionSize;n&&(this.setChildDisplaySize(r,n,n),void 0!==this.actionWidth&&this.setActionSize(n)),!0!==t.action&&this.setActionTexture(t.action,t.actionFrame)}return this}};class Mh extends Th{get text(){var t=this.childrenMap.text;return t?t.text:""}set text(t){var e=this.childrenMap.text;e&&e.setText(t)}setText(t){return this.text=t,this}setIconTexture(t,e){var i=this.childrenMap.icon;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.iconWidth&&void 0!==this.iconHeight&&(_h(i,this.iconWidth,this.iconHeight),this.resetChildScaleState(i)),this):this}setTexture(t,e){return this.setIconTexture(t,e),this}setIconSize(t,e){return void 0===e&&(e=t),this.iconWidth=t,this.iconHeight=e,this}get texture(){var t=this.childrenMap.icon;if(t)return t.texture}get frame(){var t=this.childrenMap.icon;if(t)return t.frame}setActionTexture(t,e){var i=this.childrenMap.action;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.actionWidth&&void 0!==this.actionHeight&&(_h(i,this.actionWidth,this.actionHeight),this.resetChildScaleState(i)),this):this}get actionTexture(){var t=this.childrenMap.action;if(t)return t.texture}get actionFrame(){var t=this.childrenMap.action;if(t)return t.frame}setActionSize(t,e){return void 0===e&&(e=t),this.actionWidth=t,this.actionHeight=e,this}preLayout(){var t=this.childrenMap.icon;t&&void 0!==this.iconWidth&&void 0!==this.iconHeight&&_h(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&_h(e,this.actionWidth,this.actionHeight),super.preLayout()}postLayout(t,e,i){var s=this.childrenMap.iconMask;s&&(s.setPosition(),this.resetChildPositionState(s));var r=this.childrenMap.actionMask;return r&&(r.setPosition(),this.resetChildPositionState(r)),super.postLayout(t,e,i),this}resize(t,e){super.resize(t,e);var i=this.childrenMap.iconMask;i&&i.resize();var s=this.childrenMap.actionMask;return s&&s.resize(),this}}Object.assign(Mh.prototype,Eh);const Rh=Phaser.GameObjects.Graphics.prototype.setPosition,Lh=Phaser.Geom.Rectangle,Dh=Phaser.Geom.Circle;var Ah=function(t,e,i,s,r){this.geom=function(t,e,i,s,r,n,h){if(1===t){s=s.left;var a=-e*(r-.5),o=-i*(n-.5),l=Math.min(e,i)/2+s;void 0!==h&&h instanceof Dh||(h=new Dh),h.setTo(a,o,l)}else{var d=-e*r-s.left,c=-i*n-s.top,u=e+s.left+s.right,p=i+s.top+s.bottom;void 0!==h&&h instanceof Lh||(h=new Lh),h.setTo(d,c,u,p)}return h}(this.shapeType,t,e,i,s,r,this.geom),this.clear().fillStyle(16777215),1===this.shapeType?this.fillCircleShape(this.geom):this.fillRectShape(this.geom)},Yh=function(t,e){for(var i in t){if(!(i in e))return!1;if(t[i]!==e[i])return!1}for(var i in e)if(!(i in t))return!1;return!0},Xh={setPosition:function(t,e){var i=this.parent;return void 0===t&&(t=i.x),void 0===e&&(e=i.y),Rh.call(this,t,e),this},resize:function(t,e,i){var s=this.parent;void 0===t&&(t=s.width),void 0===e&&(e=s.height),void 0===i?i=this.padding:"number"==typeof i&&(i=GetBoundsConfig(i));var r=this.width!==t||this.height!==e,n=this.padding!==i&&!Yh(this.padding,i);return r||n?(this.width=t,this.height=e,n&&mt(i,this.padding),this.originX=s.originX,this.originY=s.originY,Ah.call(this,t,e,i,s.originX,s.originY),this):this},setOrigin:function(t,e){void 0===e&&(e=t);var i=this.parent;return void 0===t&&(t=i.originX),void 0===e&&(e=i.originY),this.originX===t&&this.originY===e||(this.originX=t,this.originY=e,Ah.call(this,this.width,this.height,this.padding,t,e)),this},contains:function(t,e){return t-=this.x,e-=this.y,this.geom.contains(t,e)}};const Wh=Phaser.GameObjects.Graphics;class zh extends Wh{constructor(t,e,i){void 0===e&&(e=0),"string"==typeof e&&(e=Fh[e]),super(t.scene),this.parent=t,this.shapeType=e,this.padding=ge(i),this.setPosition().resize().setVisible(!1)}destroy(){return this.parent=void 0,super.destroy(),this}}const Fh={rectangle:0,circle:1};Object.assign(zh.prototype,Xh);var jh=function(t,e,i,s){var r=new zh(e,i,s);if(t&&!t.isRexSizer){var n=r.createGeometryMask();t.setMask(n),this.once("destroy",(function(){t.setMask(),n.destroy()}))}return this.pin(r),r};const Ih=Phaser.GameObjects.Text;var Bh=function(t){return t instanceof Ih};const Hh=Phaser.GameObjects.BitmapText;var Nh=function(t){return t instanceof Hh},Gh=function(t){return Nh(t)?2:Bh(t)?0:1},Vh=/^[\x00-\x7F]+$/,Uh=function(t){return Vh.test(t)},$h=function(t,e){for(var i=[],s=t.split("\n"),r=e.style,n=r.wordWrapWidth,h=r.hasOwnProperty("wrapMode")?r.wrapMode:3,a=e.context,o=0,l=s.length;o0&&r.push(o.join("")),r},Kh=0,qh=1,Zh=2,Qh=0,ta=1,ea=2,ia=/(?:\r\n|\r|\n)/;const sa={none:Qh,word:ta,char:ea,character:ea,mix:3},ra=Phaser.Renderer.WebGL.Utils;var na={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,h=r.height,a=ra.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,h,e.x,e.y,n/e.resolution,h/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,h,a(e.tintTopLeft,i.alpha*e._alphaTL),a(e.tintTopRight,i.alpha*e._alphaTR),a(e.tintBottomLeft,i.alpha*e._alphaBL),a(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const ha=Phaser.Display.Color;var aa={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,h,a,o,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===h&&(h=0),void 0===a&&(a=0),void 0===o&&(o=c),void 0===l&&(l=u);var p=d.cutX+h,v=d.cutY+a;return this.context.drawImage(d.source.image,p,v,o,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new ha);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var h=i;i=h.red,s=h.green,r=h.blue,n=h.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var a=this.context.createImageData(1,1);return a.data[0]=i,a.data[1]=s,a.data[2]=r,a.data[3]=n,this.context.putImageData(a,t,e),this.dirty=!0,this}},oa=function(t,e,i,s,r,n,h){var a,o=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===h&&(h=e.height);var d=(a=o.exists(i)?o.get(i):o.createCanvas(i,n,h)).getSourceImage();d.width!==n&&(d.width=n),d.height!==h&&(d.height=h);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,h),c.drawImage(e,s,r,n,h),l.gl&&a&&l.canvasToTexture(d,a.source[0].glTexture,!0,0)},la={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,oa(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};e();const da=Phaser.Display.Canvas.CanvasPool,ca=Phaser.GameObjects.GameObject,ua=Phaser.Utils.String.UUID;class pa extends ca{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=da.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=ua(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){da.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}}const va=Phaser.GameObjects.Components;Phaser.Class.mixin(pa,[va.Alpha,va.BlendMode,va.Crop,va.Depth,va.Flip,va.GetBounds,va.Mask,va.Origin,va.Pipeline,va.PostPipeline,va.ScrollFactor,va.Tint,va.Transform,va.Visible,na,aa,la]);var ga={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:Ts(this.data,t,e)},incData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)+e),this},mulData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)*e),this},clearData(){return this.data&&ft(this.data),this}};class fa{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}}Object.assign(fa.prototype,ga);var ma={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const ya=Phaser.Math.RotateAround;var xa;const ba=Phaser.Geom.Rectangle;var Ca,wa=function(t){void 0===Ca&&(Ca=new ba);var e=t.drawTLX,i=t.drawTLY;return Ca.setTo(e,i,t.drawTRX-e,t.drawBLY-i),Ca};const Sa=Phaser.Math.RotateAround;var Oa,Pa=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Oa&&(Oa={}),s=Oa),s.x=e,s.y=i,0!==t.rotation&&Sa(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const Ta=Phaser.GameObjects.Components.TransformMatrix;var _a,ka,Ea={},Ma=function(t,e,i,s,r){var n=Pa(e,i,s,!0),h=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=Ea);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===_a&&(_a=new Ta,ka=new Ta),t.parentContainer?t.getWorldTransformMatrix(_a,ka):_a.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),_a.transformPoint(r,n,s),s}(t,n.x,n.y,r);return h},Ra=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,h=e.drawCenterY+s;return Ma(t,e,n,h,r)},La={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===xa&&(xa={}),s=xa),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&ya(s,0,0,-i.rotation),s}(t,e,this,!0);return wa(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return Ra(this.parent,this,t,e,i)}};Object.assign(La,ma);const Da=Phaser.Math.DegToRad,Aa=Phaser.Math.RadToDeg,Ya=Phaser.Utils.Objects.GetValue;class Xa extends fa{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return Aa(this._rotation)}set angle(t){this.rotation=Da(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=Ya(t,"width",void 0),i=Ya(t,"height",void 0),s=Ya(t,"scaleX",void 0),r=Ya(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(Xa.prototype,La);const Wa=Phaser.Utils.String.Pad;var za=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${Wa(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},Fa=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const ja=Phaser.Utils.Objects.GetValue;let Ia=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=ja(t,"x",0),i=ja(t,"y",0));var s=this.cornerRadius;s.tl=Ba(ja(t,"tl",void 0),e,i),s.tr=Ba(ja(t,"tr",void 0),e,i),s.bl=Ba(ja(t,"bl",void 0),e,i),s.br=Ba(ja(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Ha(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Ha(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Ha(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Ha(this.cornerRadius.br,t)}};var Ba=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Na(t),t},Ha=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=ja(e,"x",0),t.y=ja(e,"y",0)),Na(t)},Na=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const Ga=Phaser.Math.DegToRad;var Va=function(t){return!t.hasOwnProperty("convex")||t.convex},Ua=function(t){return t.x>0&&t.y>0},$a=function(t,e,i,s,r,n,h,a,o){if(a&&h>n?h-=360:!a&&h=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=m.tl,Ua(a)?(o=a.x*g,l=a.y*f,Va(a)?$a(t,o,l,o,l,180,270,!1,h):$a(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,Ua(a)?(o=a.x*g,l=a.y*f,Va(a)?$a(t,s-o,l,o,l,270,360,!1,h):$a(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,Ua(a)?(o=a.x*g,l=a.y*f,Va(a)?$a(t,s-o,r-l,o,l,0,90,!1,h):$a(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,Ua(a)?(o=a.x*g,l=a.y*f,Va(a)?$a(t,o,r-l,o,l,90,180,!1,h):$a(t,0,r,o,l,360,270,!0,h)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,h,u),null!=a)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,a),p.addColorStop(1,d),a=p),e.fillStyle=a,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())},Ka=function(t,e,i,s,r,n,h,a){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),Ja(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}};const qa=Phaser.Utils.Objects.GetValue;class Za extends Xa{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(qa(e,"color",null),qa(e,"color2",null),qa(e,"horizontalGradient",!0)),this.setStroke(qa(e,"stroke",null),qa(e,"strokeThickness",2)),this.setCornerRadius(qa(e,"cornerRadius",0),qa(e,"cornerIteration",null))}set color(t){t=za(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=za(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=za(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,Fa("color2",t,this),Fa("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Fa("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Fa("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){Ka(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Qa=Phaser.Utils.Objects.GetValue;class to extends Xa{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(Qa(e,"color",null),Qa(e,"color2",null),Qa(e,"horizontalGradient",!0)),this.setStroke(Qa(e,"stroke",null),Qa(e,"strokeThickness",2))}set color(t){t=za(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=za(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=za(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,Qa(t,"color2",null),Qa(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Qa(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,h=this.parent.height-i.top-i.bottom,a=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?a.createLinearGradient(0,0,n,0):a.createLinearGradient(0,0,0,h)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,a.fillStyle=t,a.fillRect(s,r,n,h));null!=this.stroke&&this.strokeThickness>0&&(a.strokeStyle=this.stroke,a.lineWidth=this.strokeThickness,a.strokeRect(s,r,n,h))}}const eo=Phaser.Utils.Objects.GetValue;let io=class t{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(eo(t,"bold",!1)),this.setItalic(eo(t,"italic",!1)),this.setFontSize(eo(t,"fontSize","16px")),this.setFontFamily(eo(t,"fontFamily","Courier")),this.setColor(eo(t,"color","#fff")),this.setStrokeStyle(eo(t,"stroke",null),eo(t,"strokeThickness",0)),this.setShadow(eo(t,"shadowColor",null),eo(t,"shadowOffsetX",0),eo(t,"shadowOffsetY",0),eo(t,"shadowBlur",0)),this.setOffset(eo(t,"offsetX",0),eo(t,"offsetY",0)),this.setSpace(eo(t,"leftSpace",0),eo(t,"rightSpace",0)),this.setAlign(eo(t,"align",void 0)),this.setBackgroundColor(eo(t,"backgroundColor",null)),this.setBackgroundHeight(eo(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(eo(t,"backgroundBottomY",void 0)),this.setBackgroundLeftX(eo(t,"backgroundLeftX",0)),this.setBackgroundRightX(eo(t,"backgroundRightX",0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(Fa("stroke",t,this),Fa("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Fa("shadowOffsetX",t,this),Fa("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),t.hasOwnProperty("backgroundLeftX")&&this.setBackgroundLeftX(t.backgroundLeftX),t.hasOwnProperty("backgroundRightX")&&this.setBackgroundRightX(t.backgroundRightX),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new t(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=za(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=za(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=za(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=za(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setBackgroundLeftX(t){return this.backgroundLeftX=t,this}setBackgroundRightX(t){return this.backgroundRightX=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}};const so=Phaser.Utils.Array.Remove,ro=Phaser.Utils.Array.Remove,no="text",ho="image",ao="drawer",oo="space",lo="command";var co=function(t){return t.type===no&&"\n"===t.text},uo=function(t){return t.type===no&&"\f"===t.text},po=function(t){return t.type===no};class vo extends Xa{constructor(t,e,i){super(t,no),this.updateTextFlag=!1,this.style=new io(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX+e.backgroundLeftX,s=i,r=this.drawTRX+e.backgroundRightX-i+1;if(r>0){var n=e.backgroundBottomY;null==n&&(n=this.drawBLY);var h=e.backgroundHeight;null==h&&(h=n-this.drawTLY);var a=n-h;t.fillRect(s,a,r,h)}}var o=e.hasFill,l=e.hasStroke;(o||l)&&(e.syncFont(t).syncStyle(t),l&&(e.syncShadow(t),t.strokeText(this.text,0,0)),o&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var go=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const fo=Phaser.Display.Canvas.CanvasPool;var mo=function(t,e,i,s,r,n,h,a){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===a&&(a=!1),a&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(h){var l=fo.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=h,d.fillRect(0,0,r,n),o.drawImage(l,0,0,r,n,i,s,r,n),fo.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)};Phaser.Display.Canvas.CanvasPool;class yo extends Xa{constructor(t,e,i){super(t,ho),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){mo(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class xo extends Xa{constructor(t,e,i,s){super(t,ao),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class bo extends Xa{constructor(t,e){super(t,oo),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class Co extends fa{constructor(t,e,i,s,r){super(t,lo),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}function wo(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>wo(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=wo(t[i]));return e}var So=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const Oo={none:0,word:1,char:2,character:2,mix:3};var Po=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,h=!r&&!n,a=t.length,o=e,l=s.word,d=0,c=!1;o0&&!a){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=Eo.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=Eo.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=Ro(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=Ro(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=Ro(t,"wrapMode");void 0===c&&(c=Ro(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=Oo[c]);var u=Ro(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=Ro(t,"letterSpacing",0),v=Ro(t,"hAlign",0),g=Ro(t,"vAlign",0),f=Ro(t,"justifyPercentage",.25),m=So({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:h,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,x=0,b=y.length;x0&&(E.push({children:M,width:R}),L=Math.max(L,R)),m.start+=k.length,m.isLastPage=!D&&m.start===_,m.maxLineWidth=L,m.linesHeight=E.length*n;var j=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,I=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,h=t.vAlign,a=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(h=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=Ao(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=Ao(t,"maxLines",0);var a=0===i,o=Ao(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=Ao(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=Ao(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=Ao(t,"letterSpacing",0),p=Ao(t,"rtl",!0),v=Ao(t,"hAlign",p?2:0),g=Ao(t,"vAlign",0),f=So({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:o,wrapHeight:c,rtl:p}),m=this.children,y=0,x=m.length;y0&&(k.push({children:E,height:M}),R=Math.max(R,M)),f.start+=_.length,f.isLastPage=f.start===T,f.maxLineHeight=R,f.linesWidth=k.length*n;var W=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,z=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,h=t.vAlign,a=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}a&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,h=i.bottom;return Le(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return Re(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),so(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return ro(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(no);return null===i?i=new vo(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),Ra(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const nl=Phaser.Utils.Objects.GetFastValue;var hl={};class al{constructor(t){this.pools=nl(t,"pools",hl)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new rl),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;ei&&(r=Math.floor(i));for(var n={},h=gl(t,r,e,i,n),a=0;a<=ul&&0!==h;a++){if((r+=h)<0){r=0;break}h=gl(t,r,e,i,n)}return a===ul&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),fl(t,e,i),t},vl=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},gl=function(t,e,i,s,r){var n,h=vl(t,e,r),a=vl(t,e+1,r);if(void 0!==s)if(h.height<=s&&a.height>s)n=0;else{if(h.height>s)return-1;n=Math.floor(s-h.height)}if(h.width<=i&&a.width>i)return 0;if(h.width>i)return-1;var o=Math.floor(i-h.width);return void 0===n?o:Math.min(o,n)},fl=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const ml=Phaser.Utils.Objects.GetValue,yl=Phaser.Utils.Objects.GetValue;class xl extends Mh{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=yl(e,"background",void 0),r=yl(e,"icon",void 0),n=yl(e,"iconMask",void 0),h=yl(e,"text",void 0),a=yl(e,"action",void 0),o=yl(e,"actionMask",void 0),l=yl(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(h||a)&&(i={right:yl(e,"space.icon",0),top:yl(e,"space.iconTop",0),bottom:yl(e,"space.iconBottom",0),left:yl(e,"space.iconLeft",0)}):(h||a)&&(i={bottom:yl(e,"space.icon",0),left:yl(e,"space.iconLeft",0),right:yl(e,"space.iconRight",0),top:yl(e,"space.iconTop",0)});var d=yl(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=jh.call(this,r,r,1)),!d){var c=yl(e,"iconSize",void 0);this.setIconSize(yl(e,"iconWidth",c),yl(e,"iconHeight",c))}}if(h){var u=yl(e,"wrapText",!1),p=yl(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),function(t,e){switch(Gh(t)){case 0:switch("string"==typeof e&&(e=sa[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=$h;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=sa[e]||0),t.style.wrapMode=e}}(h,u),e.expandTextWidth=!0,cl(h)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=ml(e,"minWidth",0),s=ml(e,"minHeight",0),r=ml(e,"fitHeight",!1);t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return pl(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),pl(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t})}(h,{fitHeight:!0}));var v,g,f=yl(e,"space.text",0),m=yl(e,"expandTextWidth",!1),y=yl(e,"expandTextHeight",!1);0===this.orientation?(v=m?1:0,a&&(i={right:f}),g=y):(v=y?1:0,a&&(i={bottom:f}),g=m),this.add(h,{proportion:v,expand:g,padding:i})}if(a&&(i=0===this.orientation?{top:yl(e,"space.actionTop",0),bottom:yl(e,"space.actionBottom",0),right:yl(e,"space.actionRight",0)}:{left:yl(e,"space.actionLeft",0),right:yl(e,"space.actionRight",0),bottom:yl(e,"space.actionBottom",0)},d=yl(e,"squareFitAction",!1)?1:0,this.add(a,{proportion:0,padding:i,fitRatio:d}),o&&(o=jh.call(this,a,a,1)),!d)){var x=yl(e,"actionSize");this.setActionSize(yl(e,"actionWidth",x),yl(e,"actionHeight",x))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",h),this.addChildrenMap("action",a),this.addChildrenMap("actionMask",o)}}var bl=Phaser.Renderer.WebGL.Utils,Cl=function(t,e,i,s,r,n){for(var h=bl.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),a=i.pathData,o=i.pathIndexes,l=0;l>>16,a=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+h+","+a+","+o+","+n+")"},Tl=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,h=(16711680&r)>>>16,a=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+h+","+a+","+o+","+n+")",t.lineWidth=e.lineWidth};const _l=Phaser.Renderer.Canvas.SetTransform;var kl={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Ol(e,i,s),h=r.calcMatrix.copyFrom(n.calc),a=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&Cl(r,h,e,l,a,o),e.isStroked&&Sl(r,e,l,a,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(_l(t,r,e,i,s)){var n=e._displayOriginX,h=e._displayOriginY,a=e.pathData,o=a.length-1,l=a[0]-n,d=a[1]-h;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(Ml.prototype,kl);var Rl=function(t){return t.x>0&&t.y>0},Ll=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const Dl=Phaser.Math.DegToRad;var Al=function(t,e,i,s,r,n,h,a,o){h&&n>r?n-=360:!h&&n0,h=0,a=e.length;h=0?t.startAt(h+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(h+n,i):t.startAt(h,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(h,i),t.close(),t};const Ad=Phaser.Utils.Objects.GetValue,Yd=Phaser.Utils.Objects.IsPlainObject;class Xd extends(od(td)){constructor(t,e,i,s,r,n,h,a){Yd(e)?(e=(a=e).x,i=a.y,s=a.width,r=a.height,n=a.barColor,h=a.value):Yd(s)?(s=(a=s).width,r=a.height,n=a.barColor,h=a.value):Yd(n)&&(n=(a=n).barColor,h=a.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===h&&(h=0),super(t,e,i,s,r,a),this.type="rexLineProgress",this.bootProgressBase(a),this.addShape((new Ld).setName("trackFill")).addShape((new Ld).setName("bar")).addShape((new Ld).setName("trackStroke")),this.setTrackColor(Ad(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(Ad(a,"trackStrokeThickness",2),Ad(a,"trackStrokeColor",void 0)),this.setSkewX(Ad(a,"skewX",0)),this.setRTL(Ad(a,"rtl",!1)),this.setValue(h)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var Wd={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&Dd(s,0,0,e,i,t);var r,n,h=this.getShape("bar");h.fillStyle(this.barColor),h.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),Dd(h,r,0,n,i,t));var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&Dd(a,0,0,e,i,t)}};Object.assign(Xd.prototype,Wd);var zd=function(t){return null==t||""===t||0===t.length},Fd=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(zd(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(zd(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,h=e.length;n=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=wo(i),s=wo(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),h=n.width,a=0,o=0,l=i.length;o0?h/a:0,c=n.height,u=0;for(o=0,l=s.length;o0?0:g,x=0,o=0;for(var S=i.length;o0?0:f),f>=1&&g>=1){var O=typeof(m=this.getFrameNameCallback(o,C,e));"string"!==O&&"number"!==O||r.add(m,0,x+n.cutX,b+n.cutY,f,g)}x+=f}b+=g}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,h,a,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/o,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(u,p);if(u>v){var g=(u-v)*o;d>=0?d+=g:d=g,u=v}if(p>v){var f=(p-v)*l;c>=0?c+=f:c=f,p=v}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var x=0,b=this.rows.count;x0&&a>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(C,x)?0:1)?this._drawImage(this.textureKey,s,m,y,h,a):this._drawTileSprite(this.textureKey,s,m,y,h,a)),m+=h;y+=a}this._endDraw()},setStretchMode:function(t){return sc(t)?(this.stretchMode.edge=nc(rc(t,"edge",0)),this.stretchMode.internal=nc(rc(t,"internal",0))):(t=nc(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return ac.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const lc=Phaser.Utils.Objects.IsPlainObject,dc=Phaser.Utils.Objects.GetValue,cc=Phaser.GameObjects;var uc=void 0,pc=function(t,e){if(uc||(uc={},ti(t).events.once("destroy",(function(){for(var t in uc)uc[t].destroy();uc=void 0}))),!uc.hasOwnProperty(e)){var i=ti(t).scene.systemScene;(t=new cc[e](i)).setOrigin(0),uc[e]=t}return uc[e]};const vc=Phaser.GameObjects.RenderTexture;class gc extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if(lc(i)?(i=dc(d=i,"x",0),s=dc(d,"y",0),r=dc(d,"width",1),n=dc(d,"height",1),h=dc(d,"key",void 0),a=dc(d,"baseFrame",void 0),o=dc(d,"columns",void 0),l=dc(d,"rows",void 0)):lc(r)?(r=dc(d=r,"width",1),n=dc(d,"height",1),h=dc(d,"key",void 0),a=dc(d,"baseFrame",void 0),o=dc(d,"columns",void 0),l=dc(d,"rows",void 0)):lc(h)?(h=dc(d=h,"key",void 0),a=dc(d,"baseFrame",void 0),o=dc(d,"columns",void 0),l=dc(d,"rows",void 0)):lc(a)?(a=dc(d=a,"baseFrame",void 0),o=dc(d,"columns",void 0),l=dc(d,"rows",void 0)):Array.isArray(a)?(d=l,l=o,o=a,a=dc(d,"baseFrame",void 0)):lc(o)&&(o=dc(d=o,"columns",void 0),l=dc(d,"rows",void 0)),void 0===a&&(a=dc(d,"frame",void 0)),void 0===o){var c=dc(d,"leftWidth",void 0),u=dc(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=dc(d,"topHeight",void 0),v=dc(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(dc(d,"getFrameNameCallback",void 0)),this.setStretchMode(dc(d,"stretchMode",0)),this.setPreserveRatio(dc(d,"preserveRatio",!0));var g=dc(d,"maxFixedPartScale",1),f=dc(d,"maxFixedPartScaleX",g),m=dc(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(h,a,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,oc),i}(vc,"rexNinePatch")){}var fc={_drawImage:function(t,e,i,s,r,n){var h=pc(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=pc(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(gc.prototype,fc);let mc=class extends ii{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Bd(t,e))return t[e];var i=t.parent;return Bd(i,e)?i[e]:void 0}set(t,e,i){return Bd(t,e)?t[e]=i:Bd(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}};const yc=Phaser.Utils.Objects.GetValue;class xc extends gc{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=yc(e,"effects",!0);i&&Ud(this,i),this.style=new mc(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(xc.prototype,Vl);const bc=["alpha","tint","flipX","flipY"];var Cc=function(t,e){if(!e)return t;for(var i=0,s=bc.length;i=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const T=Phaser.Math.DegToRad;var _={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=T(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},k={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=O(t.scaleX,i.scaleX),e.scaleY=O(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},E={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=O(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},L={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},D={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},A={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(t){void 0===t&&(t=!1);var e=this;return this._mask=null,this.setChildMaskVisible(this),this.children.forEach((function(t){t.clearMask&&t.clearMask(!1),t.hasOwnProperty("isRexContainerLite")||e.setChildMaskVisible(t)})),t&&this.mask&&this.mask.destroy(),this}},Y=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},z=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const j=Phaser.Utils.Array;var I={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},ke=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const Ee=/(\S+)\[(\d+)\]/i,Me=Phaser.Utils.Objects.GetValue;var Re=function(t,e){return void 0===e?t:t[e]},Le=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Me(e,"left",0),t.right=Me(e,"right",0),t.top=Me(e,"top",0),t.bottom=Me(e,"bottom",0)),t},De={getInnerPadding(t){return Re(this.space,t)},setInnerPadding(t,e){return Le(this.space,t,e),this},getOuterPadding(t){return Re(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Le(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Re(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Le(this.getSizerConfig(t).padding,e,i),this}},Ae=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Ye=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Xe=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},We=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},ze=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},Fe=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},je={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Ie=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?mi:fi,this.repeatCounter=0,this}stop(){return this.state=gi,this}update(t,e){this.state!==gi&&this.state!==xi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=yi)):(this.nowTime=this.duration,this.state=xi):this.nowTime>=0&&(this.state=mi))}get t(){var t;switch(this.state){case gi:case fi:case yi:t=0;break;case mi:t=this.nowTime/this.duration;break;case xi:t=1}return pi(t,0,1)}set t(t){(t=pi(t,-1,1))<0?(this.state=fi,this.nowTime=-this.delay*t):(this.state=mi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===gi}get isDelay(){return this.state===fi}get isCountDown(){return this.state===mi}get isRunning(){return this.state===fi||this.state===mi}get isDone(){return this.state===xi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const gi=0,fi=1,mi=2,yi=3,xi=-1;class bi extends di{constructor(t,e){super(t,e),this.timer=new vi}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const Ci=Phaser.Utils.Objects.GetValue,wi=Phaser.Utils.Objects.GetAdvancedValue,Si=Phaser.Tweens.Builders.GetEaseFunction;class Oi extends bi{resetFromJSON(t){return this.timer.resetFromJSON(Ci(t,"timer")),this.setEnable(Ci(t,"enable",!0)),this.setTarget(Ci(t,"target",this.parent)),this.setDelay(wi(t,"delay",0)),this.setDuration(wi(t,"duration",1e3)),this.setEase(Ci(t,"ease","Linear")),this.setRepeat(Ci(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Si(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Pi=Phaser.Utils.Objects.GetValue,Ti=Phaser.Utils.Objects.GetAdvancedValue,_i=Phaser.Math.Linear;let ki=class extends Oi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Pi(t,"mode",0)),this.setScaleRange(Ti(t,"start",void 0),Ti(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ei[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Ti(t,"x",this.parent.scaleX),this.startY=Ti(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Ti(e,"x",void 0),this.endY=Ti(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=_i(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=_i(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const Ei={stop:0,destroy:1,yoyo:2};var Mi=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new ki(t,a):r.resetFromJSON(a),r.restart(),r},Ri=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof ki&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new ki(t,h):n.resetFromJSON(h),n.restart(),n},Li=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Di=function(t){return Li(t,"complete")};const Ai=Phaser.Utils.Objects.IsPlainObject;var Yi={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Ai(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Mi(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Di(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Ai(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Ri(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Di(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Di(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Ai(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new ki(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Di(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Xi={};Object.assign(Xi,Yi),Xi.onInitScale=function(){Yi.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=be.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Wi=Phaser.Utils.Objects.GetValue,zi=Phaser.Utils.Objects.GetAdvancedValue,Fi=Phaser.Math.Linear;class ji extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Wi(t,"mode",0)),this.setAlphaRange(zi(t,"start",this.parent.alpha),zi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ii[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Fi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ii={stop:0,destroy:1,yoyo:2},Bi=Phaser.Utils.Objects.IsPlainObject;var Hi=function(t,e,i,s){var r,n;Bi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new ji(t,h):s.resetFromJSON(h),s.restart(),s},Ni=function(t,e,i,s){i instanceof ji&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new ji(t,r):s.resetFromJSON(r),s.restart(),s};const Gi=Phaser.Utils.Objects.IsPlainObject;var Vi={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Gi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Hi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Di(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Gi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Ni(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Di(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Di(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Ui={};Object.assign(Ui,Vi),Ui.onInitFade=function(){Vi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=be.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const $i=Phaser.Utils.Objects.GetValue,Ji=Phaser.Utils.Objects.GetAdvancedValue,Ki=Phaser.Math.Linear;class qi extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode($i(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ji(t,"x",void 0),i=Ji(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Zi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Ji(i,"startX",void 0),this.startY=Ji(i,"startY",void 0),this.endX=Ji(i,"endX",void 0),this.endY=Ji(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Ki(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ki(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Zi={stop:0,destroy:1,yoyo:2};var Qi=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const ts=Phaser.Utils.Objects.IsPlainObject,es=Phaser.Math.Distance.Between;var is={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(ts(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*es(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof qi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=Qi(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=Qi(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new qi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Di(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Di(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(ts(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*es(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof qi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=Qi(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=Qi(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new qi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Di(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Di(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},ss={};Object.assign(ss,is),ss.onInitEaseMove=function(){is.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=be.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const rs=Phaser.Utils.Objects.GetValue;class ns extends ai{constructor(t,e){super(t,e),this.timer=new vi,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(rs(t,"timer")),this.setEnable(rs(t,"enable",!0)),this.setMode(rs(t,"mode",1)),this.isRunning=rs(t,"isRunning",!1),this.setMagnitudeMode(rs(t,"magnitudeMode",1)),this.setAxisMode(rs(t,"axis",0)),this.setDuration(rs(t,"duration",500)),this.setMagnitude(rs(t,"magnitude",10)),this.ox=rs(t,"ox",void 0),this.oy=rs(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=hs[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=os[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=as[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=rs(i,"magnitude",void 0),t=rs(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const hs={effect:0,behavior:1},as={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},os={constant:0,decay:1},ls=Phaser.Utils.Objects.IsPlainObject;var ds={shake(t,e,i){if(ls(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new ns(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Di(this._shake)}};const cs=Phaser.Utils.Objects.GetValue,us=Phaser.Math.Linear;class ps extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=cs(t,"key","value");var i=e[this.propertyKey];return this.fromValue=cs(t,"from",i),this.toValue=cs(t,"to",i),this.setEase(cs(t,"ease",this.ease)),this.setDuration(cs(t,"duration",this.duration)),this.setRepeat(cs(t,"repeat",0)),this.setDelay(cs(t,"delay",0)),this.setRepeatDelay(cs(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=us(this.fromValue,this.toValue,i)}}const vs=Phaser.Utils.Objects.IsPlainObject;class gs extends ii{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new ps(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(vs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(vs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var fs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new gs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Li(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},ms=Phaser.Utils.Array.Remove,ys={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var Ds={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=qe(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},As={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=Wt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=Wt),this.transitOutCallback=t,this}},Ys={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Xs={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Ws={};Object.assign(Ws,Ds,As,Ys,Xs);const zs=Phaser.Utils.Objects.GetValue;class Fs extends ii{constructor(t,e){super(t,e),this.setTransitInTime(zs(e,"duration.in",200)),this.setTransitOutTime(zs(e,"duration.out",200)),this.setTransitInCallback(zs(e,"transitIn")),this.setTransitOutCallback(zs(e,"transitOut")),this.oneShotMode=zs(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Ls(this,{eventEmitter:!1,initState:zs(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Fs.prototype,Ws);var js=function(t){if(t.parentContainer)return js(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?js(e):t};class Is extends ii{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=js(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Bs=Phaser.GameObjects.Rectangle;let Hs=class extends Bs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Is(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}};const Ns=Phaser.Utils.Objects.GetValue;class Gs extends ii{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Ns(t,"hitAreaMode",0)),this.setEnable(Ns(t,"enable",!0)),this.setStopMode(Ns(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Vs[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Vs={default:0,fullWindow:1};const Us=Phaser.Utils.Objects.GetValue;class $s extends Hs{constructor(t,e){super(t,Us(e,"color",0),Us(e,"alpha",.8)),this.touchEventStop=new Gs(this,{hitAreaMode:1})}}var Js={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Mi(t,e)},scaleDown(t,e){Ri(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Hi(t,e)},fadeOut(t,e){Ni(t,e,!1)}},Ks=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Hi(t,e,t.alpha)},qs=function(t,e){Ni(t,e,!1)},Zs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!nt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Qs=Phaser.Utils.Objects.GetValue;let tr=class extends Fs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=er.popUp),null==e.transitOut&&(e.transitOut=er.scaleDown),e.destroy=Qs(e,"destroy",!0),super(t,e);var i=Qs(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new $s(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Qs(i,"transitIn",Ks)),this.setCoverTransitOutCallback(Qs(i,"transitOut",qs)));var s=Qs(e,"touchOutsideClose",!1),r=Qs(e,"duration.hold",-1),n=Qs(e,"timeOutClose",r>=0),h=Qs(e,"anyTouchClose",!1);Qs(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Qs(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Zs(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=er[t]),t){case er.popUp:t=Js.popUp;break;case er.fadeIn:t=Js.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=er[t]),t){case er.scaleDown:t=Js.scaleDown;break;case er.fadeOut:t=Js.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const er={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var ir=function(t){return t&&"function"==typeof t},sr={modal(t,e){return ir(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new tr(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},rr=function(t,e,i,s,r){ir(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},nr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return rr.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return rr.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return rr.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return rr.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return rr.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return rr.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return rr.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return rr.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return rr.call(this,"shutdown",t,e,i,s),this}},hr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=ar),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},ar={},or=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?Zs(t,e.x,e.y,i,s):!!(r=hr(e,n,!0))&&Zs(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const xr={press:0,pointerdown:0,release:1,pointerup:1};var br={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new yr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},Cr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!wr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return Sr.length=0,!0;return Sr.length=0,!1},Sr=[];const Or=Phaser.Utils.Objects.GetValue;class Pr extends ii{constructor(t,e){super(t,e),this._enable=void 0;var i=Or(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Or(t,"enable",!0)),this.setMode(Or(t,"mode",1)),this.setClickInterval(Or(t,"clickInterval",100)),this.setDragThreshold(Or(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Tr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?Cr:or)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Tr={press:0,pointerdown:0,release:1,pointerup:1};var _r={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Pr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class kr extends Rs{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Er=Phaser.Utils.Objects.GetValue;class Mr extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new kr,this.parent.setInteractive(Er(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Er(t,"enable",!0)),this.setCooldown(Er(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Rr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&or(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Mr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Mr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Lr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Dr=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Jr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Kr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Jr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=qr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&or(t,s,e,i)}}const Jr=0,Kr=1,qr="IDLE",Zr=Phaser.Utils.Objects.GetValue,Qr=Phaser.Math.Distance.Between;class tn extends $r{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=en},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Zr(t,"time",250)),this.setTapInterval(Zr(t,"tapInterval",200)),this.setDragThreshold(Zr(t,"threshold",9)),this.setTapOffset(Zr(t,"tapOffset",10));var e=Zr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Zr(t,"maxTaps",void 0)),this.setMinTaps(Zr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case en:this.state=sn;break;case sn:var t=this.lastPointer;Qr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=rn,this.state=sn);break;case rn:this.state=sn}}onDragEnd(){this.state===sn&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=rn))}onDrag(){this.state!==en&&this.pointer.getDistance()>this.dragThreshold&&(this.state=en)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===sn){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=en):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=rn:this.state=en)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===rn&&(this.state=en)}get isTapped(){return this.state===rn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const en="IDLE",sn="BEGIN",rn="RECOGNIZED",nn=Phaser.Utils.Objects.GetValue;class hn extends $r{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=an},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(nn(t,"threshold",9)),this.setHoldTime(nn(t,"time",251)),this}onDragStart(){this.state=on,0===this.holdTime&&(this.state=ln)}onDragEnd(){this.state=an}onDrag(){this.state!==an&&this.pointer.getDistance()>this.dragThreshold&&(this.state=an)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===on&&t-this.pointer.downTime>=this.holdTime&&(this.state=ln)}get isPressed(){return this.state===ln}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const an="IDLE",on="BEGIN",ln="RECOGNIZED";Phaser.Utils.Objects.GetValue;var dn=function(t){return ti(t).loop.delta};const cn=Phaser.Math.Distance.Between,un=Phaser.Math.Angle.Between;var pn={getDt:function(){return dn(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return cn(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return un(e.x,e.y,t.x,t.y)}},vn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},gn={};const fn=Phaser.Utils.Objects.GetValue,mn=Phaser.Math.RadToDeg;class yn extends $r{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=xn},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(fn(t,"threshold",10)),this.setVelocityThreshold(fn(t,"velocityThreshold",1e3)),this.setDirectionMode(fn(t,"dir","8dir")),this}onDragStart(){this.state=bn}onDragEnd(){this.state=xn}onDrag(){this.state===bn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=Cn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Cn&&(this.state=xn)}get isSwiped(){return this.state===Cn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=vn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=gn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(mn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(yn.prototype,pn);const xn="IDLE",bn="BEGIN",Cn="RECOGNIZED",wn=Phaser.Utils.Objects.GetValue,Sn=Phaser.Utils.Array.SpliceOne,On=Phaser.Math.Distance.Between,Pn=Phaser.Math.Angle.Between;class Tn{constructor(t,e){var i=qe(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(wn(e,"inputConfig",void 0)),this.setEventEmitter(wn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(wn(t,"enable",!0)),this.bounds=wn(t,"bounds",void 0),this.tracerState=kn,this.pointers.length=0,ft(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,ft(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case kn:this.tracerState=En,this.onDrag1Start();break;case En:this.tracerState=Mn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],Sn(this.pointers,e),this.tracerState){case En:this.tracerState=kn,this.onDrag1End();break;case Mn:this.tracerState=En,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case En:this.onDrag1();break;case Mn:this.onDrag2()}}}dragCancel(){return this.tracerState===Mn&&this.onDrag2End(),this.pointers.length=0,ft(this.movedState),this.tracerState=kn,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0],e=this.pointers[1];return On(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0],e=this.pointers[1];return Pn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;_n.x=e.x-i.x,_n.y=e.y-i.y}else _n.x=0,_n.y=0;return _n}get centerX(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Mn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Mn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Rn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&or(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&or(t,s,e,i)}}Object.assign(Tn.prototype,$e);var _n={};const kn=0,En=1,Mn=2,Rn="IDLE";Phaser.Utils.Objects.GetValue;const Ln=Phaser.Math.RotateAround;var Dn=function(t,e,i,s){return Ln(t,e,i,s),t.rotation+=s,t},An={};const Yn=Phaser.Utils.Objects.GetValue,Xn=Phaser.Math.Angle.WrapDegrees,Wn=Phaser.Math.Angle.ShortestBetween,zn=Phaser.Math.RadToDeg,Fn=Phaser.Math.DegToRad;var jn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=An),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Xn(zn(this.angleBetween));this.angle=Wn(this.prevAngle,t),this.prevAngle=t,this.state=Hn}break;case Hn:t=Xn(zn(this.angleBetween)),this.angle=Wn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Hn}get rotation(){return Fn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,jn);const In="IDLE",Bn="BEGIN",Hn="RECOGNIZED",Nn=Phaser.Utils.Objects.GetValue;var Gn=function(t){var e=Nn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new tn(this,e),this._tap.on("tap",(function(t,e,s){Ar(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Ar(i.eventEmitter,`${i.eventNamePrefix}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Vn=Phaser.Utils.Objects.GetValue;var Un=function(t){var e=Vn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new hn(this,e),this._press.on("pressstart",(function(t,e,s){Ar(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this).on("pressend",(function(t,e,s){Ar(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const $n=Phaser.Utils.Objects.GetValue;var Jn=function(t){var e=$n(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new yn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Ar(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Ar(i.eventEmitter,`${i.eventNamePrefix}swipe`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Kn=Phaser.Utils.Objects.GetValue;var qn=function(t,e){return t.setInteractive(),Kn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Kn(e,"targets",[t]),targetMode:Kn(e,"targetMode","parent"),eventEmitter:Kn(e,"eventEmitter",t),eventNamePrefix:Kn(e,"inputEventPrefix","child.")},Xr.call(t,e),Fr.call(t,e),Br.call(t,e),Vr.call(t,e),Gn.call(t,e),Un.call(t,e),Jn.call(t,e),t},Zn={getSizerConfig:function(t){return void 0===t&&(t=this),Mt(t)},getChildPrevState:function(t){var e=Mt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Dt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=oe(e,"color"),s=oe(e,"lineWidth");var o=oe(e,"name",!1);o&&(r=oe(o,"createTextCallback",ce),n=oe(o,"createTextCallbackScope",void 0),"string"==typeof(h=oe(o,"align","left-top"))&&(h=Xt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new le(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}var d,c,u=this.getAllShownChildren([this]);ue(u,u);for(var p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const ah=Phaser.Utils.Objects.IsPlainObject,oh=Phaser.Utils.Objects.GetValue,lh=Phaser.Display.Align.CENTER,dh={min:0,full:-1};var ch=function(t,e,i,s,r,n,h,a,o,l){var d,c,u,p;me.call(this,t);var v=t.isRexSpace,g=typeof e;if(null===e)return this;if("number"===g);else if("string"===g)e=dh[e];else if(ah(e)){var f;e=oh(f=e,"proportion",void 0),i=oh(f,"align",lh),s=oh(f,"padding",0),r=oh(f,"expand",!1),n=oh(f,"key",void 0),h=oh(f,"index",void 0),t.isRexSizer||(a=oh(f,"minWidth",void 0),o=oh(f,"minHeight",void 0)),l=oh(f,"fitRatio",0),d=oh(f,"offsetX",0),c=oh(f,"offsetY",0),u=oh(f,"offsetOriginX",0),p=oh(f,"offsetOriginY",0)}return"string"==typeof i&&(i=Xt[i]),void 0===e&&(e=v?1:0),void 0===i&&(i=lh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(v?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(v?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),(f=this.getSizerConfig(t)).proportion=e,f.align=i,f.padding=ge(s),f.expand=r,f.fitRatio=0===e?l:0,f.alignOffsetX=d,f.alignOffsetY=c,f.alignOffsetOriginX=u,f.alignOffsetOriginY=p,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},uh={add:ch,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),ch.call(this,new nh(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return ah(i)&&(i.index=t),ch.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=hh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const ph=Et.prototype.clear;var vh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),ph.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,vh.call(this,t),this}},mh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=Xt[e]),this.getSizerConfig(t).align=e,this}},yh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},xh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},bh={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},Ch={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Ne(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Ie.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d,c,u=this.sizerChildren,p=this.innerLeft,v=this.innerTop,g=this.innerWidth,f=this.innerHeight,m=p,y=v,x=this.startChildIndex,b=0,C=u.length;b0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=We.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Ye.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&sh.call(this,t,void 0),Xe.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||ze.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&sh.call(this,void 0,t),Fe.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(Ch,uh,fh,mh,yh,xh,bh);var wh=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},Sh={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const Oh=Phaser.Utils.Objects.IsPlainObject,Ph=Phaser.Utils.Objects.GetValue;class Th extends th{constructor(t,e,i,s,r,n,h){Oh(e)?(e=Ph(h=e,"x",0),i=Ph(h,"y",0),s=Ph(h,"width",void 0),r=Ph(h,"height",void 0),n=Ph(h,"orientation",0)):Oh(s)?(s=Ph(h=s,"width",void 0),r=Ph(h,"height",void 0),n=Ph(h,"orientation",0)):Oh(n)&&(n=Ph(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Ph(h,"space.item",0)),this.setStartChildIndex(Ph(h,"startChildIndex",0)),this.setRTL(Ph(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=Sh[t]),t}(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=wh.call(this)),this._childrenProportion}}Object.assign(Th.prototype,Ch);var _h=function(t,e,i){if(t){var s=null==e,r=null==i;return s&&r||(s||(t.displayWidth=e),r||(t.displayHeight=i),s&&(t.scaleX=t.scaleY),r&&(t.scaleY=t.scaleX)),t}},kh=function(t,e){var i;return t||0===t||(t=""),void 0===e&&(e=!0),Array.isArray(t)&&(t=t.join("\n")),(i=e?`${this.text}\n${t}`:`${this.text}${t}`)!=this.text&&this.setText(i),this},Eh={appendText:kh,resetDisplayContent:function(t){void 0===t?t={}:"string"==typeof t&&(t={text:t});var e=t.text||"";this.setText(e);var i=this.childrenMap.icon;if(i){t.icon?this.show(i):this.hide(i);var s=t.iconSize;s&&(this.setChildDisplaySize(i,s,s),void 0!==this.iconWidth&&this.setIconSize(s)),!0!==t.icon&&this.setIconTexture(t.icon,t.iconFrame)}var r=this.childrenMap.action;if(r){t.action?this.show(r):this.hide(r);var n=t.actionSize;n&&(this.setChildDisplaySize(r,n,n),void 0!==this.actionWidth&&this.setActionSize(n)),!0!==t.action&&this.setActionTexture(t.action,t.actionFrame)}return this}};class Mh extends Th{get text(){var t=this.childrenMap.text;return t?t.text:""}set text(t){var e=this.childrenMap.text;e&&e.setText(t)}setText(t){return this.text=t,this}setIconTexture(t,e){var i=this.childrenMap.icon;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.iconWidth&&void 0!==this.iconHeight&&(_h(i,this.iconWidth,this.iconHeight),this.resetChildScaleState(i)),this):this}setTexture(t,e){return this.setIconTexture(t,e),this}setIconSize(t,e){return void 0===e&&(e=t),this.iconWidth=t,this.iconHeight=e,this}get texture(){var t=this.childrenMap.icon;if(t)return t.texture}get frame(){var t=this.childrenMap.icon;if(t)return t.frame}setActionTexture(t,e){var i=this.childrenMap.action;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.actionWidth&&void 0!==this.actionHeight&&(_h(i,this.actionWidth,this.actionHeight),this.resetChildScaleState(i)),this):this}get actionTexture(){var t=this.childrenMap.action;if(t)return t.texture}get actionFrame(){var t=this.childrenMap.action;if(t)return t.frame}setActionSize(t,e){return void 0===e&&(e=t),this.actionWidth=t,this.actionHeight=e,this}preLayout(){var t=this.childrenMap.icon;t&&void 0!==this.iconWidth&&void 0!==this.iconHeight&&_h(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&_h(e,this.actionWidth,this.actionHeight),super.preLayout()}postLayout(t,e,i){var s=this.childrenMap.iconMask;s&&(s.setPosition(),this.resetChildPositionState(s));var r=this.childrenMap.actionMask;return r&&(r.setPosition(),this.resetChildPositionState(r)),super.postLayout(t,e,i),this}resize(t,e){super.resize(t,e);var i=this.childrenMap.iconMask;i&&i.resize();var s=this.childrenMap.actionMask;return s&&s.resize(),this}}Object.assign(Mh.prototype,Eh);const Rh=Phaser.GameObjects.Graphics.prototype.setPosition,Lh=Phaser.Geom.Rectangle,Dh=Phaser.Geom.Circle;var Ah=function(t,e,i,s,r){this.geom=function(t,e,i,s,r,n,h){if(1===t){s=s.left;var a=-e*(r-.5),o=-i*(n-.5),l=Math.min(e,i)/2+s;void 0!==h&&h instanceof Dh||(h=new Dh),h.setTo(a,o,l)}else{var d=-e*r-s.left,c=-i*n-s.top,u=e+s.left+s.right,p=i+s.top+s.bottom;void 0!==h&&h instanceof Lh||(h=new Lh),h.setTo(d,c,u,p)}return h}(this.shapeType,t,e,i,s,r,this.geom),this.clear().fillStyle(16777215),1===this.shapeType?this.fillCircleShape(this.geom):this.fillRectShape(this.geom)},Yh=function(t,e){for(var i in t){if(!(i in e))return!1;if(t[i]!==e[i])return!1}for(var i in e)if(!(i in t))return!1;return!0},Xh={setPosition:function(t,e){var i=this.parent;return void 0===t&&(t=i.x),void 0===e&&(e=i.y),Rh.call(this,t,e),this},resize:function(t,e,i){var s=this.parent;void 0===t&&(t=s.width),void 0===e&&(e=s.height),void 0===i?i=this.padding:"number"==typeof i&&(i=GetBoundsConfig(i));var r=this.width!==t||this.height!==e,n=this.padding!==i&&!Yh(this.padding,i);return r||n?(this.width=t,this.height=e,n&&mt(i,this.padding),this.originX=s.originX,this.originY=s.originY,Ah.call(this,t,e,i,s.originX,s.originY),this):this},setOrigin:function(t,e){void 0===e&&(e=t);var i=this.parent;return void 0===t&&(t=i.originX),void 0===e&&(e=i.originY),this.originX===t&&this.originY===e||(this.originX=t,this.originY=e,Ah.call(this,this.width,this.height,this.padding,t,e)),this},contains:function(t,e){return t-=this.x,e-=this.y,this.geom.contains(t,e)}};const Wh=Phaser.GameObjects.Graphics;class zh extends Wh{constructor(t,e,i){void 0===e&&(e=0),"string"==typeof e&&(e=Fh[e]),super(t.scene),this.parent=t,this.shapeType=e,this.padding=ge(i),this.setPosition().resize().setVisible(!1)}destroy(){return this.parent=void 0,super.destroy(),this}}const Fh={rectangle:0,circle:1};Object.assign(zh.prototype,Xh);var jh=function(t,e,i,s){var r=new zh(e,i,s);if(t&&!t.isRexSizer){var n=r.createGeometryMask();t.setMask(n),this.once("destroy",(function(){t.setMask(),n.destroy()}))}return this.pin(r),r};const Ih=Phaser.GameObjects.Text;var Bh=function(t){return t instanceof Ih};const Hh=Phaser.GameObjects.BitmapText;var Nh=function(t){return t instanceof Hh},Gh=function(t){return Nh(t)?2:Bh(t)?0:1},Vh=/^[\x00-\x7F]+$/,Uh=function(t){return Vh.test(t)},$h=function(t,e){for(var i=[],s=t.split("\n"),r=e.style,n=r.wordWrapWidth,h=r.hasOwnProperty("wrapMode")?r.wrapMode:3,a=e.context,o=0,l=s.length;o0&&r.push(o.join("")),r},Kh=0,qh=1,Zh=2,Qh=0,ta=1,ea=2,ia=/(?:\r\n|\r|\n)/;const sa={none:Qh,word:ta,char:ea,character:ea,mix:3},ra=Phaser.Renderer.WebGL.Utils;var na={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,h=r.height,a=ra.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,h,e.x,e.y,n/e.resolution,h/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,h,a(e.tintTopLeft,i.alpha*e._alphaTL),a(e.tintTopRight,i.alpha*e._alphaTR),a(e.tintBottomLeft,i.alpha*e._alphaBL),a(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const ha=Phaser.Display.Color;var aa={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,h,a,o,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===h&&(h=0),void 0===a&&(a=0),void 0===o&&(o=c),void 0===l&&(l=u);var p=d.cutX+h,v=d.cutY+a;return this.context.drawImage(d.source.image,p,v,o,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new ha);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var h=i;i=h.red,s=h.green,r=h.blue,n=h.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var a=this.context.createImageData(1,1);return a.data[0]=i,a.data[1]=s,a.data[2]=r,a.data[3]=n,this.context.putImageData(a,t,e),this.dirty=!0,this}},oa=function(t,e,i,s,r,n,h){var a,o=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===h&&(h=e.height);var d=(a=o.exists(i)?o.get(i):o.createCanvas(i,n,h)).getSourceImage();d.width!==n&&(d.width=n),d.height!==h&&(d.height=h);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,h),c.drawImage(e,s,r,n,h),l.gl&&a&&l.canvasToTexture(d,a.source[0].glTexture,!0,0)},la={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,oa(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};e();const da=Phaser.Display.Canvas.CanvasPool,ca=Phaser.GameObjects.GameObject,ua=Phaser.Utils.String.UUID;class pa extends ca{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=da.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=ua(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){da.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}}const va=Phaser.GameObjects.Components;Phaser.Class.mixin(pa,[va.Alpha,va.BlendMode,va.Crop,va.Depth,va.Flip,va.GetBounds,va.Mask,va.Origin,va.Pipeline,va.PostPipeline,va.ScrollFactor,va.Tint,va.Transform,va.Visible,na,aa,la]);var ga={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:Ts(this.data,t,e)},incData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)+e),this},mulData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)*e),this},clearData(){return this.data&&ft(this.data),this}};class fa{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}}Object.assign(fa.prototype,ga);var ma={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const ya=Phaser.Math.RotateAround;var xa;const ba=Phaser.Geom.Rectangle;var Ca,wa=function(t){void 0===Ca&&(Ca=new ba);var e=t.drawTLX,i=t.drawTLY;return Ca.setTo(e,i,t.drawTRX-e,t.drawBLY-i),Ca};const Sa=Phaser.Math.RotateAround;var Oa,Pa=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Oa&&(Oa={}),s=Oa),s.x=e,s.y=i,0!==t.rotation&&Sa(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const Ta=Phaser.GameObjects.Components.TransformMatrix;var _a,ka,Ea={},Ma=function(t,e,i,s,r){var n=Pa(e,i,s,!0),h=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=Ea);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===_a&&(_a=new Ta,ka=new Ta),t.parentContainer?t.getWorldTransformMatrix(_a,ka):_a.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),_a.transformPoint(r,n,s),s}(t,n.x,n.y,r);return h},Ra=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,h=e.drawCenterY+s;return Ma(t,e,n,h,r)},La={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===xa&&(xa={}),s=xa),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&ya(s,0,0,-i.rotation),s}(t,e,this,!0);return wa(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return Ra(this.parent,this,t,e,i)}};Object.assign(La,ma);const Da=Phaser.Math.DegToRad,Aa=Phaser.Math.RadToDeg,Ya=Phaser.Utils.Objects.GetValue;class Xa extends fa{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return Aa(this._rotation)}set angle(t){this.rotation=Da(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=Ya(t,"width",void 0),i=Ya(t,"height",void 0),s=Ya(t,"scaleX",void 0),r=Ya(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(Xa.prototype,La);const Wa=Phaser.Utils.String.Pad;var za=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${Wa(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},Fa=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const ja=Phaser.Utils.Objects.GetValue;let Ia=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=ja(t,"x",0),i=ja(t,"y",0));var s=this.cornerRadius;s.tl=Ba(ja(t,"tl",void 0),e,i),s.tr=Ba(ja(t,"tr",void 0),e,i),s.bl=Ba(ja(t,"bl",void 0),e,i),s.br=Ba(ja(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Ha(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Ha(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Ha(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Ha(this.cornerRadius.br,t)}};var Ba=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Na(t),t},Ha=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=ja(e,"x",0),t.y=ja(e,"y",0)),Na(t)},Na=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const Ga=Phaser.Math.DegToRad;var Va=function(t){return!t.hasOwnProperty("convex")||t.convex},Ua=function(t){return t.x>0&&t.y>0},$a=function(t,e,i,s,r,n,h,a,o){if(a&&h>n?h-=360:!a&&h=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=m.tl,Ua(a)?(o=a.x*g,l=a.y*f,Va(a)?$a(t,o,l,o,l,180,270,!1,h):$a(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,Ua(a)?(o=a.x*g,l=a.y*f,Va(a)?$a(t,s-o,l,o,l,270,360,!1,h):$a(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,Ua(a)?(o=a.x*g,l=a.y*f,Va(a)?$a(t,s-o,r-l,o,l,0,90,!1,h):$a(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,Ua(a)?(o=a.x*g,l=a.y*f,Va(a)?$a(t,o,r-l,o,l,90,180,!1,h):$a(t,0,r,o,l,360,270,!0,h)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,h,u),null!=a)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,a),p.addColorStop(1,d),a=p),e.fillStyle=a,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())},Ka=function(t,e,i,s,r,n,h,a){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),Ja(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}};const qa=Phaser.Utils.Objects.GetValue;class Za extends Xa{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(qa(e,"color",null),qa(e,"color2",null),qa(e,"horizontalGradient",!0)),this.setStroke(qa(e,"stroke",null),qa(e,"strokeThickness",2)),this.setCornerRadius(qa(e,"cornerRadius",0),qa(e,"cornerIteration",null))}set color(t){t=za(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=za(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=za(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,Fa("color2",t,this),Fa("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Fa("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Fa("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){Ka(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Qa=Phaser.Utils.Objects.GetValue;class to extends Xa{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(Qa(e,"color",null),Qa(e,"color2",null),Qa(e,"horizontalGradient",!0)),this.setStroke(Qa(e,"stroke",null),Qa(e,"strokeThickness",2))}set color(t){t=za(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=za(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=za(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,Qa(t,"color2",null),Qa(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Qa(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,h=this.parent.height-i.top-i.bottom,a=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?a.createLinearGradient(0,0,n,0):a.createLinearGradient(0,0,0,h)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,a.fillStyle=t,a.fillRect(s,r,n,h));null!=this.stroke&&this.strokeThickness>0&&(a.strokeStyle=this.stroke,a.lineWidth=this.strokeThickness,a.strokeRect(s,r,n,h))}}const eo=Phaser.Utils.Objects.GetValue;let io=class t{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(eo(t,"bold",!1)),this.setItalic(eo(t,"italic",!1)),this.setFontSize(eo(t,"fontSize","16px")),this.setFontFamily(eo(t,"fontFamily","Courier")),this.setColor(eo(t,"color","#fff")),this.setStrokeStyle(eo(t,"stroke",null),eo(t,"strokeThickness",0)),this.setShadow(eo(t,"shadowColor",null),eo(t,"shadowOffsetX",0),eo(t,"shadowOffsetY",0),eo(t,"shadowBlur",0)),this.setOffset(eo(t,"offsetX",0),eo(t,"offsetY",0)),this.setSpace(eo(t,"leftSpace",0),eo(t,"rightSpace",0)),this.setAlign(eo(t,"align",void 0)),this.setBackgroundColor(eo(t,"backgroundColor",null)),this.setBackgroundHeight(eo(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(eo(t,"backgroundBottomY",void 0)),this.setBackgroundLeftX(eo(t,"backgroundLeftX",0)),this.setBackgroundRightX(eo(t,"backgroundRightX",0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(Fa("stroke",t,this),Fa("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Fa("shadowOffsetX",t,this),Fa("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),t.hasOwnProperty("backgroundLeftX")&&this.setBackgroundLeftX(t.backgroundLeftX),t.hasOwnProperty("backgroundRightX")&&this.setBackgroundRightX(t.backgroundRightX),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new t(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=za(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=za(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=za(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=za(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setBackgroundLeftX(t){return this.backgroundLeftX=t,this}setBackgroundRightX(t){return this.backgroundRightX=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}};const so=Phaser.Utils.Array.Remove,ro=Phaser.Utils.Array.Remove,no="text",ho="image",ao="drawer",oo="space",lo="command";var co=function(t){return t.type===no&&"\n"===t.text},uo=function(t){return t.type===no&&"\f"===t.text},po=function(t){return t.type===no};class vo extends Xa{constructor(t,e,i){super(t,no),this.updateTextFlag=!1,this.style=new io(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX+e.backgroundLeftX,s=i,r=this.drawTRX+e.backgroundRightX-i+1;if(r>0){var n=e.backgroundBottomY;null==n&&(n=this.drawBLY);var h=e.backgroundHeight;null==h&&(h=n-this.drawTLY);var a=n-h;t.fillRect(s,a,r,h)}}var o=e.hasFill,l=e.hasStroke;(o||l)&&(e.syncFont(t).syncStyle(t),l&&(e.syncShadow(t),t.strokeText(this.text,0,0)),o&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var go=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const fo=Phaser.Display.Canvas.CanvasPool;var mo=function(t,e,i,s,r,n,h,a){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===a&&(a=!1),a&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(h){var l=fo.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=h,d.fillRect(0,0,r,n),o.drawImage(l,0,0,r,n,i,s,r,n),fo.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)};Phaser.Display.Canvas.CanvasPool;class yo extends Xa{constructor(t,e,i){super(t,ho),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){mo(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class xo extends Xa{constructor(t,e,i,s){super(t,ao),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class bo extends Xa{constructor(t,e){super(t,oo),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class Co extends fa{constructor(t,e,i,s,r){super(t,lo),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}function wo(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>wo(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=wo(t[i]));return e}var So=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const Oo={none:0,word:1,char:2,character:2,mix:3};var Po=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,h=!r&&!n,a=t.length,o=e,l=s.word,d=0,c=!1;o0&&!a){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=Eo.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=Eo.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=Ro(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=Ro(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=Ro(t,"wrapMode");void 0===c&&(c=Ro(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=Oo[c]);var u=Ro(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=Ro(t,"letterSpacing",0),v=Ro(t,"hAlign",0),g=Ro(t,"vAlign",0),f=Ro(t,"justifyPercentage",.25),m=So({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:h,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,x=0,b=y.length;x0&&(E.push({children:M,width:R}),L=Math.max(L,R)),m.start+=k.length,m.isLastPage=!D&&m.start===_,m.maxLineWidth=L,m.linesHeight=E.length*n;var j=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,I=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,h=t.vAlign,a=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(h=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=Ao(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=Ao(t,"maxLines",0);var a=0===i,o=Ao(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=Ao(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=Ao(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=Ao(t,"letterSpacing",0),p=Ao(t,"rtl",!0),v=Ao(t,"hAlign",p?2:0),g=Ao(t,"vAlign",0),f=So({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:o,wrapHeight:c,rtl:p}),m=this.children,y=0,x=m.length;y0&&(k.push({children:E,height:M}),R=Math.max(R,M)),f.start+=_.length,f.isLastPage=f.start===T,f.maxLineHeight=R,f.linesWidth=k.length*n;var W=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,z=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,h=t.vAlign,a=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}a&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,h=i.bottom;return Le(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return Re(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),so(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return ro(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(no);return null===i?i=new vo(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),Ra(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const nl=Phaser.Utils.Objects.GetFastValue;var hl={};class al{constructor(t){this.pools=nl(t,"pools",hl)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new rl),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;ei&&(r=Math.floor(i));for(var n={},h=gl(t,r,e,i,n),a=0;a<=ul&&0!==h;a++){if((r+=h)<0){r=0;break}h=gl(t,r,e,i,n)}return a===ul&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),fl(t,e,i),t},vl=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},gl=function(t,e,i,s,r){var n,h=vl(t,e,r),a=vl(t,e+1,r);if(void 0!==s)if(h.height<=s&&a.height>s)n=0;else{if(h.height>s)return-1;n=Math.floor(s-h.height)}if(h.width<=i&&a.width>i)return 0;if(h.width>i)return-1;var o=Math.floor(i-h.width);return void 0===n?o:Math.min(o,n)},fl=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const ml=Phaser.Utils.Objects.GetValue,yl=Phaser.Utils.Objects.GetValue;class xl extends Mh{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=yl(e,"background",void 0),r=yl(e,"icon",void 0),n=yl(e,"iconMask",void 0),h=yl(e,"text",void 0),a=yl(e,"action",void 0),o=yl(e,"actionMask",void 0),l=yl(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(h||a)&&(i={right:yl(e,"space.icon",0),top:yl(e,"space.iconTop",0),bottom:yl(e,"space.iconBottom",0),left:yl(e,"space.iconLeft",0)}):(h||a)&&(i={bottom:yl(e,"space.icon",0),left:yl(e,"space.iconLeft",0),right:yl(e,"space.iconRight",0),top:yl(e,"space.iconTop",0)});var d=yl(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=jh.call(this,r,r,1)),!d){var c=yl(e,"iconSize",void 0);this.setIconSize(yl(e,"iconWidth",c),yl(e,"iconHeight",c))}}if(h){var u=yl(e,"wrapText",!1),p=yl(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),function(t,e){switch(Gh(t)){case 0:switch("string"==typeof e&&(e=sa[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=$h;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=sa[e]||0),t.style.wrapMode=e}}(h,u),e.expandTextWidth=!0,cl(h)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=ml(e,"minWidth",0),s=ml(e,"minHeight",0),r=ml(e,"fitHeight",!1);t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return pl(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),pl(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t})}(h,{fitHeight:!0}));var v,g,f=yl(e,"space.text",0),m=yl(e,"expandTextWidth",!1),y=yl(e,"expandTextHeight",!1);0===this.orientation?(v=m?1:0,a&&(i={right:f}),g=y):(v=y?1:0,a&&(i={bottom:f}),g=m),this.add(h,{proportion:v,expand:g,padding:i})}if(a&&(i=0===this.orientation?{top:yl(e,"space.actionTop",0),bottom:yl(e,"space.actionBottom",0),right:yl(e,"space.actionRight",0)}:{left:yl(e,"space.actionLeft",0),right:yl(e,"space.actionRight",0),bottom:yl(e,"space.actionBottom",0)},d=yl(e,"squareFitAction",!1)?1:0,this.add(a,{proportion:0,padding:i,fitRatio:d}),o&&(o=jh.call(this,a,a,1)),!d)){var x=yl(e,"actionSize");this.setActionSize(yl(e,"actionWidth",x),yl(e,"actionHeight",x))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",h),this.addChildrenMap("action",a),this.addChildrenMap("actionMask",o)}}var bl=Phaser.Renderer.WebGL.Utils,Cl=function(t,e,i,s,r,n){for(var h=bl.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),a=i.pathData,o=i.pathIndexes,l=0;l>>16,a=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+h+","+a+","+o+","+n+")"},Tl=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,h=(16711680&r)>>>16,a=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+h+","+a+","+o+","+n+")",t.lineWidth=e.lineWidth};const _l=Phaser.Renderer.Canvas.SetTransform;var kl={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Ol(e,i,s),h=r.calcMatrix.copyFrom(n.calc),a=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&Cl(r,h,e,l,a,o),e.isStroked&&Sl(r,e,l,a,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(_l(t,r,e,i,s)){var n=e._displayOriginX,h=e._displayOriginY,a=e.pathData,o=a.length-1,l=a[0]-n,d=a[1]-h;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(Ml.prototype,kl);var Rl=function(t){return t.x>0&&t.y>0},Ll=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const Dl=Phaser.Math.DegToRad;var Al=function(t,e,i,s,r,n,h,a,o){h&&n>r?n-=360:!h&&n0,h=0,a=e.length;h=0?t.startAt(h+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(h+n,i):t.startAt(h,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(h,i),t.close(),t};const Yd=Phaser.Utils.Objects.GetValue,Xd=Phaser.Utils.Objects.IsPlainObject;class Wd extends(od(td)){constructor(t,e,i,s,r,n,h,a){Xd(e)?(e=(a=e).x,i=a.y,s=a.width,r=a.height,n=a.barColor,h=a.value):Xd(s)?(s=(a=s).width,r=a.height,n=a.barColor,h=a.value):Xd(n)&&(n=(a=n).barColor,h=a.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===h&&(h=0),super(t,e,i,s,r,a),this.type="rexLineProgress",this.bootProgressBase(a),this.addShape((new Dd).setName("trackFill")).addShape((new Dd).setName("bar")).addShape((new Dd).setName("trackStroke")),this.setTrackColor(Yd(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(Yd(a,"trackStrokeThickness",2),Yd(a,"trackStrokeColor",void 0)),this.setSkewX(Yd(a,"skewX",0)),this.setRTL(Yd(a,"rtl",!1)),this.setValue(h)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var zd={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&Ad(s,0,0,e,i,t);var r,n,h=this.getShape("bar");h.fillStyle(this.barColor),h.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),Ad(h,r,0,n,i,t));var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&Ad(a,0,0,e,i,t)}};Object.assign(Wd.prototype,zd);var Fd=function(t){return null==t||""===t||0===t.length},jd=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(Fd(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(Fd(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,h=e.length;n=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=wo(i),s=wo(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),h=n.width,a=0,o=0,l=i.length;o0?h/a:0,c=n.height,u=0;for(o=0,l=s.length;o0?0:g,x=0,o=0;for(var S=i.length;o0?0:f),f>=1&&g>=1){var O=typeof(m=this.getFrameNameCallback(o,C,e));"string"!==O&&"number"!==O||r.add(m,0,x+n.cutX,b+n.cutY,f,g)}x+=f}b+=g}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,h,a,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/o,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(u,p);if(u>v){var g=(u-v)*o;d>=0?d+=g:d=g,u=v}if(p>v){var f=(p-v)*l;c>=0?c+=f:c=f,p=v}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var x=0,b=this.rows.count;x0&&a>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(C,x)?0:1)?this._drawImage(this.textureKey,s,m,y,h,a):this._drawTileSprite(this.textureKey,s,m,y,h,a)),m+=h;y+=a}this._endDraw()},setStretchMode:function(t){return rc(t)?(this.stretchMode.edge=hc(nc(t,"edge",0)),this.stretchMode.internal=hc(nc(t,"internal",0))):(t=hc(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return oc.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const dc=Phaser.Utils.Objects.IsPlainObject,cc=Phaser.Utils.Objects.GetValue,uc=Phaser.GameObjects;var pc=void 0,vc=function(t,e){if(pc||(pc={},ti(t).events.once("destroy",(function(){for(var t in pc)pc[t].destroy();pc=void 0}))),!pc.hasOwnProperty(e)){var i=ti(t).scene.systemScene;(t=new uc[e](i)).setOrigin(0),pc[e]=t}return pc[e]};const gc=Phaser.GameObjects.RenderTexture;class fc extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if(dc(i)?(i=cc(d=i,"x",0),s=cc(d,"y",0),r=cc(d,"width",1),n=cc(d,"height",1),h=cc(d,"key",void 0),a=cc(d,"baseFrame",void 0),o=cc(d,"columns",void 0),l=cc(d,"rows",void 0)):dc(r)?(r=cc(d=r,"width",1),n=cc(d,"height",1),h=cc(d,"key",void 0),a=cc(d,"baseFrame",void 0),o=cc(d,"columns",void 0),l=cc(d,"rows",void 0)):dc(h)?(h=cc(d=h,"key",void 0),a=cc(d,"baseFrame",void 0),o=cc(d,"columns",void 0),l=cc(d,"rows",void 0)):dc(a)?(a=cc(d=a,"baseFrame",void 0),o=cc(d,"columns",void 0),l=cc(d,"rows",void 0)):Array.isArray(a)?(d=l,l=o,o=a,a=cc(d,"baseFrame",void 0)):dc(o)&&(o=cc(d=o,"columns",void 0),l=cc(d,"rows",void 0)),void 0===a&&(a=cc(d,"frame",void 0)),void 0===o){var c=cc(d,"leftWidth",void 0),u=cc(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=cc(d,"topHeight",void 0),v=cc(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(cc(d,"getFrameNameCallback",void 0)),this.setStretchMode(cc(d,"stretchMode",0)),this.setPreserveRatio(cc(d,"preserveRatio",!0));var g=cc(d,"maxFixedPartScale",1),f=cc(d,"maxFixedPartScaleX",g),m=cc(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(h,a,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,lc),i}(gc,"rexNinePatch")){}var mc={_drawImage:function(t,e,i,s,r,n){var h=vc(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=vc(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(fc.prototype,mc);let yc=class extends ii{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Hd(t,e))return t[e];var i=t.parent;return Hd(i,e)?i[e]:void 0}set(t,e,i){return Hd(t,e)?t[e]=i:Hd(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}};const xc=Phaser.Utils.Objects.GetValue;class bc extends fc{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=xc(e,"effects",!0);i&&$d(this,i),this.style=new yc(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(bc.prototype,Vl);const Cc=["alpha","tint","flipX","flipY"];var wc=function(t,e){if(!e)return t;for(var i=0,s=Cc.length;i * @copyright 2018 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */const Dc=Phaser.Display.Canvas.CanvasPool;var Ac=function(t){var e=Dc.create(this),i=e.getContext("2d",{willReadFrequently:!0});t.syncFont(e,i);var s=i.measureText(t.testString);if("actualBoundingBoxAscent"in s){var r=s.actualBoundingBoxAscent,n=s.actualBoundingBoxDescent,h={ascent:r,descent:n,fontSize:r+n};return Dc.remove(e),h}var a=Math.ceil(s.width*t.baselineX),o=a,l=2*o;if(o=o*t.baselineY|0,e.width=a,e.height=l,i.fillStyle="#f00",i.fillRect(0,0,a,l),i.font=t._font,i.textBaseline="alphabetic",i.fillStyle="#000",i.fillText(t.testString,0,o),h={ascent:0,descent:0,fontSize:0},!i.getImageData(0,0,a,l))return h.ascent=o,h.descent=o+6,h.fontSize=h.ascent+h.descent,Dc.remove(e),h;var d,c,u=i.getImageData(0,0,a,l).data,p=u.length,v=4*a,g=0,f=!1;for(d=0;do;d--){for(c=0;c0&&this.wrapMode!==Qh&&0===this.wrapWidth}setStyle(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wordWrap")){var s=t.wordWrap;s.hasOwnProperty("width")&&(t.wrap={mode:"word",width:s.width})}if(t&&t.hasOwnProperty("wrap")){var r=t.wrap;if(r.hasOwnProperty("mode")){var n=r.mode;"string"==typeof n&&(r.mode=sa[n])}else r.hasOwnProperty("width")&&(r.mode=1)}t&&t.rtl&&i&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var h=this.propertyMap;for(var a in h){var o=h[a],l=o[0],d=i?o[1]:this[a],c=o[2];if("wrapCallback"===a||"wrapCallbackScope"===a)this[a]=Xc(t,l,d);else{var u=Yc(t,l,d);c&&(u=c(u)),this[a]=u}}var p=Xc(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var v=Xc(t,"fill",null);null!==v&&(this.color=za(v));var g=Xc(t,"metrics",!1);return g?this.metrics={ascent:Xc(g,"ascent",0),descent:Xc(g,"descent",0),fontSize:Xc(g,"fontSize",0)}:!e&&this.metrics||(this.metrics=Ac(this)),e?this.parent.updateText():this.parent}syncFont(t,e){e.font=this._font}syncStyle(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"}syncShadow(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)}update(t){return t&&(this._font=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim(),this.metrics=Ac(this)),this.parent.updateText(t)}buildFont(){var t=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim();return t!==this._font&&(this._font=t),this}setFont(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=Xc(t,"fontFamily","Courier"),this.fontSize=Xc(t,"fontSize","16px"),this.fontStyle=Xc(t,"fontStyle","")),this.update(!0)}setFontFamily(t){return this.fontFamily=t,this.update(!0)}setFontStyle(t){return this.fontStyle=t,this.update(!0)}setFontSize(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}setTestString(t){return this.testString=t,this.update(!0)}setFixedSize(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}setResolution(t){return this.resolution=t,this.update(!1)}setXOffset(t){return this.xOffset=t,this.update(!1)}setBackgroundColor(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=za(t,this.parent.canvas,this.parent.context),this.backgroundColor2=za(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=za(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}setBackgroundCornerRadius(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}setFill(t){return this.color=za(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=za(t,this.parent.canvas,this.parent.context),this.update(!1)}setStroke(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=za(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}setShadow(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===n&&(n=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=za(i,this.parent.canvas,this.parent.context),this.shadowBlur=s,this.shadowStroke=r,this.shadowFill=n,this.update(!1)}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}setShadowColor(t){return void 0===t&&(t="#000"),this.shadowColor=za(t,this.parent.canvas,this.parent.context),this.update(!1)}setShadowBlur(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}setShadowStroke(t){return this.shadowStroke=t,this.update(!1)}setShadowFill(t){return this.shadowFill=t,this.update(!1)}setUnderline(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=za(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}setUnderlineColor(t){return void 0===t&&(t="#000"),this.underlineColor=za(t,this.parent.canvas,this.parent.context),this.update(!1)}setUnderlineThickness(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}setUnderlineOffset(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}setStrikethrough(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=za(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}setStrikethroughColor(t){return void 0===t&&(t="#000"),this.strikethroughColor=za(t,this.parent.canvas,this.parent.context),this.update(!1)}setStrikethroughThickness(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}setStrikethroughOffset(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}setWrapMode(t){return"string"==typeof t&&(t=sa[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}setWrapWidth(t){return this.wrapWidth=t,this.update(!1)}setAlign(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}setHAlign(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}setVAlign(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}setMaxLines(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}getTextMetrics(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}setTextMetrics(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=Xc(e,"fontFamily",this.fontFamily),this.fontSize=Xc(e,"fontSize",this.fontSize),this.fontStyle=Xc(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}get lineHeight(){return this.metrics.fontSize+this.parent.lineSpacing}toJSON(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}destroy(){this.parent=void 0}}var zc={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var h=this.defaultStyle;this.clear(),Ka(this,h.backgroundColor,h.backgroundStrokeColor,h.backgroundStrokeLineWidth,h.backgroundCornerRadius,h.backgroundColor2,h.backgroundHorizontalGradient,h.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var a,o,l,d,c,u,p=h.halign,v=h.valign,g=h.lineHeight,f=r.lines,m=f.length,y=h.maxLines;y>0&&m>y?(o=y,l="center"===v?Math.floor((m-o)/2):"bottom"===v?m-o:0):(o=m,l=0),d=l+o;var x=this.rtl,b=x?this.parent.width:void 0;u="center"===v?Math.max((s-o*g)/2,0):"bottom"===v?Math.max(s-o*g-2,0):0,u+=e;for(var C=l;C0){var a=this.defaultStyle.metrics,o=i-a.ascent,l=a.fontSize;this.drawRectangle(e,o,t.width,l,h.bgcolor,h)}if(h.underlineThickness>0&&t.width>0){var d=i+h.underlineOffset-h.underlineThickness/2;this.drawLine(e,d,t.width,h.underlineThickness,h.underlineColor,h)}if(t.isTextPen&&(h.buildFont(),h.syncFont(r,n),h.syncStyle(r,n),this.drawText(e,i,t.text,h)),t.isImagePen&&this.drawImage(e,i,t.prop.img,t.prop.color,h),h.strikethroughThickness>0&&t.width>0&&(d=i+h.strikethroughOffset-h.strikethroughThickness/2,this.drawLine(e,d,t.width,h.strikethroughThickness,h.strikethroughColor,h)),n.restore(),t.hasAreaMarker&&t.width>0){var c,u=t.prop.area;if(u)c={key:u};else{var p=t.prop.url;c={key:`url:${p}`,url:p}}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,c)}},clear(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawRectangle(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var h=this.context;h.fillStyle=r,h.fillRect(t,e,i,s)},drawLine(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var h=this.context;n.syncShadow(h,n.shadowStroke);var a=h.lineCap;h.lineCap="butt",h.strokeStyle=r,h.lineWidth=s,h.beginPath(),h.moveTo(t,e),h.lineTo(t+i,e),h.stroke(),h.lineCap=a},drawText(t,e,i,s){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;s.stroke&&"none"!==s.stroke&&s.strokeThickness>0&&(s.syncShadow(r,s.shadowStroke),r.strokeText(i,t,e)),s.color&&"none"!==s.color&&(s.syncShadow(r,s.shadowFill),r.fillText(i,t,e))},drawImage(t,e,i,s,r){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,s,this.autoRound)}};const Fc=Phaser.Utils.Objects.GetValue,jc=Kh,Ic=qh;class Bc{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=Fc(t,"text",""),this.x=Fc(t,"x",0),this.y=Fc(t,"y",0),this.width=Fc(t,"width",0);var e=Fc(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=Fc(t,"newLineMode",0),this.startIndex=Fc(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===Ic&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==jc&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===Ic&&(t+=1),t}get endIndex(){return this.startIndex+this.rawTextLength}get lastX(){return this.x+this.width}get isTextPen(){return""!==this.text}get isImagePen(){return!!this.prop.img}get hasAreaMarker(){return!!this.prop.area||!!this.prop.url}}const Hc=Phaser.Utils.Objects.GetFastValue,Nc=Kh,Gc=Zh;class Vc{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=Hc(t,"tagToText",Wt),this.tagToTextScope=Hc(t,"tagToTextScope",void 0)}destroy(){this.clear(),this.tagToText=void 0,this.tagToTextScope=void 0}clear(){for(var t=0,e=this.lines.length;t=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}getLineEndIndex(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,s=!1;for(e=t;e>=0&&!(s=null!=(i=this.lines[e])&&i.length>0);e--);return s?i[i.length-1].endIndex:0}getLineWidth(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}getMaxLineWidth(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,s=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}getLineWidths(){for(var t=[],e=0,i=this.lines.length;e=t&&o<=e||(h=h.substring(t-a,e-a)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,h,l,d):c+=this.tagToText(h,l,d),d=l,!(o>=e)));u++);return c}get length(){return this.lines.length}set length(t){this.clear()}}var Uc={};const $c=Phaser.Geom.Rectangle;var Jc=new rl;class Kc{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&du(g)){""!==x?h.push(n.getLine(x,b,su)):0===C&&r>0&&h.push(n.getLine("",0,su)),h.push(...ou(g,e,hu,s,0,n));var S=h.pop();x=S.text,b=S.width,n.freeLine(S)," "===x&&(x="",b=0)}else(m=b+f)>o?(h.push(n.getLine(x,b,su)),x=g,b=f,o=s):(x+=g,b=m),C===w-1&&h.push(n.getLine(x,b,l))}return h},lu=function(t,e){var i;switch(e){case nu:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==uu&&i0&&t>e&&(t=e),t}get linesWidth(){return Math.ceil(this.penManager.getMaxLineWidth())}get linesHeight(){var t=this.displayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}get imageManager(){return this.parent.imageManager}get rtl(){return this.parent.style.rtl}newPenManager(){return new Vc({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}get tmpPenManager(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}getPlainText(t,e,i){var s;if(null==t)s=this.penManager.plainText;else{var r=this.parser.splitText(t,1);s="";for(var n=0,h=r.length;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return yp(this.sizerChildren,null),vh.call(this,t),this}},bp={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)yp(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},Op={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=We.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,yp(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)yp(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},Tp=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const _p=Phaser.Utils.Objects.IsPlainObject,kp=Phaser.Utils.Objects.GetValue;class Ep extends th{constructor(t,e,i,s,r,n,h,a,o,l){_p(e)?(e=kp(l=e,"x",0),i=kp(l,"y",0),s=kp(l,"width",void 0),r=kp(l,"height",void 0),n=kp(l,"column",l.col||0),h=kp(l,"row",0),a=kp(l,"columnProportions",0),o=kp(l,"rowProportions",0)):_p(s)?(s=kp(l=s,"width",void 0),r=kp(l,"height",void 0),n=kp(l,"column",l.col||0),h=kp(l,"row",0),a=kp(l,"columnProportions",0),o=kp(l,"rowProportions",0)):_p(n)?(n=kp(l=n,"column",l.col||0),h=kp(l,"row",0),a=kp(l,"columnProportions",0),o=kp(l,"rowProportions",0)):_p(a)&&(a=kp(l=a,"columnProportions",0),o=kp(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(kp(l,"createCellContainerCallback")),this.setIndentLeft(kp(l,"space.indentLeftOdd",0),kp(l,"space.indentLeftEven",0)),this.setIndentTop(kp(l,"space.indentTopOdd",0),kp(l,"space.indentTopEven",0)),this.resetGrid(n,h,a,o,kp(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=Pp.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=Tp.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(Ep.prototype,Op);const Mp=Phaser.Utils.Objects.GetValue,Rp=Phaser.Math.Percent;var Lp=function(t,e,i){var s;return t.y===e.y?s=Rp(i.x,t.x,e.x):t.x===e.x&&(s=Rp(i.y,t.y,e.y)),s},Dp=function(t,e,i){var s,r;this.enable&&(Ap.x=e,Ap.y=i,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint()),this.value=Lp(s,r,Ap))},Ap={},Yp=function(t,e,i){if(this.enable&&t.isDown){var s,r;Xp.x=t.worldX,Xp.y=t.worldY,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint());var n=Lp(s,r,Xp);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-n)<.1?this.value=n:this.easeValueTo(n)}},Xp={},Wp=function(t,e){void 0===e&&(e=zp);var i=this.childrenMap.thumb,s=i.x,r=i.y;return ae(i,this.innerLeft,this.innerTop,this.innerWidth,this.innerHeight,t),e.x=i.x,e.y=i.y,i.x=s,i.y=r,e},zp={};const Fp=Phaser.Display.Align.LEFT_CENTER,jp=Phaser.Display.Align.TOP_CENTER;var Ip={};const Bp=Phaser.Display.Align.RIGHT_CENTER,Hp=Phaser.Display.Align.BOTTOM_CENTER;var Np={};const Gp=Phaser.Math.Linear;var Vp={};const Up=Phaser.Display.Align.LEFT_CENTER,$p=Phaser.Display.Align.TOP_CENTER,Jp=Phaser.Display.Align.RIGHT_CENTER,Kp=Phaser.Display.Align.BOTTOM_CENTER,qp=Phaser.Utils.Objects.GetValue,Zp=Phaser.Utils.Objects.IsPlainObject,Qp=Phaser.Math.Clamp,tv=Phaser.Math.Snap.To;class ev extends(od(Th)){constructor(t,e){super(t,e),this.type="rexSlider",this.bootProgressBase(e),this.reverseAxis=qp(e,"reverseAxis",!1);var i=qp(e,"background",void 0),s=qp(e,"track",void 0),r=qp(e,"indicator",void 0),n=qp(e,"thumb",void 0);if(i&&(Zp(i)&&(i=wc(t,i)),this.addBackground(i)),s&&(Zp(s)&&(s=wc(t,s)),this.add(s,{proportion:1,expand:!0,minWidth:0===this.orientation?0:void 0,minHeight:1===this.orientation?0:void 0})),r&&(Zp(r)&&(r=wc(t,r)),this.pin(r)),n){Zp(n)&&(n=wc(t,n)),this.pin(n);var h=qp(e,"thumbOffsetX",0),a=qp(e,"thumbOffsetY",0);this.setThumbOffset(h,a)}var o=qp(e,"input",0);switch("string"==typeof o&&(o=iv[o]),o){case 0:n&&(n.setInteractive(),this.scene.input.setDraggable(n),n.on("drag",Dp,this).on("dragstart",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("dragend",(function(t){this.eventEmitter.emit("inputend",t)}),this));break;case 1:this.on("pointerdown",Yp,this).on("pointermove",Yp,this).on("pointerdown",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("pointerup",(function(t){this.eventEmitter.emit("inputend",t)}),this).on("pointerover",(function(t){t.isDown&&this.eventEmitter.emit("inputstart",t)}),this).on("pointerout",(function(t){t.isDown&&this.eventEmitter.emit("inputend",t)}),this).setInteractive()}this.addChildrenMap("background",i),this.addChildrenMap("track",s),this.addChildrenMap("indicator",r),this.addChildrenMap("thumb",n),this.setEnable(qp(e,"enable",void 0));var l=qp(e,"tick",void 0);void 0===l&&(l=qp(e,"gap",void 0)),this.setGap(l),this.setValue(qp(e,"value",0),qp(e,"min",void 0),qp(e,"max",void 0))}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setGap(t,e,i){return t&&void 0!==e&&(t/=i-e),this.gap=t,this}setTick(t,e,i){return this.setGap(t,e,i),this}get tick(){return this.gap}set tick(t){this.gap=t}setThumbOffset(t,e){return this.thumbOffsetX=t,this.thumbOffsetY=e,this}get value(){return this._value}set value(t){void 0!==this.gap&&(t=tv(t,this.gap));var e=this._value;this._value=Qp(t,0,1),e!==this._value&&(this.updateThumb(this._value),this.updateIndicator(this._value),this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter))}postLayout(t,e,i){return this.updateThumb(),this.updateIndicator(),super.postLayout(t,e,i),this}}const iv={pan:0,drag:0,click:1,none:-1};var sv={getStartPoint:function(t){if(void 0===t&&(t=Ip),this.childrenMap.thumb){var e=0===this.orientation?Fp:jp;Wp.call(this,e,t)}else 0===this.orientation?(t.x=this.innerLeft+1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerTop+1);return t},getEndPoint:function(t){if(void 0===t&&(t=Np),this.childrenMap.thumb){var e=0===this.orientation?Bp:Hp;Wp.call(this,e,t)}else 0===this.orientation?(t.x=this.innerRight-1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerBottom-1);return t},updateThumb:function(t){var e,i,s=this.childrenMap.thumb;return void 0===s||(void 0===t&&(t=this.value),this.reverseAxis?(e=this.getEndPoint(),i=this.getStartPoint()):(e=this.getStartPoint(),i=this.getEndPoint()),function(t,e,i,s){void 0===s&&(s=Vp),s.x=Gp(e.x,i.x,t),s.y=Gp(e.y,i.y,t)}(t,e,i,s),s.x+=this.thumbOffsetX,s.y+=this.thumbOffsetY,this.resetChildPositionState(s)),this},updateIndicator:function(t){var e=this.childrenMap.indicator;if(void 0===e)return this;void 0===t&&(t=this.value);var i,s,r,n=this.reverseAxis,h=this.childrenMap.thumb;if(h)if(0===this.orientation){var a,o=Q(h);if(n)a=h.x-o*h.originX,i=this.right-a;else i=(a=h.x-o*h.originX)+o-this.left}else{var l,d=tt(h);if(n)l=h.y-d*h.originY,s=this.bottom-l;else s=(l=h.y-d*h.originY)+d-this.top}else 0===this.orientation?i=this.width*t:s=this.height*t;Ne(e,i,s),r=n?0===this.orientation?Jp:Kp:0===this.orientation?Up:$p,he(e,this,r),this.resetChildPositionState(e)}};Object.assign(ev.prototype,sv);const rv=Phaser.Utils.Objects.GetValue;class nv extends Th{constructor(t,e){super(t,e),this.type="rexScrollBar";var i,s,r=rv(e,"background",void 0),n=rv(e,"buttons",void 0),h=rv(n,"top",rv(n,"left",void 0)),a=rv(n,"bottom",rv(n,"right",void 0)),o=rv(e,"slider",void 0);(r&&this.addBackground(r),h&&(this.add(h),new Mr(h).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?this.scrollStep:-this.scrollStep;this.value+=t}}),this)),o)&&(o.orientation=this.orientation,o.eventEmitter=this,o.value=null,s=0===this.orientation?void 0===rv(o,"width",void 0)?1:0:void 0===rv(o,"height",void 0)?1:0,i=new ev(t,o),t.add.existing(i),this.add(i,{proportion:s}));a&&(this.add(a),new Mr(a).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?-this.scrollStep:this.scrollStep;this.value+=t}}),this));var l=[h,a];this.addChildrenMap("background",r),this.addChildrenMap("slider",i),this.addChildrenMap("buttons",l);var d=rv(e,"valuechangeCallback",null);if(null!==d){var c=rv(e,"valuechangeCallbackScope",void 0);this.on("valuechange",d,c)}this.setEnable(rv(e,"enable",void 0)),this.setValue(rv(e,"value",0)),this.setScrollStep(rv(n,"step",.01))}setScrollStep(t){return this.scrollStep=t,this}get enable(){return!!this.childrenMap.slider&&this.childrenMap.slider.enable}set enable(t){this.childrenMap.slider&&this.childrenMap.slider.setEnable(t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get value(){return this.childrenMap.slider?this.childrenMap.slider.value:0}set value(t){this.childrenMap.slider&&(this.childrenMap.slider.value=t)}setValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setValue(t,e,i),this}addValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.addValue(t,e,i),this}getValue(t,e){return this.childrenMap.slider?this.childrenMap.slider.getValue(t,e):0}easeValueTo(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.easeValueTo(t,e,i),this}stopEaseValue(){return this.childrenMap.slider&&this.childrenMap.slider.stopEaseValue(),this}setEaseValueDuration(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueDuration(t),this}setEaseValueFunction(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueFunction(t),this}setGap(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setGap(t,e,i),this}get gap(){if(this.childrenMap.slider)return this.childrenMap.slider.gap}set gap(t){this.childrenMap.slider&&(this.childrenMap.slider.gap=t)}setTick(t,e,i){return this.setGap(t,e,i),this}get tick(){if(this.childrenMap.slider)return this.childrenMap.slider.tick}set tick(t){this.childrenMap.slider&&(this.childrenMap.slider.tick=t)}}class hv extends Rs{constructor(t,e){super(e),this.parent=t,this.init()}init(){this.start("IDLE")}next_IDLE(){var t,e=this.parent;return e.dragState.isDown&&(t=0===e.dragThreshold?"DRAG":"DRAGBEGIN"),t}update_IDLE(t,e){this.next()}next_DRAGBEGIN(){var t=this.parent,e=t.dragState;return e.isDown?e.pointer.getDistance()>=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const av=Phaser.Utils.Objects.GetValue,ov=Phaser.Math.Distance.Between;class lv extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=av(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(av(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(av(t,"enable",!0)),this.holdThreshold=av(t,"holdThreshold",50),this.pointerOutReleaseEnable=av(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return dn(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:ov(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!or(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!or(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const dv=Phaser.Utils.Objects.GetValue;class cv{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(dv(t,"value",0)),this.setSpeed(dv(t,"speed",0)),this.setAcceleration(dv(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class uv{constructor(){this.value,this.dir,this.movement=new cv}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const fv={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},mv=Phaser.Utils.Objects.GetValue;class yv extends ii{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=mv(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(mv(e,"speed",.1)),this.setEnable(mv(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(mv(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||or(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const xv=Phaser.Utils.Objects.GetValue;var bv=function(t,e,i,s){var r,n,h="Y"===(i=i.toUpperCase()),a=2===t.scrollMode,o=t.childrenMap.child,l=`slider${i}`;if(r=a||s.hasOwnProperty(l)?xv(s,l,void 0):xv(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=h?1:0,n=function(t,e){void 0===e&&(e={});var i=mt(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new nv(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r),n.tickLength=xv(r,"tickLength",void 0);var p=xv(r,"position",0);"string"==typeof p&&(p=Cv[p]);var v,g,f=xv(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=xv(s,"space.slider",void 0))&&(a?f=0:v=xv(s,"space.child",0)),g=void 0===v?"number"==typeof f:"number"==typeof v,h?0===p?(d=2,c=1,u=void 0===v?g?{left:f}:f:{left:xv(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:xv(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:xv(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:xv(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=xv(r,"hideUnscrollableSlider",!1),t[`disableUnscrollableDrag${i}`]=xv(r,"disableUnscrollableDrag",!1),t[`adaptThumb${i}SizeMode`]=xv(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=xv(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`disableUnscrollableDrag${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,x=xv(s,"scrollDetectionMode");"string"==typeof x&&(x=wv[x]);var b=`scroller${i}`;(m=a||s.hasOwnProperty(b)?xv(s,b,!0):xv(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==x&&(m.rectBoundsInteractive=1===x),y=new gv(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var C,w,S,O,P,T=xv(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);T&&o&&(void 0!==x&&(T.focus=1===x?2:0),C=new yv(o,T)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,C),a&&!h||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.disableUnscrollableDrag=t[`disableUnscrollableDrag${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",C)),n&&(a?(w=h?"t":"s",O=`scroll${i}`):(w="t",O="scroll"),n.on("valuechange",(function(e){t[w]=e,t.emit(O,t)}))),y&&(a?(S=`childO${i}`,O=`scroll${i}`):(S="childOY",O="scroll"),y.on("valuechange",(function(e){t[S]=e,t.emit(O,t)}))),C&&(P=a?`addChildO${i}`:"addChildOY",C.on("scroll",(function(e){t[P](-e,!0)})))};const Cv={right:0,left:1,bottom:0,top:1},wv={gameObject:0,rectBounds:1},Sv=Phaser.Utils.Objects.GetValue;var Ov=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=Sv(e,"width"),h=Sv(e,"height");n||Sv(e,"child.expandWidth",!0)||(s[1]=0),h||Sv(e,"child.expandHeight",!0)||(r[1]=0);var a=new Ep(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=Mp(i,"child"),r=Mp(s,"gameObject",void 0);if(r){var n=Mp(i,"space.child",0);t.childMargin={};var h=t.childMargin,a={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:h.top=0,h.bottom=0,h.left=0,h.right=0;break;default:h.top=n,h.bottom=n,h.left=n,h.right=n}else switch(t.scrollMode){case 0:h.top=Mp(n,"top",0),h.bottom=Mp(n,"bottom",0),a.left=Mp(n,"left",0),a.right=Mp(n,"right",0);break;case 1:h.top=Mp(n,"left",0),h.bottom=Mp(n,"right",0),a.top=Mp(n,"top",0),a.bottom=Mp(n,"bottom",0);break;default:h.top=Mp(n,"top",0),h.bottom=Mp(n,"bottom",0),h.left=Mp(n,"left",0),h.right=Mp(n,"right",0)}e.add(r,{column:1,row:1,align:Mp(s,"align","center"),padding:a,expand:{width:Mp(s,"expandWidth",!0),height:Mp(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:bv(t,a,"y",e);break;case 1:bv(t,a,"x",e);break;default:bv(t,a,"y",e),bv(t,a,"x",e)}return a},Pv=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}i*="Y"===t?this.scaleY:this.scaleX,s&&s.setBounds(e,i),r&&(r.setEnable(e!==i),r.tickLength&&r.setTick(r.tickLength,e,i))},Tv=function(t){switch(this.scrollMode){case 0:case 1:(i=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(i,this.isOverflow),(r=this.childrenMap.scroller)&&this.disableUnscrollableDrag&&r.setEnable(this.isOverflow);break;default:var e=this[`isOverflow${t=t.toUpperCase()}`],i=this.childrenMap[`slider${t}`],s=this[`hideUnscrollableSlider${t}`];i&&s&&this.setChildVisible(i,e);var r=this.childrenMap.scroller,n=this[`disableUnscrollableDrag${t}`];r&&n&&r.setEnable(e)}},_v=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(a=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=a.childrenMap.track,s=a.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&n0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n")}return i}(this.textObject,this.text,this.lines),this.linesCount=this.lines.length,this._textHeight=void 0,this._textVisibleHeight=void 0,this.updateTextObject(),this},updateTextObject:function(){var t=Math.max(Math.floor(Dv.call(this,-this.textOY)),0),e=Av.call(this,t)+this.textOY,i=Yv.call(this,t);return function(t,e){switch(Gh(t)){case 0:var i=(r=t.style).wordWrapWidth,s=r.wordWrapCallback;r.wordWrapWidth=0,r.wordWrapCallback=void 0,t.setText(e),r.wordWrapWidth=i,r.wordWrapCallback=s;break;case 1:var r,n=(r=t.style).wrapMode;r.wrapMode=0,t.setText(e),r.wrapMode=n;break;case 2:var h=t._maxWidth;t._maxWidth=0,t.setText(e),t._maxWidth=h}}(this.textObject,i),this.textObject.rexSizer.offsetY=e,Xv.call(this),this},preLayout:function(){return this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,Ie.call(this),this},layoutChildren:function(){var t,e,i,s,r,n,h,a=this.left,o=this.top;(t=this.textObject).rexSizer.hidden||(s=a+(i=(e=t.rexSizer).padding).left*this.scaleX,r=o+i.top*this.scaleY,n=this.width*this.scaleX-(i.left+i.right)*this.scaleX,h=this.height*this.scaleY-(i.top+i.bottom)*this.scaleY,zv.call(this,t,n,h),ae(t,s,r,n,h,e.align),e.preOffsetY=0,Xv.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const jv=Phaser.Utils.Objects.IsPlainObject,Iv=Phaser.Utils.Objects.GetValue,Bv=Phaser.Display.Align.TOP_LEFT;class Hv extends th{constructor(t,e,i,s,r,n){jv(e)?(e=Iv(n=e,"x",0),i=Iv(n,"y",0),s=Iv(n,"width",void 0),r=Iv(n,"height",void 0)):jv(s)&&(s=Iv(n=s,"width",void 0),r=Iv(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexTextBlock",this.textObject=void 0,this.linesCount=0,this.textMask=void 0,this.textObjectType=void 0,this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,this._textObjectRealHeight=0,this.lines=void 0,this.text=Iv(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode(Iv(n,"clampTextOY",!0)),this.alwaysScrollable=Iv(n,"alwaysScrollable",!1);var h=Iv(n,"background",void 0),a=Iv(n,"text",void 0);void 0===a&&(a=Nv(t)),this.textCropEnable=Iv(n,"textCrop",!!a.setCrop);var o=Iv(n,"textMask",!this.textCropEnable);h&&this.addBackground(h),this.add(a),this.sizerChildren=[a];var l=this.getSizerConfig(a);l.align=Bv,l.padding=ge(0),l.expand=!0,this.textObject=a,this.textObjectType=Gh(a),l.preOffsetY=0,l.offsetY=0,o&&(this.textMask=jh.call(this,this.textObject,this)),this.addChildrenMap("background",h),this.addChildrenMap("text",a)}destroy(t){if(this.scene&&!this.ignoreDestroy){if(this.textObject=void 0,this.textMask=void 0,this.lines){switch(this.textObjectType){case 0:case 2:this.lines.length=0;break;case 1:this.lines.destroy()}this.lines=void 0}super.destroy(t)}}setClampMode(t){return void 0===t&&(t=!0),this.clampTextOY=t,this}get textLineHeight(){if(void 0===this._textLineHeight){var t;switch(this.textObjectType){case 0:case 1:var e=this.textObject.style;t=e.metrics.fontSize+e.strokeThickness;break;case 2:var i=this.textObject.fontSize/this.textObject.fontData.size;t=this.textObject.fontData.lineHeight*i}this._textLineHeight=t}return this._textLineHeight}get textLineSpacing(){if(void 0===this._textLineSpacing){var t;switch(this.textObjectType){case 0:case 1:t=this.textObject.lineSpacing;break;case 2:t=0}this._textLineSpacing=t}return this._textLineSpacing}get visibleLinesCount(){return void 0===this._visibleLinesCount&&(this._visibleLinesCount=Math.floor(Dv.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=Av.call(this,this.linesCount)),this._textHeight}get textObjectHeight(){return this._textObjectRealHeight-(this.textLineHeight+this.textLineSpacing)}get textVisibleHeight(){if(void 0===this._textVisibleHeight){var t=this.textHeight-this.textObjectHeight;!this.alwaysScrollable&&t<0&&(t=0),this._textVisibleHeight=t}return this._textVisibleHeight}textOYExceedTop(t){return void 0===t&&(t=this.textOY),t>this.topTextOY}textOYExeceedBottom(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:s?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}setTextOY(t){return this.textOY=t,this}set t(t){this.textOY=-this.textVisibleHeight*t}get t(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t}setTextOYByPercentage(t){return this.t=t,this}}var Nv=function(t){return t.add.text(0,0,"")};Object.assign(Hv.prototype,Fv);var Gv={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},Vv={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const Uv=Phaser.Utils.Objects.GetValue;class $v extends Rv{constructor(t,e){void 0===e&&(e={});var i=Uv(e,"text",void 0),s=Uv(e,"textWidth",void 0),r=Uv(e,"textHeight",void 0),n=Uv(e,"textCrop",!!i.setCrop),h=Uv(e,"textMask",!n),a=Uv(e,"content",""),o=new Hv(t,{width:s,height:r,text:i,textMask:h,textCrop:n&&!h,content:a,clampTextOY:Uv(e,"clampChildOY",!1),alwaysScrollable:Uv(e,"alwaysScrollable",!1)});t.add.existing(o),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textObjectHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.textHeight}})}(o),e.scrollMode=0,e.type="rexTextArea",e.child={gameObject:o,expandWidth:void 0===s,expandHeight:void 0===r};var l=Uv(e,"space",void 0);l&&(l.child=Uv(l,"text",0)),super(t,e),this.addChildrenMap("text",i)}get text(){return this.childrenMap.child.text}get lineHeight(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.textHeight}}Object.assign($v.prototype,Gv,Vv);const Jv=Phaser.Utils.Objects.GetValue;var Kv=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("key")&&(i="bitmaptext",e.font=e.key)),i){case"bitmaptext":case"bitmap":s=new op(t,e);break;case"bbcodetext":case"bbcode":s=new rp(t,0,0,"",e);break;case"label":s=new Qv(t,e);break;case"textarea":s=function(t,e,i){e=e?wo(e):{};var s=Jv(i,"background",wc),r=Jv(i,"text",Kv),n=Jv(i,"track",wc),h=Jv(i,"thumb",wc);s?e.background=s(t,e.background):delete e.background,r?e.text=r(t,e.text):delete e.text;var a=e.slider;!1!==a&&null!==a&&(void 0===a&&(a={}),n?a.track=n(t,a.track):delete a.track,h?a.thumb=h(t,a.thumb):delete a.thumb,e.slider=a);var o=new $v(t,e);return t.add.existing(o),o}(t,e);break;default:s=new Pc(t,e)}return Cc(s,e),t.add.existing(s),s},qv=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("leftWidth")?i="nineSlice":(e.hasOwnProperty("color")||e.hasOwnProperty("strokeColor"))&&(i="roundRectangle")),i){case"nineSlice":s=e.hasOwnProperty("stretchMode")?new xc(t,e):new qd(t,e);break;case"roundRectangle":s=new Ul(t,e);break;default:s=new ec(t,e)}return Cc(s,e),t.add.existing(s),s};const Zv=Phaser.Utils.Objects.GetValue;class Qv extends xl{constructor(t,e,i){e=function(t,e,i){e=e?wo(e):{};var s=Zv(i,"background",wc),r=Zv(i,"text",Kv),n=Zv(i,"icon",qv),h=Zv(i,"action",qv);return null!==e.background&&s?e.background=s(t,e.background):delete e.background,null!==e.text&&r?e.text=r(t,e.text):delete e.text,null!==e.icon&&n?e.icon=n(t,e.icon):delete e.icon,null!==e.action&&h?e.action=h(t,e.action):delete e.action,e}(t,e,i),super(t,e),this.type="rexSimpleLabel"}setActiveState(t){return tg(this.getChildren(),"setActiveState",t),this}setHoverState(t){return tg(this.getChildren(),"setHoverState",t),this}setDisableState(t){return tg(this.getChildren(),"setDisableState",t),this}}var tg=function(t,e,i){for(var s=0,r=t.length;s=r&&o=i&&oi.length&&(t.prevCursorPosition=null),null!==t.prevCursorPosition&&(s=e.getCharChild(t.prevCursorPosition))&&("\n"===s.text&&s.clearTextSize(),e.emit("cursorout",s,t.prevCursorPosition,e)),null!=r&&(s=e.getCharChild(r))&&("\n"===s.text&&s.copyTextSize(e.lastInsertCursor),function(t){var e,i,s=t.parent,r=s.width,n=s.height,h=t.drawX,a=t.drawY,o=h+t.drawTLX,l=h+t.drawTRX,d=a+t.drawTLY,c=a+t.drawBLY;e=o<0?0-o:l>r?r-l:0,i=d<0?0-d:c>n?n-c:0,s._textOX+=e,s._textOY+=i}(s),e.emit("cursorin",s,r,e)),e.emit("movecursor",r,t.prevCursorPosition,e),t.prevCursorPosition=r)}(this)):(bg(this),Cg(this)),this}setNumberInput(){return this.onUpdateCallback=xg,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}}const Og=Phaser.Utils.Objects.GetValue,Pg=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var Tg=function(t,e){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return!0;if(-1!==e.indexOf(".")){for(var i=e.split("."),s=t,r=0;rt.length?i:t})),h.value=t.join(e)}else h.value=t.join(i.slice(a,a+h.count));a+=h.count,h.added||(o+=h.count)}}let l=e[h-1];return h>1&&"string"==typeof l.value&&(l.added||l.removed)&&t.equals("",l.value)&&(e[h-2].value+=l.value,e.pop()),e}Ag.prototype={diff(t,e,i={}){let s=i.callback;"function"==typeof i&&(s=i,i={}),this.options=i;let r=this;function n(t){return s?(setTimeout((function(){s(void 0,t)}),0),!0):t}t=this.castInput(t),e=this.castInput(e),t=this.removeEmpty(this.tokenize(t));let h=(e=this.removeEmpty(this.tokenize(e))).length,a=t.length,o=1,l=h+a;i.maxEditLength&&(l=Math.min(l,i.maxEditLength));let d=[{newPos:-1,components:[]}],c=this.extractCommon(d[0],e,t,0);if(d[0].newPos+1>=h&&c+1>=a)return n([{value:this.join(e),count:e.length}]);function u(){for(let s=-1*o;s<=o;s+=2){let o,l=d[s-1],c=d[s+1],u=(c?c.newPos:0)-s;l&&(d[s-1]=void 0);let p=l&&l.newPos+1=h&&u+1>=a)return n(Yg(r,o.components,e,t,r.useLongestToken));d[s]=o}else d[s]=void 0}var i;o++}if(s)!function t(){setTimeout((function(){if(o>l)return s();u()||t()}),0)}();else for(;o<=l;){let t=u();if(t)return t}},pushComponent(t,e,i){let s=t[t.length-1];s&&s.added===e&&s.removed===i?t[t.length-1]={count:s.count+1,added:e,removed:i}:t.push({count:1,added:e,removed:i})},extractCommon(t,e,i,s){let r=e.length,n=i.length,h=t.newPos,a=h-s,o=0;for(;h+1t,tokenize:t=>t.split(""),join:t=>t.join("")};const Xg=new Ag,Wg=/^[a-zA-Z\u{C0}-\u{FF}\u{D8}-\u{F6}\u{F8}-\u{2C6}\u{2C8}-\u{2D7}\u{2DE}-\u{2FF}\u{1E00}-\u{1EFF}]+$/u,zg=/\S/,Fg=new Ag;Fg.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!zg.test(t)&&!zg.test(e)},Fg.tokenize=function(t){let e=t.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/);for(let t=0;tvoid 0===i?e:i}=this.options;return"string"==typeof t?t:JSON.stringify(Hg(t,null,null,i),i," ")},Bg.equals=function(t,e){return Ag.prototype.equals.call(Bg,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const Ng=new Ag;Ng.tokenize=function(t){return t.slice()},Ng.join=Ng.removeEmpty=function(t){return t};const Gg=Phaser.Utils.Array.Remove;var Vg=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),Gg(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(o=i,l=e,Xg.diff(o,l,d)),r=0,n=0,h=s.length;nr)i+=h;else{if(s!==r)break;i+=Math.min(e.position,h)}}return i},qg={cursorMoveLeft(){if(!this.isOpened)return this;var t=$g(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=$g(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=Jg(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=$g(Kg(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=Jg(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=$g(Kg(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const Zg=Phaser.Utils.Objects.IsPlainObject;class Qg extends dl{constructor(t,e,i,s,r,n){Zg(e)?n=e:Zg(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(Tg(e,"wrap.vAlign")||Fd(e,"wrap.vAlign",s=i?"center":"top"),Tg(e,"wrap.wrapMode")||Fd(e,"wrap.wrapMode","char"),Tg(e,"wrap.maxLines")||Fd(e,"wrap.maxLines",s=i?1:void 0),i&&Fd(e,"wrap.wrapWidth",1/0),Tg(e,"wrap.useDefaultTextHeight")||Fd(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!Tg(e.edit,"inputType")){var s=i?"text":"textarea";Fd(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new kg(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var h=n.text;h&&delete n.text;var a=jl(n.background,"focus"),o=jl(n.style,"cursor"),l=jl(n.style,"range");super(t,e,i,s,r,n),this.type="rexCanvasInput",this.contentWidth=void 0,this.contentHeight=void 0,this.lineHeight=void 0,this.linesCount=void 0,this.characterCountOfLines=[],this._text,this.textEdit=function(t,e){var i=Og(e,"edit");return void 0===i&&(i={}),sg(e,i,Pg),new Sg(t,i)}(this,n),Eg.call(this),n.focusStyle&&Object.assign(a,n.focusStyle),Dg.call(this,a),n.cursorStyle&&Object.assign(o,n.cursorStyle),Rg.call(this,o),n.rangeStyle&&Object.assign(l,n.rangeStyle),Mg(l)&&Object.assign(l,o),Lg.call(this,l);var d=n.onAddChar;d&&this.on("addchar",d);var c=n.onCursorIn;c&&this.on("cursorin",c);var u=n.onCursorOut;u&&this.on("cursorout",u);var p=!n.onRangeIn&&!n.onRangeOut,v=p?n.onCursorIn:n.onRangeIn;v&&this.on("rangein",v);var g=p?n.onCursorOut:n.onRangeOut;g&&this.on("rangeout",g);var f,m=n.onMoveCursor;m&&this.on("movecursor",m),this.setParseTextCallback(n.parseTextCallback),this.lastInsertCursor=((f=this.createCharChild("|")).text="",f),h||(h=""),this.setText(h)}addChild(t,e){if(super.addChild(t,e),Array.isArray(t))for(var i=t,s=0,r=i.length;so;d--){for(c=0;c0&&this.wrapMode!==Qh&&0===this.wrapWidth}setStyle(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wordWrap")){var s=t.wordWrap;s.hasOwnProperty("width")&&(t.wrap={mode:"word",width:s.width})}if(t&&t.hasOwnProperty("wrap")){var r=t.wrap;if(r.hasOwnProperty("mode")){var n=r.mode;"string"==typeof n&&(r.mode=sa[n])}else r.hasOwnProperty("width")&&(r.mode=1)}t&&t.rtl&&i&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var h=this.propertyMap;for(var a in h){var o=h[a],l=o[0],d=i?o[1]:this[a],c=o[2];if("wrapCallback"===a||"wrapCallbackScope"===a)this[a]=Wc(t,l,d);else{var u=Xc(t,l,d);c&&(u=c(u)),this[a]=u}}var p=Wc(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var v=Wc(t,"fill",null);null!==v&&(this.color=za(v));var g=Wc(t,"metrics",!1);return g?this.metrics={ascent:Wc(g,"ascent",0),descent:Wc(g,"descent",0),fontSize:Wc(g,"fontSize",0)}:!e&&this.metrics||(this.metrics=Yc(this)),e?this.parent.updateText():this.parent}syncFont(t,e){e.font=this._font}syncStyle(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"}syncShadow(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)}update(t){return t&&(this._font=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim(),this.metrics=Yc(this)),this.parent.updateText(t)}buildFont(){var t=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim();return t!==this._font&&(this._font=t),this}setFont(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=Wc(t,"fontFamily","Courier"),this.fontSize=Wc(t,"fontSize","16px"),this.fontStyle=Wc(t,"fontStyle","")),this.update(!0)}setFontFamily(t){return this.fontFamily=t,this.update(!0)}setFontStyle(t){return this.fontStyle=t,this.update(!0)}setFontSize(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}setTestString(t){return this.testString=t,this.update(!0)}setFixedSize(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}setResolution(t){return this.resolution=t,this.update(!1)}setXOffset(t){return this.xOffset=t,this.update(!1)}setBackgroundColor(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=za(t,this.parent.canvas,this.parent.context),this.backgroundColor2=za(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=za(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}setBackgroundCornerRadius(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}setFill(t){return this.color=za(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=za(t,this.parent.canvas,this.parent.context),this.update(!1)}setStroke(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=za(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}setShadow(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===n&&(n=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=za(i,this.parent.canvas,this.parent.context),this.shadowBlur=s,this.shadowStroke=r,this.shadowFill=n,this.update(!1)}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}setShadowColor(t){return void 0===t&&(t="#000"),this.shadowColor=za(t,this.parent.canvas,this.parent.context),this.update(!1)}setShadowBlur(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}setShadowStroke(t){return this.shadowStroke=t,this.update(!1)}setShadowFill(t){return this.shadowFill=t,this.update(!1)}setUnderline(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=za(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}setUnderlineColor(t){return void 0===t&&(t="#000"),this.underlineColor=za(t,this.parent.canvas,this.parent.context),this.update(!1)}setUnderlineThickness(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}setUnderlineOffset(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}setStrikethrough(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=za(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}setStrikethroughColor(t){return void 0===t&&(t="#000"),this.strikethroughColor=za(t,this.parent.canvas,this.parent.context),this.update(!1)}setStrikethroughThickness(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}setStrikethroughOffset(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}setWrapMode(t){return"string"==typeof t&&(t=sa[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}setWrapWidth(t){return this.wrapWidth=t,this.update(!1)}setAlign(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}setHAlign(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}setVAlign(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}setMaxLines(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}getTextMetrics(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}setTextMetrics(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=Wc(e,"fontFamily",this.fontFamily),this.fontSize=Wc(e,"fontSize",this.fontSize),this.fontStyle=Wc(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}get lineHeight(){return this.metrics.fontSize+this.parent.lineSpacing}toJSON(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}destroy(){this.parent=void 0}}var Fc={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var h=this.defaultStyle;this.clear(),Ka(this,h.backgroundColor,h.backgroundStrokeColor,h.backgroundStrokeLineWidth,h.backgroundCornerRadius,h.backgroundColor2,h.backgroundHorizontalGradient,h.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var a,o,l,d,c,u,p=h.halign,v=h.valign,g=h.lineHeight,f=r.lines,m=f.length,y=h.maxLines;y>0&&m>y?(o=y,l="center"===v?Math.floor((m-o)/2):"bottom"===v?m-o:0):(o=m,l=0),d=l+o;var x=this.rtl,b=x?this.parent.width:void 0;u="center"===v?Math.max((s-o*g)/2,0):"bottom"===v?Math.max(s-o*g-2,0):0,u+=e;for(var C=l;C0){var a=this.defaultStyle.metrics,o=i-a.ascent,l=a.fontSize;this.drawRectangle(e,o,t.width,l,h.bgcolor,h)}if(h.underlineThickness>0&&t.width>0){var d=i+h.underlineOffset-h.underlineThickness/2;this.drawLine(e,d,t.width,h.underlineThickness,h.underlineColor,h)}if(t.isTextPen&&(h.buildFont(),h.syncFont(r,n),h.syncStyle(r,n),this.drawText(e,i,t.text,h)),t.isImagePen&&this.drawImage(e,i,t.prop.img,t.prop.color,h),h.strikethroughThickness>0&&t.width>0&&(d=i+h.strikethroughOffset-h.strikethroughThickness/2,this.drawLine(e,d,t.width,h.strikethroughThickness,h.strikethroughColor,h)),n.restore(),t.hasAreaMarker&&t.width>0){var c,u=t.prop.area;if(u)c={key:u};else{var p=t.prop.url;c={key:`url:${p}`,url:p}}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,c)}},clear(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawRectangle(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var h=this.context;h.fillStyle=r,h.fillRect(t,e,i,s)},drawLine(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var h=this.context;n.syncShadow(h,n.shadowStroke);var a=h.lineCap;h.lineCap="butt",h.strokeStyle=r,h.lineWidth=s,h.beginPath(),h.moveTo(t,e),h.lineTo(t+i,e),h.stroke(),h.lineCap=a},drawText(t,e,i,s){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;s.stroke&&"none"!==s.stroke&&s.strokeThickness>0&&(s.syncShadow(r,s.shadowStroke),r.strokeText(i,t,e)),s.color&&"none"!==s.color&&(s.syncShadow(r,s.shadowFill),r.fillText(i,t,e))},drawImage(t,e,i,s,r){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,s,this.autoRound)}};const jc=Phaser.Utils.Objects.GetValue,Ic=Kh,Bc=qh;class Hc{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=jc(t,"text",""),this.x=jc(t,"x",0),this.y=jc(t,"y",0),this.width=jc(t,"width",0);var e=jc(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=jc(t,"newLineMode",0),this.startIndex=jc(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===Bc&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==Ic&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===Bc&&(t+=1),t}get endIndex(){return this.startIndex+this.rawTextLength}get lastX(){return this.x+this.width}get isTextPen(){return""!==this.text}get isImagePen(){return!!this.prop.img}get hasAreaMarker(){return!!this.prop.area||!!this.prop.url}}const Nc=Phaser.Utils.Objects.GetFastValue,Gc=Kh,Vc=Zh;class Uc{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=Nc(t,"tagToText",Wt),this.tagToTextScope=Nc(t,"tagToTextScope",void 0)}destroy(){this.clear(),this.tagToText=void 0,this.tagToTextScope=void 0}clear(){for(var t=0,e=this.lines.length;t=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}getLineEndIndex(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,s=!1;for(e=t;e>=0&&!(s=null!=(i=this.lines[e])&&i.length>0);e--);return s?i[i.length-1].endIndex:0}getLineWidth(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}getMaxLineWidth(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,s=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}getLineWidths(){for(var t=[],e=0,i=this.lines.length;e=t&&o<=e||(h=h.substring(t-a,e-a)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,h,l,d):c+=this.tagToText(h,l,d),d=l,!(o>=e)));u++);return c}get length(){return this.lines.length}set length(t){this.clear()}}var $c={};const Jc=Phaser.Geom.Rectangle;var Kc=new rl;class qc{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&cu(g)){""!==x?h.push(n.getLine(x,b,ru)):0===C&&r>0&&h.push(n.getLine("",0,ru)),h.push(...lu(g,e,au,s,0,n));var S=h.pop();x=S.text,b=S.width,n.freeLine(S)," "===x&&(x="",b=0)}else(m=b+f)>o?(h.push(n.getLine(x,b,ru)),x=g,b=f,o=s):(x+=g,b=m),C===w-1&&h.push(n.getLine(x,b,l))}return h},du=function(t,e){var i;switch(e){case hu:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==pu&&i0&&t>e&&(t=e),t}get linesWidth(){return Math.ceil(this.penManager.getMaxLineWidth())}get linesHeight(){var t=this.displayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}get imageManager(){return this.parent.imageManager}get rtl(){return this.parent.style.rtl}newPenManager(){return new Uc({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}get tmpPenManager(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}getPlainText(t,e,i){var s;if(null==t)s=this.penManager.plainText;else{var r=this.parser.splitText(t,1);s="";for(var n=0,h=r.length;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return xp(this.sizerChildren,null),vh.call(this,t),this}},Cp={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)xp(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},Pp={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=We.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,xp(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)xp(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},_p=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const kp=Phaser.Utils.Objects.IsPlainObject,Ep=Phaser.Utils.Objects.GetValue;class Mp extends th{constructor(t,e,i,s,r,n,h,a,o,l){kp(e)?(e=Ep(l=e,"x",0),i=Ep(l,"y",0),s=Ep(l,"width",void 0),r=Ep(l,"height",void 0),n=Ep(l,"column",l.col||0),h=Ep(l,"row",0),a=Ep(l,"columnProportions",0),o=Ep(l,"rowProportions",0)):kp(s)?(s=Ep(l=s,"width",void 0),r=Ep(l,"height",void 0),n=Ep(l,"column",l.col||0),h=Ep(l,"row",0),a=Ep(l,"columnProportions",0),o=Ep(l,"rowProportions",0)):kp(n)?(n=Ep(l=n,"column",l.col||0),h=Ep(l,"row",0),a=Ep(l,"columnProportions",0),o=Ep(l,"rowProportions",0)):kp(a)&&(a=Ep(l=a,"columnProportions",0),o=Ep(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(Ep(l,"createCellContainerCallback")),this.setIndentLeft(Ep(l,"space.indentLeftOdd",0),Ep(l,"space.indentLeftEven",0)),this.setIndentTop(Ep(l,"space.indentTopOdd",0),Ep(l,"space.indentTopEven",0)),this.resetGrid(n,h,a,o,Ep(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=Tp.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=_p.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(Mp.prototype,Pp);const Rp=Phaser.Utils.Objects.GetValue,Lp=Phaser.Math.Percent;var Dp=function(t,e,i){var s;return t.y===e.y?s=Lp(i.x,t.x,e.x):t.x===e.x&&(s=Lp(i.y,t.y,e.y)),s},Ap=function(t,e,i){var s,r;this.enable&&(Yp.x=e,Yp.y=i,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint()),this.value=Dp(s,r,Yp))},Yp={},Xp=function(t,e,i){if(this.enable&&t.isDown){var s,r;Wp.x=t.worldX,Wp.y=t.worldY,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint());var n=Dp(s,r,Wp);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-n)<.1?this.value=n:this.easeValueTo(n)}},Wp={},zp=function(t,e){void 0===e&&(e=Fp);var i=this.childrenMap.thumb,s=i.x,r=i.y;return ae(i,this.innerLeft,this.innerTop,this.innerWidth,this.innerHeight,t),e.x=i.x,e.y=i.y,i.x=s,i.y=r,e},Fp={};const jp=Phaser.Display.Align.LEFT_CENTER,Ip=Phaser.Display.Align.TOP_CENTER;var Bp={};const Hp=Phaser.Display.Align.RIGHT_CENTER,Np=Phaser.Display.Align.BOTTOM_CENTER;var Gp={};const Vp=Phaser.Math.Linear;var Up={};const $p=Phaser.Display.Align.LEFT_CENTER,Jp=Phaser.Display.Align.TOP_CENTER,Kp=Phaser.Display.Align.RIGHT_CENTER,qp=Phaser.Display.Align.BOTTOM_CENTER,Zp=Phaser.Utils.Objects.GetValue,Qp=Phaser.Utils.Objects.IsPlainObject,tv=Phaser.Math.Clamp,ev=Phaser.Math.Snap.To;class iv extends(od(Th)){constructor(t,e){super(t,e),this.type="rexSlider",this.bootProgressBase(e),this.reverseAxis=Zp(e,"reverseAxis",!1);var i=Zp(e,"background",void 0),s=Zp(e,"track",void 0),r=Zp(e,"indicator",void 0),n=Zp(e,"thumb",void 0);if(i&&(Qp(i)&&(i=Sc(t,i)),this.addBackground(i)),s&&(Qp(s)&&(s=Sc(t,s)),this.add(s,{proportion:1,expand:!0,minWidth:0===this.orientation?0:void 0,minHeight:1===this.orientation?0:void 0})),r&&(Qp(r)&&(r=Sc(t,r)),this.pin(r)),n){Qp(n)&&(n=Sc(t,n)),this.pin(n);var h=Zp(e,"thumbOffsetX",0),a=Zp(e,"thumbOffsetY",0);this.setThumbOffset(h,a)}var o=Zp(e,"input",0);switch("string"==typeof o&&(o=sv[o]),o){case 0:n&&(n.setInteractive(),this.scene.input.setDraggable(n),n.on("drag",Ap,this).on("dragstart",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("dragend",(function(t){this.eventEmitter.emit("inputend",t)}),this));break;case 1:this.on("pointerdown",Xp,this).on("pointermove",Xp,this).on("pointerdown",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("pointerup",(function(t){this.eventEmitter.emit("inputend",t)}),this).on("pointerover",(function(t){t.isDown&&this.eventEmitter.emit("inputstart",t)}),this).on("pointerout",(function(t){t.isDown&&this.eventEmitter.emit("inputend",t)}),this).setInteractive()}this.addChildrenMap("background",i),this.addChildrenMap("track",s),this.addChildrenMap("indicator",r),this.addChildrenMap("thumb",n),this.setEnable(Zp(e,"enable",void 0));var l=Zp(e,"tick",void 0);void 0===l&&(l=Zp(e,"gap",void 0)),this.setGap(l),this.setValue(Zp(e,"value",0),Zp(e,"min",void 0),Zp(e,"max",void 0))}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setGap(t,e,i){return t&&void 0!==e&&(t/=i-e),this.gap=t,this}setTick(t,e,i){return this.setGap(t,e,i),this}get tick(){return this.gap}set tick(t){this.gap=t}setThumbOffset(t,e){return this.thumbOffsetX=t,this.thumbOffsetY=e,this}get value(){return this._value}set value(t){void 0!==this.gap&&(t=ev(t,this.gap));var e=this._value;this._value=tv(t,0,1),e!==this._value&&(this.updateThumb(this._value),this.updateIndicator(this._value),this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter))}postLayout(t,e,i){return this.updateThumb(),this.updateIndicator(),super.postLayout(t,e,i),this}}const sv={pan:0,drag:0,click:1,none:-1};var rv={getStartPoint:function(t){if(void 0===t&&(t=Bp),this.childrenMap.thumb){var e=0===this.orientation?jp:Ip;zp.call(this,e,t)}else 0===this.orientation?(t.x=this.innerLeft+1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerTop+1);return t},getEndPoint:function(t){if(void 0===t&&(t=Gp),this.childrenMap.thumb){var e=0===this.orientation?Hp:Np;zp.call(this,e,t)}else 0===this.orientation?(t.x=this.innerRight-1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerBottom-1);return t},updateThumb:function(t){var e,i,s=this.childrenMap.thumb;return void 0===s||(void 0===t&&(t=this.value),this.reverseAxis?(e=this.getEndPoint(),i=this.getStartPoint()):(e=this.getStartPoint(),i=this.getEndPoint()),function(t,e,i,s){void 0===s&&(s=Up),s.x=Vp(e.x,i.x,t),s.y=Vp(e.y,i.y,t)}(t,e,i,s),s.x+=this.thumbOffsetX,s.y+=this.thumbOffsetY,this.resetChildPositionState(s)),this},updateIndicator:function(t){var e=this.childrenMap.indicator;if(void 0===e)return this;void 0===t&&(t=this.value);var i,s,r,n=this.reverseAxis,h=this.childrenMap.thumb;if(h)if(0===this.orientation){var a,o=Q(h);if(n)a=h.x-o*h.originX,i=this.right-a;else i=(a=h.x-o*h.originX)+o-this.left}else{var l,d=tt(h);if(n)l=h.y-d*h.originY,s=this.bottom-l;else s=(l=h.y-d*h.originY)+d-this.top}else 0===this.orientation?i=this.width*t:s=this.height*t;Ne(e,i,s),r=n?0===this.orientation?Kp:qp:0===this.orientation?$p:Jp,he(e,this,r),this.resetChildPositionState(e)}};Object.assign(iv.prototype,rv);const nv=Phaser.Utils.Objects.GetValue;class hv extends Th{constructor(t,e){super(t,e),this.type="rexScrollBar";var i,s,r=nv(e,"background",void 0),n=nv(e,"buttons",void 0),h=nv(n,"top",nv(n,"left",void 0)),a=nv(n,"bottom",nv(n,"right",void 0)),o=nv(e,"slider",void 0);(r&&this.addBackground(r),h&&(this.add(h),new Mr(h).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?this.scrollStep:-this.scrollStep;this.value+=t}}),this)),o)&&(o.orientation=this.orientation,o.eventEmitter=this,o.value=null,s=0===this.orientation?void 0===nv(o,"width",void 0)?1:0:void 0===nv(o,"height",void 0)?1:0,i=new iv(t,o),t.add.existing(i),this.add(i,{proportion:s}));a&&(this.add(a),new Mr(a).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?-this.scrollStep:this.scrollStep;this.value+=t}}),this));var l=[h,a];this.addChildrenMap("background",r),this.addChildrenMap("slider",i),this.addChildrenMap("buttons",l);var d=nv(e,"valuechangeCallback",null);if(null!==d){var c=nv(e,"valuechangeCallbackScope",void 0);this.on("valuechange",d,c)}this.setEnable(nv(e,"enable",void 0)),this.setValue(nv(e,"value",0)),this.setScrollStep(nv(n,"step",.01))}setScrollStep(t){return this.scrollStep=t,this}get enable(){return!!this.childrenMap.slider&&this.childrenMap.slider.enable}set enable(t){this.childrenMap.slider&&this.childrenMap.slider.setEnable(t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get value(){return this.childrenMap.slider?this.childrenMap.slider.value:0}set value(t){this.childrenMap.slider&&(this.childrenMap.slider.value=t)}setValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setValue(t,e,i),this}addValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.addValue(t,e,i),this}getValue(t,e){return this.childrenMap.slider?this.childrenMap.slider.getValue(t,e):0}easeValueTo(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.easeValueTo(t,e,i),this}stopEaseValue(){return this.childrenMap.slider&&this.childrenMap.slider.stopEaseValue(),this}setEaseValueDuration(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueDuration(t),this}setEaseValueFunction(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueFunction(t),this}setGap(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setGap(t,e,i),this}get gap(){if(this.childrenMap.slider)return this.childrenMap.slider.gap}set gap(t){this.childrenMap.slider&&(this.childrenMap.slider.gap=t)}setTick(t,e,i){return this.setGap(t,e,i),this}get tick(){if(this.childrenMap.slider)return this.childrenMap.slider.tick}set tick(t){this.childrenMap.slider&&(this.childrenMap.slider.tick=t)}}class av extends Rs{constructor(t,e){super(e),this.parent=t,this.init()}init(){this.start("IDLE")}next_IDLE(){var t,e=this.parent;return e.dragState.isDown&&(t=0===e.dragThreshold?"DRAG":"DRAGBEGIN"),t}update_IDLE(t,e){this.next()}next_DRAGBEGIN(){var t=this.parent,e=t.dragState;return e.isDown?e.pointer.getDistance()>=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const ov=Phaser.Utils.Objects.GetValue,lv=Phaser.Math.Distance.Between;class dv extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=ov(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(ov(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(ov(t,"enable",!0)),this.holdThreshold=ov(t,"holdThreshold",50),this.pointerOutReleaseEnable=ov(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return dn(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:lv(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!or(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!or(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const cv=Phaser.Utils.Objects.GetValue;class uv{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(cv(t,"value",0)),this.setSpeed(cv(t,"speed",0)),this.setAcceleration(cv(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class pv{constructor(){this.value,this.dir,this.movement=new uv}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const mv={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},yv=Phaser.Utils.Objects.GetValue;class xv extends ii{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=yv(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(yv(e,"speed",.1)),this.setEnable(yv(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(yv(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||or(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const bv=Phaser.Utils.Objects.GetValue;var Cv=function(t,e,i,s){var r,n,h="Y"===(i=i.toUpperCase()),a=2===t.scrollMode,o=t.childrenMap.child,l=`slider${i}`;if(r=a||s.hasOwnProperty(l)?bv(s,l,void 0):bv(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=h?1:0,n=function(t,e){void 0===e&&(e={});var i=mt(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new hv(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r),n.tickLength=bv(r,"tickLength",void 0);var p=bv(r,"position",0);"string"==typeof p&&(p=wv[p]);var v,g,f=bv(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=bv(s,"space.slider",void 0))&&(a?f=0:v=bv(s,"space.child",0)),g=void 0===v?"number"==typeof f:"number"==typeof v,h?0===p?(d=2,c=1,u=void 0===v?g?{left:f}:f:{left:bv(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:bv(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:bv(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:bv(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=bv(r,"hideUnscrollableSlider",!1),t[`disableUnscrollableDrag${i}`]=bv(r,"disableUnscrollableDrag",!1),t[`adaptThumb${i}SizeMode`]=bv(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=bv(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`disableUnscrollableDrag${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,x=bv(s,"scrollDetectionMode");"string"==typeof x&&(x=Sv[x]);var b=`scroller${i}`;(m=a||s.hasOwnProperty(b)?bv(s,b,!0):bv(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==x&&(m.rectBoundsInteractive=1===x),y=new fv(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var C,w,S,O,P,T=bv(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);T&&o&&(void 0!==x&&(T.focus=1===x?2:0),C=new xv(o,T)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,C),a&&!h||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.disableUnscrollableDrag=t[`disableUnscrollableDrag${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",C)),n&&(a?(w=h?"t":"s",O=`scroll${i}`):(w="t",O="scroll"),n.on("valuechange",(function(e){t[w]=e,t.emit(O,t)}))),y&&(a?(S=`childO${i}`,O=`scroll${i}`):(S="childOY",O="scroll"),y.on("valuechange",(function(e){t[S]=e,t.emit(O,t)}))),C&&(P=a?`addChildO${i}`:"addChildOY",C.on("scroll",(function(e){t[P](-e,!0)})))};const wv={right:0,left:1,bottom:0,top:1},Sv={gameObject:0,rectBounds:1},Ov=Phaser.Utils.Objects.GetValue;var Pv=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=Ov(e,"width"),h=Ov(e,"height");n||Ov(e,"child.expandWidth",!0)||(s[1]=0),h||Ov(e,"child.expandHeight",!0)||(r[1]=0);var a=new Mp(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=Rp(i,"child"),r=Rp(s,"gameObject",void 0);if(r){var n=Rp(i,"space.child",0);t.childMargin={};var h=t.childMargin,a={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:h.top=0,h.bottom=0,h.left=0,h.right=0;break;default:h.top=n,h.bottom=n,h.left=n,h.right=n}else switch(t.scrollMode){case 0:h.top=Rp(n,"top",0),h.bottom=Rp(n,"bottom",0),a.left=Rp(n,"left",0),a.right=Rp(n,"right",0);break;case 1:h.top=Rp(n,"left",0),h.bottom=Rp(n,"right",0),a.top=Rp(n,"top",0),a.bottom=Rp(n,"bottom",0);break;default:h.top=Rp(n,"top",0),h.bottom=Rp(n,"bottom",0),h.left=Rp(n,"left",0),h.right=Rp(n,"right",0)}e.add(r,{column:1,row:1,align:Rp(s,"align","center"),padding:a,expand:{width:Rp(s,"expandWidth",!0),height:Rp(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:Cv(t,a,"y",e);break;case 1:Cv(t,a,"x",e);break;default:Cv(t,a,"y",e),Cv(t,a,"x",e)}return a},Tv=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}i*="Y"===t?this.scaleY:this.scaleX,s&&s.setBounds(e,i),r&&(r.setEnable(e!==i),r.tickLength&&r.setTick(r.tickLength,e,i))},_v=function(t){switch(this.scrollMode){case 0:case 1:(i=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(i,this.isOverflow),(r=this.childrenMap.scroller)&&this.disableUnscrollableDrag&&r.setEnable(this.isOverflow);break;default:var e=this[`isOverflow${t=t.toUpperCase()}`],i=this.childrenMap[`slider${t}`],s=this[`hideUnscrollableSlider${t}`];i&&s&&this.setChildVisible(i,e);var r=this.childrenMap.scroller,n=this[`disableUnscrollableDrag${t}`];r&&n&&r.setEnable(e)}},kv=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(a=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=a.childrenMap.track,s=a.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&n0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n")}return i}(this.textObject,this.text,this.lines),this.linesCount=this.lines.length,this._textHeight=void 0,this._textVisibleHeight=void 0,this.updateTextObject(),this},updateTextObject:function(){var t=Math.max(Math.floor(Av.call(this,-this.textOY)),0),e=Yv.call(this,t)+this.textOY,i=Xv.call(this,t);return function(t,e){switch(Gh(t)){case 0:var i=(r=t.style).wordWrapWidth,s=r.wordWrapCallback;r.wordWrapWidth=0,r.wordWrapCallback=void 0,t.setText(e),r.wordWrapWidth=i,r.wordWrapCallback=s;break;case 1:var r,n=(r=t.style).wrapMode;r.wrapMode=0,t.setText(e),r.wrapMode=n;break;case 2:var h=t._maxWidth;t._maxWidth=0,t.setText(e),t._maxWidth=h}}(this.textObject,i),this.textObject.rexSizer.offsetY=e,Wv.call(this),this},preLayout:function(){return this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,Ie.call(this),this},layoutChildren:function(){var t,e,i,s,r,n,h,a=this.left,o=this.top;(t=this.textObject).rexSizer.hidden||(s=a+(i=(e=t.rexSizer).padding).left*this.scaleX,r=o+i.top*this.scaleY,n=this.width*this.scaleX-(i.left+i.right)*this.scaleX,h=this.height*this.scaleY-(i.top+i.bottom)*this.scaleY,Fv.call(this,t,n,h),ae(t,s,r,n,h,e.align),e.preOffsetY=0,Wv.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const Iv=Phaser.Utils.Objects.IsPlainObject,Bv=Phaser.Utils.Objects.GetValue,Hv=Phaser.Display.Align.TOP_LEFT;class Nv extends th{constructor(t,e,i,s,r,n){Iv(e)?(e=Bv(n=e,"x",0),i=Bv(n,"y",0),s=Bv(n,"width",void 0),r=Bv(n,"height",void 0)):Iv(s)&&(s=Bv(n=s,"width",void 0),r=Bv(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexTextBlock",this.textObject=void 0,this.linesCount=0,this.textMask=void 0,this.textObjectType=void 0,this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,this._textObjectRealHeight=0,this.lines=void 0,this.text=Bv(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode(Bv(n,"clampTextOY",!0)),this.alwaysScrollable=Bv(n,"alwaysScrollable",!1);var h=Bv(n,"background",void 0),a=Bv(n,"text",void 0);void 0===a&&(a=Gv(t)),this.textCropEnable=Bv(n,"textCrop",!!a.setCrop);var o=Bv(n,"textMask",!this.textCropEnable);h&&this.addBackground(h),this.add(a),this.sizerChildren=[a];var l=this.getSizerConfig(a);l.align=Hv,l.padding=ge(0),l.expand=!0,this.textObject=a,this.textObjectType=Gh(a),l.preOffsetY=0,l.offsetY=0,o&&(this.textMask=jh.call(this,this.textObject,this)),this.addChildrenMap("background",h),this.addChildrenMap("text",a)}destroy(t){if(this.scene&&!this.ignoreDestroy){if(this.textObject=void 0,this.textMask=void 0,this.lines){switch(this.textObjectType){case 0:case 2:this.lines.length=0;break;case 1:this.lines.destroy()}this.lines=void 0}super.destroy(t)}}setClampMode(t){return void 0===t&&(t=!0),this.clampTextOY=t,this}get textLineHeight(){if(void 0===this._textLineHeight){var t;switch(this.textObjectType){case 0:case 1:var e=this.textObject.style;t=e.metrics.fontSize+e.strokeThickness;break;case 2:var i=this.textObject.fontSize/this.textObject.fontData.size;t=this.textObject.fontData.lineHeight*i}this._textLineHeight=t}return this._textLineHeight}get textLineSpacing(){if(void 0===this._textLineSpacing){var t;switch(this.textObjectType){case 0:case 1:t=this.textObject.lineSpacing;break;case 2:t=0}this._textLineSpacing=t}return this._textLineSpacing}get visibleLinesCount(){return void 0===this._visibleLinesCount&&(this._visibleLinesCount=Math.floor(Av.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=Yv.call(this,this.linesCount)),this._textHeight}get textObjectHeight(){return this._textObjectRealHeight-(this.textLineHeight+this.textLineSpacing)}get textVisibleHeight(){if(void 0===this._textVisibleHeight){var t=this.textHeight-this.textObjectHeight;!this.alwaysScrollable&&t<0&&(t=0),this._textVisibleHeight=t}return this._textVisibleHeight}textOYExceedTop(t){return void 0===t&&(t=this.textOY),t>this.topTextOY}textOYExeceedBottom(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:s?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}setTextOY(t){return this.textOY=t,this}set t(t){this.textOY=-this.textVisibleHeight*t}get t(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t}setTextOYByPercentage(t){return this.t=t,this}}var Gv=function(t){return t.add.text(0,0,"")};Object.assign(Nv.prototype,jv);var Vv={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},Uv={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const $v=Phaser.Utils.Objects.GetValue;class Jv extends Lv{constructor(t,e){void 0===e&&(e={});var i=$v(e,"text",void 0),s=$v(e,"textWidth",void 0),r=$v(e,"textHeight",void 0),n=$v(e,"textCrop",!!i.setCrop),h=$v(e,"textMask",!n),a=$v(e,"content",""),o=new Nv(t,{width:s,height:r,text:i,textMask:h,textCrop:n&&!h,content:a,clampTextOY:$v(e,"clampChildOY",!1),alwaysScrollable:$v(e,"alwaysScrollable",!1)});t.add.existing(o),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textObjectHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.textHeight}})}(o),e.scrollMode=0,e.type="rexTextArea",e.child={gameObject:o,expandWidth:void 0===s,expandHeight:void 0===r};var l=$v(e,"space",void 0);l&&(l.child=$v(l,"text",0)),super(t,e),this.addChildrenMap("text",i)}get text(){return this.childrenMap.child.text}get lineHeight(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.textHeight}}Object.assign(Jv.prototype,Vv,Uv);const Kv=Phaser.Utils.Objects.GetValue;var qv=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("key")&&(i="bitmaptext",e.font=e.key)),i){case"bitmaptext":case"bitmap":s=new lp(t,e);break;case"bbcodetext":case"bbcode":s=new np(t,0,0,"",e);break;case"label":s=new tg(t,e);break;case"textarea":s=function(t,e,i){e=e?wo(e):{};var s=Kv(i,"background",Sc),r=Kv(i,"text",qv),n=Kv(i,"track",Sc),h=Kv(i,"thumb",Sc);s?e.background=s(t,e.background):delete e.background,r?e.text=r(t,e.text):delete e.text;var a=e.slider;!1!==a&&null!==a&&(void 0===a&&(a={}),n?a.track=n(t,a.track):delete a.track,h?a.thumb=h(t,a.thumb):delete a.thumb,e.slider=a);var o=new Jv(t,e);return t.add.existing(o),o}(t,e);break;default:s=new Tc(t,e)}return wc(s,e),t.add.existing(s),s},Zv=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("leftWidth")?i="nineSlice":(e.hasOwnProperty("color")||e.hasOwnProperty("strokeColor"))&&(i="roundRectangle")),i){case"nineSlice":s=e.hasOwnProperty("stretchMode")?new bc(t,e):new Zd(t,e);break;case"roundRectangle":s=new Ul(t,e);break;default:s=new ic(t,e)}return wc(s,e),t.add.existing(s),s};const Qv=Phaser.Utils.Objects.GetValue;class tg extends xl{constructor(t,e,i){e=function(t,e,i){e=e?wo(e):{};var s=Qv(i,"background",Sc),r=Qv(i,"text",qv),n=Qv(i,"icon",Zv),h=Qv(i,"action",Zv);return null!==e.background&&s?e.background=s(t,e.background):delete e.background,null!==e.text&&r?e.text=r(t,e.text):delete e.text,null!==e.icon&&n?e.icon=n(t,e.icon):delete e.icon,null!==e.action&&h?e.action=h(t,e.action):delete e.action,e}(t,e,i),super(t,e),this.type="rexSimpleLabel"}setActiveState(t){return eg(this.getChildren(),"setActiveState",t),this}setHoverState(t){return eg(this.getChildren(),"setHoverState",t),this}setDisableState(t){return eg(this.getChildren(),"setDisableState",t),this}}var eg=function(t,e,i){for(var s=0,r=t.length;s=r&&o=i&&oi.length&&(t.prevCursorPosition=null),null!==t.prevCursorPosition&&(s=e.getCharChild(t.prevCursorPosition))&&("\n"===s.text&&s.clearTextSize(),e.emit("cursorout",s,t.prevCursorPosition,e)),null!=r&&(s=e.getCharChild(r))&&("\n"===s.text&&s.copyTextSize(e.lastInsertCursor),function(t){var e,i,s=t.parent,r=s.width,n=s.height,h=t.drawX,a=t.drawY,o=h+t.drawTLX,l=h+t.drawTRX,d=a+t.drawTLY,c=a+t.drawBLY;e=o<0?0-o:l>r?r-l:0,i=d<0?0-d:c>n?n-c:0,s._textOX+=e,s._textOY+=i}(s),e.emit("cursorin",s,r,e)),e.emit("movecursor",r,t.prevCursorPosition,e),t.prevCursorPosition=r)}(this)):(Cg(this),wg(this)),this}setNumberInput(){return this.onUpdateCallback=bg,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}}const Pg=Phaser.Utils.Objects.GetValue,Tg=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var _g=function(t,e){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return!0;if(-1!==e.indexOf(".")){for(var i=e.split("."),s=t,r=0;rt.length?i:t})),h.value=t.join(e)}else h.value=t.join(i.slice(a,a+h.count));a+=h.count,h.added||(o+=h.count)}}let l=e[h-1];return h>1&&"string"==typeof l.value&&(l.added||l.removed)&&t.equals("",l.value)&&(e[h-2].value+=l.value,e.pop()),e}Yg.prototype={diff(t,e,i={}){let s=i.callback;"function"==typeof i&&(s=i,i={}),this.options=i;let r=this;function n(t){return s?(setTimeout((function(){s(void 0,t)}),0),!0):t}t=this.castInput(t),e=this.castInput(e),t=this.removeEmpty(this.tokenize(t));let h=(e=this.removeEmpty(this.tokenize(e))).length,a=t.length,o=1,l=h+a;i.maxEditLength&&(l=Math.min(l,i.maxEditLength));let d=[{newPos:-1,components:[]}],c=this.extractCommon(d[0],e,t,0);if(d[0].newPos+1>=h&&c+1>=a)return n([{value:this.join(e),count:e.length}]);function u(){for(let s=-1*o;s<=o;s+=2){let o,l=d[s-1],c=d[s+1],u=(c?c.newPos:0)-s;l&&(d[s-1]=void 0);let p=l&&l.newPos+1=h&&u+1>=a)return n(Xg(r,o.components,e,t,r.useLongestToken));d[s]=o}else d[s]=void 0}var i;o++}if(s)!function t(){setTimeout((function(){if(o>l)return s();u()||t()}),0)}();else for(;o<=l;){let t=u();if(t)return t}},pushComponent(t,e,i){let s=t[t.length-1];s&&s.added===e&&s.removed===i?t[t.length-1]={count:s.count+1,added:e,removed:i}:t.push({count:1,added:e,removed:i})},extractCommon(t,e,i,s){let r=e.length,n=i.length,h=t.newPos,a=h-s,o=0;for(;h+1t,tokenize:t=>t.split(""),join:t=>t.join("")};const Wg=new Yg,zg=/^[a-zA-Z\u{C0}-\u{FF}\u{D8}-\u{F6}\u{F8}-\u{2C6}\u{2C8}-\u{2D7}\u{2DE}-\u{2FF}\u{1E00}-\u{1EFF}]+$/u,Fg=/\S/,jg=new Yg;jg.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!Fg.test(t)&&!Fg.test(e)},jg.tokenize=function(t){let e=t.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/);for(let t=0;tvoid 0===i?e:i}=this.options;return"string"==typeof t?t:JSON.stringify(Ng(t,null,null,i),i," ")},Hg.equals=function(t,e){return Yg.prototype.equals.call(Hg,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const Gg=new Yg;Gg.tokenize=function(t){return t.slice()},Gg.join=Gg.removeEmpty=function(t){return t};const Vg=Phaser.Utils.Array.Remove;var Ug=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),Vg(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(o=i,l=e,Wg.diff(o,l,d)),r=0,n=0,h=s.length;nr)i+=h;else{if(s!==r)break;i+=Math.min(e.position,h)}}return i},Zg={cursorMoveLeft(){if(!this.isOpened)return this;var t=Jg(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=Jg(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=Kg(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=Jg(qg(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=Kg(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=Jg(qg(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const Qg=Phaser.Utils.Objects.IsPlainObject;class tf extends dl{constructor(t,e,i,s,r,n){Qg(e)?n=e:Qg(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(_g(e,"wrap.vAlign")||jd(e,"wrap.vAlign",s=i?"center":"top"),_g(e,"wrap.wrapMode")||jd(e,"wrap.wrapMode","char"),_g(e,"wrap.maxLines")||jd(e,"wrap.maxLines",s=i?1:void 0),i&&jd(e,"wrap.wrapWidth",1/0),_g(e,"wrap.useDefaultTextHeight")||jd(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!_g(e.edit,"inputType")){var s=i?"text":"textarea";jd(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new Eg(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var h=n.text;h&&delete n.text;var a=jl(n.background,"focus"),o=jl(n.style,"cursor"),l=jl(n.style,"range");super(t,e,i,s,r,n),this.type="rexCanvasInput",this.contentWidth=void 0,this.contentHeight=void 0,this.lineHeight=void 0,this.linesCount=void 0,this.characterCountOfLines=[],this._text,this.textEdit=function(t,e){var i=Pg(e,"edit");return void 0===i&&(i={}),rg(e,i,Tg),new Og(t,i)}(this,n),Mg.call(this),n.focusStyle&&Object.assign(a,n.focusStyle),Ag.call(this,a),n.cursorStyle&&Object.assign(o,n.cursorStyle),Lg.call(this,o),n.rangeStyle&&Object.assign(l,n.rangeStyle),Rg(l)&&Object.assign(l,o),Dg.call(this,l);var d=n.onAddChar;d&&this.on("addchar",d);var c=n.onCursorIn;c&&this.on("cursorin",c);var u=n.onCursorOut;u&&this.on("cursorout",u);var p=!n.onRangeIn&&!n.onRangeOut,v=p?n.onCursorIn:n.onRangeIn;v&&this.on("rangein",v);var g=p?n.onCursorOut:n.onRangeOut;g&&this.on("rangeout",g);var f,m=n.onMoveCursor;m&&this.on("movecursor",m),this.setParseTextCallback(n.parseTextCallback),this.lastInsertCursor=((f=this.createCharChild("|")).text="",f),h||(h=""),this.setText(h)}addChild(t,e){if(super.addChild(t,e),Array.isArray(t))for(var i=t,s=0,r=i.length;s=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const k=Phaser.Math.DegToRad;var T={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=k(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},_={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=O(t.scaleX,i.scaleX),e.scaleY=O(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},E={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=O(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},L={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},D={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},A={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(t){void 0===t&&(t=!1);var e=this;return this._mask=null,this.setChildMaskVisible(this),this.children.forEach((function(t){t.clearMask&&t.clearMask(!1),t.hasOwnProperty("isRexContainerLite")||e.setChildMaskVisible(t)})),t&&this.mask&&this.mask.destroy(),this}},Y=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},W=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const F=Phaser.Utils.Array;var I={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},_e=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const Ee=/(\S+)\[(\d+)\]/i,Me=Phaser.Utils.Objects.GetValue;var Re=function(t,e){return void 0===e?t:t[e]},Le=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Me(e,"left",0),t.right=Me(e,"right",0),t.top=Me(e,"top",0),t.bottom=Me(e,"bottom",0)),t},De={getInnerPadding(t){return Re(this.space,t)},setInnerPadding(t,e){return Le(this.space,t,e),this},getOuterPadding(t){return Re(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Le(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Re(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Le(this.getSizerConfig(t).padding,e,i),this}},Ae=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Ye=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},ze=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Xe=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},We=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},je=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Fe={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Ie=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?mi:fi,this.repeatCounter=0,this}stop(){return this.state=gi,this}update(t,e){this.state!==gi&&this.state!==xi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=yi)):(this.nowTime=this.duration,this.state=xi):this.nowTime>=0&&(this.state=mi))}get t(){var t;switch(this.state){case gi:case fi:case yi:t=0;break;case mi:t=this.nowTime/this.duration;break;case xi:t=1}return pi(t,0,1)}set t(t){(t=pi(t,-1,1))<0?(this.state=fi,this.nowTime=-this.delay*t):(this.state=mi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===gi}get isDelay(){return this.state===fi}get isCountDown(){return this.state===mi}get isRunning(){return this.state===fi||this.state===mi}get isDone(){return this.state===xi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const gi=0,fi=1,mi=2,yi=3,xi=-1;class bi extends di{constructor(t,e){super(t,e),this.timer=new vi}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const Ci=Phaser.Utils.Objects.GetValue,wi=Phaser.Utils.Objects.GetAdvancedValue,Si=Phaser.Tweens.Builders.GetEaseFunction;class Oi extends bi{resetFromJSON(t){return this.timer.resetFromJSON(Ci(t,"timer")),this.setEnable(Ci(t,"enable",!0)),this.setTarget(Ci(t,"target",this.parent)),this.setDelay(wi(t,"delay",0)),this.setDuration(wi(t,"duration",1e3)),this.setEase(Ci(t,"ease","Linear")),this.setRepeat(Ci(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Si(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Pi=Phaser.Utils.Objects.GetValue,ki=Phaser.Utils.Objects.GetAdvancedValue,Ti=Phaser.Math.Linear;let _i=class extends Oi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Pi(t,"mode",0)),this.setScaleRange(ki(t,"start",void 0),ki(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ei[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=ki(t,"x",this.parent.scaleX),this.startY=ki(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=ki(e,"x",void 0),this.endY=ki(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Ti(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Ti(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const Ei={stop:0,destroy:1,yoyo:2};var Mi=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new _i(t,a):r.resetFromJSON(a),r.restart(),r},Ri=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof _i&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new _i(t,h):n.resetFromJSON(h),n.restart(),n},Li=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Di=function(t){return Li(t,"complete")};const Ai=Phaser.Utils.Objects.IsPlainObject;var Yi={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Ai(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Mi(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Di(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Ai(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Ri(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Di(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Di(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Ai(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new _i(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Di(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},zi={};Object.assign(zi,Yi),zi.onInitScale=function(){Yi.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=be.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Xi=Phaser.Utils.Objects.GetValue,Wi=Phaser.Utils.Objects.GetAdvancedValue,ji=Phaser.Math.Linear;class Fi extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Xi(t,"mode",0)),this.setAlphaRange(Wi(t,"start",this.parent.alpha),Wi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ii[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=ji(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ii={stop:0,destroy:1,yoyo:2},Bi=Phaser.Utils.Objects.IsPlainObject;var Hi=function(t,e,i,s){var r,n;Bi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Fi(t,h):s.resetFromJSON(h),s.restart(),s},Gi=function(t,e,i,s){i instanceof Fi&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Fi(t,r):s.resetFromJSON(r),s.restart(),s};const Vi=Phaser.Utils.Objects.IsPlainObject;var Ni={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Vi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Hi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Di(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Vi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Gi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Di(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Di(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Ui={};Object.assign(Ui,Ni),Ui.onInitFade=function(){Ni.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=be.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const $i=Phaser.Utils.Objects.GetValue,Ji=Phaser.Utils.Objects.GetAdvancedValue,qi=Phaser.Math.Linear;class Ki extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode($i(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ji(t,"x",void 0),i=Ji(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Zi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Ji(i,"startX",void 0),this.startY=Ji(i,"startY",void 0),this.endX=Ji(i,"endX",void 0),this.endY=Ji(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=qi(this.startX,this.endX,i)),this.hasMoveY&&(t.y=qi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Zi={stop:0,destroy:1,yoyo:2};var Qi=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const ts=Phaser.Utils.Objects.IsPlainObject,es=Phaser.Math.Distance.Between;var is={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(ts(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*es(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Ki&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=Qi(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=Qi(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Ki(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Di(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Di(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(ts(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*es(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Ki&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=Qi(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=Qi(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Ki(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Di(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Di(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},ss={};Object.assign(ss,is),ss.onInitEaseMove=function(){is.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=be.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const rs=Phaser.Utils.Objects.GetValue;class ns extends ai{constructor(t,e){super(t,e),this.timer=new vi,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(rs(t,"timer")),this.setEnable(rs(t,"enable",!0)),this.setMode(rs(t,"mode",1)),this.isRunning=rs(t,"isRunning",!1),this.setMagnitudeMode(rs(t,"magnitudeMode",1)),this.setAxisMode(rs(t,"axis",0)),this.setDuration(rs(t,"duration",500)),this.setMagnitude(rs(t,"magnitude",10)),this.ox=rs(t,"ox",void 0),this.oy=rs(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=hs[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=os[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=as[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=rs(i,"magnitude",void 0),t=rs(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const hs={effect:0,behavior:1},as={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},os={constant:0,decay:1},ls=Phaser.Utils.Objects.IsPlainObject;var ds={shake(t,e,i){if(ls(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new ns(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Di(this._shake)}};const cs=Phaser.Utils.Objects.GetValue,us=Phaser.Math.Linear;class ps extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=cs(t,"key","value");var i=e[this.propertyKey];return this.fromValue=cs(t,"from",i),this.toValue=cs(t,"to",i),this.setEase(cs(t,"ease",this.ease)),this.setDuration(cs(t,"duration",this.duration)),this.setRepeat(cs(t,"repeat",0)),this.setDelay(cs(t,"delay",0)),this.setRepeatDelay(cs(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=us(this.fromValue,this.toValue,i)}}const vs=Phaser.Utils.Objects.IsPlainObject;class gs extends ii{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new ps(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(vs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(vs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var fs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new gs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Li(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},ms=Phaser.Utils.Array.Remove,ys={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var Ds={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Ke(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},As={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=Xt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=Xt),this.transitOutCallback=t,this}},Ys={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},zs={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Xs={};Object.assign(Xs,Ds,As,Ys,zs);const Ws=Phaser.Utils.Objects.GetValue;class js extends ii{constructor(t,e){super(t,e),this.setTransitInTime(Ws(e,"duration.in",200)),this.setTransitOutTime(Ws(e,"duration.out",200)),this.setTransitInCallback(Ws(e,"transitIn")),this.setTransitOutCallback(Ws(e,"transitOut")),this.oneShotMode=Ws(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Ls(this,{eventEmitter:!1,initState:Ws(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(js.prototype,Xs);var Fs=function(t){if(t.parentContainer)return Fs(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?Fs(e):t};class Is extends ii{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Fs(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Bs=Phaser.GameObjects.Rectangle;let Hs=class extends Bs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Is(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}};const Gs=Phaser.Utils.Objects.GetValue;class Vs extends ii{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Gs(t,"hitAreaMode",0)),this.setEnable(Gs(t,"enable",!0)),this.setStopMode(Gs(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Ns[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Ns={default:0,fullWindow:1};const Us=Phaser.Utils.Objects.GetValue;class $s extends Hs{constructor(t,e){super(t,Us(e,"color",0),Us(e,"alpha",.8)),this.touchEventStop=new Vs(this,{hitAreaMode:1})}}var Js={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Mi(t,e)},scaleDown(t,e){Ri(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Hi(t,e)},fadeOut(t,e){Gi(t,e,!1)}},qs=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Hi(t,e,t.alpha)},Ks=function(t,e){Gi(t,e,!1)},Zs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!nt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Qs=Phaser.Utils.Objects.GetValue;let tr=class extends js{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=er.popUp),null==e.transitOut&&(e.transitOut=er.scaleDown),e.destroy=Qs(e,"destroy",!0),super(t,e);var i=Qs(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new $s(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Qs(i,"transitIn",qs)),this.setCoverTransitOutCallback(Qs(i,"transitOut",Ks)));var s=Qs(e,"touchOutsideClose",!1),r=Qs(e,"duration.hold",-1),n=Qs(e,"timeOutClose",r>=0),h=Qs(e,"anyTouchClose",!1);Qs(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Qs(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Zs(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=er[t]),t){case er.popUp:t=Js.popUp;break;case er.fadeIn:t=Js.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=er[t]),t){case er.scaleDown:t=Js.scaleDown;break;case er.fadeOut:t=Js.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const er={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var ir=function(t){return t&&"function"==typeof t},sr={modal(t,e){return ir(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new tr(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},rr=function(t,e,i,s,r){ir(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},nr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return rr.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return rr.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return rr.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return rr.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return rr.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return rr.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return rr.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return rr.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return rr.call(this,"shutdown",t,e,i,s),this}},hr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=ar),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},ar={},or=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?Zs(t,e.x,e.y,i,s):!!(r=hr(e,n,!0))&&Zs(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const xr={press:0,pointerdown:0,release:1,pointerup:1};var br={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new yr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},Cr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!wr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return Sr.length=0,!0;return Sr.length=0,!1},Sr=[];const Or=Phaser.Utils.Objects.GetValue;class Pr extends ii{constructor(t,e){super(t,e),this._enable=void 0;var i=Or(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Or(t,"enable",!0)),this.setMode(Or(t,"mode",1)),this.setClickInterval(Or(t,"clickInterval",100)),this.setDragThreshold(Or(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=kr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?Cr:or)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const kr={press:0,pointerdown:0,release:1,pointerup:1};var Tr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Pr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class _r extends Rs{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Er=Phaser.Utils.Objects.GetValue;class Mr extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new _r,this.parent.setInteractive(Er(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Er(t,"enable",!0)),this.setCooldown(Er(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Rr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&or(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Mr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Mr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Lr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Dr=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Jr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===qr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Jr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Kr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&or(t,s,e,i)}}const Jr=0,qr=1,Kr="IDLE",Zr=Phaser.Utils.Objects.GetValue,Qr=Phaser.Math.Distance.Between;class tn extends $r{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=en},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Zr(t,"time",250)),this.setTapInterval(Zr(t,"tapInterval",200)),this.setDragThreshold(Zr(t,"threshold",9)),this.setTapOffset(Zr(t,"tapOffset",10));var e=Zr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Zr(t,"maxTaps",void 0)),this.setMinTaps(Zr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case en:this.state=sn;break;case sn:var t=this.lastPointer;Qr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=rn,this.state=sn);break;case rn:this.state=sn}}onDragEnd(){this.state===sn&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=rn))}onDrag(){this.state!==en&&this.pointer.getDistance()>this.dragThreshold&&(this.state=en)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===sn){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=en):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=rn:this.state=en)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===rn&&(this.state=en)}get isTapped(){return this.state===rn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const en="IDLE",sn="BEGIN",rn="RECOGNIZED",nn=Phaser.Utils.Objects.GetValue;class hn extends $r{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=an},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(nn(t,"threshold",9)),this.setHoldTime(nn(t,"time",251)),this}onDragStart(){this.state=on,0===this.holdTime&&(this.state=ln)}onDragEnd(){this.state=an}onDrag(){this.state!==an&&this.pointer.getDistance()>this.dragThreshold&&(this.state=an)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===on&&t-this.pointer.downTime>=this.holdTime&&(this.state=ln)}get isPressed(){return this.state===ln}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const an="IDLE",on="BEGIN",ln="RECOGNIZED";Phaser.Utils.Objects.GetValue;var dn=function(t){return ti(t).loop.delta};const cn=Phaser.Math.Distance.Between,un=Phaser.Math.Angle.Between;var pn={getDt:function(){return dn(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return cn(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return un(e.x,e.y,t.x,t.y)}},vn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},gn={};const fn=Phaser.Utils.Objects.GetValue,mn=Phaser.Math.RadToDeg;class yn extends $r{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=xn},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(fn(t,"threshold",10)),this.setVelocityThreshold(fn(t,"velocityThreshold",1e3)),this.setDirectionMode(fn(t,"dir","8dir")),this}onDragStart(){this.state=bn}onDragEnd(){this.state=xn}onDrag(){this.state===bn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=Cn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Cn&&(this.state=xn)}get isSwiped(){return this.state===Cn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=vn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=gn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(mn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(yn.prototype,pn);const xn="IDLE",bn="BEGIN",Cn="RECOGNIZED",wn=Phaser.Utils.Objects.GetValue,Sn=Phaser.Utils.Array.SpliceOne,On=Phaser.Math.Distance.Between,Pn=Phaser.Math.Angle.Between;class kn{constructor(t,e){var i=Ke(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(wn(e,"inputConfig",void 0)),this.setEventEmitter(wn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(wn(t,"enable",!0)),this.bounds=wn(t,"bounds",void 0),this.tracerState=_n,this.pointers.length=0,ft(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,ft(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case _n:this.tracerState=En,this.onDrag1Start();break;case En:this.tracerState=Mn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],Sn(this.pointers,e),this.tracerState){case En:this.tracerState=_n,this.onDrag1End();break;case Mn:this.tracerState=En,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case En:this.onDrag1();break;case Mn:this.onDrag2()}}}dragCancel(){return this.tracerState===Mn&&this.onDrag2End(),this.pointers.length=0,ft(this.movedState),this.tracerState=_n,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0],e=this.pointers[1];return On(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0],e=this.pointers[1];return Pn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Tn.x=e.x-i.x,Tn.y=e.y-i.y}else Tn.x=0,Tn.y=0;return Tn}get centerX(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Mn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Mn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Rn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&or(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&or(t,s,e,i)}}Object.assign(kn.prototype,$e);var Tn={};const _n=0,En=1,Mn=2,Rn="IDLE";Phaser.Utils.Objects.GetValue;const Ln=Phaser.Math.RotateAround;var Dn=function(t,e,i,s){return Ln(t,e,i,s),t.rotation+=s,t},An={};const Yn=Phaser.Utils.Objects.GetValue,zn=Phaser.Math.Angle.WrapDegrees,Xn=Phaser.Math.Angle.ShortestBetween,Wn=Phaser.Math.RadToDeg,jn=Phaser.Math.DegToRad;var Fn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=An),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=zn(Wn(this.angleBetween));this.angle=Xn(this.prevAngle,t),this.prevAngle=t,this.state=Hn}break;case Hn:t=zn(Wn(this.angleBetween)),this.angle=Xn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Hn}get rotation(){return jn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Fn);const In="IDLE",Bn="BEGIN",Hn="RECOGNIZED",Gn=Phaser.Utils.Objects.GetValue;var Vn=function(t){var e=Gn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new tn(this,e),this._tap.on("tap",(function(t,e,s){Ar(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Ar(i.eventEmitter,`${i.eventNamePrefix}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Nn=Phaser.Utils.Objects.GetValue;var Un=function(t){var e=Nn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new hn(this,e),this._press.on("pressstart",(function(t,e,s){Ar(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this).on("pressend",(function(t,e,s){Ar(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const $n=Phaser.Utils.Objects.GetValue;var Jn=function(t){var e=$n(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new yn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Ar(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Ar(i.eventEmitter,`${i.eventNamePrefix}swipe`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const qn=Phaser.Utils.Objects.GetValue;var Kn=function(t,e){return t.setInteractive(),qn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:qn(e,"targets",[t]),targetMode:qn(e,"targetMode","parent"),eventEmitter:qn(e,"eventEmitter",t),eventNamePrefix:qn(e,"inputEventPrefix","child.")},zr.call(t,e),jr.call(t,e),Br.call(t,e),Nr.call(t,e),Vn.call(t,e),Un.call(t,e),Jn.call(t,e),t},Zn={getSizerConfig:function(t){return void 0===t&&(t=this),Mt(t)},getChildPrevState:function(t){var e=Mt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Dt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=oe(e,"color"),s=oe(e,"lineWidth");var o=oe(e,"name",!1);o&&(r=oe(o,"createTextCallback",ce),n=oe(o,"createTextCallbackScope",void 0),"string"==typeof(h=oe(o,"align","left-top"))&&(h=zt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new le(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}var d,c,u=this.getAllShownChildren([this]);ue(u,u);for(var p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const ah=Phaser.Utils.Objects.IsPlainObject,oh=Phaser.Utils.Objects.GetValue,lh=Phaser.Display.Align.CENTER,dh={min:0,full:-1};var ch=function(t,e,i,s,r,n,h,a,o,l){var d,c,u,p;me.call(this,t);var v=t.isRexSpace,g=typeof e;if(null===e)return this;if("number"===g);else if("string"===g)e=dh[e];else if(ah(e)){var f;e=oh(f=e,"proportion",void 0),i=oh(f,"align",lh),s=oh(f,"padding",0),r=oh(f,"expand",!1),n=oh(f,"key",void 0),h=oh(f,"index",void 0),t.isRexSizer||(a=oh(f,"minWidth",void 0),o=oh(f,"minHeight",void 0)),l=oh(f,"fitRatio",0),d=oh(f,"offsetX",0),c=oh(f,"offsetY",0),u=oh(f,"offsetOriginX",0),p=oh(f,"offsetOriginY",0)}return"string"==typeof i&&(i=zt[i]),void 0===e&&(e=v?1:0),void 0===i&&(i=lh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(v?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(v?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),(f=this.getSizerConfig(t)).proportion=e,f.align=i,f.padding=ge(s),f.expand=r,f.fitRatio=0===e?l:0,f.alignOffsetX=d,f.alignOffsetY=c,f.alignOffsetOriginX=u,f.alignOffsetOriginY=p,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},uh={add:ch,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),ch.call(this,new nh(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return ah(i)&&(i.index=t),ch.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=hh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const ph=Et.prototype.clear;var vh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),ph.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,vh.call(this,t),this}},mh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=zt[e]),this.getSizerConfig(t).align=e,this}},yh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},xh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},bh={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},Ch={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Ge(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Ie.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d,c,u=this.sizerChildren,p=this.innerLeft,v=this.innerTop,g=this.innerWidth,f=this.innerHeight,m=p,y=v,x=this.startChildIndex,b=0,C=u.length;b0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Xe.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Ye.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&sh.call(this,t,void 0),ze.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||We.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&sh.call(this,void 0,t),je.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(Ch,uh,fh,mh,yh,xh,bh);var wh=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},Sh={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},Oh=function(t){return"string"==typeof t&&(t=Sh[t]),t};const Ph=Phaser.Utils.Objects.IsPlainObject,kh=Phaser.Utils.Objects.GetValue;class Th extends th{constructor(t,e,i,s,r,n,h){Ph(e)?(e=kh(h=e,"x",0),i=kh(h,"y",0),s=kh(h,"width",void 0),r=kh(h,"height",void 0),n=kh(h,"orientation",0)):Ph(s)?(s=kh(h=s,"width",void 0),r=kh(h,"height",void 0),n=kh(h,"orientation",0)):Ph(n)&&(n=kh(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(kh(h,"space.item",0)),this.setStartChildIndex(kh(h,"startChildIndex",0)),this.setRTL(kh(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=Oh(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=wh.call(this)),this._childrenProportion}}Object.assign(Th.prototype,Ch);var _h=Phaser.Renderer.WebGL.Utils,Eh=function(t,e,i,s,r,n){for(var h=_h.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),a=i.pathData,o=i.pathIndexes,l=0;l>>16,a=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+h+","+a+","+o+","+n+")"},Ah=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,h=(16711680&r)>>>16,a=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+h+","+a+","+o+","+n+")",t.lineWidth=e.lineWidth};const Yh=Phaser.Renderer.Canvas.SetTransform;var zh={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Lh(e,i,s),h=r.calcMatrix.copyFrom(n.calc),a=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&Eh(r,h,e,l,a,o),e.isStroked&&Rh(r,e,l,a,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(Yh(t,r,e,i,s)){var n=e._displayOriginX,h=e._displayOriginY,a=e.pathData,o=a.length-1,l=a[0]-n,d=a[1]-h;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(Wh.prototype,zh);const jh=Phaser.Utils.Objects.GetValue;let Fh=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=jh(t,"x",0),i=jh(t,"y",0));var s=this.cornerRadius;s.tl=Ih(jh(t,"tl",void 0),e,i),s.tr=Ih(jh(t,"tr",void 0),e,i),s.bl=Ih(jh(t,"bl",void 0),e,i),s.br=Ih(jh(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Bh(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Bh(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Bh(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Bh(this.cornerRadius.br,t)}};var Ih=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Hh(t),t},Bh=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=jh(e,"x",0),t.y=jh(e,"y",0)),Hh(t)},Hh=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},Gh=function(t){return t.x>0&&t.y>0},Vh=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const Nh=Phaser.Math.DegToRad;var Uh=function(t,e,i,s,r,n,h,a,o){h&&n>r?n-=360:!h&&n0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(Ra.prototype,Ta);const La=Phaser.Utils.String.Pad;var Da=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${La(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},Aa=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Ya=Phaser.Math.DegToRad;var za=function(t){return!t.hasOwnProperty("convex")||t.convex},Xa=function(t){return t.x>0&&t.y>0},Wa=function(t,e,i,s,r,n,h,a,o){if(a&&h>n?h-=360:!a&&h=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=m.tl,Xa(a)?(o=a.x*g,l=a.y*f,za(a)?Wa(t,o,l,o,l,180,270,!1,h):Wa(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,Xa(a)?(o=a.x*g,l=a.y*f,za(a)?Wa(t,s-o,l,o,l,270,360,!1,h):Wa(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,Xa(a)?(o=a.x*g,l=a.y*f,za(a)?Wa(t,s-o,r-l,o,l,0,90,!1,h):Wa(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,Xa(a)?(o=a.x*g,l=a.y*f,za(a)?Wa(t,o,r-l,o,l,90,180,!1,h):Wa(t,0,r,o,l,360,270,!0,h)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,h,u),null!=a)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,a),p.addColorStop(1,d),a=p),e.fillStyle=a,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())},Fa=function(t,e,i,s,r,n,h,a){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),ja(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}};const Ia=Phaser.Utils.Objects.GetValue;class Ba extends Ra{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(Ia(e,"color",null),Ia(e,"color2",null),Ia(e,"horizontalGradient",!0)),this.setStroke(Ia(e,"stroke",null),Ia(e,"strokeThickness",2)),this.setCornerRadius(Ia(e,"cornerRadius",0),Ia(e,"cornerIteration",null))}set color(t){t=Da(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Da(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Da(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,Aa("color2",t,this),Aa("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Aa("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Aa("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){Fa(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Ha=Phaser.Utils.Objects.GetValue;class Ga extends Ra{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(Ha(e,"color",null),Ha(e,"color2",null),Ha(e,"horizontalGradient",!0)),this.setStroke(Ha(e,"stroke",null),Ha(e,"strokeThickness",2))}set color(t){t=Da(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Da(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Da(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,Ha(t,"color2",null),Ha(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Ha(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,h=this.parent.height-i.top-i.bottom,a=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?a.createLinearGradient(0,0,n,0):a.createLinearGradient(0,0,0,h)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,a.fillStyle=t,a.fillRect(s,r,n,h));null!=this.stroke&&this.strokeThickness>0&&(a.strokeStyle=this.stroke,a.lineWidth=this.strokeThickness,a.strokeRect(s,r,n,h))}}const Va=Phaser.Utils.Objects.GetValue;let Na=class t{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(Va(t,"bold",!1)),this.setItalic(Va(t,"italic",!1)),this.setFontSize(Va(t,"fontSize","16px")),this.setFontFamily(Va(t,"fontFamily","Courier")),this.setColor(Va(t,"color","#fff")),this.setStrokeStyle(Va(t,"stroke",null),Va(t,"strokeThickness",0)),this.setShadow(Va(t,"shadowColor",null),Va(t,"shadowOffsetX",0),Va(t,"shadowOffsetY",0),Va(t,"shadowBlur",0)),this.setOffset(Va(t,"offsetX",0),Va(t,"offsetY",0)),this.setSpace(Va(t,"leftSpace",0),Va(t,"rightSpace",0)),this.setAlign(Va(t,"align",void 0)),this.setBackgroundColor(Va(t,"backgroundColor",null)),this.setBackgroundHeight(Va(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Va(t,"backgroundBottomY",void 0)),this.setBackgroundLeftX(Va(t,"backgroundLeftX",0)),this.setBackgroundRightX(Va(t,"backgroundRightX",0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(Aa("stroke",t,this),Aa("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Aa("shadowOffsetX",t,this),Aa("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),t.hasOwnProperty("backgroundLeftX")&&this.setBackgroundLeftX(t.backgroundLeftX),t.hasOwnProperty("backgroundRightX")&&this.setBackgroundRightX(t.backgroundRightX),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new t(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=Da(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=Da(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=Da(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=Da(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setBackgroundLeftX(t){return this.backgroundLeftX=t,this}setBackgroundRightX(t){return this.backgroundRightX=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}};const Ua=Phaser.Utils.Array.Remove,$a=Phaser.Utils.Array.Remove,Ja="text",qa="image",Ka="drawer",Za="space",Qa="command";var to=function(t){return t.type===Ja&&"\n"===t.text},eo=function(t){return t.type===Ja&&"\f"===t.text},io=function(t){return t.type===Ja};class so extends Ra{constructor(t,e,i){super(t,Ja),this.updateTextFlag=!1,this.style=new Na(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX+e.backgroundLeftX,s=i,r=this.drawTRX+e.backgroundRightX-i+1;if(r>0){var n=e.backgroundBottomY;null==n&&(n=this.drawBLY);var h=e.backgroundHeight;null==h&&(h=n-this.drawTLY);var a=n-h;t.fillRect(s,a,r,h)}}var o=e.hasFill,l=e.hasStroke;(o||l)&&(e.syncFont(t).syncStyle(t),l&&(e.syncShadow(t),t.strokeText(this.text,0,0)),o&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var ro=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const no=Phaser.Display.Canvas.CanvasPool;var ho=function(t,e,i,s,r,n,h,a){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===a&&(a=!1),a&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(h){var l=no.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=h,d.fillRect(0,0,r,n),o.drawImage(l,0,0,r,n,i,s,r,n),no.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)};Phaser.Display.Canvas.CanvasPool;class ao extends Ra{constructor(t,e,i){super(t,qa),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){ho(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class oo extends Ra{constructor(t,e,i,s){super(t,Ka),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class lo extends Ra{constructor(t,e){super(t,Za),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class co extends ca{constructor(t,e,i,s,r){super(t,Qa),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}function uo(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>uo(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=uo(t[i]));return e}var po=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const vo={none:0,word:1,char:2,character:2,mix:3};var go=/^[\x00-\x7F]+$/,fo=function(t){return go.test(t)},mo=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,h=!r&&!n,a=t.length,o=e,l=s.word,d=0,c=!1;o0&&!a){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=Co.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=Co.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=So(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=So(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=So(t,"wrapMode");void 0===c&&(c=So(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=vo[c]);var u=So(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=So(t,"letterSpacing",0),v=So(t,"hAlign",0),g=So(t,"vAlign",0),f=So(t,"justifyPercentage",.25),m=po({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:h,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,x=0,b=y.length;x0&&(E.push({children:M,width:R}),L=Math.max(L,R)),m.start+=_.length,m.isLastPage=!D&&m.start===T,m.maxLineWidth=L,m.linesHeight=E.length*n;var F=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,I=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,h=t.vAlign,a=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(h=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=ko(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=ko(t,"maxLines",0);var a=0===i,o=ko(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=ko(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=ko(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=ko(t,"letterSpacing",0),p=ko(t,"rtl",!0),v=ko(t,"hAlign",p?2:0),g=ko(t,"vAlign",0),f=po({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:o,wrapHeight:c,rtl:p}),m=this.children,y=0,x=m.length;y0&&(_.push({children:E,height:M}),R=Math.max(R,M)),f.start+=T.length,f.isLastPage=f.start===k,f.maxLineHeight=R,f.linesWidth=_.length*n;var X=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,W=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,h=t.vAlign,a=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}a&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,h=i.bottom;return Le(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return Re(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),Ua(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return $a(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(Ja);return null===i?i=new so(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),ka(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const Ko=Phaser.Utils.Objects.GetFastValue;var Zo={};class Qo{constructor(t){this.pools=Ko(t,"pools",Zo)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new qo),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;e=r&&o=i&&oi.length&&(t.prevCursorPosition=null),null!==t.prevCursorPosition&&(s=e.getCharChild(t.prevCursorPosition))&&("\n"===s.text&&s.clearTextSize(),e.emit("cursorout",s,t.prevCursorPosition,e)),null!=r&&(s=e.getCharChild(r))&&("\n"===s.text&&s.copyTextSize(e.lastInsertCursor),function(t){var e,i,s=t.parent,r=s.width,n=s.height,h=t.drawX,a=t.drawY,o=h+t.drawTLX,l=h+t.drawTRX,d=a+t.drawTLY,c=a+t.drawBLY;e=o<0?0-o:l>r?r-l:0,i=d<0?0-d:c>n?n-c:0,s._textOX+=e,s._textOY+=i}(s),e.emit("cursorin",s,r,e)),e.emit("movecursor",r,t.prevCursorPosition,e),t.prevCursorPosition=r)}(this)):(wl(this),Sl(this)),this}setNumberInput(){return this.onUpdateCallback=Cl,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}}const kl=Phaser.Utils.Objects.GetValue,Tl=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var _l=function(t,e){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return!0;if(-1!==e.indexOf(".")){for(var i=e.split("."),s=t,r=0;rt.length?i:t})),h.value=t.join(e)}else h.value=t.join(i.slice(a,a+h.count));a+=h.count,h.added||(o+=h.count)}}let l=e[h-1];return h>1&&"string"==typeof l.value&&(l.added||l.removed)&&t.equals("",l.value)&&(e[h-2].value+=l.value,e.pop()),e}Il.prototype={diff(t,e,i={}){let s=i.callback;"function"==typeof i&&(s=i,i={}),this.options=i;let r=this;function n(t){return s?(setTimeout((function(){s(void 0,t)}),0),!0):t}t=this.castInput(t),e=this.castInput(e),t=this.removeEmpty(this.tokenize(t));let h=(e=this.removeEmpty(this.tokenize(e))).length,a=t.length,o=1,l=h+a;i.maxEditLength&&(l=Math.min(l,i.maxEditLength));let d=[{newPos:-1,components:[]}],c=this.extractCommon(d[0],e,t,0);if(d[0].newPos+1>=h&&c+1>=a)return n([{value:this.join(e),count:e.length}]);function u(){for(let s=-1*o;s<=o;s+=2){let o,l=d[s-1],c=d[s+1],u=(c?c.newPos:0)-s;l&&(d[s-1]=void 0);let p=l&&l.newPos+1=h&&u+1>=a)return n(Bl(r,o.components,e,t,r.useLongestToken));d[s]=o}else d[s]=void 0}var i;o++}if(s)!function t(){setTimeout((function(){if(o>l)return s();u()||t()}),0)}();else for(;o<=l;){let t=u();if(t)return t}},pushComponent(t,e,i){let s=t[t.length-1];s&&s.added===e&&s.removed===i?t[t.length-1]={count:s.count+1,added:e,removed:i}:t.push({count:1,added:e,removed:i})},extractCommon(t,e,i,s){let r=e.length,n=i.length,h=t.newPos,a=h-s,o=0;for(;h+1t,tokenize:t=>t.split(""),join:t=>t.join("")};const Hl=new Il,Gl=/^[a-zA-Z\u{C0}-\u{FF}\u{D8}-\u{F6}\u{F8}-\u{2C6}\u{2C8}-\u{2D7}\u{2DE}-\u{2FF}\u{1E00}-\u{1EFF}]+$/u,Vl=/\S/,Nl=new Il;Nl.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!Vl.test(t)&&!Vl.test(e)},Nl.tokenize=function(t){let e=t.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/);for(let t=0;tvoid 0===i?e:i}=this.options;return"string"==typeof t?t:JSON.stringify(ql(t,null,null,i),i," ")},Jl.equals=function(t,e){return Il.prototype.equals.call(Jl,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const Kl=new Il;Kl.tokenize=function(t){return t.slice()},Kl.join=Kl.removeEmpty=function(t){return t};const Zl=Phaser.Utils.Array.Remove;var Ql=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),Zl(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(o=i,l=e,Hl.diff(o,l,d)),r=0,n=0,h=s.length;nr)i+=h;else{if(s!==r)break;i+=Math.min(e.position,h)}}return i},rd={cursorMoveLeft(){if(!this.isOpened)return this;var t=ed(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=ed(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=id(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=ed(sd(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=id(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=ed(sd(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const nd=Phaser.Utils.Objects.IsPlainObject;class hd extends il{constructor(t,e,i,s,r,n){nd(e)?n=e:nd(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(_l(e,"wrap.vAlign")||Ml(e,"wrap.vAlign",s=i?"center":"top"),_l(e,"wrap.wrapMode")||Ml(e,"wrap.wrapMode","char"),_l(e,"wrap.maxLines")||Ml(e,"wrap.maxLines",s=i?1:void 0),i&&Ml(e,"wrap.wrapWidth",1/0),_l(e,"wrap.useDefaultTextHeight")||Ml(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!_l(e.edit,"inputType")){var s=i?"text":"textarea";Ml(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new Ll(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var h=n.text;h&&delete n.text;var a=Dl(n.background,"focus"),o=Dl(n.style,"cursor"),l=Dl(n.style,"range");super(t,e,i,s,r,n),this.type="rexCanvasInput",this.contentWidth=void 0,this.contentHeight=void 0,this.lineHeight=void 0,this.linesCount=void 0,this.characterCountOfLines=[],this._text,this.textEdit=function(t,e){var i=kl(e,"edit");return void 0===i&&(i={}),nl(e,i,Tl),new Pl(t,i)}(this,n),Al.call(this),n.focusStyle&&Object.assign(a,n.focusStyle),Fl.call(this,a),n.cursorStyle&&Object.assign(o,n.cursorStyle),Wl.call(this,o),n.rangeStyle&&Object.assign(l,n.rangeStyle),Yl(l)&&Object.assign(l,o),jl.call(this,l);var d=n.onAddChar;d&&this.on("addchar",d);var c=n.onCursorIn;c&&this.on("cursorin",c);var u=n.onCursorOut;u&&this.on("cursorout",u);var p=!n.onRangeIn&&!n.onRangeOut,v=p?n.onCursorIn:n.onRangeIn;v&&this.on("rangein",v);var g=p?n.onCursorOut:n.onRangeOut;g&&this.on("rangeout",g);var f,m=n.onMoveCursor;m&&this.on("movecursor",m),this.setParseTextCallback(n.parseTextCallback),this.lastInsertCursor=((f=this.createCharChild("|")).text="",f),h||(h=""),this.setText(h)}addChild(t,e){if(super.addChild(t,e),Array.isArray(t))for(var i=t,s=0,r=i.length;s0&&(r=!0,void 0===n&&(n=0),void 0===h&&(h=0)),(u=this.getSizerConfig(t)).align=i,u.padding=ge(s),Ed(r)?(u.expandWidth=Md(r,"width",!1),u.expandHeight=Md(r,"height",!1)):(u.expandWidth=r,u.expandHeight=r),t.isRexSizer||(u.expandWidth&&(t.minWidth=void 0===n?Q(t):n),u.expandHeight&&(t.minHeight=void 0===h?tt(t):h)),u.alignOffsetX=a,u.alignOffsetY=o,u.alignOffsetOriginX=d,u.alignOffsetOriginY=c,u.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,p&&this.addChildrenMap(e,t),this}},Ad={remove(t,e){var i;if("string"==typeof t){if(i=t,!(t=this.sizerChildren[i]))return this}else{if(this.getParentSizer(t)!==this)return this;i=this.childToKey(t)}return i&&(delete this.sizerChildren[i],this.childrenMap.hasOwnProperty(i)&&delete this.childrenMap[i]),Oe.call(this,t,e),this},removeAll(t){for(var e in this.sizerChildren)this.remove(e,t);return this},clear(t){for(var e in this.sizerChildren)delete this.sizerChildren[e],this.childrenMap.hasOwnProperty(e)&&delete this.childrenMap[e];return vh.call(this,t),this}},Yd={getChildrenWidth:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var h in r)t=r[h],void 0===(i=this.getChildWidth(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).left+e.right)*this.scaleX,s=Math.max(i,s));return n?void 0:s+(this.space.left+this.space.right)*this.scaleX},getChildrenHeight:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var h in r)t=r[h],void 0===(i=this.getChildHeight(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).top+e.bottom)*this.scaleY,s=Math.max(i,s));return n?void 0:s+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(s.expandWidth){var r=e-(this.space.left+this.space.right)*this.scaleX,n=s.padding;i=r-(n.left+n.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(s.expandHeight){var r=e-(this.space.top+this.space.bottom)*this.scaleY,n=s.padding;i=r-(n.top+n.bottom)*this.scaleY}return i},getChildrenSizers:function(t){void 0===t&&(t=[]);var e,i=this.sizerChildren;for(var s in i)(e=i[s]).isRexSizer&&t.push(e);return t},layoutChildren:function(){var t,e,i,s,r,n,h,a,o,l,d,c,u=this.innerLeft,p=this.innerTop,v=this.innerWidth,g=this.innerHeight,f=this.sizerChildren;for(var m in f)(t=f[m]).rexSizer.hidden||(i=(e=t.rexSizer).padding,pr.call(this,t),l=this.getExpandedChildWidth(t),d=this.getExpandedChildHeight(t),e.aspectRatio>0&&(Td.width=e.aspectRatio,Td.height=1,_d.width=l,_d.height=d,l=(c=Od(Td,_d,"FIT",!0)).width,d=c.height),t.isRexSizer?(t.runLayout(this,l,d),eh(t,this)):Ge(t,l,d),s=u+i.left*this.scaleX,n=v-(i.left+i.right)*this.scaleX,r=p+i.top*this.scaleY,h=g-(i.top+i.bottom)*this.scaleY,void 0===l&&(l=Q(t)),void 0===d&&(d=tt(t)),a=(e.alignOffsetX+e.alignOffsetOriginX*l)*this.scaleX,o=(e.alignOffsetY+e.alignOffsetOriginY*d)*this.scaleY,vr.call(this,t,s,r,n,h,e.align,a,o))}};Object.assign(Yd,Dd,Ad);const zd=Phaser.Utils.Objects.IsPlainObject,Xd=Phaser.Utils.Objects.GetValue;class Wd extends th{constructor(t,e,i,s,r,n){zd(e)?(e=Xd(n=e,"x",0),i=Xd(n,"y",0),s=Xd(n,"width",void 0),r=Xd(n,"height",void 0)):zd(s)&&(s=Xd(n=s,"width",void 0),r=Xd(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexOverlapSizer",this.sizerChildren={},this.addChildrenMap("items",this.sizerChildren)}childToKey(t){if("string"!=typeof t)return function(t,e){if(Array.isArray(t))return t.indexOf(e);for(var i in t)if(t[i]===e)return i;return null}(this.sizerChildren,t);var e=t;return this.sizerChildren.hasOwnPropery(e)?e:null}}Object.assign(Wd.prototype,Yd);var jd={loadFromURL(t,e){var i=this,s=new Image;return s.onload=function(){i.width!==s.width||i.height!==s.height?i.resize(s.width,s.height):i.clear(),i.context.drawImage(s,0,0),i.updateTexture(),e&&e(),s.onload=null,s.src="",s.remove()},s.src=t,this},loadFromURLPromise(t){var e=this;return new Promise((function(i,s){e.loadFromURL(t,i)}))},loadFromFile(t,e){var i=URL.createObjectURL(t);return this.loadFromURL(i,(function(){URL.revokeObjectURL(i),e&&e()})),this},loadFromFilePromise(t){var e=this;return new Promise((function(i,s){e.loadFromFile(t,i)}))}};class Fd extends oa{}Object.assign(Fd.prototype,jd);const Id=Phaser.Display.Color,Bd=Phaser.Math.Percent,Hd=Phaser.Display.Color,Gd=Phaser.Math.Percent,Vd=Phaser.Display.Color.ColorToRGBA,Nd=Phaser.Display.Color.HSVToRGB;class Ud extends Fd{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=2),super(t,e,i,s,r),this.type="rexColorPicker.HPaletteCanvas",this.colorObject=new Hd,this.setOrientation(n),this.setSize(s,r)}setOrientation(t){return this.orientation=Oh(t),this}updateTexture(){return function(t,e,i){void 0===i&&(i=!1);var s=t.width,r=t.height,n=new Id;if(i)for(var h=0;h0&&r.push(o.join("")),r},Ec=0,Mc=1,Rc=2,Lc=0,Dc=1,Ac=2,Yc=/(?:\r\n|\r|\n)/;const zc={none:Lc,word:Dc,char:Ac,character:Ac,mix:3};var Xc=function(t,e){return void 0===e&&(e=0),t._minWidth=e,t.runWidthWrap=function(t){return t instanceof il}(t)?function(t){return function(e){return t.setFixedSize(e,0).runWordWrap(),t.minHeight=t.height,t}}(t):Pc(t)?function(t){return function(e){return t.setMaxWidth(e),t.minHeight=t.height,t}}(t):function(t){return function(e){var i=t.padding,s=e-(i.left+i.right)*t.scaleX,r=t.style;return Sc(t)?(r.wordWrapWidth=s,r.maxLines=0):(0===r.wrapMode&&(r.wrapMode=1),r.wrapWidth=s,r.maxLines=0),r.fixedWidth=e,r.fixedHeight=0,t.updateText(),t.minHeight=t.height,t}}(t),t};const Wc=65535;var jc=function(t,e,i){if(null==e)return t;if(0===e)return Bc(t,0,i),t;var s=t.text.length;if(0===s)return Bc(t,e,i),t;var r=Math.floor(1.5*e/s);void 0!==i&&r>i&&(r=Math.floor(i));for(var n={},h=Ic(t,r,e,i,n),a=0;a<=Wc&&0!==h;a++){if((r+=h)<0){r=0;break}h=Ic(t,r,e,i,n)}return a===Wc&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),Bc(t,e,i),t},Fc=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},Ic=function(t,e,i,s,r){var n,h=Fc(t,e,r),a=Fc(t,e+1,r);if(void 0!==s)if(h.height<=s&&a.height>s)n=0;else{if(h.height>s)return-1;n=Math.floor(s-h.height)}if(h.width<=i&&a.width>i)return 0;if(h.width>i)return-1;var o=Math.floor(i-h.width);return void 0===n?o:Math.min(o,n)},Bc=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const Hc=Phaser.Utils.Objects.GetValue,Gc=Phaser.Utils.Objects.GetValue;class Vc extends uc{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=Gc(e,"background",void 0),r=Gc(e,"icon",void 0),n=Gc(e,"iconMask",void 0),h=Gc(e,"text",void 0),a=Gc(e,"action",void 0),o=Gc(e,"actionMask",void 0),l=Gc(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(h||a)&&(i={right:Gc(e,"space.icon",0),top:Gc(e,"space.iconTop",0),bottom:Gc(e,"space.iconBottom",0),left:Gc(e,"space.iconLeft",0)}):(h||a)&&(i={bottom:Gc(e,"space.icon",0),left:Gc(e,"space.iconLeft",0),right:Gc(e,"space.iconRight",0),top:Gc(e,"space.iconTop",0)});var d=Gc(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=Cc.call(this,r,r,1)),!d){var c=Gc(e,"iconSize",void 0);this.setIconSize(Gc(e,"iconWidth",c),Gc(e,"iconHeight",c))}}if(h){var u=Gc(e,"wrapText",!1),p=Gc(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),function(t,e){switch(kc(t)){case 0:switch("string"==typeof e&&(e=zc[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=Tc;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=zc[e]||0),t.style.wrapMode=e}}(h,u),e.expandTextWidth=!0,Xc(h)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=Hc(e,"minWidth",0),s=Hc(e,"minHeight",0),r=Hc(e,"fitHeight",!1);t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return jc(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),jc(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t})}(h,{fitHeight:!0}));var v,g,f=Gc(e,"space.text",0),m=Gc(e,"expandTextWidth",!1),y=Gc(e,"expandTextHeight",!1);0===this.orientation?(v=m?1:0,a&&(i={right:f}),g=y):(v=y?1:0,a&&(i={bottom:f}),g=m),this.add(h,{proportion:v,expand:g,padding:i})}if(a&&(i=0===this.orientation?{top:Gc(e,"space.actionTop",0),bottom:Gc(e,"space.actionBottom",0),right:Gc(e,"space.actionRight",0)}:{left:Gc(e,"space.actionLeft",0),right:Gc(e,"space.actionRight",0),bottom:Gc(e,"space.actionBottom",0)},d=Gc(e,"squareFitAction",!1)?1:0,this.add(a,{proportion:0,padding:i,fitRatio:d}),o&&(o=Cc.call(this,a,a,1)),!d)){var x=Gc(e,"actionSize");this.setActionSize(Gc(e,"actionWidth",x),Gc(e,"actionHeight",x))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",h),this.addChildrenMap("action",a),this.addChildrenMap("actionMask",o)}}const Nc=Phaser.Utils.Objects.GetValue;class Uc extends ii{constructor(t,e){super(t,e),this.style=Nc(e,"style",this);var i=Nc(e,"propertiesMap");this.activeStyle=$c(e,"active",i),this.hoverStyle=$c(e,"hover",i),this.disableStyle=$c(e,"disable",i),this.onModifyStyle=Nc(e,"onModifyStyle")}getStyle(t){return zl(this.style,t)}modifyStyle(t){for(var e in t)this.style[e]=t[e];return this.onModifyStyle&&this.onModifyStyle(this.parent,t),this}applyStyle(t){if(t){var e=this.getStyle(t);return Xl(e,t)?void 0:(this.modifyStyle(t),e)}}setActiveState(t){return Jc.call(this,"active",t),this}setHoverState(t){return Jc.call(this,"hover",t),this}setDisableState(t){return Jc.call(this,"disable",t),this}}var $c=function(t,e,i){var s=Dl(t,e);if(i)for(var r in s)i.hasOwnProperty(r)&&(s[i[r]]=s[r],delete s[r]);return s},Jc=function(t,e){void 0===e&&(e=!0);var i=`${t}State`,s=`${t}Style`,r=`${t}StyleSave`;this[i]!==e&&(this[i]=e,e?this[r]=this.applyStyle(this[s]):(this.applyStyle(this[r]),this[r]=void 0))},qc={addStyleManager(t){return this.styleManager=new Uc(this,t),this},setActiveState(t){return this.styleManager.setActiveState(t),this},setHoverState(t){return this.styleManager.setHoverState(t),this},setDisableState(t){return this.styleManager.setDisableState(t),this}};class Kc extends Kh{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesRoundRectangleShape",e.style=this,e.propertiesMap=Zc,this.addStyleManager(e),delete e.style,delete e.propertiesMap}}const Zc={color:"fillColor",alpha:"fillAlpha",strokeWidth:"lineWidth"};Object.assign(Kc.prototype,qc);const Qc=Phaser.GameObjects.GetCalcMatrix,tu=Phaser.Renderer.Canvas.SetTransform;var eu={renderWebGL:function(t,e,i,s){e.updateData(),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Qc(e,i,s),h=r.calcMatrix.copyFrom(n.calc),a=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e);for(var d,c=e.geom,u=0,p=c.length;u0,h=0,a=e.length;h=0?t.startAt(h+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(h+n,i):t.startAt(h,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(h,i),t.close(),t};const Wu=Phaser.Utils.Objects.GetValue,ju=Phaser.Utils.Objects.IsPlainObject;class Fu extends(uu(ru)){constructor(t,e,i,s,r,n,h,a){ju(e)?(e=(a=e).x,i=a.y,s=a.width,r=a.height,n=a.barColor,h=a.value):ju(s)?(s=(a=s).width,r=a.height,n=a.barColor,h=a.value):ju(n)&&(n=(a=n).barColor,h=a.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===h&&(h=0),super(t,e,i,s,r,a),this.type="rexLineProgress",this.bootProgressBase(a),this.addShape((new zu).setName("trackFill")).addShape((new zu).setName("bar")).addShape((new zu).setName("trackStroke")),this.setTrackColor(Wu(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(Wu(a,"trackStrokeThickness",2),Wu(a,"trackStrokeColor",void 0)),this.setSkewX(Wu(a,"skewX",0)),this.setRTL(Wu(a,"rtl",!1)),this.setValue(h)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var Iu={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&Xu(s,0,0,e,i,t);var r,n,h=this.getShape("bar");h.fillStyle(this.barColor),h.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),Xu(h,r,0,n,i,t));var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&Xu(a,0,0,e,i,t)}};Object.assign(Fu.prototype,Iu);class Bu extends Fu{constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("value")||(e.value=0),e.hasOwnProperty("hover.bar")||(e["hover.bar"]=!0),e.hasOwnProperty("easeDuration")||(e.easeDuration=200),e.hasOwnProperty("ease")||(e.ease="Quad"),Ml(e,"easeValue.duration",e.easeDuration),Ml(e,"easeValue.ease",e.ease),super(t,e),this.type="rexStatesBarRectangleShape",this.barState=!1,e.style=this,e.propertiesMap=Hu,this.addStyleManager(e),delete e.style,delete e.propertiesMap}get bar(){return this.barState}set bar(t){t=!!t,this.barState!==t&&(this.barState=t,this.easeValueTo(this.barState?1:0))}}const Hu={color:"trackColor",strokeColor:"trackStrokeColor",strokeWidth:"trackStrokeThickness"};Object.assign(Bu.prototype,qc);var Gu=function(t,e){if(!t)return!1;if(t.hasOwnProperty(e))return!0;for(;t;){if(Object.getOwnPropertyDescriptor(t,e))return!0;t=t.__proto__}return!1},Vu=function(t){return t.preFX?t.preFX:t.postFX?t.postFX:null},Nu=function(t,e){t._effectSwitchNames||(t._effectSwitchNames=[],t.clearAllEffects=function(){for(var e=t._effectSwitchNames,i=0,s=e.length;i=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=uo(i),s=uo(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),h=n.width,a=0,o=0,l=i.length;o0?h/a:0,c=n.height,u=0;for(o=0,l=s.length;o0?0:g,x=0,o=0;for(var S=i.length;o0?0:f),f>=1&&g>=1){var O=typeof(m=this.getFrameNameCallback(o,C,e));"string"!==O&&"number"!==O||r.add(m,0,x+n.cutX,b+n.cutY,f,g)}x+=f}b+=g}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,h,a,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/o,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(u,p);if(u>v){var g=(u-v)*o;d>=0?d+=g:d=g,u=v}if(p>v){var f=(p-v)*l;c>=0?c+=f:c=f,p=v}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var x=0,b=this.rows.count;x0&&a>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(C,x)?0:1)?this._drawImage(this.textureKey,s,m,y,h,a):this._drawTileSprite(this.textureKey,s,m,y,h,a)),m+=h;y+=a}this._endDraw()},setStretchMode:function(t){return np(t)?(this.stretchMode.edge=ap(hp(t,"edge",0)),this.stretchMode.internal=ap(hp(t,"internal",0))):(t=ap(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return lp.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const cp=Phaser.Utils.Objects.IsPlainObject,up=Phaser.Utils.Objects.GetValue,pp=Phaser.GameObjects;var vp=void 0,gp=function(t,e){if(vp||(vp={},ti(t).events.once("destroy",(function(){for(var t in vp)vp[t].destroy();vp=void 0}))),!vp.hasOwnProperty(e)){var i=ti(t).scene.systemScene;(t=new pp[e](i)).setOrigin(0),vp[e]=t}return vp[e]};const fp=Phaser.GameObjects.RenderTexture;class mp extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if(cp(i)?(i=up(d=i,"x",0),s=up(d,"y",0),r=up(d,"width",1),n=up(d,"height",1),h=up(d,"key",void 0),a=up(d,"baseFrame",void 0),o=up(d,"columns",void 0),l=up(d,"rows",void 0)):cp(r)?(r=up(d=r,"width",1),n=up(d,"height",1),h=up(d,"key",void 0),a=up(d,"baseFrame",void 0),o=up(d,"columns",void 0),l=up(d,"rows",void 0)):cp(h)?(h=up(d=h,"key",void 0),a=up(d,"baseFrame",void 0),o=up(d,"columns",void 0),l=up(d,"rows",void 0)):cp(a)?(a=up(d=a,"baseFrame",void 0),o=up(d,"columns",void 0),l=up(d,"rows",void 0)):Array.isArray(a)?(d=l,l=o,o=a,a=up(d,"baseFrame",void 0)):cp(o)&&(o=up(d=o,"columns",void 0),l=up(d,"rows",void 0)),void 0===a&&(a=up(d,"frame",void 0)),void 0===o){var c=up(d,"leftWidth",void 0),u=up(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=up(d,"topHeight",void 0),v=up(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(up(d,"getFrameNameCallback",void 0)),this.setStretchMode(up(d,"stretchMode",0)),this.setPreserveRatio(up(d,"preserveRatio",!0));var g=up(d,"maxFixedPartScale",1),f=up(d,"maxFixedPartScaleX",g),m=up(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(h,a,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,dp),i}(fp,"rexNinePatch")){}var yp={_drawImage:function(t,e,i,s,r,n){var h=gp(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=gp(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(mp.prototype,yp);let xp=class extends ii{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Gu(t,e))return t[e];var i=t.parent;return Gu(i,e)?i[e]:void 0}set(t,e,i){return Gu(t,e)?t[e]=i:Gu(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}};const bp=Phaser.Utils.Objects.GetValue;class Cp extends mp{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=bp(e,"effects",!0);i&&Ju(this,i),this.style=new xp(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Cp.prototype,qc);const wp=["alpha","tint","flipX","flipY"];var Sp=function(t,e){if(!e)return t;for(var i=0,s=wp.length;i=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const k=Phaser.Math.DegToRad;var T={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=k(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},_={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=O(t.scaleX,i.scaleX),e.scaleY=O(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},E={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=O(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},L={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},D={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},A={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(t){void 0===t&&(t=!1);var e=this;return this._mask=null,this.setChildMaskVisible(this),this.children.forEach((function(t){t.clearMask&&t.clearMask(!1),t.hasOwnProperty("isRexContainerLite")||e.setChildMaskVisible(t)})),t&&this.mask&&this.mask.destroy(),this}},Y=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},W=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const F=Phaser.Utils.Array;var I={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},_e=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const Ee=/(\S+)\[(\d+)\]/i,Me=Phaser.Utils.Objects.GetValue;var Re=function(t,e){return void 0===e?t:t[e]},Le=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Me(e,"left",0),t.right=Me(e,"right",0),t.top=Me(e,"top",0),t.bottom=Me(e,"bottom",0)),t},De={getInnerPadding(t){return Re(this.space,t)},setInnerPadding(t,e){return Le(this.space,t,e),this},getOuterPadding(t){return Re(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Le(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Re(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Le(this.getSizerConfig(t).padding,e,i),this}},Ae=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Ye=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},ze=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Xe=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},We=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},je=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Fe={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Ie=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?mi:fi,this.repeatCounter=0,this}stop(){return this.state=gi,this}update(t,e){this.state!==gi&&this.state!==xi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=yi)):(this.nowTime=this.duration,this.state=xi):this.nowTime>=0&&(this.state=mi))}get t(){var t;switch(this.state){case gi:case fi:case yi:t=0;break;case mi:t=this.nowTime/this.duration;break;case xi:t=1}return pi(t,0,1)}set t(t){(t=pi(t,-1,1))<0?(this.state=fi,this.nowTime=-this.delay*t):(this.state=mi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===gi}get isDelay(){return this.state===fi}get isCountDown(){return this.state===mi}get isRunning(){return this.state===fi||this.state===mi}get isDone(){return this.state===xi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const gi=0,fi=1,mi=2,yi=3,xi=-1;class bi extends di{constructor(t,e){super(t,e),this.timer=new vi}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const Ci=Phaser.Utils.Objects.GetValue,wi=Phaser.Utils.Objects.GetAdvancedValue,Si=Phaser.Tweens.Builders.GetEaseFunction;class Oi extends bi{resetFromJSON(t){return this.timer.resetFromJSON(Ci(t,"timer")),this.setEnable(Ci(t,"enable",!0)),this.setTarget(Ci(t,"target",this.parent)),this.setDelay(wi(t,"delay",0)),this.setDuration(wi(t,"duration",1e3)),this.setEase(Ci(t,"ease","Linear")),this.setRepeat(Ci(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Si(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Pi=Phaser.Utils.Objects.GetValue,ki=Phaser.Utils.Objects.GetAdvancedValue,Ti=Phaser.Math.Linear;let _i=class extends Oi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Pi(t,"mode",0)),this.setScaleRange(ki(t,"start",void 0),ki(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ei[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=ki(t,"x",this.parent.scaleX),this.startY=ki(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=ki(e,"x",void 0),this.endY=ki(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Ti(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Ti(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const Ei={stop:0,destroy:1,yoyo:2};var Mi=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new _i(t,a):r.resetFromJSON(a),r.restart(),r},Ri=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof _i&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new _i(t,h):n.resetFromJSON(h),n.restart(),n},Li=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Di=function(t){return Li(t,"complete")};const Ai=Phaser.Utils.Objects.IsPlainObject;var Yi={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Ai(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Mi(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Di(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Ai(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Ri(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Di(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Di(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Ai(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new _i(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Di(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},zi={};Object.assign(zi,Yi),zi.onInitScale=function(){Yi.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=be.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Xi=Phaser.Utils.Objects.GetValue,Wi=Phaser.Utils.Objects.GetAdvancedValue,ji=Phaser.Math.Linear;class Fi extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Xi(t,"mode",0)),this.setAlphaRange(Wi(t,"start",this.parent.alpha),Wi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ii[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=ji(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ii={stop:0,destroy:1,yoyo:2},Bi=Phaser.Utils.Objects.IsPlainObject;var Hi=function(t,e,i,s){var r,n;Bi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Fi(t,h):s.resetFromJSON(h),s.restart(),s},Gi=function(t,e,i,s){i instanceof Fi&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Fi(t,r):s.resetFromJSON(r),s.restart(),s};const Vi=Phaser.Utils.Objects.IsPlainObject;var Ni={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Vi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Hi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Di(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Vi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Gi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Di(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Di(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Ui={};Object.assign(Ui,Ni),Ui.onInitFade=function(){Ni.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=be.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const $i=Phaser.Utils.Objects.GetValue,Ji=Phaser.Utils.Objects.GetAdvancedValue,qi=Phaser.Math.Linear;class Ki extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode($i(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ji(t,"x",void 0),i=Ji(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Zi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Ji(i,"startX",void 0),this.startY=Ji(i,"startY",void 0),this.endX=Ji(i,"endX",void 0),this.endY=Ji(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=qi(this.startX,this.endX,i)),this.hasMoveY&&(t.y=qi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Zi={stop:0,destroy:1,yoyo:2};var Qi=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const ts=Phaser.Utils.Objects.IsPlainObject,es=Phaser.Math.Distance.Between;var is={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(ts(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*es(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Ki&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=Qi(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=Qi(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Ki(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Di(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Di(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(ts(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*es(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Ki&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=Qi(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=Qi(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Ki(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Di(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Di(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},ss={};Object.assign(ss,is),ss.onInitEaseMove=function(){is.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=be.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const rs=Phaser.Utils.Objects.GetValue;class ns extends ai{constructor(t,e){super(t,e),this.timer=new vi,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(rs(t,"timer")),this.setEnable(rs(t,"enable",!0)),this.setMode(rs(t,"mode",1)),this.isRunning=rs(t,"isRunning",!1),this.setMagnitudeMode(rs(t,"magnitudeMode",1)),this.setAxisMode(rs(t,"axis",0)),this.setDuration(rs(t,"duration",500)),this.setMagnitude(rs(t,"magnitude",10)),this.ox=rs(t,"ox",void 0),this.oy=rs(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=hs[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=os[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=as[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=rs(i,"magnitude",void 0),t=rs(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const hs={effect:0,behavior:1},as={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},os={constant:0,decay:1},ls=Phaser.Utils.Objects.IsPlainObject;var ds={shake(t,e,i){if(ls(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new ns(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Di(this._shake)}};const cs=Phaser.Utils.Objects.GetValue,us=Phaser.Math.Linear;class ps extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=cs(t,"key","value");var i=e[this.propertyKey];return this.fromValue=cs(t,"from",i),this.toValue=cs(t,"to",i),this.setEase(cs(t,"ease",this.ease)),this.setDuration(cs(t,"duration",this.duration)),this.setRepeat(cs(t,"repeat",0)),this.setDelay(cs(t,"delay",0)),this.setRepeatDelay(cs(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=us(this.fromValue,this.toValue,i)}}const vs=Phaser.Utils.Objects.IsPlainObject;class gs extends ii{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new ps(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(vs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(vs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var fs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new gs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Li(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},ms=Phaser.Utils.Array.Remove,ys={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var Ds={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Ke(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},As={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=Xt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=Xt),this.transitOutCallback=t,this}},Ys={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},zs={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Xs={};Object.assign(Xs,Ds,As,Ys,zs);const Ws=Phaser.Utils.Objects.GetValue;class js extends ii{constructor(t,e){super(t,e),this.setTransitInTime(Ws(e,"duration.in",200)),this.setTransitOutTime(Ws(e,"duration.out",200)),this.setTransitInCallback(Ws(e,"transitIn")),this.setTransitOutCallback(Ws(e,"transitOut")),this.oneShotMode=Ws(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Ls(this,{eventEmitter:!1,initState:Ws(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(js.prototype,Xs);var Fs=function(t){if(t.parentContainer)return Fs(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?Fs(e):t};class Is extends ii{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Fs(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Bs=Phaser.GameObjects.Rectangle;let Hs=class extends Bs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Is(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}};const Gs=Phaser.Utils.Objects.GetValue;class Vs extends ii{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Gs(t,"hitAreaMode",0)),this.setEnable(Gs(t,"enable",!0)),this.setStopMode(Gs(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Ns[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Ns={default:0,fullWindow:1};const Us=Phaser.Utils.Objects.GetValue;class $s extends Hs{constructor(t,e){super(t,Us(e,"color",0),Us(e,"alpha",.8)),this.touchEventStop=new Vs(this,{hitAreaMode:1})}}var Js={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Mi(t,e)},scaleDown(t,e){Ri(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Hi(t,e)},fadeOut(t,e){Gi(t,e,!1)}},qs=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Hi(t,e,t.alpha)},Ks=function(t,e){Gi(t,e,!1)},Zs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!nt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Qs=Phaser.Utils.Objects.GetValue;let tr=class extends js{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=er.popUp),null==e.transitOut&&(e.transitOut=er.scaleDown),e.destroy=Qs(e,"destroy",!0),super(t,e);var i=Qs(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new $s(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Qs(i,"transitIn",qs)),this.setCoverTransitOutCallback(Qs(i,"transitOut",Ks)));var s=Qs(e,"touchOutsideClose",!1),r=Qs(e,"duration.hold",-1),n=Qs(e,"timeOutClose",r>=0),h=Qs(e,"anyTouchClose",!1);Qs(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Qs(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Zs(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=er[t]),t){case er.popUp:t=Js.popUp;break;case er.fadeIn:t=Js.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=er[t]),t){case er.scaleDown:t=Js.scaleDown;break;case er.fadeOut:t=Js.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const er={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var ir=function(t){return t&&"function"==typeof t},sr={modal(t,e){return ir(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new tr(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},rr=function(t,e,i,s,r){ir(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},nr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return rr.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return rr.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return rr.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return rr.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return rr.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return rr.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return rr.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return rr.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return rr.call(this,"shutdown",t,e,i,s),this}},hr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=ar),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},ar={},or=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?Zs(t,e.x,e.y,i,s):!!(r=hr(e,n,!0))&&Zs(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const xr={press:0,pointerdown:0,release:1,pointerup:1};var br={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new yr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},Cr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!wr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return Sr.length=0,!0;return Sr.length=0,!1},Sr=[];const Or=Phaser.Utils.Objects.GetValue;class Pr extends ii{constructor(t,e){super(t,e),this._enable=void 0;var i=Or(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Or(t,"enable",!0)),this.setMode(Or(t,"mode",1)),this.setClickInterval(Or(t,"clickInterval",100)),this.setDragThreshold(Or(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=kr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?Cr:or)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const kr={press:0,pointerdown:0,release:1,pointerup:1};var Tr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Pr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class _r extends Rs{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Er=Phaser.Utils.Objects.GetValue;class Mr extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new _r,this.parent.setInteractive(Er(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Er(t,"enable",!0)),this.setCooldown(Er(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Rr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&or(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Mr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Mr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Lr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Dr=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Jr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===qr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Jr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Kr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&or(t,s,e,i)}}const Jr=0,qr=1,Kr="IDLE",Zr=Phaser.Utils.Objects.GetValue,Qr=Phaser.Math.Distance.Between;class tn extends $r{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=en},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Zr(t,"time",250)),this.setTapInterval(Zr(t,"tapInterval",200)),this.setDragThreshold(Zr(t,"threshold",9)),this.setTapOffset(Zr(t,"tapOffset",10));var e=Zr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Zr(t,"maxTaps",void 0)),this.setMinTaps(Zr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case en:this.state=sn;break;case sn:var t=this.lastPointer;Qr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=rn,this.state=sn);break;case rn:this.state=sn}}onDragEnd(){this.state===sn&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=rn))}onDrag(){this.state!==en&&this.pointer.getDistance()>this.dragThreshold&&(this.state=en)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===sn){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=en):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=rn:this.state=en)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===rn&&(this.state=en)}get isTapped(){return this.state===rn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const en="IDLE",sn="BEGIN",rn="RECOGNIZED",nn=Phaser.Utils.Objects.GetValue;class hn extends $r{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=an},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(nn(t,"threshold",9)),this.setHoldTime(nn(t,"time",251)),this}onDragStart(){this.state=on,0===this.holdTime&&(this.state=ln)}onDragEnd(){this.state=an}onDrag(){this.state!==an&&this.pointer.getDistance()>this.dragThreshold&&(this.state=an)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===on&&t-this.pointer.downTime>=this.holdTime&&(this.state=ln)}get isPressed(){return this.state===ln}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const an="IDLE",on="BEGIN",ln="RECOGNIZED";Phaser.Utils.Objects.GetValue;var dn=function(t){return ti(t).loop.delta};const cn=Phaser.Math.Distance.Between,un=Phaser.Math.Angle.Between;var pn={getDt:function(){return dn(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return cn(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return un(e.x,e.y,t.x,t.y)}},vn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},gn={};const fn=Phaser.Utils.Objects.GetValue,mn=Phaser.Math.RadToDeg;class yn extends $r{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=xn},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(fn(t,"threshold",10)),this.setVelocityThreshold(fn(t,"velocityThreshold",1e3)),this.setDirectionMode(fn(t,"dir","8dir")),this}onDragStart(){this.state=bn}onDragEnd(){this.state=xn}onDrag(){this.state===bn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=Cn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Cn&&(this.state=xn)}get isSwiped(){return this.state===Cn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=vn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=gn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(mn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(yn.prototype,pn);const xn="IDLE",bn="BEGIN",Cn="RECOGNIZED",wn=Phaser.Utils.Objects.GetValue,Sn=Phaser.Utils.Array.SpliceOne,On=Phaser.Math.Distance.Between,Pn=Phaser.Math.Angle.Between;class kn{constructor(t,e){var i=Ke(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(wn(e,"inputConfig",void 0)),this.setEventEmitter(wn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(wn(t,"enable",!0)),this.bounds=wn(t,"bounds",void 0),this.tracerState=_n,this.pointers.length=0,ft(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,ft(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case _n:this.tracerState=En,this.onDrag1Start();break;case En:this.tracerState=Mn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],Sn(this.pointers,e),this.tracerState){case En:this.tracerState=_n,this.onDrag1End();break;case Mn:this.tracerState=En,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case En:this.onDrag1();break;case Mn:this.onDrag2()}}}dragCancel(){return this.tracerState===Mn&&this.onDrag2End(),this.pointers.length=0,ft(this.movedState),this.tracerState=_n,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0],e=this.pointers[1];return On(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0],e=this.pointers[1];return Pn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Tn.x=e.x-i.x,Tn.y=e.y-i.y}else Tn.x=0,Tn.y=0;return Tn}get centerX(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Mn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Mn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Rn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&or(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&or(t,s,e,i)}}Object.assign(kn.prototype,$e);var Tn={};const _n=0,En=1,Mn=2,Rn="IDLE";Phaser.Utils.Objects.GetValue;const Ln=Phaser.Math.RotateAround;var Dn=function(t,e,i,s){return Ln(t,e,i,s),t.rotation+=s,t},An={};const Yn=Phaser.Utils.Objects.GetValue,zn=Phaser.Math.Angle.WrapDegrees,Xn=Phaser.Math.Angle.ShortestBetween,Wn=Phaser.Math.RadToDeg,jn=Phaser.Math.DegToRad;var Fn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=An),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=zn(Wn(this.angleBetween));this.angle=Xn(this.prevAngle,t),this.prevAngle=t,this.state=Hn}break;case Hn:t=zn(Wn(this.angleBetween)),this.angle=Xn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Hn}get rotation(){return jn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Fn);const In="IDLE",Bn="BEGIN",Hn="RECOGNIZED",Gn=Phaser.Utils.Objects.GetValue;var Vn=function(t){var e=Gn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new tn(this,e),this._tap.on("tap",(function(t,e,s){Ar(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Ar(i.eventEmitter,`${i.eventNamePrefix}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Nn=Phaser.Utils.Objects.GetValue;var Un=function(t){var e=Nn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new hn(this,e),this._press.on("pressstart",(function(t,e,s){Ar(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this).on("pressend",(function(t,e,s){Ar(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const $n=Phaser.Utils.Objects.GetValue;var Jn=function(t){var e=$n(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new yn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Ar(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Ar(i.eventEmitter,`${i.eventNamePrefix}swipe`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const qn=Phaser.Utils.Objects.GetValue;var Kn=function(t,e){return t.setInteractive(),qn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:qn(e,"targets",[t]),targetMode:qn(e,"targetMode","parent"),eventEmitter:qn(e,"eventEmitter",t),eventNamePrefix:qn(e,"inputEventPrefix","child.")},zr.call(t,e),jr.call(t,e),Br.call(t,e),Nr.call(t,e),Vn.call(t,e),Un.call(t,e),Jn.call(t,e),t},Zn={getSizerConfig:function(t){return void 0===t&&(t=this),Mt(t)},getChildPrevState:function(t){var e=Mt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Dt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=oe(e,"color"),s=oe(e,"lineWidth");var o=oe(e,"name",!1);o&&(r=oe(o,"createTextCallback",ce),n=oe(o,"createTextCallbackScope",void 0),"string"==typeof(h=oe(o,"align","left-top"))&&(h=zt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new le(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}var d,c,u=this.getAllShownChildren([this]);ue(u,u);for(var p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const ah=Phaser.Utils.Objects.IsPlainObject,oh=Phaser.Utils.Objects.GetValue,lh=Phaser.Display.Align.CENTER,dh={min:0,full:-1};var ch=function(t,e,i,s,r,n,h,a,o,l){var d,c,u,p;me.call(this,t);var v=t.isRexSpace,g=typeof e;if(null===e)return this;if("number"===g);else if("string"===g)e=dh[e];else if(ah(e)){var f;e=oh(f=e,"proportion",void 0),i=oh(f,"align",lh),s=oh(f,"padding",0),r=oh(f,"expand",!1),n=oh(f,"key",void 0),h=oh(f,"index",void 0),t.isRexSizer||(a=oh(f,"minWidth",void 0),o=oh(f,"minHeight",void 0)),l=oh(f,"fitRatio",0),d=oh(f,"offsetX",0),c=oh(f,"offsetY",0),u=oh(f,"offsetOriginX",0),p=oh(f,"offsetOriginY",0)}return"string"==typeof i&&(i=zt[i]),void 0===e&&(e=v?1:0),void 0===i&&(i=lh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(v?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(v?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),(f=this.getSizerConfig(t)).proportion=e,f.align=i,f.padding=ge(s),f.expand=r,f.fitRatio=0===e?l:0,f.alignOffsetX=d,f.alignOffsetY=c,f.alignOffsetOriginX=u,f.alignOffsetOriginY=p,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},uh={add:ch,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),ch.call(this,new nh(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return ah(i)&&(i.index=t),ch.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=hh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const ph=Et.prototype.clear;var vh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),ph.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,vh.call(this,t),this}},mh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=zt[e]),this.getSizerConfig(t).align=e,this}},yh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},xh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},bh={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},Ch={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Ge(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Ie.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d,c,u=this.sizerChildren,p=this.innerLeft,v=this.innerTop,g=this.innerWidth,f=this.innerHeight,m=p,y=v,x=this.startChildIndex,b=0,C=u.length;b0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Xe.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Ye.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&sh.call(this,t,void 0),ze.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||We.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&sh.call(this,void 0,t),je.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(Ch,uh,fh,mh,yh,xh,bh);var wh=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},Sh={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},Oh=function(t){return"string"==typeof t&&(t=Sh[t]),t};const Ph=Phaser.Utils.Objects.IsPlainObject,kh=Phaser.Utils.Objects.GetValue;class Th extends th{constructor(t,e,i,s,r,n,h){Ph(e)?(e=kh(h=e,"x",0),i=kh(h,"y",0),s=kh(h,"width",void 0),r=kh(h,"height",void 0),n=kh(h,"orientation",0)):Ph(s)?(s=kh(h=s,"width",void 0),r=kh(h,"height",void 0),n=kh(h,"orientation",0)):Ph(n)&&(n=kh(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(kh(h,"space.item",0)),this.setStartChildIndex(kh(h,"startChildIndex",0)),this.setRTL(kh(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=Oh(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=wh.call(this)),this._childrenProportion}}Object.assign(Th.prototype,Ch);var _h=Phaser.Renderer.WebGL.Utils,Eh=function(t,e,i,s,r,n){for(var h=_h.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),a=i.pathData,o=i.pathIndexes,l=0;l>>16,a=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+h+","+a+","+o+","+n+")"},Ah=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,h=(16711680&r)>>>16,a=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+h+","+a+","+o+","+n+")",t.lineWidth=e.lineWidth};const Yh=Phaser.Renderer.Canvas.SetTransform;var zh={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Lh(e,i,s),h=r.calcMatrix.copyFrom(n.calc),a=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&Eh(r,h,e,l,a,o),e.isStroked&&Rh(r,e,l,a,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(Yh(t,r,e,i,s)){var n=e._displayOriginX,h=e._displayOriginY,a=e.pathData,o=a.length-1,l=a[0]-n,d=a[1]-h;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(Wh.prototype,zh);const jh=Phaser.Utils.Objects.GetValue;let Fh=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=jh(t,"x",0),i=jh(t,"y",0));var s=this.cornerRadius;s.tl=Ih(jh(t,"tl",void 0),e,i),s.tr=Ih(jh(t,"tr",void 0),e,i),s.bl=Ih(jh(t,"bl",void 0),e,i),s.br=Ih(jh(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Bh(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Bh(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Bh(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Bh(this.cornerRadius.br,t)}};var Ih=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Hh(t),t},Bh=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=jh(e,"x",0),t.y=jh(e,"y",0)),Hh(t)},Hh=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},Gh=function(t){return t.x>0&&t.y>0},Vh=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const Nh=Phaser.Math.DegToRad;var Uh=function(t,e,i,s,r,n,h,a,o){h&&n>r?n-=360:!h&&n0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(Ra.prototype,Ta);const La=Phaser.Utils.String.Pad;var Da=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${La(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},Aa=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Ya=Phaser.Math.DegToRad;var za=function(t){return!t.hasOwnProperty("convex")||t.convex},Xa=function(t){return t.x>0&&t.y>0},Wa=function(t,e,i,s,r,n,h,a,o){if(a&&h>n?h-=360:!a&&h=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=m.tl,Xa(a)?(o=a.x*g,l=a.y*f,za(a)?Wa(t,o,l,o,l,180,270,!1,h):Wa(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,Xa(a)?(o=a.x*g,l=a.y*f,za(a)?Wa(t,s-o,l,o,l,270,360,!1,h):Wa(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,Xa(a)?(o=a.x*g,l=a.y*f,za(a)?Wa(t,s-o,r-l,o,l,0,90,!1,h):Wa(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,Xa(a)?(o=a.x*g,l=a.y*f,za(a)?Wa(t,o,r-l,o,l,90,180,!1,h):Wa(t,0,r,o,l,360,270,!0,h)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,h,u),null!=a)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,a),p.addColorStop(1,d),a=p),e.fillStyle=a,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())},Fa=function(t,e,i,s,r,n,h,a){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),ja(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}};const Ia=Phaser.Utils.Objects.GetValue;class Ba extends Ra{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(Ia(e,"color",null),Ia(e,"color2",null),Ia(e,"horizontalGradient",!0)),this.setStroke(Ia(e,"stroke",null),Ia(e,"strokeThickness",2)),this.setCornerRadius(Ia(e,"cornerRadius",0),Ia(e,"cornerIteration",null))}set color(t){t=Da(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Da(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Da(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,Aa("color2",t,this),Aa("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Aa("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Aa("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){Fa(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Ha=Phaser.Utils.Objects.GetValue;class Ga extends Ra{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(Ha(e,"color",null),Ha(e,"color2",null),Ha(e,"horizontalGradient",!0)),this.setStroke(Ha(e,"stroke",null),Ha(e,"strokeThickness",2))}set color(t){t=Da(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Da(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Da(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,Ha(t,"color2",null),Ha(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Ha(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,h=this.parent.height-i.top-i.bottom,a=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?a.createLinearGradient(0,0,n,0):a.createLinearGradient(0,0,0,h)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,a.fillStyle=t,a.fillRect(s,r,n,h));null!=this.stroke&&this.strokeThickness>0&&(a.strokeStyle=this.stroke,a.lineWidth=this.strokeThickness,a.strokeRect(s,r,n,h))}}const Va=Phaser.Utils.Objects.GetValue;let Na=class t{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(Va(t,"bold",!1)),this.setItalic(Va(t,"italic",!1)),this.setFontSize(Va(t,"fontSize","16px")),this.setFontFamily(Va(t,"fontFamily","Courier")),this.setColor(Va(t,"color","#fff")),this.setStrokeStyle(Va(t,"stroke",null),Va(t,"strokeThickness",0)),this.setShadow(Va(t,"shadowColor",null),Va(t,"shadowOffsetX",0),Va(t,"shadowOffsetY",0),Va(t,"shadowBlur",0)),this.setOffset(Va(t,"offsetX",0),Va(t,"offsetY",0)),this.setSpace(Va(t,"leftSpace",0),Va(t,"rightSpace",0)),this.setAlign(Va(t,"align",void 0)),this.setBackgroundColor(Va(t,"backgroundColor",null)),this.setBackgroundHeight(Va(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Va(t,"backgroundBottomY",void 0)),this.setBackgroundLeftX(Va(t,"backgroundLeftX",0)),this.setBackgroundRightX(Va(t,"backgroundRightX",0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(Aa("stroke",t,this),Aa("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Aa("shadowOffsetX",t,this),Aa("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),t.hasOwnProperty("backgroundLeftX")&&this.setBackgroundLeftX(t.backgroundLeftX),t.hasOwnProperty("backgroundRightX")&&this.setBackgroundRightX(t.backgroundRightX),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new t(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=Da(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=Da(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=Da(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=Da(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setBackgroundLeftX(t){return this.backgroundLeftX=t,this}setBackgroundRightX(t){return this.backgroundRightX=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}};const Ua=Phaser.Utils.Array.Remove,$a=Phaser.Utils.Array.Remove,Ja="text",qa="image",Ka="drawer",Za="space",Qa="command";var to=function(t){return t.type===Ja&&"\n"===t.text},eo=function(t){return t.type===Ja&&"\f"===t.text},io=function(t){return t.type===Ja};class so extends Ra{constructor(t,e,i){super(t,Ja),this.updateTextFlag=!1,this.style=new Na(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX+e.backgroundLeftX,s=i,r=this.drawTRX+e.backgroundRightX-i+1;if(r>0){var n=e.backgroundBottomY;null==n&&(n=this.drawBLY);var h=e.backgroundHeight;null==h&&(h=n-this.drawTLY);var a=n-h;t.fillRect(s,a,r,h)}}var o=e.hasFill,l=e.hasStroke;(o||l)&&(e.syncFont(t).syncStyle(t),l&&(e.syncShadow(t),t.strokeText(this.text,0,0)),o&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var ro=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const no=Phaser.Display.Canvas.CanvasPool;var ho=function(t,e,i,s,r,n,h,a){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===a&&(a=!1),a&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(h){var l=no.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=h,d.fillRect(0,0,r,n),o.drawImage(l,0,0,r,n,i,s,r,n),no.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)};Phaser.Display.Canvas.CanvasPool;class ao extends Ra{constructor(t,e,i){super(t,qa),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){ho(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class oo extends Ra{constructor(t,e,i,s){super(t,Ka),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class lo extends Ra{constructor(t,e){super(t,Za),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class co extends ca{constructor(t,e,i,s,r){super(t,Qa),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}function uo(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>uo(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=uo(t[i]));return e}var po=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const vo={none:0,word:1,char:2,character:2,mix:3};var go=/^[\x00-\x7F]+$/,fo=function(t){return go.test(t)},mo=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,h=!r&&!n,a=t.length,o=e,l=s.word,d=0,c=!1;o0&&!a){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=Co.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=Co.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=So(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=So(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=So(t,"wrapMode");void 0===c&&(c=So(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=vo[c]);var u=So(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=So(t,"letterSpacing",0),v=So(t,"hAlign",0),g=So(t,"vAlign",0),f=So(t,"justifyPercentage",.25),m=po({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:h,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,x=0,b=y.length;x0&&(E.push({children:M,width:R}),L=Math.max(L,R)),m.start+=_.length,m.isLastPage=!D&&m.start===T,m.maxLineWidth=L,m.linesHeight=E.length*n;var F=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,I=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,h=t.vAlign,a=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(h=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=ko(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=ko(t,"maxLines",0);var a=0===i,o=ko(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=ko(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=ko(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=ko(t,"letterSpacing",0),p=ko(t,"rtl",!0),v=ko(t,"hAlign",p?2:0),g=ko(t,"vAlign",0),f=po({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:o,wrapHeight:c,rtl:p}),m=this.children,y=0,x=m.length;y0&&(_.push({children:E,height:M}),R=Math.max(R,M)),f.start+=T.length,f.isLastPage=f.start===k,f.maxLineHeight=R,f.linesWidth=_.length*n;var X=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,W=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,h=t.vAlign,a=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}a&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,h=i.bottom;return Le(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return Re(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),Ua(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return $a(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(Ja);return null===i?i=new so(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),ka(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const Ko=Phaser.Utils.Objects.GetFastValue;var Zo={};class Qo{constructor(t){this.pools=Ko(t,"pools",Zo)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new qo),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;e=r&&o=i&&oi.length&&(t.prevCursorPosition=null),null!==t.prevCursorPosition&&(s=e.getCharChild(t.prevCursorPosition))&&("\n"===s.text&&s.clearTextSize(),e.emit("cursorout",s,t.prevCursorPosition,e)),null!=r&&(s=e.getCharChild(r))&&("\n"===s.text&&s.copyTextSize(e.lastInsertCursor),function(t){var e,i,s=t.parent,r=s.width,n=s.height,h=t.drawX,a=t.drawY,o=h+t.drawTLX,l=h+t.drawTRX,d=a+t.drawTLY,c=a+t.drawBLY;e=o<0?0-o:l>r?r-l:0,i=d<0?0-d:c>n?n-c:0,s._textOX+=e,s._textOY+=i}(s),e.emit("cursorin",s,r,e)),e.emit("movecursor",r,t.prevCursorPosition,e),t.prevCursorPosition=r)}(this)):(wl(this),Sl(this)),this}setNumberInput(){return this.onUpdateCallback=Cl,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}}const kl=Phaser.Utils.Objects.GetValue,Tl=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var _l=function(t,e){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return!0;if(-1!==e.indexOf(".")){for(var i=e.split("."),s=t,r=0;rt.length?i:t})),h.value=t.join(e)}else h.value=t.join(i.slice(a,a+h.count));a+=h.count,h.added||(o+=h.count)}}let l=e[h-1];return h>1&&"string"==typeof l.value&&(l.added||l.removed)&&t.equals("",l.value)&&(e[h-2].value+=l.value,e.pop()),e}Il.prototype={diff(t,e,i={}){let s=i.callback;"function"==typeof i&&(s=i,i={}),this.options=i;let r=this;function n(t){return s?(setTimeout((function(){s(void 0,t)}),0),!0):t}t=this.castInput(t),e=this.castInput(e),t=this.removeEmpty(this.tokenize(t));let h=(e=this.removeEmpty(this.tokenize(e))).length,a=t.length,o=1,l=h+a;i.maxEditLength&&(l=Math.min(l,i.maxEditLength));let d=[{newPos:-1,components:[]}],c=this.extractCommon(d[0],e,t,0);if(d[0].newPos+1>=h&&c+1>=a)return n([{value:this.join(e),count:e.length}]);function u(){for(let s=-1*o;s<=o;s+=2){let o,l=d[s-1],c=d[s+1],u=(c?c.newPos:0)-s;l&&(d[s-1]=void 0);let p=l&&l.newPos+1=h&&u+1>=a)return n(Bl(r,o.components,e,t,r.useLongestToken));d[s]=o}else d[s]=void 0}var i;o++}if(s)!function t(){setTimeout((function(){if(o>l)return s();u()||t()}),0)}();else for(;o<=l;){let t=u();if(t)return t}},pushComponent(t,e,i){let s=t[t.length-1];s&&s.added===e&&s.removed===i?t[t.length-1]={count:s.count+1,added:e,removed:i}:t.push({count:1,added:e,removed:i})},extractCommon(t,e,i,s){let r=e.length,n=i.length,h=t.newPos,a=h-s,o=0;for(;h+1t,tokenize:t=>t.split(""),join:t=>t.join("")};const Hl=new Il,Gl=/^[a-zA-Z\u{C0}-\u{FF}\u{D8}-\u{F6}\u{F8}-\u{2C6}\u{2C8}-\u{2D7}\u{2DE}-\u{2FF}\u{1E00}-\u{1EFF}]+$/u,Vl=/\S/,Nl=new Il;Nl.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!Vl.test(t)&&!Vl.test(e)},Nl.tokenize=function(t){let e=t.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/);for(let t=0;tvoid 0===i?e:i}=this.options;return"string"==typeof t?t:JSON.stringify(ql(t,null,null,i),i," ")},Jl.equals=function(t,e){return Il.prototype.equals.call(Jl,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const Kl=new Il;Kl.tokenize=function(t){return t.slice()},Kl.join=Kl.removeEmpty=function(t){return t};const Zl=Phaser.Utils.Array.Remove;var Ql=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),Zl(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(o=i,l=e,Hl.diff(o,l,d)),r=0,n=0,h=s.length;nr)i+=h;else{if(s!==r)break;i+=Math.min(e.position,h)}}return i},rd={cursorMoveLeft(){if(!this.isOpened)return this;var t=ed(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=ed(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=id(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=ed(sd(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=id(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=ed(sd(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const nd=Phaser.Utils.Objects.IsPlainObject;class hd extends il{constructor(t,e,i,s,r,n){nd(e)?n=e:nd(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(_l(e,"wrap.vAlign")||Ml(e,"wrap.vAlign",s=i?"center":"top"),_l(e,"wrap.wrapMode")||Ml(e,"wrap.wrapMode","char"),_l(e,"wrap.maxLines")||Ml(e,"wrap.maxLines",s=i?1:void 0),i&&Ml(e,"wrap.wrapWidth",1/0),_l(e,"wrap.useDefaultTextHeight")||Ml(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!_l(e.edit,"inputType")){var s=i?"text":"textarea";Ml(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new Ll(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var h=n.text;h&&delete n.text;var a=Dl(n.background,"focus"),o=Dl(n.style,"cursor"),l=Dl(n.style,"range");super(t,e,i,s,r,n),this.type="rexCanvasInput",this.contentWidth=void 0,this.contentHeight=void 0,this.lineHeight=void 0,this.linesCount=void 0,this.characterCountOfLines=[],this._text,this.textEdit=function(t,e){var i=kl(e,"edit");return void 0===i&&(i={}),nl(e,i,Tl),new Pl(t,i)}(this,n),Al.call(this),n.focusStyle&&Object.assign(a,n.focusStyle),Fl.call(this,a),n.cursorStyle&&Object.assign(o,n.cursorStyle),Wl.call(this,o),n.rangeStyle&&Object.assign(l,n.rangeStyle),Yl(l)&&Object.assign(l,o),jl.call(this,l);var d=n.onAddChar;d&&this.on("addchar",d);var c=n.onCursorIn;c&&this.on("cursorin",c);var u=n.onCursorOut;u&&this.on("cursorout",u);var p=!n.onRangeIn&&!n.onRangeOut,v=p?n.onCursorIn:n.onRangeIn;v&&this.on("rangein",v);var g=p?n.onCursorOut:n.onRangeOut;g&&this.on("rangeout",g);var f,m=n.onMoveCursor;m&&this.on("movecursor",m),this.setParseTextCallback(n.parseTextCallback),this.lastInsertCursor=((f=this.createCharChild("|")).text="",f),h||(h=""),this.setText(h)}addChild(t,e){if(super.addChild(t,e),Array.isArray(t))for(var i=t,s=0,r=i.length;s0&&(r=!0,void 0===n&&(n=0),void 0===h&&(h=0)),(u=this.getSizerConfig(t)).align=i,u.padding=ge(s),Ed(r)?(u.expandWidth=Md(r,"width",!1),u.expandHeight=Md(r,"height",!1)):(u.expandWidth=r,u.expandHeight=r),t.isRexSizer||(u.expandWidth&&(t.minWidth=void 0===n?Q(t):n),u.expandHeight&&(t.minHeight=void 0===h?tt(t):h)),u.alignOffsetX=a,u.alignOffsetY=o,u.alignOffsetOriginX=d,u.alignOffsetOriginY=c,u.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,p&&this.addChildrenMap(e,t),this}},Ad={remove(t,e){var i;if("string"==typeof t){if(i=t,!(t=this.sizerChildren[i]))return this}else{if(this.getParentSizer(t)!==this)return this;i=this.childToKey(t)}return i&&(delete this.sizerChildren[i],this.childrenMap.hasOwnProperty(i)&&delete this.childrenMap[i]),Oe.call(this,t,e),this},removeAll(t){for(var e in this.sizerChildren)this.remove(e,t);return this},clear(t){for(var e in this.sizerChildren)delete this.sizerChildren[e],this.childrenMap.hasOwnProperty(e)&&delete this.childrenMap[e];return vh.call(this,t),this}},Yd={getChildrenWidth:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var h in r)t=r[h],void 0===(i=this.getChildWidth(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).left+e.right)*this.scaleX,s=Math.max(i,s));return n?void 0:s+(this.space.left+this.space.right)*this.scaleX},getChildrenHeight:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var h in r)t=r[h],void 0===(i=this.getChildHeight(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).top+e.bottom)*this.scaleY,s=Math.max(i,s));return n?void 0:s+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(s.expandWidth){var r=e-(this.space.left+this.space.right)*this.scaleX,n=s.padding;i=r-(n.left+n.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(s.expandHeight){var r=e-(this.space.top+this.space.bottom)*this.scaleY,n=s.padding;i=r-(n.top+n.bottom)*this.scaleY}return i},getChildrenSizers:function(t){void 0===t&&(t=[]);var e,i=this.sizerChildren;for(var s in i)(e=i[s]).isRexSizer&&t.push(e);return t},layoutChildren:function(){var t,e,i,s,r,n,h,a,o,l,d,c,u=this.innerLeft,p=this.innerTop,v=this.innerWidth,g=this.innerHeight,f=this.sizerChildren;for(var m in f)(t=f[m]).rexSizer.hidden||(i=(e=t.rexSizer).padding,pr.call(this,t),l=this.getExpandedChildWidth(t),d=this.getExpandedChildHeight(t),e.aspectRatio>0&&(Td.width=e.aspectRatio,Td.height=1,_d.width=l,_d.height=d,l=(c=Od(Td,_d,"FIT",!0)).width,d=c.height),t.isRexSizer?(t.runLayout(this,l,d),eh(t,this)):Ge(t,l,d),s=u+i.left*this.scaleX,n=v-(i.left+i.right)*this.scaleX,r=p+i.top*this.scaleY,h=g-(i.top+i.bottom)*this.scaleY,void 0===l&&(l=Q(t)),void 0===d&&(d=tt(t)),a=(e.alignOffsetX+e.alignOffsetOriginX*l)*this.scaleX,o=(e.alignOffsetY+e.alignOffsetOriginY*d)*this.scaleY,vr.call(this,t,s,r,n,h,e.align,a,o))}};Object.assign(Yd,Dd,Ad);const zd=Phaser.Utils.Objects.IsPlainObject,Xd=Phaser.Utils.Objects.GetValue;class Wd extends th{constructor(t,e,i,s,r,n){zd(e)?(e=Xd(n=e,"x",0),i=Xd(n,"y",0),s=Xd(n,"width",void 0),r=Xd(n,"height",void 0)):zd(s)&&(s=Xd(n=s,"width",void 0),r=Xd(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexOverlapSizer",this.sizerChildren={},this.addChildrenMap("items",this.sizerChildren)}childToKey(t){if("string"!=typeof t)return function(t,e){if(Array.isArray(t))return t.indexOf(e);for(var i in t)if(t[i]===e)return i;return null}(this.sizerChildren,t);var e=t;return this.sizerChildren.hasOwnPropery(e)?e:null}}Object.assign(Wd.prototype,Yd);var jd={loadFromURL(t,e){var i=this,s=new Image;return s.onload=function(){i.width!==s.width||i.height!==s.height?i.resize(s.width,s.height):i.clear(),i.context.drawImage(s,0,0),i.updateTexture(),e&&e(),s.onload=null,s.src="",s.remove()},s.src=t,this},loadFromURLPromise(t){var e=this;return new Promise((function(i,s){e.loadFromURL(t,i)}))},loadFromFile(t,e){var i=URL.createObjectURL(t);return this.loadFromURL(i,(function(){URL.revokeObjectURL(i),e&&e()})),this},loadFromFilePromise(t){var e=this;return new Promise((function(i,s){e.loadFromFile(t,i)}))}};class Fd extends oa{}Object.assign(Fd.prototype,jd);const Id=Phaser.Display.Color,Bd=Phaser.Math.Percent,Hd=Phaser.Display.Color,Gd=Phaser.Math.Percent,Vd=Phaser.Display.Color.ColorToRGBA,Nd=Phaser.Display.Color.HSVToRGB;class Ud extends Fd{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=2),super(t,e,i,s,r),this.type="rexColorPicker.HPaletteCanvas",this.colorObject=new Hd,this.setOrientation(n),this.setSize(s,r)}setOrientation(t){return this.orientation=Oh(t),this}updateTexture(){return function(t,e,i){void 0===i&&(i=!1);var s=t.width,r=t.height,n=new Id;if(i)for(var h=0;h0&&r.push(o.join("")),r},Ec=0,Mc=1,Rc=2,Lc=0,Dc=1,Ac=2,Yc=/(?:\r\n|\r|\n)/;const zc={none:Lc,word:Dc,char:Ac,character:Ac,mix:3};var Xc=function(t,e){return void 0===e&&(e=0),t._minWidth=e,t.runWidthWrap=function(t){return t instanceof il}(t)?function(t){return function(e){return t.setFixedSize(e,0).runWordWrap(),t.minHeight=t.height,t}}(t):Pc(t)?function(t){return function(e){return t.setMaxWidth(e),t.minHeight=t.height,t}}(t):function(t){return function(e){var i=t.padding,s=e-(i.left+i.right)*t.scaleX,r=t.style;return Sc(t)?(r.wordWrapWidth=s,r.maxLines=0):(0===r.wrapMode&&(r.wrapMode=1),r.wrapWidth=s,r.maxLines=0),r.fixedWidth=e,r.fixedHeight=0,t.updateText(),t.minHeight=t.height,t}}(t),t};const Wc=65535;var jc=function(t,e,i){if(null==e)return t;if(0===e)return Bc(t,0,i),t;var s=t.text.length;if(0===s)return Bc(t,e,i),t;var r=Math.floor(1.5*e/s);void 0!==i&&r>i&&(r=Math.floor(i));for(var n={},h=Ic(t,r,e,i,n),a=0;a<=Wc&&0!==h;a++){if((r+=h)<0){r=0;break}h=Ic(t,r,e,i,n)}return a===Wc&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),Bc(t,e,i),t},Fc=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},Ic=function(t,e,i,s,r){var n,h=Fc(t,e,r),a=Fc(t,e+1,r);if(void 0!==s)if(h.height<=s&&a.height>s)n=0;else{if(h.height>s)return-1;n=Math.floor(s-h.height)}if(h.width<=i&&a.width>i)return 0;if(h.width>i)return-1;var o=Math.floor(i-h.width);return void 0===n?o:Math.min(o,n)},Bc=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const Hc=Phaser.Utils.Objects.GetValue,Gc=Phaser.Utils.Objects.GetValue;class Vc extends uc{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=Gc(e,"background",void 0),r=Gc(e,"icon",void 0),n=Gc(e,"iconMask",void 0),h=Gc(e,"text",void 0),a=Gc(e,"action",void 0),o=Gc(e,"actionMask",void 0),l=Gc(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(h||a)&&(i={right:Gc(e,"space.icon",0),top:Gc(e,"space.iconTop",0),bottom:Gc(e,"space.iconBottom",0),left:Gc(e,"space.iconLeft",0)}):(h||a)&&(i={bottom:Gc(e,"space.icon",0),left:Gc(e,"space.iconLeft",0),right:Gc(e,"space.iconRight",0),top:Gc(e,"space.iconTop",0)});var d=Gc(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=Cc.call(this,r,r,1)),!d){var c=Gc(e,"iconSize",void 0);this.setIconSize(Gc(e,"iconWidth",c),Gc(e,"iconHeight",c))}}if(h){var u=Gc(e,"wrapText",!1),p=Gc(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),function(t,e){switch(kc(t)){case 0:switch("string"==typeof e&&(e=zc[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=Tc;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=zc[e]||0),t.style.wrapMode=e}}(h,u),e.expandTextWidth=!0,Xc(h)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=Hc(e,"minWidth",0),s=Hc(e,"minHeight",0),r=Hc(e,"fitHeight",!1);t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return jc(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),jc(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t})}(h,{fitHeight:!0}));var v,g,f=Gc(e,"space.text",0),m=Gc(e,"expandTextWidth",!1),y=Gc(e,"expandTextHeight",!1);0===this.orientation?(v=m?1:0,a&&(i={right:f}),g=y):(v=y?1:0,a&&(i={bottom:f}),g=m),this.add(h,{proportion:v,expand:g,padding:i})}if(a&&(i=0===this.orientation?{top:Gc(e,"space.actionTop",0),bottom:Gc(e,"space.actionBottom",0),right:Gc(e,"space.actionRight",0)}:{left:Gc(e,"space.actionLeft",0),right:Gc(e,"space.actionRight",0),bottom:Gc(e,"space.actionBottom",0)},d=Gc(e,"squareFitAction",!1)?1:0,this.add(a,{proportion:0,padding:i,fitRatio:d}),o&&(o=Cc.call(this,a,a,1)),!d)){var x=Gc(e,"actionSize");this.setActionSize(Gc(e,"actionWidth",x),Gc(e,"actionHeight",x))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",h),this.addChildrenMap("action",a),this.addChildrenMap("actionMask",o)}}const Nc=Phaser.Utils.Objects.GetValue;class Uc extends ii{constructor(t,e){super(t,e),this.style=Nc(e,"style",this);var i=Nc(e,"propertiesMap");this.activeStyle=$c(e,"active",i),this.hoverStyle=$c(e,"hover",i),this.disableStyle=$c(e,"disable",i),this.onModifyStyle=Nc(e,"onModifyStyle")}getStyle(t){return zl(this.style,t)}modifyStyle(t){for(var e in t)this.style[e]=t[e];return this.onModifyStyle&&this.onModifyStyle(this.parent,t),this}applyStyle(t){if(t){var e=this.getStyle(t);return Xl(e,t)?void 0:(this.modifyStyle(t),e)}}setActiveState(t){return Jc.call(this,"active",t),this}setHoverState(t){return Jc.call(this,"hover",t),this}setDisableState(t){return Jc.call(this,"disable",t),this}}var $c=function(t,e,i){var s=Dl(t,e);if(i)for(var r in s)i.hasOwnProperty(r)&&(s[i[r]]=s[r],delete s[r]);return s},Jc=function(t,e){void 0===e&&(e=!0);var i=`${t}State`,s=`${t}Style`,r=`${t}StyleSave`;this[i]!==e&&(this[i]=e,e?this[r]=this.applyStyle(this[s]):(this.applyStyle(this[r]),this[r]=void 0))},qc={addStyleManager(t){return this.styleManager=new Uc(this,t),this},setActiveState(t){return this.styleManager.setActiveState(t),this},setHoverState(t){return this.styleManager.setHoverState(t),this},setDisableState(t){return this.styleManager.setDisableState(t),this}};class Kc extends Kh{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesRoundRectangleShape",e.style=this,e.propertiesMap=Zc,this.addStyleManager(e),delete e.style,delete e.propertiesMap}}const Zc={color:"fillColor",alpha:"fillAlpha",strokeWidth:"lineWidth"};Object.assign(Kc.prototype,qc);const Qc=Phaser.GameObjects.GetCalcMatrix,tu=Phaser.Renderer.Canvas.SetTransform;var eu={renderWebGL:function(t,e,i,s){e.updateData(),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Qc(e,i,s),h=r.calcMatrix.copyFrom(n.calc),a=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e);for(var d,c=e.geom,u=0,p=c.length;u0,h=0,a=e.length;h=0?t.startAt(h+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(h+n,i):t.startAt(h,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(h,i),t.close(),t};const ju=Phaser.Utils.Objects.GetValue,Fu=Phaser.Utils.Objects.IsPlainObject;class Iu extends(uu(ru)){constructor(t,e,i,s,r,n,h,a){Fu(e)?(e=(a=e).x,i=a.y,s=a.width,r=a.height,n=a.barColor,h=a.value):Fu(s)?(s=(a=s).width,r=a.height,n=a.barColor,h=a.value):Fu(n)&&(n=(a=n).barColor,h=a.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===h&&(h=0),super(t,e,i,s,r,a),this.type="rexLineProgress",this.bootProgressBase(a),this.addShape((new Xu).setName("trackFill")).addShape((new Xu).setName("bar")).addShape((new Xu).setName("trackStroke")),this.setTrackColor(ju(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(ju(a,"trackStrokeThickness",2),ju(a,"trackStrokeColor",void 0)),this.setSkewX(ju(a,"skewX",0)),this.setRTL(ju(a,"rtl",!1)),this.setValue(h)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var Bu={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&Wu(s,0,0,e,i,t);var r,n,h=this.getShape("bar");h.fillStyle(this.barColor),h.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),Wu(h,r,0,n,i,t));var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&Wu(a,0,0,e,i,t)}};Object.assign(Iu.prototype,Bu);class Hu extends Iu{constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("value")||(e.value=0),e.hasOwnProperty("hover.bar")||(e["hover.bar"]=!0),e.hasOwnProperty("easeDuration")||(e.easeDuration=200),e.hasOwnProperty("ease")||(e.ease="Quad"),Ml(e,"easeValue.duration",e.easeDuration),Ml(e,"easeValue.ease",e.ease),super(t,e),this.type="rexStatesBarRectangleShape",this.barState=!1,e.style=this,e.propertiesMap=Gu,this.addStyleManager(e),delete e.style,delete e.propertiesMap}get bar(){return this.barState}set bar(t){t=!!t,this.barState!==t&&(this.barState=t,this.easeValueTo(this.barState?1:0))}}const Gu={color:"trackColor",strokeColor:"trackStrokeColor",strokeWidth:"trackStrokeThickness"};Object.assign(Hu.prototype,qc);var Vu=function(t,e){if(!t)return!1;if(t.hasOwnProperty(e))return!0;for(;t;){if(Object.getOwnPropertyDescriptor(t,e))return!0;t=t.__proto__}return!1},Nu=function(t){return t.preFX?t.preFX:t.postFX?t.postFX:null},Uu=function(t,e){t._effectSwitchNames||(t._effectSwitchNames=[],t.clearAllEffects=function(){for(var e=t._effectSwitchNames,i=0,s=e.length;i=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=uo(i),s=uo(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),h=n.width,a=0,o=0,l=i.length;o0?h/a:0,c=n.height,u=0;for(o=0,l=s.length;o0?0:g,x=0,o=0;for(var S=i.length;o0?0:f),f>=1&&g>=1){var O=typeof(m=this.getFrameNameCallback(o,C,e));"string"!==O&&"number"!==O||r.add(m,0,x+n.cutX,b+n.cutY,f,g)}x+=f}b+=g}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,h,a,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/o,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(u,p);if(u>v){var g=(u-v)*o;d>=0?d+=g:d=g,u=v}if(p>v){var f=(p-v)*l;c>=0?c+=f:c=f,p=v}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var x=0,b=this.rows.count;x0&&a>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(C,x)?0:1)?this._drawImage(this.textureKey,s,m,y,h,a):this._drawTileSprite(this.textureKey,s,m,y,h,a)),m+=h;y+=a}this._endDraw()},setStretchMode:function(t){return hp(t)?(this.stretchMode.edge=op(ap(t,"edge",0)),this.stretchMode.internal=op(ap(t,"internal",0))):(t=op(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return dp.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const up=Phaser.Utils.Objects.IsPlainObject,pp=Phaser.Utils.Objects.GetValue,vp=Phaser.GameObjects;var gp=void 0,fp=function(t,e){if(gp||(gp={},ti(t).events.once("destroy",(function(){for(var t in gp)gp[t].destroy();gp=void 0}))),!gp.hasOwnProperty(e)){var i=ti(t).scene.systemScene;(t=new vp[e](i)).setOrigin(0),gp[e]=t}return gp[e]};const mp=Phaser.GameObjects.RenderTexture;class yp extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if(up(i)?(i=pp(d=i,"x",0),s=pp(d,"y",0),r=pp(d,"width",1),n=pp(d,"height",1),h=pp(d,"key",void 0),a=pp(d,"baseFrame",void 0),o=pp(d,"columns",void 0),l=pp(d,"rows",void 0)):up(r)?(r=pp(d=r,"width",1),n=pp(d,"height",1),h=pp(d,"key",void 0),a=pp(d,"baseFrame",void 0),o=pp(d,"columns",void 0),l=pp(d,"rows",void 0)):up(h)?(h=pp(d=h,"key",void 0),a=pp(d,"baseFrame",void 0),o=pp(d,"columns",void 0),l=pp(d,"rows",void 0)):up(a)?(a=pp(d=a,"baseFrame",void 0),o=pp(d,"columns",void 0),l=pp(d,"rows",void 0)):Array.isArray(a)?(d=l,l=o,o=a,a=pp(d,"baseFrame",void 0)):up(o)&&(o=pp(d=o,"columns",void 0),l=pp(d,"rows",void 0)),void 0===a&&(a=pp(d,"frame",void 0)),void 0===o){var c=pp(d,"leftWidth",void 0),u=pp(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=pp(d,"topHeight",void 0),v=pp(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(pp(d,"getFrameNameCallback",void 0)),this.setStretchMode(pp(d,"stretchMode",0)),this.setPreserveRatio(pp(d,"preserveRatio",!0));var g=pp(d,"maxFixedPartScale",1),f=pp(d,"maxFixedPartScaleX",g),m=pp(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(h,a,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,cp),i}(mp,"rexNinePatch")){}var xp={_drawImage:function(t,e,i,s,r,n){var h=fp(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=fp(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(yp.prototype,xp);let bp=class extends ii{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Vu(t,e))return t[e];var i=t.parent;return Vu(i,e)?i[e]:void 0}set(t,e,i){return Vu(t,e)?t[e]=i:Vu(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}};const Cp=Phaser.Utils.Objects.GetValue;class wp extends yp{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=Cp(e,"effects",!0);i&&qu(this,i),this.style=new bp(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(wp.prototype,qc);const Sp=["alpha","tint","flipX","flipY"];var Op=function(t,e){if(!e)return t;for(var i=0,s=Sp.length;i * @copyright 2018 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */const Yp=Phaser.Display.Canvas.CanvasPool;var zp=function(t){var e=Yp.create(this),i=e.getContext("2d",{willReadFrequently:!0});t.syncFont(e,i);var s=i.measureText(t.testString);if("actualBoundingBoxAscent"in s){var r=s.actualBoundingBoxAscent,n=s.actualBoundingBoxDescent,h={ascent:r,descent:n,fontSize:r+n};return Yp.remove(e),h}var a=Math.ceil(s.width*t.baselineX),o=a,l=2*o;if(o=o*t.baselineY|0,e.width=a,e.height=l,i.fillStyle="#f00",i.fillRect(0,0,a,l),i.font=t._font,i.textBaseline="alphabetic",i.fillStyle="#000",i.fillText(t.testString,0,o),h={ascent:0,descent:0,fontSize:0},!i.getImageData(0,0,a,l))return h.ascent=o,h.descent=o+6,h.fontSize=h.ascent+h.descent,Yp.remove(e),h;var d,c,u=i.getImageData(0,0,a,l).data,p=u.length,v=4*a,g=0,f=!1;for(d=0;do;d--){for(c=0;c0&&this.wrapMode!==Lc&&0===this.wrapWidth}setStyle(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wordWrap")){var s=t.wordWrap;s.hasOwnProperty("width")&&(t.wrap={mode:"word",width:s.width})}if(t&&t.hasOwnProperty("wrap")){var r=t.wrap;if(r.hasOwnProperty("mode")){var n=r.mode;"string"==typeof n&&(r.mode=zc[n])}else r.hasOwnProperty("width")&&(r.mode=1)}t&&t.rtl&&i&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var h=this.propertyMap;for(var a in h){var o=h[a],l=o[0],d=i?o[1]:this[a],c=o[2];if("wrapCallback"===a||"wrapCallbackScope"===a)this[a]=Wp(t,l,d);else{var u=Xp(t,l,d);c&&(u=c(u)),this[a]=u}}var p=Wp(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var v=Wp(t,"fill",null);null!==v&&(this.color=Da(v));var g=Wp(t,"metrics",!1);return g?this.metrics={ascent:Wp(g,"ascent",0),descent:Wp(g,"descent",0),fontSize:Wp(g,"fontSize",0)}:!e&&this.metrics||(this.metrics=zp(this)),e?this.parent.updateText():this.parent}syncFont(t,e){e.font=this._font}syncStyle(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"}syncShadow(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)}update(t){return t&&(this._font=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim(),this.metrics=zp(this)),this.parent.updateText(t)}buildFont(){var t=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim();return t!==this._font&&(this._font=t),this}setFont(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=Wp(t,"fontFamily","Courier"),this.fontSize=Wp(t,"fontSize","16px"),this.fontStyle=Wp(t,"fontStyle","")),this.update(!0)}setFontFamily(t){return this.fontFamily=t,this.update(!0)}setFontStyle(t){return this.fontStyle=t,this.update(!0)}setFontSize(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}setTestString(t){return this.testString=t,this.update(!0)}setFixedSize(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}setResolution(t){return this.resolution=t,this.update(!1)}setXOffset(t){return this.xOffset=t,this.update(!1)}setBackgroundColor(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=Da(t,this.parent.canvas,this.parent.context),this.backgroundColor2=Da(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=Da(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}setBackgroundCornerRadius(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}setFill(t){return this.color=Da(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=Da(t,this.parent.canvas,this.parent.context),this.update(!1)}setStroke(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=Da(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}setShadow(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===n&&(n=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=Da(i,this.parent.canvas,this.parent.context),this.shadowBlur=s,this.shadowStroke=r,this.shadowFill=n,this.update(!1)}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}setShadowColor(t){return void 0===t&&(t="#000"),this.shadowColor=Da(t,this.parent.canvas,this.parent.context),this.update(!1)}setShadowBlur(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}setShadowStroke(t){return this.shadowStroke=t,this.update(!1)}setShadowFill(t){return this.shadowFill=t,this.update(!1)}setUnderline(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=Da(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}setUnderlineColor(t){return void 0===t&&(t="#000"),this.underlineColor=Da(t,this.parent.canvas,this.parent.context),this.update(!1)}setUnderlineThickness(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}setUnderlineOffset(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}setStrikethrough(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=Da(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}setStrikethroughColor(t){return void 0===t&&(t="#000"),this.strikethroughColor=Da(t,this.parent.canvas,this.parent.context),this.update(!1)}setStrikethroughThickness(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}setStrikethroughOffset(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}setWrapMode(t){return"string"==typeof t&&(t=zc[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}setWrapWidth(t){return this.wrapWidth=t,this.update(!1)}setAlign(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}setHAlign(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}setVAlign(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}setMaxLines(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}getTextMetrics(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}setTextMetrics(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=Wp(e,"fontFamily",this.fontFamily),this.fontSize=Wp(e,"fontSize",this.fontSize),this.fontStyle=Wp(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}get lineHeight(){return this.metrics.fontSize+this.parent.lineSpacing}toJSON(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}destroy(){this.parent=void 0}}var Fp={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var h=this.defaultStyle;this.clear(),Fa(this,h.backgroundColor,h.backgroundStrokeColor,h.backgroundStrokeLineWidth,h.backgroundCornerRadius,h.backgroundColor2,h.backgroundHorizontalGradient,h.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var a,o,l,d,c,u,p=h.halign,v=h.valign,g=h.lineHeight,f=r.lines,m=f.length,y=h.maxLines;y>0&&m>y?(o=y,l="center"===v?Math.floor((m-o)/2):"bottom"===v?m-o:0):(o=m,l=0),d=l+o;var x=this.rtl,b=x?this.parent.width:void 0;u="center"===v?Math.max((s-o*g)/2,0):"bottom"===v?Math.max(s-o*g-2,0):0,u+=e;for(var C=l;C0){var a=this.defaultStyle.metrics,o=i-a.ascent,l=a.fontSize;this.drawRectangle(e,o,t.width,l,h.bgcolor,h)}if(h.underlineThickness>0&&t.width>0){var d=i+h.underlineOffset-h.underlineThickness/2;this.drawLine(e,d,t.width,h.underlineThickness,h.underlineColor,h)}if(t.isTextPen&&(h.buildFont(),h.syncFont(r,n),h.syncStyle(r,n),this.drawText(e,i,t.text,h)),t.isImagePen&&this.drawImage(e,i,t.prop.img,t.prop.color,h),h.strikethroughThickness>0&&t.width>0&&(d=i+h.strikethroughOffset-h.strikethroughThickness/2,this.drawLine(e,d,t.width,h.strikethroughThickness,h.strikethroughColor,h)),n.restore(),t.hasAreaMarker&&t.width>0){var c,u=t.prop.area;if(u)c={key:u};else{var p=t.prop.url;c={key:`url:${p}`,url:p}}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,c)}},clear(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawRectangle(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var h=this.context;h.fillStyle=r,h.fillRect(t,e,i,s)},drawLine(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var h=this.context;n.syncShadow(h,n.shadowStroke);var a=h.lineCap;h.lineCap="butt",h.strokeStyle=r,h.lineWidth=s,h.beginPath(),h.moveTo(t,e),h.lineTo(t+i,e),h.stroke(),h.lineCap=a},drawText(t,e,i,s){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;s.stroke&&"none"!==s.stroke&&s.strokeThickness>0&&(s.syncShadow(r,s.shadowStroke),r.strokeText(i,t,e)),s.color&&"none"!==s.color&&(s.syncShadow(r,s.shadowFill),r.fillText(i,t,e))},drawImage(t,e,i,s,r){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,s,this.autoRound)}};const Ip=Phaser.Utils.Objects.GetValue,Bp=Ec,Hp=Mc;class Gp{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=Ip(t,"text",""),this.x=Ip(t,"x",0),this.y=Ip(t,"y",0),this.width=Ip(t,"width",0);var e=Ip(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=Ip(t,"newLineMode",0),this.startIndex=Ip(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===Hp&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==Bp&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===Hp&&(t+=1),t}get endIndex(){return this.startIndex+this.rawTextLength}get lastX(){return this.x+this.width}get isTextPen(){return""!==this.text}get isImagePen(){return!!this.prop.img}get hasAreaMarker(){return!!this.prop.area||!!this.prop.url}}const Vp=Phaser.Utils.Objects.GetFastValue,Np=Ec,Up=Rc;class $p{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=Vp(t,"tagToText",Xt),this.tagToTextScope=Vp(t,"tagToTextScope",void 0)}destroy(){this.clear(),this.tagToText=void 0,this.tagToTextScope=void 0}clear(){for(var t=0,e=this.lines.length;t=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}getLineEndIndex(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,s=!1;for(e=t;e>=0&&!(s=null!=(i=this.lines[e])&&i.length>0);e--);return s?i[i.length-1].endIndex:0}getLineWidth(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}getMaxLineWidth(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,s=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}getLineWidths(){for(var t=[],e=0,i=this.lines.length;e=t&&o<=e||(h=h.substring(t-a,e-a)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,h,l,d):c+=this.tagToText(h,l,d),d=l,!(o>=e)));u++);return c}get length(){return this.lines.length}set length(t){this.clear()}}var Jp={};const qp=Phaser.Geom.Rectangle;var Kp=new qo;class Zp{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&uv(g)){""!==x?h.push(n.getLine(x,b,nv)):0===C&&r>0&&h.push(n.getLine("",0,nv)),h.push(...dv(g,e,ov,s,0,n));var S=h.pop();x=S.text,b=S.width,n.freeLine(S)," "===x&&(x="",b=0)}else(m=b+f)>o?(h.push(n.getLine(x,b,nv)),x=g,b=f,o=s):(x+=g,b=m),C===w-1&&h.push(n.getLine(x,b,l))}return h},cv=function(t,e){var i;switch(e){case av:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==vv&&i0&&t>e&&(t=e),t}get linesWidth(){return Math.ceil(this.penManager.getMaxLineWidth())}get linesHeight(){var t=this.displayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}get imageManager(){return this.parent.imageManager}get rtl(){return this.parent.style.rtl}newPenManager(){return new $p({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}get tmpPenManager(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}getPlainText(t,e,i){var s;if(null==t)s=this.penManager.plainText;else{var r=this.parser.splitText(t,1);s="";for(var n=0,h=r.length;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return bg(this.sizerChildren,null),vh.call(this,t),this}},wg={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)bg(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},kg={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Xe.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,bg(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)bg(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},_g=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const Eg=Phaser.Utils.Objects.IsPlainObject,Mg=Phaser.Utils.Objects.GetValue;class Rg extends th{constructor(t,e,i,s,r,n,h,a,o,l){Eg(e)?(e=Mg(l=e,"x",0),i=Mg(l,"y",0),s=Mg(l,"width",void 0),r=Mg(l,"height",void 0),n=Mg(l,"column",l.col||0),h=Mg(l,"row",0),a=Mg(l,"columnProportions",0),o=Mg(l,"rowProportions",0)):Eg(s)?(s=Mg(l=s,"width",void 0),r=Mg(l,"height",void 0),n=Mg(l,"column",l.col||0),h=Mg(l,"row",0),a=Mg(l,"columnProportions",0),o=Mg(l,"rowProportions",0)):Eg(n)?(n=Mg(l=n,"column",l.col||0),h=Mg(l,"row",0),a=Mg(l,"columnProportions",0),o=Mg(l,"rowProportions",0)):Eg(a)&&(a=Mg(l=a,"columnProportions",0),o=Mg(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(Mg(l,"createCellContainerCallback")),this.setIndentLeft(Mg(l,"space.indentLeftOdd",0),Mg(l,"space.indentLeftEven",0)),this.setIndentTop(Mg(l,"space.indentTopOdd",0),Mg(l,"space.indentTopEven",0)),this.resetGrid(n,h,a,o,Mg(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=Tg.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=_g.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(Rg.prototype,kg);const Lg=Phaser.Utils.Objects.GetValue,Dg=Phaser.Math.Percent;var Ag=function(t,e,i){var s;return t.y===e.y?s=Dg(i.x,t.x,e.x):t.x===e.x&&(s=Dg(i.y,t.y,e.y)),s},Yg=function(t,e,i){var s,r;this.enable&&(zg.x=e,zg.y=i,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint()),this.value=Ag(s,r,zg))},zg={},Xg=function(t,e,i){if(this.enable&&t.isDown){var s,r;Wg.x=t.worldX,Wg.y=t.worldY,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint());var n=Ag(s,r,Wg);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-n)<.1?this.value=n:this.easeValueTo(n)}},Wg={},jg=function(t,e){void 0===e&&(e=Fg);var i=this.childrenMap.thumb,s=i.x,r=i.y;return ae(i,this.innerLeft,this.innerTop,this.innerWidth,this.innerHeight,t),e.x=i.x,e.y=i.y,i.x=s,i.y=r,e},Fg={};const Ig=Phaser.Display.Align.LEFT_CENTER,Bg=Phaser.Display.Align.TOP_CENTER;var Hg={};const Gg=Phaser.Display.Align.RIGHT_CENTER,Vg=Phaser.Display.Align.BOTTOM_CENTER;var Ng={};const Ug=Phaser.Math.Linear;var $g={};const Jg=Phaser.Display.Align.LEFT_CENTER,qg=Phaser.Display.Align.TOP_CENTER,Kg=Phaser.Display.Align.RIGHT_CENTER,Zg=Phaser.Display.Align.BOTTOM_CENTER,Qg=Phaser.Utils.Objects.GetValue,tf=Phaser.Utils.Objects.IsPlainObject,ef=Phaser.Math.Clamp,sf=Phaser.Math.Snap.To;class rf extends(uu(Th)){constructor(t,e){super(t,e),this.type="rexSlider",this.bootProgressBase(e),this.reverseAxis=Qg(e,"reverseAxis",!1);var i=Qg(e,"background",void 0),s=Qg(e,"track",void 0),r=Qg(e,"indicator",void 0),n=Qg(e,"thumb",void 0);if(i&&(tf(i)&&(i=Op(t,i)),this.addBackground(i)),s&&(tf(s)&&(s=Op(t,s)),this.add(s,{proportion:1,expand:!0,minWidth:0===this.orientation?0:void 0,minHeight:1===this.orientation?0:void 0})),r&&(tf(r)&&(r=Op(t,r)),this.pin(r)),n){tf(n)&&(n=Op(t,n)),this.pin(n);var h=Qg(e,"thumbOffsetX",0),a=Qg(e,"thumbOffsetY",0);this.setThumbOffset(h,a)}var o=Qg(e,"input",0);switch("string"==typeof o&&(o=nf[o]),o){case 0:n&&(n.setInteractive(),this.scene.input.setDraggable(n),n.on("drag",Yg,this).on("dragstart",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("dragend",(function(t){this.eventEmitter.emit("inputend",t)}),this));break;case 1:this.on("pointerdown",Xg,this).on("pointermove",Xg,this).on("pointerdown",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("pointerup",(function(t){this.eventEmitter.emit("inputend",t)}),this).on("pointerover",(function(t){t.isDown&&this.eventEmitter.emit("inputstart",t)}),this).on("pointerout",(function(t){t.isDown&&this.eventEmitter.emit("inputend",t)}),this).setInteractive()}this.addChildrenMap("background",i),this.addChildrenMap("track",s),this.addChildrenMap("indicator",r),this.addChildrenMap("thumb",n),this.setEnable(Qg(e,"enable",void 0));var l=Qg(e,"tick",void 0);void 0===l&&(l=Qg(e,"gap",void 0)),this.setGap(l),this.setValue(Qg(e,"value",0),Qg(e,"min",void 0),Qg(e,"max",void 0))}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setGap(t,e,i){return t&&void 0!==e&&(t/=i-e),this.gap=t,this}setTick(t,e,i){return this.setGap(t,e,i),this}get tick(){return this.gap}set tick(t){this.gap=t}setThumbOffset(t,e){return this.thumbOffsetX=t,this.thumbOffsetY=e,this}get value(){return this._value}set value(t){void 0!==this.gap&&(t=sf(t,this.gap));var e=this._value;this._value=ef(t,0,1),e!==this._value&&(this.updateThumb(this._value),this.updateIndicator(this._value),this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter))}postLayout(t,e,i){return this.updateThumb(),this.updateIndicator(),super.postLayout(t,e,i),this}}const nf={pan:0,drag:0,click:1,none:-1};var hf={getStartPoint:function(t){if(void 0===t&&(t=Hg),this.childrenMap.thumb){var e=0===this.orientation?Ig:Bg;jg.call(this,e,t)}else 0===this.orientation?(t.x=this.innerLeft+1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerTop+1);return t},getEndPoint:function(t){if(void 0===t&&(t=Ng),this.childrenMap.thumb){var e=0===this.orientation?Gg:Vg;jg.call(this,e,t)}else 0===this.orientation?(t.x=this.innerRight-1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerBottom-1);return t},updateThumb:function(t){var e,i,s=this.childrenMap.thumb;return void 0===s||(void 0===t&&(t=this.value),this.reverseAxis?(e=this.getEndPoint(),i=this.getStartPoint()):(e=this.getStartPoint(),i=this.getEndPoint()),function(t,e,i,s){void 0===s&&(s=$g),s.x=Ug(e.x,i.x,t),s.y=Ug(e.y,i.y,t)}(t,e,i,s),s.x+=this.thumbOffsetX,s.y+=this.thumbOffsetY,this.resetChildPositionState(s)),this},updateIndicator:function(t){var e=this.childrenMap.indicator;if(void 0===e)return this;void 0===t&&(t=this.value);var i,s,r,n=this.reverseAxis,h=this.childrenMap.thumb;if(h)if(0===this.orientation){var a,o=Q(h);if(n)a=h.x-o*h.originX,i=this.right-a;else i=(a=h.x-o*h.originX)+o-this.left}else{var l,d=tt(h);if(n)l=h.y-d*h.originY,s=this.bottom-l;else s=(l=h.y-d*h.originY)+d-this.top}else 0===this.orientation?i=this.width*t:s=this.height*t;Ge(e,i,s),r=n?0===this.orientation?Kg:Zg:0===this.orientation?Jg:qg,he(e,this,r),this.resetChildPositionState(e)}};Object.assign(rf.prototype,hf);const af=Phaser.Utils.Objects.GetValue;class of extends Th{constructor(t,e){super(t,e),this.type="rexScrollBar";var i,s,r=af(e,"background",void 0),n=af(e,"buttons",void 0),h=af(n,"top",af(n,"left",void 0)),a=af(n,"bottom",af(n,"right",void 0)),o=af(e,"slider",void 0);(r&&this.addBackground(r),h&&(this.add(h),new Mr(h).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?this.scrollStep:-this.scrollStep;this.value+=t}}),this)),o)&&(o.orientation=this.orientation,o.eventEmitter=this,o.value=null,s=0===this.orientation?void 0===af(o,"width",void 0)?1:0:void 0===af(o,"height",void 0)?1:0,i=new rf(t,o),t.add.existing(i),this.add(i,{proportion:s}));a&&(this.add(a),new Mr(a).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?-this.scrollStep:this.scrollStep;this.value+=t}}),this));var l=[h,a];this.addChildrenMap("background",r),this.addChildrenMap("slider",i),this.addChildrenMap("buttons",l);var d=af(e,"valuechangeCallback",null);if(null!==d){var c=af(e,"valuechangeCallbackScope",void 0);this.on("valuechange",d,c)}this.setEnable(af(e,"enable",void 0)),this.setValue(af(e,"value",0)),this.setScrollStep(af(n,"step",.01))}setScrollStep(t){return this.scrollStep=t,this}get enable(){return!!this.childrenMap.slider&&this.childrenMap.slider.enable}set enable(t){this.childrenMap.slider&&this.childrenMap.slider.setEnable(t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get value(){return this.childrenMap.slider?this.childrenMap.slider.value:0}set value(t){this.childrenMap.slider&&(this.childrenMap.slider.value=t)}setValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setValue(t,e,i),this}addValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.addValue(t,e,i),this}getValue(t,e){return this.childrenMap.slider?this.childrenMap.slider.getValue(t,e):0}easeValueTo(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.easeValueTo(t,e,i),this}stopEaseValue(){return this.childrenMap.slider&&this.childrenMap.slider.stopEaseValue(),this}setEaseValueDuration(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueDuration(t),this}setEaseValueFunction(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueFunction(t),this}setGap(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setGap(t,e,i),this}get gap(){if(this.childrenMap.slider)return this.childrenMap.slider.gap}set gap(t){this.childrenMap.slider&&(this.childrenMap.slider.gap=t)}setTick(t,e,i){return this.setGap(t,e,i),this}get tick(){if(this.childrenMap.slider)return this.childrenMap.slider.tick}set tick(t){this.childrenMap.slider&&(this.childrenMap.slider.tick=t)}}class lf extends Rs{constructor(t,e){super(e),this.parent=t,this.init()}init(){this.start("IDLE")}next_IDLE(){var t,e=this.parent;return e.dragState.isDown&&(t=0===e.dragThreshold?"DRAG":"DRAGBEGIN"),t}update_IDLE(t,e){this.next()}next_DRAGBEGIN(){var t=this.parent,e=t.dragState;return e.isDown?e.pointer.getDistance()>=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const df=Phaser.Utils.Objects.GetValue,cf=Phaser.Math.Distance.Between;class uf extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=df(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(df(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(df(t,"enable",!0)),this.holdThreshold=df(t,"holdThreshold",50),this.pointerOutReleaseEnable=df(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return dn(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:cf(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!or(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!or(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const pf=Phaser.Utils.Objects.GetValue;class vf{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(pf(t,"value",0)),this.setSpeed(pf(t,"speed",0)),this.setAcceleration(pf(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class gf{constructor(){this.value,this.dir,this.movement=new vf}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const xf={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},bf=Phaser.Utils.Objects.GetValue;class Cf extends ii{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=bf(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(bf(e,"speed",.1)),this.setEnable(bf(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(bf(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||or(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const wf=Phaser.Utils.Objects.GetValue;var Sf=function(t,e,i,s){var r,n,h="Y"===(i=i.toUpperCase()),a=2===t.scrollMode,o=t.childrenMap.child,l=`slider${i}`;if(r=a||s.hasOwnProperty(l)?wf(s,l,void 0):wf(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=h?1:0,n=function(t,e){void 0===e&&(e={});var i=mt(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new of(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r),n.tickLength=wf(r,"tickLength",void 0);var p=wf(r,"position",0);"string"==typeof p&&(p=Of[p]);var v,g,f=wf(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=wf(s,"space.slider",void 0))&&(a?f=0:v=wf(s,"space.child",0)),g=void 0===v?"number"==typeof f:"number"==typeof v,h?0===p?(d=2,c=1,u=void 0===v?g?{left:f}:f:{left:wf(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:wf(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:wf(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:wf(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=wf(r,"hideUnscrollableSlider",!1),t[`disableUnscrollableDrag${i}`]=wf(r,"disableUnscrollableDrag",!1),t[`adaptThumb${i}SizeMode`]=wf(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=wf(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`disableUnscrollableDrag${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,x=wf(s,"scrollDetectionMode");"string"==typeof x&&(x=Pf[x]);var b=`scroller${i}`;(m=a||s.hasOwnProperty(b)?wf(s,b,!0):wf(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==x&&(m.rectBoundsInteractive=1===x),y=new yf(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var C,w,S,O,P,k=wf(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);k&&o&&(void 0!==x&&(k.focus=1===x?2:0),C=new Cf(o,k)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,C),a&&!h||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.disableUnscrollableDrag=t[`disableUnscrollableDrag${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",C)),n&&(a?(w=h?"t":"s",O=`scroll${i}`):(w="t",O="scroll"),n.on("valuechange",(function(e){t[w]=e,t.emit(O,t)}))),y&&(a?(S=`childO${i}`,O=`scroll${i}`):(S="childOY",O="scroll"),y.on("valuechange",(function(e){t[S]=e,t.emit(O,t)}))),C&&(P=a?`addChildO${i}`:"addChildOY",C.on("scroll",(function(e){t[P](-e,!0)})))};const Of={right:0,left:1,bottom:0,top:1},Pf={gameObject:0,rectBounds:1},kf=Phaser.Utils.Objects.GetValue;var Tf=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=kf(e,"width"),h=kf(e,"height");n||kf(e,"child.expandWidth",!0)||(s[1]=0),h||kf(e,"child.expandHeight",!0)||(r[1]=0);var a=new Rg(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=Lg(i,"child"),r=Lg(s,"gameObject",void 0);if(r){var n=Lg(i,"space.child",0);t.childMargin={};var h=t.childMargin,a={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:h.top=0,h.bottom=0,h.left=0,h.right=0;break;default:h.top=n,h.bottom=n,h.left=n,h.right=n}else switch(t.scrollMode){case 0:h.top=Lg(n,"top",0),h.bottom=Lg(n,"bottom",0),a.left=Lg(n,"left",0),a.right=Lg(n,"right",0);break;case 1:h.top=Lg(n,"left",0),h.bottom=Lg(n,"right",0),a.top=Lg(n,"top",0),a.bottom=Lg(n,"bottom",0);break;default:h.top=Lg(n,"top",0),h.bottom=Lg(n,"bottom",0),h.left=Lg(n,"left",0),h.right=Lg(n,"right",0)}e.add(r,{column:1,row:1,align:Lg(s,"align","center"),padding:a,expand:{width:Lg(s,"expandWidth",!0),height:Lg(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:Sf(t,a,"y",e);break;case 1:Sf(t,a,"x",e);break;default:Sf(t,a,"y",e),Sf(t,a,"x",e)}return a},_f=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}i*="Y"===t?this.scaleY:this.scaleX,s&&s.setBounds(e,i),r&&(r.setEnable(e!==i),r.tickLength&&r.setTick(r.tickLength,e,i))},Ef=function(t){switch(this.scrollMode){case 0:case 1:(i=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(i,this.isOverflow),(r=this.childrenMap.scroller)&&this.disableUnscrollableDrag&&r.setEnable(this.isOverflow);break;default:var e=this[`isOverflow${t=t.toUpperCase()}`],i=this.childrenMap[`slider${t}`],s=this[`hideUnscrollableSlider${t}`];i&&s&&this.setChildVisible(i,e);var r=this.childrenMap.scroller,n=this[`disableUnscrollableDrag${t}`];r&&n&&r.setEnable(e)}},Mf=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(a=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=a.childrenMap.track,s=a.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&n0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n")}return i}(this.textObject,this.text,this.lines),this.linesCount=this.lines.length,this._textHeight=void 0,this._textVisibleHeight=void 0,this.updateTextObject(),this},updateTextObject:function(){var t=Math.max(Math.floor(zf.call(this,-this.textOY)),0),e=Xf.call(this,t)+this.textOY,i=Wf.call(this,t);return function(t,e){switch(kc(t)){case 0:var i=(r=t.style).wordWrapWidth,s=r.wordWrapCallback;r.wordWrapWidth=0,r.wordWrapCallback=void 0,t.setText(e),r.wordWrapWidth=i,r.wordWrapCallback=s;break;case 1:var r,n=(r=t.style).wrapMode;r.wrapMode=0,t.setText(e),r.wrapMode=n;break;case 2:var h=t._maxWidth;t._maxWidth=0,t.setText(e),t._maxWidth=h}}(this.textObject,i),this.textObject.rexSizer.offsetY=e,jf.call(this),this},preLayout:function(){return this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,Ie.call(this),this},layoutChildren:function(){var t,e,i,s,r,n,h,a=this.left,o=this.top;(t=this.textObject).rexSizer.hidden||(s=a+(i=(e=t.rexSizer).padding).left*this.scaleX,r=o+i.top*this.scaleY,n=this.width*this.scaleX-(i.left+i.right)*this.scaleX,h=this.height*this.scaleY-(i.top+i.bottom)*this.scaleY,If.call(this,t,n,h),ae(t,s,r,n,h,e.align),e.preOffsetY=0,jf.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const Hf=Phaser.Utils.Objects.IsPlainObject,Gf=Phaser.Utils.Objects.GetValue,Vf=Phaser.Display.Align.TOP_LEFT;class Nf extends th{constructor(t,e,i,s,r,n){Hf(e)?(e=Gf(n=e,"x",0),i=Gf(n,"y",0),s=Gf(n,"width",void 0),r=Gf(n,"height",void 0)):Hf(s)&&(s=Gf(n=s,"width",void 0),r=Gf(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexTextBlock",this.textObject=void 0,this.linesCount=0,this.textMask=void 0,this.textObjectType=void 0,this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,this._textObjectRealHeight=0,this.lines=void 0,this.text=Gf(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode(Gf(n,"clampTextOY",!0)),this.alwaysScrollable=Gf(n,"alwaysScrollable",!1);var h=Gf(n,"background",void 0),a=Gf(n,"text",void 0);void 0===a&&(a=Uf(t)),this.textCropEnable=Gf(n,"textCrop",!!a.setCrop);var o=Gf(n,"textMask",!this.textCropEnable);h&&this.addBackground(h),this.add(a),this.sizerChildren=[a];var l=this.getSizerConfig(a);l.align=Vf,l.padding=ge(0),l.expand=!0,this.textObject=a,this.textObjectType=kc(a),l.preOffsetY=0,l.offsetY=0,o&&(this.textMask=Cc.call(this,this.textObject,this)),this.addChildrenMap("background",h),this.addChildrenMap("text",a)}destroy(t){if(this.scene&&!this.ignoreDestroy){if(this.textObject=void 0,this.textMask=void 0,this.lines){switch(this.textObjectType){case 0:case 2:this.lines.length=0;break;case 1:this.lines.destroy()}this.lines=void 0}super.destroy(t)}}setClampMode(t){return void 0===t&&(t=!0),this.clampTextOY=t,this}get textLineHeight(){if(void 0===this._textLineHeight){var t;switch(this.textObjectType){case 0:case 1:var e=this.textObject.style;t=e.metrics.fontSize+e.strokeThickness;break;case 2:var i=this.textObject.fontSize/this.textObject.fontData.size;t=this.textObject.fontData.lineHeight*i}this._textLineHeight=t}return this._textLineHeight}get textLineSpacing(){if(void 0===this._textLineSpacing){var t;switch(this.textObjectType){case 0:case 1:t=this.textObject.lineSpacing;break;case 2:t=0}this._textLineSpacing=t}return this._textLineSpacing}get visibleLinesCount(){return void 0===this._visibleLinesCount&&(this._visibleLinesCount=Math.floor(zf.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=Xf.call(this,this.linesCount)),this._textHeight}get textObjectHeight(){return this._textObjectRealHeight-(this.textLineHeight+this.textLineSpacing)}get textVisibleHeight(){if(void 0===this._textVisibleHeight){var t=this.textHeight-this.textObjectHeight;!this.alwaysScrollable&&t<0&&(t=0),this._textVisibleHeight=t}return this._textVisibleHeight}textOYExceedTop(t){return void 0===t&&(t=this.textOY),t>this.topTextOY}textOYExeceedBottom(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:s?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}setTextOY(t){return this.textOY=t,this}set t(t){this.textOY=-this.textVisibleHeight*t}get t(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t}setTextOYByPercentage(t){return this.t=t,this}}var Uf=function(t){return t.add.text(0,0,"")};Object.assign(Nf.prototype,Bf);var $f={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},Jf={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const qf=Phaser.Utils.Objects.GetValue;class Kf extends Af{constructor(t,e){void 0===e&&(e={});var i=qf(e,"text",void 0),s=qf(e,"textWidth",void 0),r=qf(e,"textHeight",void 0),n=qf(e,"textCrop",!!i.setCrop),h=qf(e,"textMask",!n),a=qf(e,"content",""),o=new Nf(t,{width:s,height:r,text:i,textMask:h,textCrop:n&&!h,content:a,clampTextOY:qf(e,"clampChildOY",!1),alwaysScrollable:qf(e,"alwaysScrollable",!1)});t.add.existing(o),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textObjectHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.textHeight}})}(o),e.scrollMode=0,e.type="rexTextArea",e.child={gameObject:o,expandWidth:void 0===s,expandHeight:void 0===r};var l=qf(e,"space",void 0);l&&(l.child=qf(l,"text",0)),super(t,e),this.addChildrenMap("text",i)}get text(){return this.childrenMap.child.text}get lineHeight(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.textHeight}}Object.assign(Kf.prototype,$f,Jf);const Zf=Phaser.Utils.Objects.GetValue;var Qf=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("key")&&(i="bitmaptext",e.font=e.key)),i){case"bitmaptext":case"bitmap":s=new dg(t,e);break;case"bbcodetext":case"bbcode":s=new hg(t,0,0,"",e);break;case"label":s=new im(t,e);break;case"textarea":s=function(t,e,i){e=e?uo(e):{};var s=Zf(i,"background",Op),r=Zf(i,"text",Qf),n=Zf(i,"track",Op),h=Zf(i,"thumb",Op);s?e.background=s(t,e.background):delete e.background,r?e.text=r(t,e.text):delete e.text;var a=e.slider;!1!==a&&null!==a&&(void 0===a&&(a={}),n?a.track=n(t,a.track):delete a.track,h?a.thumb=h(t,a.thumb):delete a.thumb,e.slider=a);var o=new Kf(t,e);return t.add.existing(o),o}(t,e);break;default:s=new Tp(t,e)}return Sp(s,e),t.add.existing(s),s},tm=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("leftWidth")?i="nineSlice":(e.hasOwnProperty("color")||e.hasOwnProperty("strokeColor"))&&(i="roundRectangle")),i){case"nineSlice":s=e.hasOwnProperty("stretchMode")?new Cp(t,e):new Qu(t,e);break;case"roundRectangle":s=new Kc(t,e);break;default:s=new sp(t,e)}return Sp(s,e),t.add.existing(s),s};const em=Phaser.Utils.Objects.GetValue;class im extends Vc{constructor(t,e,i){e=function(t,e,i){e=e?uo(e):{};var s=em(i,"background",Op),r=em(i,"text",Qf),n=em(i,"icon",tm),h=em(i,"action",tm);return null!==e.background&&s?e.background=s(t,e.background):delete e.background,null!==e.text&&r?e.text=r(t,e.text):delete e.text,null!==e.icon&&n?e.icon=n(t,e.icon):delete e.icon,null!==e.action&&h?e.action=h(t,e.action):delete e.action,e}(t,e,i),super(t,e),this.type="rexSimpleLabel"}setActiveState(t){return sm(this.getChildren(),"setActiveState",t),this}setHoverState(t){return sm(this.getChildren(),"setHoverState",t),this}setDisableState(t){return sm(this.getChildren(),"setDisableState",t),this}}var sm=function(t,e,i){for(var s=0,r=t.length;s0&&{height:this.colorComponentsHeight,formatLabel:this.colorComponentsFormatLabelConfig,inputText:this.colorComponentsInputTextConfig,space:this.colorComponentsSpace};var h=new cm(t,{width:s,height:n,background:e,space:this.colorPickerSpace,hPalette:{position:this.colorPickerHPalettePosition},colorComponents:r,value:this.value});return t.add.existing(h),h};const pm=Phaser.Utils.Objects.GetValue;var vm=function(t,e){var i=pm(e,"expandDirection",void 0);"string"==typeof i&&(i=gm[i]);var s,r,n,h,a,o,l,d=(n="alignTargetX",_l(s=e,r="alignTarget")?ks(s,r):n&&_l(s,n)?ks(s,n):h&&_l(s,h)?ks(s,h):a),c=pm(e,"alignTargetY",d),u=pm(e,"alignOffsetX",0),p=pm(e,"alignOffsetY",0),v=pm(e,"alignSide","").includes("right"),g=pm(e,"bounds"),f=0===i,m=!(f||1===i),y=v?1:0,x=f||m?0:1;t.setOrigin(y,x),o=v?d.getTopRight().x:d.getTopLeft().x,l=c.getBottomLeft().y,t.setPosition(o+u,l+p);var b=g;b||(b=Dt(t.scene)),m&&t.getBottomLeft().y>b.bottom&&(l=c.getTopLeft().y,t.setOrigin(0,1).setPosition(o+u,l+p))};const gm={down:0,up:1},fm=Phaser.Utils.Objects.GetValue;class mm extends js{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=function(t,e){Mi(t,e,"y","Cubic")}),null==e.transitOut&&(e.transitOut=function(t,e){!function(t,e,i,s,r){void 0===s&&(s="Linear");var n={mode:0};switch(i){case 0:case"x":n.end={x:0};break;case 1:case"y":n.end={y:0};break;default:n.end=0}n.duration=e,n.ease=s,void 0===r?r=new _i(t,n):r.resetFromJSON(n),r.restart()}(t,e,"y","Linear")}),e.manualClose=!0,e.clickOutsideClose=!0,e.destroy=!0,super(t,e),vm(t,e),t.isRexSizer&&t.layout();var i=fm(e,"touchOutsideClose",!1),s=fm(e,"anyTouchClose",!1);s&&(i=!1),s?this.once("open",this.anyTouchClose,this):i&&this.once("open",this.touchOutsideClose,this),this.requestOpen()}shutdown(t){this.isShutdown||(this.scene.input.off("pointerup",this.touchCloseCallback,this),super.shutdown(t))}touchOutsideClose(){return this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Zs(this.parent,t.worldX,t.worldY)||this.requestClose()}onOpen(){this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.parent,this),super.onClose()}}var ym={openColorPicker:function(){if(!this.colorPicker){var t=um.call(this).layout(),e=new mm(t,{duration:{in:this.colorPickerEaseInDuration,out:this.colorPickerEaseOutDuration},transitIn:this.colorPickerTransitInCallback,transitOut:this.colorPickerTransitOutCallback,expandDirection:this.colorPickerExpandDirection,alignTargetX:this,alignTargetY:this,bounds:this.colorPickerBounds,touchOutsideClose:!0}).on("open",(function(){t.on("valuechange",(function(t){this.setValue(t)}),this)}),this).on("close",(function(){this.colorPicker=void 0,this.dropDownBehavior=void 0}),this);return this.colorPicker=t,this.dropDownBehavior=e,this.pin(t),this}}};Object.assign(ym,wd);const xm=Phaser.Utils.Objects.GetValue;class bm extends Cd{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexColorInput",e.hasOwnProperty("colorPicker")||(e.colorPicker={background:{color:0}});var i=e.colorPicker,s=!1!==i&&null!==i;if(s){var r;this.setColorPickerSize(xm(i,"width",160),xm(i,"height",170));var n=xm(i,"background");r=n?function(t){return Op(t,n)}:xm(i,"createBackgroundCallback"),this.setCreateColorPickerBackgroundCallback(r),this.setColorPickerHPalettePosition(xm(i,"hPalettePosition",0)),this.setColorPickerExpandDirection(xm(i,"expandDirection")),this.setColorPickerEaseInDuration(xm(i,"easeIn",200)),this.setColorPickerEaseOutDuration(xm(i,"easeOut",200)),this.setColorPickerTransitInCallback(xm(i,"transitIn")),this.setColorPickerTransitOutCallback(xm(i,"transitOut")),this.setColorPickerBounds(xm(i,"bounds"));var h=xm(i,"space");void 0===h&&(h={left:10,right:10,top:10,bottom:10,item:8}),this.setColorPickerSpace(h)}var a=e.colorComponents;if(s&&!1!==a&&null!==a){this.setColorComponentsHeight(xm(a,"height",30)),this.setColorComponentsFormatLabelConfig(xm(a,"formatLabel"));var o=xm(a,"inputText");o||(o=xm(e,"inputText")),this.setColorComponentsInputTextConfig(o);var l=xm(a,"space");void 0===l&&(l={item:8}),this.setColorComponentsSpace(l)}var d=this.childrenMap.swatch;d&&s&&this.onClick(d,this.openColorPicker,this)}}return Object.assign(bm.prototype,ym),bm},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rexcolorinput=e(); + */const zp=Phaser.Display.Canvas.CanvasPool;var Xp=function(t){var e=zp.create(this),i=e.getContext("2d",{willReadFrequently:!0});t.syncFont(e,i);var s=i.measureText(t.testString);if("actualBoundingBoxAscent"in s){var r=s.actualBoundingBoxAscent,n=s.actualBoundingBoxDescent,h={ascent:r,descent:n,fontSize:r+n};return zp.remove(e),h}var a=Math.ceil(s.width*t.baselineX),o=a,l=2*o;if(o=o*t.baselineY|0,e.width=a,e.height=l,i.fillStyle="#f00",i.fillRect(0,0,a,l),i.font=t._font,i.textBaseline="alphabetic",i.fillStyle="#000",i.fillText(t.testString,0,o),h={ascent:0,descent:0,fontSize:0},!i.getImageData(0,0,a,l))return h.ascent=o,h.descent=o+6,h.fontSize=h.ascent+h.descent,zp.remove(e),h;var d,c,u=i.getImageData(0,0,a,l).data,p=u.length,v=4*a,g=0,f=!1;for(d=0;do;d--){for(c=0;c0&&this.wrapMode!==Lc&&0===this.wrapWidth}setStyle(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wordWrap")){var s=t.wordWrap;s.hasOwnProperty("width")&&(t.wrap={mode:"word",width:s.width})}if(t&&t.hasOwnProperty("wrap")){var r=t.wrap;if(r.hasOwnProperty("mode")){var n=r.mode;"string"==typeof n&&(r.mode=zc[n])}else r.hasOwnProperty("width")&&(r.mode=1)}t&&t.rtl&&i&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var h=this.propertyMap;for(var a in h){var o=h[a],l=o[0],d=i?o[1]:this[a],c=o[2];if("wrapCallback"===a||"wrapCallbackScope"===a)this[a]=jp(t,l,d);else{var u=Wp(t,l,d);c&&(u=c(u)),this[a]=u}}var p=jp(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var v=jp(t,"fill",null);null!==v&&(this.color=Da(v));var g=jp(t,"metrics",!1);return g?this.metrics={ascent:jp(g,"ascent",0),descent:jp(g,"descent",0),fontSize:jp(g,"fontSize",0)}:!e&&this.metrics||(this.metrics=Xp(this)),e?this.parent.updateText():this.parent}syncFont(t,e){e.font=this._font}syncStyle(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"}syncShadow(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)}update(t){return t&&(this._font=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim(),this.metrics=Xp(this)),this.parent.updateText(t)}buildFont(){var t=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim();return t!==this._font&&(this._font=t),this}setFont(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=jp(t,"fontFamily","Courier"),this.fontSize=jp(t,"fontSize","16px"),this.fontStyle=jp(t,"fontStyle","")),this.update(!0)}setFontFamily(t){return this.fontFamily=t,this.update(!0)}setFontStyle(t){return this.fontStyle=t,this.update(!0)}setFontSize(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}setTestString(t){return this.testString=t,this.update(!0)}setFixedSize(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}setResolution(t){return this.resolution=t,this.update(!1)}setXOffset(t){return this.xOffset=t,this.update(!1)}setBackgroundColor(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=Da(t,this.parent.canvas,this.parent.context),this.backgroundColor2=Da(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=Da(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}setBackgroundCornerRadius(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}setFill(t){return this.color=Da(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=Da(t,this.parent.canvas,this.parent.context),this.update(!1)}setStroke(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=Da(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}setShadow(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===n&&(n=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=Da(i,this.parent.canvas,this.parent.context),this.shadowBlur=s,this.shadowStroke=r,this.shadowFill=n,this.update(!1)}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}setShadowColor(t){return void 0===t&&(t="#000"),this.shadowColor=Da(t,this.parent.canvas,this.parent.context),this.update(!1)}setShadowBlur(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}setShadowStroke(t){return this.shadowStroke=t,this.update(!1)}setShadowFill(t){return this.shadowFill=t,this.update(!1)}setUnderline(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=Da(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}setUnderlineColor(t){return void 0===t&&(t="#000"),this.underlineColor=Da(t,this.parent.canvas,this.parent.context),this.update(!1)}setUnderlineThickness(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}setUnderlineOffset(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}setStrikethrough(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=Da(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}setStrikethroughColor(t){return void 0===t&&(t="#000"),this.strikethroughColor=Da(t,this.parent.canvas,this.parent.context),this.update(!1)}setStrikethroughThickness(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}setStrikethroughOffset(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}setWrapMode(t){return"string"==typeof t&&(t=zc[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}setWrapWidth(t){return this.wrapWidth=t,this.update(!1)}setAlign(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}setHAlign(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}setVAlign(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}setMaxLines(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}getTextMetrics(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}setTextMetrics(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=jp(e,"fontFamily",this.fontFamily),this.fontSize=jp(e,"fontSize",this.fontSize),this.fontStyle=jp(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}get lineHeight(){return this.metrics.fontSize+this.parent.lineSpacing}toJSON(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}destroy(){this.parent=void 0}}var Ip={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var h=this.defaultStyle;this.clear(),Fa(this,h.backgroundColor,h.backgroundStrokeColor,h.backgroundStrokeLineWidth,h.backgroundCornerRadius,h.backgroundColor2,h.backgroundHorizontalGradient,h.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var a,o,l,d,c,u,p=h.halign,v=h.valign,g=h.lineHeight,f=r.lines,m=f.length,y=h.maxLines;y>0&&m>y?(o=y,l="center"===v?Math.floor((m-o)/2):"bottom"===v?m-o:0):(o=m,l=0),d=l+o;var x=this.rtl,b=x?this.parent.width:void 0;u="center"===v?Math.max((s-o*g)/2,0):"bottom"===v?Math.max(s-o*g-2,0):0,u+=e;for(var C=l;C0){var a=this.defaultStyle.metrics,o=i-a.ascent,l=a.fontSize;this.drawRectangle(e,o,t.width,l,h.bgcolor,h)}if(h.underlineThickness>0&&t.width>0){var d=i+h.underlineOffset-h.underlineThickness/2;this.drawLine(e,d,t.width,h.underlineThickness,h.underlineColor,h)}if(t.isTextPen&&(h.buildFont(),h.syncFont(r,n),h.syncStyle(r,n),this.drawText(e,i,t.text,h)),t.isImagePen&&this.drawImage(e,i,t.prop.img,t.prop.color,h),h.strikethroughThickness>0&&t.width>0&&(d=i+h.strikethroughOffset-h.strikethroughThickness/2,this.drawLine(e,d,t.width,h.strikethroughThickness,h.strikethroughColor,h)),n.restore(),t.hasAreaMarker&&t.width>0){var c,u=t.prop.area;if(u)c={key:u};else{var p=t.prop.url;c={key:`url:${p}`,url:p}}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,c)}},clear(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawRectangle(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var h=this.context;h.fillStyle=r,h.fillRect(t,e,i,s)},drawLine(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var h=this.context;n.syncShadow(h,n.shadowStroke);var a=h.lineCap;h.lineCap="butt",h.strokeStyle=r,h.lineWidth=s,h.beginPath(),h.moveTo(t,e),h.lineTo(t+i,e),h.stroke(),h.lineCap=a},drawText(t,e,i,s){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;s.stroke&&"none"!==s.stroke&&s.strokeThickness>0&&(s.syncShadow(r,s.shadowStroke),r.strokeText(i,t,e)),s.color&&"none"!==s.color&&(s.syncShadow(r,s.shadowFill),r.fillText(i,t,e))},drawImage(t,e,i,s,r){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,s,this.autoRound)}};const Bp=Phaser.Utils.Objects.GetValue,Hp=Ec,Gp=Mc;class Vp{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=Bp(t,"text",""),this.x=Bp(t,"x",0),this.y=Bp(t,"y",0),this.width=Bp(t,"width",0);var e=Bp(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=Bp(t,"newLineMode",0),this.startIndex=Bp(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===Gp&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==Hp&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===Gp&&(t+=1),t}get endIndex(){return this.startIndex+this.rawTextLength}get lastX(){return this.x+this.width}get isTextPen(){return""!==this.text}get isImagePen(){return!!this.prop.img}get hasAreaMarker(){return!!this.prop.area||!!this.prop.url}}const Np=Phaser.Utils.Objects.GetFastValue,Up=Ec,$p=Rc;class Jp{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=Np(t,"tagToText",Xt),this.tagToTextScope=Np(t,"tagToTextScope",void 0)}destroy(){this.clear(),this.tagToText=void 0,this.tagToTextScope=void 0}clear(){for(var t=0,e=this.lines.length;t=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}getLineEndIndex(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,s=!1;for(e=t;e>=0&&!(s=null!=(i=this.lines[e])&&i.length>0);e--);return s?i[i.length-1].endIndex:0}getLineWidth(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}getMaxLineWidth(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,s=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}getLineWidths(){for(var t=[],e=0,i=this.lines.length;e=t&&o<=e||(h=h.substring(t-a,e-a)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,h,l,d):c+=this.tagToText(h,l,d),d=l,!(o>=e)));u++);return c}get length(){return this.lines.length}set length(t){this.clear()}}var qp={};const Kp=Phaser.Geom.Rectangle;var Zp=new qo;class Qp{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&pv(g)){""!==x?h.push(n.getLine(x,b,hv)):0===C&&r>0&&h.push(n.getLine("",0,hv)),h.push(...cv(g,e,lv,s,0,n));var S=h.pop();x=S.text,b=S.width,n.freeLine(S)," "===x&&(x="",b=0)}else(m=b+f)>o?(h.push(n.getLine(x,b,hv)),x=g,b=f,o=s):(x+=g,b=m),C===w-1&&h.push(n.getLine(x,b,l))}return h},uv=function(t,e){var i;switch(e){case ov:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==gv&&i0&&t>e&&(t=e),t}get linesWidth(){return Math.ceil(this.penManager.getMaxLineWidth())}get linesHeight(){var t=this.displayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}get imageManager(){return this.parent.imageManager}get rtl(){return this.parent.style.rtl}newPenManager(){return new Jp({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}get tmpPenManager(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}getPlainText(t,e,i){var s;if(null==t)s=this.penManager.plainText;else{var r=this.parser.splitText(t,1);s="";for(var n=0,h=r.length;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return Cg(this.sizerChildren,null),vh.call(this,t),this}},Sg={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)Cg(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},Tg={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Xe.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,Cg(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Cg(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},Eg=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const Mg=Phaser.Utils.Objects.IsPlainObject,Rg=Phaser.Utils.Objects.GetValue;class Lg extends th{constructor(t,e,i,s,r,n,h,a,o,l){Mg(e)?(e=Rg(l=e,"x",0),i=Rg(l,"y",0),s=Rg(l,"width",void 0),r=Rg(l,"height",void 0),n=Rg(l,"column",l.col||0),h=Rg(l,"row",0),a=Rg(l,"columnProportions",0),o=Rg(l,"rowProportions",0)):Mg(s)?(s=Rg(l=s,"width",void 0),r=Rg(l,"height",void 0),n=Rg(l,"column",l.col||0),h=Rg(l,"row",0),a=Rg(l,"columnProportions",0),o=Rg(l,"rowProportions",0)):Mg(n)?(n=Rg(l=n,"column",l.col||0),h=Rg(l,"row",0),a=Rg(l,"columnProportions",0),o=Rg(l,"rowProportions",0)):Mg(a)&&(a=Rg(l=a,"columnProportions",0),o=Rg(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(Rg(l,"createCellContainerCallback")),this.setIndentLeft(Rg(l,"space.indentLeftOdd",0),Rg(l,"space.indentLeftEven",0)),this.setIndentTop(Rg(l,"space.indentTopOdd",0),Rg(l,"space.indentTopEven",0)),this.resetGrid(n,h,a,o,Rg(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=_g.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=Eg.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(Lg.prototype,Tg);const Dg=Phaser.Utils.Objects.GetValue,Ag=Phaser.Math.Percent;var Yg=function(t,e,i){var s;return t.y===e.y?s=Ag(i.x,t.x,e.x):t.x===e.x&&(s=Ag(i.y,t.y,e.y)),s},zg=function(t,e,i){var s,r;this.enable&&(Xg.x=e,Xg.y=i,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint()),this.value=Yg(s,r,Xg))},Xg={},Wg=function(t,e,i){if(this.enable&&t.isDown){var s,r;jg.x=t.worldX,jg.y=t.worldY,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint());var n=Yg(s,r,jg);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-n)<.1?this.value=n:this.easeValueTo(n)}},jg={},Fg=function(t,e){void 0===e&&(e=Ig);var i=this.childrenMap.thumb,s=i.x,r=i.y;return ae(i,this.innerLeft,this.innerTop,this.innerWidth,this.innerHeight,t),e.x=i.x,e.y=i.y,i.x=s,i.y=r,e},Ig={};const Bg=Phaser.Display.Align.LEFT_CENTER,Hg=Phaser.Display.Align.TOP_CENTER;var Gg={};const Vg=Phaser.Display.Align.RIGHT_CENTER,Ng=Phaser.Display.Align.BOTTOM_CENTER;var Ug={};const $g=Phaser.Math.Linear;var Jg={};const qg=Phaser.Display.Align.LEFT_CENTER,Kg=Phaser.Display.Align.TOP_CENTER,Zg=Phaser.Display.Align.RIGHT_CENTER,Qg=Phaser.Display.Align.BOTTOM_CENTER,tf=Phaser.Utils.Objects.GetValue,ef=Phaser.Utils.Objects.IsPlainObject,sf=Phaser.Math.Clamp,rf=Phaser.Math.Snap.To;class nf extends(uu(Th)){constructor(t,e){super(t,e),this.type="rexSlider",this.bootProgressBase(e),this.reverseAxis=tf(e,"reverseAxis",!1);var i=tf(e,"background",void 0),s=tf(e,"track",void 0),r=tf(e,"indicator",void 0),n=tf(e,"thumb",void 0);if(i&&(ef(i)&&(i=Pp(t,i)),this.addBackground(i)),s&&(ef(s)&&(s=Pp(t,s)),this.add(s,{proportion:1,expand:!0,minWidth:0===this.orientation?0:void 0,minHeight:1===this.orientation?0:void 0})),r&&(ef(r)&&(r=Pp(t,r)),this.pin(r)),n){ef(n)&&(n=Pp(t,n)),this.pin(n);var h=tf(e,"thumbOffsetX",0),a=tf(e,"thumbOffsetY",0);this.setThumbOffset(h,a)}var o=tf(e,"input",0);switch("string"==typeof o&&(o=hf[o]),o){case 0:n&&(n.setInteractive(),this.scene.input.setDraggable(n),n.on("drag",zg,this).on("dragstart",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("dragend",(function(t){this.eventEmitter.emit("inputend",t)}),this));break;case 1:this.on("pointerdown",Wg,this).on("pointermove",Wg,this).on("pointerdown",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("pointerup",(function(t){this.eventEmitter.emit("inputend",t)}),this).on("pointerover",(function(t){t.isDown&&this.eventEmitter.emit("inputstart",t)}),this).on("pointerout",(function(t){t.isDown&&this.eventEmitter.emit("inputend",t)}),this).setInteractive()}this.addChildrenMap("background",i),this.addChildrenMap("track",s),this.addChildrenMap("indicator",r),this.addChildrenMap("thumb",n),this.setEnable(tf(e,"enable",void 0));var l=tf(e,"tick",void 0);void 0===l&&(l=tf(e,"gap",void 0)),this.setGap(l),this.setValue(tf(e,"value",0),tf(e,"min",void 0),tf(e,"max",void 0))}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setGap(t,e,i){return t&&void 0!==e&&(t/=i-e),this.gap=t,this}setTick(t,e,i){return this.setGap(t,e,i),this}get tick(){return this.gap}set tick(t){this.gap=t}setThumbOffset(t,e){return this.thumbOffsetX=t,this.thumbOffsetY=e,this}get value(){return this._value}set value(t){void 0!==this.gap&&(t=rf(t,this.gap));var e=this._value;this._value=sf(t,0,1),e!==this._value&&(this.updateThumb(this._value),this.updateIndicator(this._value),this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter))}postLayout(t,e,i){return this.updateThumb(),this.updateIndicator(),super.postLayout(t,e,i),this}}const hf={pan:0,drag:0,click:1,none:-1};var af={getStartPoint:function(t){if(void 0===t&&(t=Gg),this.childrenMap.thumb){var e=0===this.orientation?Bg:Hg;Fg.call(this,e,t)}else 0===this.orientation?(t.x=this.innerLeft+1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerTop+1);return t},getEndPoint:function(t){if(void 0===t&&(t=Ug),this.childrenMap.thumb){var e=0===this.orientation?Vg:Ng;Fg.call(this,e,t)}else 0===this.orientation?(t.x=this.innerRight-1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerBottom-1);return t},updateThumb:function(t){var e,i,s=this.childrenMap.thumb;return void 0===s||(void 0===t&&(t=this.value),this.reverseAxis?(e=this.getEndPoint(),i=this.getStartPoint()):(e=this.getStartPoint(),i=this.getEndPoint()),function(t,e,i,s){void 0===s&&(s=Jg),s.x=$g(e.x,i.x,t),s.y=$g(e.y,i.y,t)}(t,e,i,s),s.x+=this.thumbOffsetX,s.y+=this.thumbOffsetY,this.resetChildPositionState(s)),this},updateIndicator:function(t){var e=this.childrenMap.indicator;if(void 0===e)return this;void 0===t&&(t=this.value);var i,s,r,n=this.reverseAxis,h=this.childrenMap.thumb;if(h)if(0===this.orientation){var a,o=Q(h);if(n)a=h.x-o*h.originX,i=this.right-a;else i=(a=h.x-o*h.originX)+o-this.left}else{var l,d=tt(h);if(n)l=h.y-d*h.originY,s=this.bottom-l;else s=(l=h.y-d*h.originY)+d-this.top}else 0===this.orientation?i=this.width*t:s=this.height*t;Ge(e,i,s),r=n?0===this.orientation?Zg:Qg:0===this.orientation?qg:Kg,he(e,this,r),this.resetChildPositionState(e)}};Object.assign(nf.prototype,af);const of=Phaser.Utils.Objects.GetValue;class lf extends Th{constructor(t,e){super(t,e),this.type="rexScrollBar";var i,s,r=of(e,"background",void 0),n=of(e,"buttons",void 0),h=of(n,"top",of(n,"left",void 0)),a=of(n,"bottom",of(n,"right",void 0)),o=of(e,"slider",void 0);(r&&this.addBackground(r),h&&(this.add(h),new Mr(h).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?this.scrollStep:-this.scrollStep;this.value+=t}}),this)),o)&&(o.orientation=this.orientation,o.eventEmitter=this,o.value=null,s=0===this.orientation?void 0===of(o,"width",void 0)?1:0:void 0===of(o,"height",void 0)?1:0,i=new nf(t,o),t.add.existing(i),this.add(i,{proportion:s}));a&&(this.add(a),new Mr(a).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?-this.scrollStep:this.scrollStep;this.value+=t}}),this));var l=[h,a];this.addChildrenMap("background",r),this.addChildrenMap("slider",i),this.addChildrenMap("buttons",l);var d=of(e,"valuechangeCallback",null);if(null!==d){var c=of(e,"valuechangeCallbackScope",void 0);this.on("valuechange",d,c)}this.setEnable(of(e,"enable",void 0)),this.setValue(of(e,"value",0)),this.setScrollStep(of(n,"step",.01))}setScrollStep(t){return this.scrollStep=t,this}get enable(){return!!this.childrenMap.slider&&this.childrenMap.slider.enable}set enable(t){this.childrenMap.slider&&this.childrenMap.slider.setEnable(t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get value(){return this.childrenMap.slider?this.childrenMap.slider.value:0}set value(t){this.childrenMap.slider&&(this.childrenMap.slider.value=t)}setValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setValue(t,e,i),this}addValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.addValue(t,e,i),this}getValue(t,e){return this.childrenMap.slider?this.childrenMap.slider.getValue(t,e):0}easeValueTo(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.easeValueTo(t,e,i),this}stopEaseValue(){return this.childrenMap.slider&&this.childrenMap.slider.stopEaseValue(),this}setEaseValueDuration(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueDuration(t),this}setEaseValueFunction(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueFunction(t),this}setGap(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setGap(t,e,i),this}get gap(){if(this.childrenMap.slider)return this.childrenMap.slider.gap}set gap(t){this.childrenMap.slider&&(this.childrenMap.slider.gap=t)}setTick(t,e,i){return this.setGap(t,e,i),this}get tick(){if(this.childrenMap.slider)return this.childrenMap.slider.tick}set tick(t){this.childrenMap.slider&&(this.childrenMap.slider.tick=t)}}class df extends Rs{constructor(t,e){super(e),this.parent=t,this.init()}init(){this.start("IDLE")}next_IDLE(){var t,e=this.parent;return e.dragState.isDown&&(t=0===e.dragThreshold?"DRAG":"DRAGBEGIN"),t}update_IDLE(t,e){this.next()}next_DRAGBEGIN(){var t=this.parent,e=t.dragState;return e.isDown?e.pointer.getDistance()>=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const cf=Phaser.Utils.Objects.GetValue,uf=Phaser.Math.Distance.Between;class pf extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=cf(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(cf(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(cf(t,"enable",!0)),this.holdThreshold=cf(t,"holdThreshold",50),this.pointerOutReleaseEnable=cf(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return dn(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:uf(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!or(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!or(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const vf=Phaser.Utils.Objects.GetValue;class gf{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(vf(t,"value",0)),this.setSpeed(vf(t,"speed",0)),this.setAcceleration(vf(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class ff{constructor(){this.value,this.dir,this.movement=new gf}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const bf={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},Cf=Phaser.Utils.Objects.GetValue;class wf extends ii{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=Cf(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(Cf(e,"speed",.1)),this.setEnable(Cf(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(Cf(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||or(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const Sf=Phaser.Utils.Objects.GetValue;var Of=function(t,e,i,s){var r,n,h="Y"===(i=i.toUpperCase()),a=2===t.scrollMode,o=t.childrenMap.child,l=`slider${i}`;if(r=a||s.hasOwnProperty(l)?Sf(s,l,void 0):Sf(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=h?1:0,n=function(t,e){void 0===e&&(e={});var i=mt(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new lf(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r),n.tickLength=Sf(r,"tickLength",void 0);var p=Sf(r,"position",0);"string"==typeof p&&(p=Pf[p]);var v,g,f=Sf(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=Sf(s,"space.slider",void 0))&&(a?f=0:v=Sf(s,"space.child",0)),g=void 0===v?"number"==typeof f:"number"==typeof v,h?0===p?(d=2,c=1,u=void 0===v?g?{left:f}:f:{left:Sf(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:Sf(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:Sf(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:Sf(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=Sf(r,"hideUnscrollableSlider",!1),t[`disableUnscrollableDrag${i}`]=Sf(r,"disableUnscrollableDrag",!1),t[`adaptThumb${i}SizeMode`]=Sf(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=Sf(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`disableUnscrollableDrag${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,x=Sf(s,"scrollDetectionMode");"string"==typeof x&&(x=kf[x]);var b=`scroller${i}`;(m=a||s.hasOwnProperty(b)?Sf(s,b,!0):Sf(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==x&&(m.rectBoundsInteractive=1===x),y=new xf(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var C,w,S,O,P,k=Sf(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);k&&o&&(void 0!==x&&(k.focus=1===x?2:0),C=new wf(o,k)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,C),a&&!h||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.disableUnscrollableDrag=t[`disableUnscrollableDrag${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",C)),n&&(a?(w=h?"t":"s",O=`scroll${i}`):(w="t",O="scroll"),n.on("valuechange",(function(e){t[w]=e,t.emit(O,t)}))),y&&(a?(S=`childO${i}`,O=`scroll${i}`):(S="childOY",O="scroll"),y.on("valuechange",(function(e){t[S]=e,t.emit(O,t)}))),C&&(P=a?`addChildO${i}`:"addChildOY",C.on("scroll",(function(e){t[P](-e,!0)})))};const Pf={right:0,left:1,bottom:0,top:1},kf={gameObject:0,rectBounds:1},Tf=Phaser.Utils.Objects.GetValue;var _f=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=Tf(e,"width"),h=Tf(e,"height");n||Tf(e,"child.expandWidth",!0)||(s[1]=0),h||Tf(e,"child.expandHeight",!0)||(r[1]=0);var a=new Lg(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=Dg(i,"child"),r=Dg(s,"gameObject",void 0);if(r){var n=Dg(i,"space.child",0);t.childMargin={};var h=t.childMargin,a={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:h.top=0,h.bottom=0,h.left=0,h.right=0;break;default:h.top=n,h.bottom=n,h.left=n,h.right=n}else switch(t.scrollMode){case 0:h.top=Dg(n,"top",0),h.bottom=Dg(n,"bottom",0),a.left=Dg(n,"left",0),a.right=Dg(n,"right",0);break;case 1:h.top=Dg(n,"left",0),h.bottom=Dg(n,"right",0),a.top=Dg(n,"top",0),a.bottom=Dg(n,"bottom",0);break;default:h.top=Dg(n,"top",0),h.bottom=Dg(n,"bottom",0),h.left=Dg(n,"left",0),h.right=Dg(n,"right",0)}e.add(r,{column:1,row:1,align:Dg(s,"align","center"),padding:a,expand:{width:Dg(s,"expandWidth",!0),height:Dg(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:Of(t,a,"y",e);break;case 1:Of(t,a,"x",e);break;default:Of(t,a,"y",e),Of(t,a,"x",e)}return a},Ef=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}i*="Y"===t?this.scaleY:this.scaleX,s&&s.setBounds(e,i),r&&(r.setEnable(e!==i),r.tickLength&&r.setTick(r.tickLength,e,i))},Mf=function(t){switch(this.scrollMode){case 0:case 1:(i=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(i,this.isOverflow),(r=this.childrenMap.scroller)&&this.disableUnscrollableDrag&&r.setEnable(this.isOverflow);break;default:var e=this[`isOverflow${t=t.toUpperCase()}`],i=this.childrenMap[`slider${t}`],s=this[`hideUnscrollableSlider${t}`];i&&s&&this.setChildVisible(i,e);var r=this.childrenMap.scroller,n=this[`disableUnscrollableDrag${t}`];r&&n&&r.setEnable(e)}},Rf=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(a=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=a.childrenMap.track,s=a.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&n0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n")}return i}(this.textObject,this.text,this.lines),this.linesCount=this.lines.length,this._textHeight=void 0,this._textVisibleHeight=void 0,this.updateTextObject(),this},updateTextObject:function(){var t=Math.max(Math.floor(Xf.call(this,-this.textOY)),0),e=Wf.call(this,t)+this.textOY,i=jf.call(this,t);return function(t,e){switch(kc(t)){case 0:var i=(r=t.style).wordWrapWidth,s=r.wordWrapCallback;r.wordWrapWidth=0,r.wordWrapCallback=void 0,t.setText(e),r.wordWrapWidth=i,r.wordWrapCallback=s;break;case 1:var r,n=(r=t.style).wrapMode;r.wrapMode=0,t.setText(e),r.wrapMode=n;break;case 2:var h=t._maxWidth;t._maxWidth=0,t.setText(e),t._maxWidth=h}}(this.textObject,i),this.textObject.rexSizer.offsetY=e,Ff.call(this),this},preLayout:function(){return this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,Ie.call(this),this},layoutChildren:function(){var t,e,i,s,r,n,h,a=this.left,o=this.top;(t=this.textObject).rexSizer.hidden||(s=a+(i=(e=t.rexSizer).padding).left*this.scaleX,r=o+i.top*this.scaleY,n=this.width*this.scaleX-(i.left+i.right)*this.scaleX,h=this.height*this.scaleY-(i.top+i.bottom)*this.scaleY,Bf.call(this,t,n,h),ae(t,s,r,n,h,e.align),e.preOffsetY=0,Ff.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const Gf=Phaser.Utils.Objects.IsPlainObject,Vf=Phaser.Utils.Objects.GetValue,Nf=Phaser.Display.Align.TOP_LEFT;class Uf extends th{constructor(t,e,i,s,r,n){Gf(e)?(e=Vf(n=e,"x",0),i=Vf(n,"y",0),s=Vf(n,"width",void 0),r=Vf(n,"height",void 0)):Gf(s)&&(s=Vf(n=s,"width",void 0),r=Vf(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexTextBlock",this.textObject=void 0,this.linesCount=0,this.textMask=void 0,this.textObjectType=void 0,this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,this._textObjectRealHeight=0,this.lines=void 0,this.text=Vf(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode(Vf(n,"clampTextOY",!0)),this.alwaysScrollable=Vf(n,"alwaysScrollable",!1);var h=Vf(n,"background",void 0),a=Vf(n,"text",void 0);void 0===a&&(a=$f(t)),this.textCropEnable=Vf(n,"textCrop",!!a.setCrop);var o=Vf(n,"textMask",!this.textCropEnable);h&&this.addBackground(h),this.add(a),this.sizerChildren=[a];var l=this.getSizerConfig(a);l.align=Nf,l.padding=ge(0),l.expand=!0,this.textObject=a,this.textObjectType=kc(a),l.preOffsetY=0,l.offsetY=0,o&&(this.textMask=Cc.call(this,this.textObject,this)),this.addChildrenMap("background",h),this.addChildrenMap("text",a)}destroy(t){if(this.scene&&!this.ignoreDestroy){if(this.textObject=void 0,this.textMask=void 0,this.lines){switch(this.textObjectType){case 0:case 2:this.lines.length=0;break;case 1:this.lines.destroy()}this.lines=void 0}super.destroy(t)}}setClampMode(t){return void 0===t&&(t=!0),this.clampTextOY=t,this}get textLineHeight(){if(void 0===this._textLineHeight){var t;switch(this.textObjectType){case 0:case 1:var e=this.textObject.style;t=e.metrics.fontSize+e.strokeThickness;break;case 2:var i=this.textObject.fontSize/this.textObject.fontData.size;t=this.textObject.fontData.lineHeight*i}this._textLineHeight=t}return this._textLineHeight}get textLineSpacing(){if(void 0===this._textLineSpacing){var t;switch(this.textObjectType){case 0:case 1:t=this.textObject.lineSpacing;break;case 2:t=0}this._textLineSpacing=t}return this._textLineSpacing}get visibleLinesCount(){return void 0===this._visibleLinesCount&&(this._visibleLinesCount=Math.floor(Xf.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=Wf.call(this,this.linesCount)),this._textHeight}get textObjectHeight(){return this._textObjectRealHeight-(this.textLineHeight+this.textLineSpacing)}get textVisibleHeight(){if(void 0===this._textVisibleHeight){var t=this.textHeight-this.textObjectHeight;!this.alwaysScrollable&&t<0&&(t=0),this._textVisibleHeight=t}return this._textVisibleHeight}textOYExceedTop(t){return void 0===t&&(t=this.textOY),t>this.topTextOY}textOYExeceedBottom(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:s?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}setTextOY(t){return this.textOY=t,this}set t(t){this.textOY=-this.textVisibleHeight*t}get t(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t}setTextOYByPercentage(t){return this.t=t,this}}var $f=function(t){return t.add.text(0,0,"")};Object.assign(Uf.prototype,Hf);var Jf={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},qf={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const Kf=Phaser.Utils.Objects.GetValue;class Zf extends Yf{constructor(t,e){void 0===e&&(e={});var i=Kf(e,"text",void 0),s=Kf(e,"textWidth",void 0),r=Kf(e,"textHeight",void 0),n=Kf(e,"textCrop",!!i.setCrop),h=Kf(e,"textMask",!n),a=Kf(e,"content",""),o=new Uf(t,{width:s,height:r,text:i,textMask:h,textCrop:n&&!h,content:a,clampTextOY:Kf(e,"clampChildOY",!1),alwaysScrollable:Kf(e,"alwaysScrollable",!1)});t.add.existing(o),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textObjectHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.textHeight}})}(o),e.scrollMode=0,e.type="rexTextArea",e.child={gameObject:o,expandWidth:void 0===s,expandHeight:void 0===r};var l=Kf(e,"space",void 0);l&&(l.child=Kf(l,"text",0)),super(t,e),this.addChildrenMap("text",i)}get text(){return this.childrenMap.child.text}get lineHeight(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.textHeight}}Object.assign(Zf.prototype,Jf,qf);const Qf=Phaser.Utils.Objects.GetValue;var tm=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("key")&&(i="bitmaptext",e.font=e.key)),i){case"bitmaptext":case"bitmap":s=new cg(t,e);break;case"bbcodetext":case"bbcode":s=new ag(t,0,0,"",e);break;case"label":s=new sm(t,e);break;case"textarea":s=function(t,e,i){e=e?uo(e):{};var s=Qf(i,"background",Pp),r=Qf(i,"text",tm),n=Qf(i,"track",Pp),h=Qf(i,"thumb",Pp);s?e.background=s(t,e.background):delete e.background,r?e.text=r(t,e.text):delete e.text;var a=e.slider;!1!==a&&null!==a&&(void 0===a&&(a={}),n?a.track=n(t,a.track):delete a.track,h?a.thumb=h(t,a.thumb):delete a.thumb,e.slider=a);var o=new Zf(t,e);return t.add.existing(o),o}(t,e);break;default:s=new _p(t,e)}return Op(s,e),t.add.existing(s),s},em=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("leftWidth")?i="nineSlice":(e.hasOwnProperty("color")||e.hasOwnProperty("strokeColor"))&&(i="roundRectangle")),i){case"nineSlice":s=e.hasOwnProperty("stretchMode")?new wp(t,e):new tp(t,e);break;case"roundRectangle":s=new Kc(t,e);break;default:s=new rp(t,e)}return Op(s,e),t.add.existing(s),s};const im=Phaser.Utils.Objects.GetValue;class sm extends Vc{constructor(t,e,i){e=function(t,e,i){e=e?uo(e):{};var s=im(i,"background",Pp),r=im(i,"text",tm),n=im(i,"icon",em),h=im(i,"action",em);return null!==e.background&&s?e.background=s(t,e.background):delete e.background,null!==e.text&&r?e.text=r(t,e.text):delete e.text,null!==e.icon&&n?e.icon=n(t,e.icon):delete e.icon,null!==e.action&&h?e.action=h(t,e.action):delete e.action,e}(t,e,i),super(t,e),this.type="rexSimpleLabel"}setActiveState(t){return rm(this.getChildren(),"setActiveState",t),this}setHoverState(t){return rm(this.getChildren(),"setHoverState",t),this}setDisableState(t){return rm(this.getChildren(),"setDisableState",t),this}}var rm=function(t,e,i){for(var s=0,r=t.length;s0&&{height:this.colorComponentsHeight,formatLabel:this.colorComponentsFormatLabelConfig,inputText:this.colorComponentsInputTextConfig,space:this.colorComponentsSpace};var h=new um(t,{width:s,height:n,background:e,space:this.colorPickerSpace,hPalette:{position:this.colorPickerHPalettePosition},colorComponents:r,value:this.value});return t.add.existing(h),h};const vm=Phaser.Utils.Objects.GetValue;var gm=function(t,e){var i=vm(e,"expandDirection",void 0);"string"==typeof i&&(i=fm[i]);var s,r,n,h,a,o,l,d=(n="alignTargetX",_l(s=e,r="alignTarget")?ks(s,r):n&&_l(s,n)?ks(s,n):h&&_l(s,h)?ks(s,h):a),c=vm(e,"alignTargetY",d),u=vm(e,"alignOffsetX",0),p=vm(e,"alignOffsetY",0),v=vm(e,"alignSide","").includes("right"),g=vm(e,"bounds"),f=0===i,m=!(f||1===i),y=v?1:0,x=f||m?0:1;t.setOrigin(y,x),o=v?d.getTopRight().x:d.getTopLeft().x,l=c.getBottomLeft().y,t.setPosition(o+u,l+p);var b=g;b||(b=Dt(t.scene)),m&&t.getBottomLeft().y>b.bottom&&(l=c.getTopLeft().y,t.setOrigin(0,1).setPosition(o+u,l+p))};const fm={down:0,up:1},mm=Phaser.Utils.Objects.GetValue;class ym extends js{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=function(t,e){Mi(t,e,"y","Cubic")}),null==e.transitOut&&(e.transitOut=function(t,e){!function(t,e,i,s,r){void 0===s&&(s="Linear");var n={mode:0};switch(i){case 0:case"x":n.end={x:0};break;case 1:case"y":n.end={y:0};break;default:n.end=0}n.duration=e,n.ease=s,void 0===r?r=new _i(t,n):r.resetFromJSON(n),r.restart()}(t,e,"y","Linear")}),e.manualClose=!0,e.clickOutsideClose=!0,e.destroy=!0,super(t,e),gm(t,e),t.isRexSizer&&t.layout();var i=mm(e,"touchOutsideClose",!1),s=mm(e,"anyTouchClose",!1);s&&(i=!1),s?this.once("open",this.anyTouchClose,this):i&&this.once("open",this.touchOutsideClose,this),this.requestOpen()}shutdown(t){this.isShutdown||(this.scene.input.off("pointerup",this.touchCloseCallback,this),super.shutdown(t))}touchOutsideClose(){return this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Zs(this.parent,t.worldX,t.worldY)||this.requestClose()}onOpen(){this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.parent,this),super.onClose()}}var xm={openColorPicker:function(){if(!this.colorPicker){var t=pm.call(this).layout(),e=new ym(t,{duration:{in:this.colorPickerEaseInDuration,out:this.colorPickerEaseOutDuration},transitIn:this.colorPickerTransitInCallback,transitOut:this.colorPickerTransitOutCallback,expandDirection:this.colorPickerExpandDirection,alignTargetX:this,alignTargetY:this,bounds:this.colorPickerBounds,touchOutsideClose:!0}).on("open",(function(){t.on("valuechange",(function(t){this.setValue(t)}),this)}),this).on("close",(function(){this.colorPicker=void 0,this.dropDownBehavior=void 0}),this);return this.colorPicker=t,this.dropDownBehavior=e,this.pin(t),this}}};Object.assign(xm,wd);const bm=Phaser.Utils.Objects.GetValue;class Cm extends Cd{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexColorInput",e.hasOwnProperty("colorPicker")||(e.colorPicker={background:{color:0}});var i=e.colorPicker,s=!1!==i&&null!==i;if(s){var r;this.setColorPickerSize(bm(i,"width",160),bm(i,"height",170));var n=bm(i,"background");r=n?function(t){return Pp(t,n)}:bm(i,"createBackgroundCallback"),this.setCreateColorPickerBackgroundCallback(r),this.setColorPickerHPalettePosition(bm(i,"hPalettePosition",0)),this.setColorPickerExpandDirection(bm(i,"expandDirection")),this.setColorPickerEaseInDuration(bm(i,"easeIn",200)),this.setColorPickerEaseOutDuration(bm(i,"easeOut",200)),this.setColorPickerTransitInCallback(bm(i,"transitIn")),this.setColorPickerTransitOutCallback(bm(i,"transitOut")),this.setColorPickerBounds(bm(i,"bounds"));var h=bm(i,"space");void 0===h&&(h={left:10,right:10,top:10,bottom:10,item:8}),this.setColorPickerSpace(h)}var a=e.colorComponents;if(s&&!1!==a&&null!==a){this.setColorComponentsHeight(bm(a,"height",30)),this.setColorComponentsFormatLabelConfig(bm(a,"formatLabel"));var o=bm(a,"inputText");o||(o=bm(e,"inputText")),this.setColorComponentsInputTextConfig(o);var l=bm(a,"space");void 0===l&&(l={item:8}),this.setColorComponentsSpace(l)}var d=this.childrenMap.swatch;d&&s&&this.onClick(d,this.openColorPicker,this)}}return Object.assign(Cm.prototype,xm),Cm},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rexcolorinput=e(); diff --git a/dist/rexconfirmdialog.js b/dist/rexconfirmdialog.js index ae599ac188..74b3aa4ff8 100644 --- a/dist/rexconfirmdialog.js +++ b/dist/rexconfirmdialog.js @@ -24481,6 +24481,32 @@ return pathData; }; + //import CatmullRomInterpolation from '../../utils/math/interpolation/CatmullRomInterpolation.js'; + + const CatmullRomInterpolation = Phaser.Math.Interpolation.CatmullRom; + + var CatmullRomTo = function (points, iterations, pathData) { + var pathDataCnt = pathData.length; + var p0x = pathData[pathDataCnt - 2]; + var p0y = pathData[pathDataCnt - 1]; + + var xList = [p0x]; + var yList = [p0y]; + for (var i = 0, cnt = points.length; i < cnt; i += 2) { + xList.push(points[i]); + yList.push(points[i + 1]); + } + + for (var i = 1, last = iterations - 1; i <= last; i++) { + var t = i / last; + pathData.push( + CatmullRomInterpolation(xList, t), + CatmullRomInterpolation(yList, t) + ); + } + return pathData; + }; + var DuplicateLast = function (pathData) { var len = pathData.length; if (len < 2) { @@ -24592,6 +24618,18 @@ return this; }, + catmullRomTo(...points) { + CatmullRomTo( + points, + this.iterations, + this.pathData + ); + + this.lastPointX = points[points.length-2]; + this.lastPointY = points[points.length-1]; + return this; + }, + close() { // Line to first point var startX = this.pathData[0], @@ -25029,6 +25067,13 @@ return this; } + catmullRomTo(...points) { + this.builder.catmullRomTo(...points); + + this.dirty = true; + return this; + } + close() { this.builder.close(); diff --git a/dist/rexconfirmdialog.min.js b/dist/rexconfirmdialog.min.js index 5ad9a4c0ae..db358e2728 100644 --- a/dist/rexconfirmdialog.min.js +++ b/dist/rexconfirmdialog.min.js @@ -1,6 +1,6 @@ -var t,e;t=void 0,e=function(){var t=!1,e=function(e){t||(void 0===e&&(e=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const _=Phaser.Math.DegToRad;var T={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=_(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},k={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=O(t.scaleX,i.scaleX),e.scaleY=O(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},E={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=O(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},L={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},D={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},z={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(t){void 0===t&&(t=!1);var e=this;return this._mask=null,this.setChildMaskVisible(this),this.children.forEach((function(t){t.clearMask&&t.clearMask(!1),t.hasOwnProperty("isRexContainerLite")||e.setChildMaskVisible(t)})),t&&this.mask&&this.mask.destroy(),this}},A=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},B=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const j=Phaser.Utils.Array;var I={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},ke=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const Ee=/(\S+)\[(\d+)\]/i,Me=Phaser.Utils.Objects.GetValue;var Re=function(t,e){return void 0===e?t:t[e]},Le=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Me(e,"left",0),t.right=Me(e,"right",0),t.top=Me(e,"top",0),t.bottom=Me(e,"bottom",0)),t},De={getInnerPadding(t){return Re(this.space,t)},setInnerPadding(t,e){return Le(this.space,t,e),this},getOuterPadding(t){return Re(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Le(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Re(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Le(this.getSizerConfig(t).padding,e,i),this}},ze=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Ae=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Ye=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Xe=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Be=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},We=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},je={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Ie=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?mi:fi,this.repeatCounter=0,this}stop(){return this.state=gi,this}update(t,e){this.state!==gi&&this.state!==bi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=yi)):(this.nowTime=this.duration,this.state=bi):this.nowTime>=0&&(this.state=mi))}get t(){var t;switch(this.state){case gi:case fi:case yi:t=0;break;case mi:t=this.nowTime/this.duration;break;case bi:t=1}return pi(t,0,1)}set t(t){(t=pi(t,-1,1))<0?(this.state=fi,this.nowTime=-this.delay*t):(this.state=mi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===gi}get isDelay(){return this.state===fi}get isCountDown(){return this.state===mi}get isRunning(){return this.state===fi||this.state===mi}get isDone(){return this.state===bi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const gi=0,fi=1,mi=2,yi=3,bi=-1;class xi extends di{constructor(t,e){super(t,e),this.timer=new vi}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const Si=Phaser.Utils.Objects.GetValue,wi=Phaser.Utils.Objects.GetAdvancedValue,Ci=Phaser.Tweens.Builders.GetEaseFunction;class Oi extends xi{resetFromJSON(t){return this.timer.resetFromJSON(Si(t,"timer")),this.setEnable(Si(t,"enable",!0)),this.setTarget(Si(t,"target",this.parent)),this.setDelay(wi(t,"delay",0)),this.setDuration(wi(t,"duration",1e3)),this.setEase(Si(t,"ease","Linear")),this.setRepeat(Si(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Ci(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Pi=Phaser.Utils.Objects.GetValue,_i=Phaser.Utils.Objects.GetAdvancedValue,Ti=Phaser.Math.Linear;let ki=class extends Oi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Pi(t,"mode",0)),this.setScaleRange(_i(t,"start",void 0),_i(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ei[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=_i(t,"x",this.parent.scaleX),this.startY=_i(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=_i(e,"x",void 0),this.endY=_i(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Ti(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Ti(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const Ei={stop:0,destroy:1,yoyo:2};var Mi=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new ki(t,a):r.resetFromJSON(a),r.restart(),r},Ri=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof ki&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new ki(t,h):n.resetFromJSON(h),n.restart(),n},Li=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Di=function(t){return Li(t,"complete")};const zi=Phaser.Utils.Objects.IsPlainObject;var Ai={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(zi(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Mi(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Di(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(zi(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Ri(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Di(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Di(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(zi(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new ki(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Di(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Yi={};Object.assign(Yi,Ai),Yi.onInitScale=function(){Ai.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=xe.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Xi=Phaser.Utils.Objects.GetValue,Bi=Phaser.Utils.Objects.GetAdvancedValue,Wi=Phaser.Math.Linear;class ji extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Xi(t,"mode",0)),this.setAlphaRange(Bi(t,"start",this.parent.alpha),Bi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ii[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Wi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ii={stop:0,destroy:1,yoyo:2},Fi=Phaser.Utils.Objects.IsPlainObject;var Hi=function(t,e,i,s){var r,n;Fi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new ji(t,h):s.resetFromJSON(h),s.restart(),s},Ni=function(t,e,i,s){i instanceof ji&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new ji(t,r):s.resetFromJSON(r),s.restart(),s};const Gi=Phaser.Utils.Objects.IsPlainObject;var Vi={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Gi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Hi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Di(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Gi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Ni(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Di(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Di(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Ui={};Object.assign(Ui,Vi),Ui.onInitFade=function(){Vi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=xe.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const $i=Phaser.Utils.Objects.GetValue,Ji=Phaser.Utils.Objects.GetAdvancedValue,Ki=Phaser.Math.Linear;class qi extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode($i(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ji(t,"x",void 0),i=Ji(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Zi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Ji(i,"startX",void 0),this.startY=Ji(i,"startY",void 0),this.endX=Ji(i,"endX",void 0),this.endY=Ji(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Ki(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ki(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Zi={stop:0,destroy:1,yoyo:2};var Qi=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const ts=Phaser.Utils.Objects.IsPlainObject,es=Phaser.Math.Distance.Between;var is={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(ts(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*es(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof qi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=Qi(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=Qi(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new qi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Di(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Di(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(ts(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*es(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof qi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=Qi(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=Qi(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new qi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Di(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Di(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},ss={};Object.assign(ss,is),ss.onInitEaseMove=function(){is.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=xe.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const rs=Phaser.Utils.Objects.GetValue;class ns extends ai{constructor(t,e){super(t,e),this.timer=new vi,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(rs(t,"timer")),this.setEnable(rs(t,"enable",!0)),this.setMode(rs(t,"mode",1)),this.isRunning=rs(t,"isRunning",!1),this.setMagnitudeMode(rs(t,"magnitudeMode",1)),this.setAxisMode(rs(t,"axis",0)),this.setDuration(rs(t,"duration",500)),this.setMagnitude(rs(t,"magnitude",10)),this.ox=rs(t,"ox",void 0),this.oy=rs(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=hs[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=os[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=as[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=rs(i,"magnitude",void 0),t=rs(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const hs={effect:0,behavior:1},as={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},os={constant:0,decay:1},ls=Phaser.Utils.Objects.IsPlainObject;var ds={shake(t,e,i){if(ls(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new ns(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Di(this._shake)}};const cs=Phaser.Utils.Objects.GetValue,us=Phaser.Math.Linear;class ps extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=cs(t,"key","value");var i=e[this.propertyKey];return this.fromValue=cs(t,"from",i),this.toValue=cs(t,"to",i),this.setEase(cs(t,"ease",this.ease)),this.setDuration(cs(t,"duration",this.duration)),this.setRepeat(cs(t,"repeat",0)),this.setDelay(cs(t,"delay",0)),this.setRepeatDelay(cs(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=us(this.fromValue,this.toValue,i)}}const vs=Phaser.Utils.Objects.IsPlainObject;class gs extends ii{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new ps(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(vs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(vs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var fs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new gs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Li(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},ms=Phaser.Utils.Array.Remove,ys={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var Ys={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=qe(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Xs={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=Xt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=Xt),this.transitOutCallback=t,this}},Bs={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Ws={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},js={};Object.assign(js,Ys,Xs,Bs,Ws);const Is=Phaser.Utils.Objects.GetValue;class Fs extends ii{constructor(t,e){super(t,e),this.setTransitInTime(Is(e,"duration.in",200)),this.setTransitOutTime(Is(e,"duration.out",200)),this.setTransitInCallback(Is(e,"transitIn")),this.setTransitOutCallback(Is(e,"transitOut")),this.oneShotMode=Is(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new As(this,{eventEmitter:!1,initState:Is(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Fs.prototype,js);var Hs=function(t){if(t.parentContainer)return Hs(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?Hs(e):t};class Ns extends ii{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Hs(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Gs=Phaser.GameObjects.Rectangle;class Vs extends Gs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Ns(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Us=Phaser.Utils.Objects.GetValue;class $s extends ii{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Us(t,"hitAreaMode",0)),this.setEnable(Us(t,"enable",!0)),this.setStopMode(Us(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Js[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Js={default:0,fullWindow:1};const Ks=Phaser.Utils.Objects.GetValue;class qs extends Vs{constructor(t,e){super(t,Ks(e,"color",0),Ks(e,"alpha",.8)),this.touchEventStop=new $s(this,{hitAreaMode:1})}}var Zs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Mi(t,e)},scaleDown(t,e){Ri(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Hi(t,e)},fadeOut(t,e){Ni(t,e,!1)}},Qs=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Hi(t,e,t.alpha)},tr=function(t,e){Ni(t,e,!1)},er=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!nt(t,!0).contains(e,i)||r&&!r(t,e,i))};const ir=Phaser.Utils.Objects.GetValue;let sr=class extends Fs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=rr.popUp),null==e.transitOut&&(e.transitOut=rr.scaleDown),e.destroy=ir(e,"destroy",!0),super(t,e);var i=ir(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new qs(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(ir(i,"transitIn",Qs)),this.setCoverTransitOutCallback(ir(i,"transitOut",tr)));var s=ir(e,"touchOutsideClose",!1),r=ir(e,"duration.hold",-1),n=ir(e,"timeOutClose",r>=0),h=ir(e,"anyTouchClose",!1);ir(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),ir(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&er(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=rr[t]),t){case rr.popUp:t=Zs.popUp;break;case rr.fadeIn:t=Zs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=rr[t]),t){case rr.scaleDown:t=Zs.scaleDown;break;case rr.fadeOut:t=Zs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const rr={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var nr=function(t){return t&&"function"==typeof t},hr={modal(t,e){return nr(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new sr(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},ar=function(t,e,i,s,r){nr(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},or={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return ar.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return ar.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return ar.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return ar.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return ar.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return ar.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return ar.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return ar.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return ar.call(this,"shutdown",t,e,i,s),this}},lr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=dr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},dr={},cr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?er(t,e.x,e.y,i,s):!!(r=lr(e,n,!0))&&er(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const Cr={press:0,pointerdown:0,release:1,pointerup:1};var Or={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new wr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},Pr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!_r(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return Tr.length=0,!0;return Tr.length=0,!1},Tr=[];const kr=Phaser.Utils.Objects.GetValue;class Er extends ii{constructor(t,e){super(t,e),this._enable=void 0;var i=kr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(kr(t,"enable",!0)),this.setMode(kr(t,"mode",1)),this.setClickInterval(kr(t,"clickInterval",100)),this.setDragThreshold(kr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Mr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?Pr:cr)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Mr={press:0,pointerdown:0,release:1,pointerup:1};var Rr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Er(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Lr extends zs{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Dr=Phaser.Utils.Objects.GetValue;class zr extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Lr,this.parent.setInteractive(Dr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Dr(t,"enable",!0)),this.setCooldown(Dr(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Ar={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&cr(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new zr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new zr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Yr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Xr=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Qr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===tn&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Qr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=en,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&cr(t,s,e,i)}}const Qr=0,tn=1,en="IDLE",sn=Phaser.Utils.Objects.GetValue,rn=Phaser.Math.Distance.Between;class nn extends Zr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=hn},eventEmitter:!1};this.setRecongizedStateObject(new zs(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(sn(t,"time",250)),this.setTapInterval(sn(t,"tapInterval",200)),this.setDragThreshold(sn(t,"threshold",9)),this.setTapOffset(sn(t,"tapOffset",10));var e=sn(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(sn(t,"maxTaps",void 0)),this.setMinTaps(sn(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case hn:this.state=an;break;case an:var t=this.lastPointer;rn(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=on,this.state=an);break;case on:this.state=an}}onDragEnd(){this.state===an&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=on))}onDrag(){this.state!==hn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=hn)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===an){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=hn):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=on:this.state=hn)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===on&&(this.state=hn)}get isTapped(){return this.state===on}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const hn="IDLE",an="BEGIN",on="RECOGNIZED",ln=Phaser.Utils.Objects.GetValue;class dn extends Zr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=cn},eventEmitter:!1};this.setRecongizedStateObject(new zs(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(ln(t,"threshold",9)),this.setHoldTime(ln(t,"time",251)),this}onDragStart(){this.state=un,0===this.holdTime&&(this.state=pn)}onDragEnd(){this.state=cn}onDrag(){this.state!==cn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=cn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===un&&t-this.pointer.downTime>=this.holdTime&&(this.state=pn)}get isPressed(){return this.state===pn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const cn="IDLE",un="BEGIN",pn="RECOGNIZED";Phaser.Utils.Objects.GetValue;var vn=function(t){return ti(t).loop.delta};const gn=Phaser.Math.Distance.Between,fn=Phaser.Math.Angle.Between;var mn={getDt:function(){return vn(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return gn(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return fn(e.x,e.y,t.x,t.y)}},yn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},bn={};const xn=Phaser.Utils.Objects.GetValue,Sn=Phaser.Math.RadToDeg;class wn extends Zr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=Cn},eventEmitter:!1};this.setRecongizedStateObject(new zs(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(xn(t,"threshold",10)),this.setVelocityThreshold(xn(t,"velocityThreshold",1e3)),this.setDirectionMode(xn(t,"dir","8dir")),this}onDragStart(){this.state=On}onDragEnd(){this.state=Cn}onDrag(){this.state===On&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=Pn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Pn&&(this.state=Cn)}get isSwiped(){return this.state===Pn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=yn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=bn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(Sn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(wn.prototype,mn);const Cn="IDLE",On="BEGIN",Pn="RECOGNIZED",_n=Phaser.Utils.Objects.GetValue,Tn=Phaser.Utils.Array.SpliceOne,kn=Phaser.Math.Distance.Between,En=Phaser.Math.Angle.Between;class Mn{constructor(t,e){var i=qe(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(_n(e,"inputConfig",void 0)),this.setEventEmitter(_n(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(_n(t,"enable",!0)),this.bounds=_n(t,"bounds",void 0),this.tracerState=Ln,this.pointers.length=0,ft(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,ft(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case Ln:this.tracerState=Dn,this.onDrag1Start();break;case Dn:this.tracerState=zn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],Tn(this.pointers,e),this.tracerState){case Dn:this.tracerState=Ln,this.onDrag1End();break;case zn:this.tracerState=Dn,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case Dn:this.onDrag1();break;case zn:this.onDrag2()}}}dragCancel(){return this.tracerState===zn&&this.onDrag2End(),this.pointers.length=0,ft(this.movedState),this.tracerState=Ln,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==zn)return 0;var t=this.pointers[0],e=this.pointers[1];return kn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==zn)return 0;var t=this.pointers[0],e=this.pointers[1];return En(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Rn.x=e.x-i.x,Rn.y=e.y-i.y}else Rn.x=0,Rn.y=0;return Rn}get centerX(){if(this.tracerState!==zn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==zn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==zn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==zn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=An,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&cr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&cr(t,s,e,i)}}Object.assign(Mn.prototype,$e);var Rn={};const Ln=0,Dn=1,zn=2,An="IDLE";Phaser.Utils.Objects.GetValue;const Yn=Phaser.Math.RotateAround;var Xn=function(t,e,i,s){return Yn(t,e,i,s),t.rotation+=s,t},Bn={};const Wn=Phaser.Utils.Objects.GetValue,jn=Phaser.Math.Angle.WrapDegrees,In=Phaser.Math.Angle.ShortestBetween,Fn=Phaser.Math.RadToDeg,Hn=Phaser.Math.DegToRad;var Nn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Bn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=jn(Fn(this.angleBetween));this.angle=In(this.prevAngle,t),this.prevAngle=t,this.state=Un}break;case Un:t=jn(Fn(this.angleBetween)),this.angle=In(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Un}get rotation(){return Hn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Nn);const Gn="IDLE",Vn="BEGIN",Un="RECOGNIZED",$n=Phaser.Utils.Objects.GetValue;var Jn=function(t){var e=$n(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new nn(this,e),this._tap.on("tap",(function(t,e,s){Br(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Br(i.eventEmitter,`${i.eventNamePrefix}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Kn=Phaser.Utils.Objects.GetValue;var qn=function(t){var e=Kn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new dn(this,e),this._press.on("pressstart",(function(t,e,s){Br(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this).on("pressend",(function(t,e,s){Br(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Zn=Phaser.Utils.Objects.GetValue;var Qn=function(t){var e=Zn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new wn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Br(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Br(i.eventEmitter,`${i.eventNamePrefix}swipe`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const th=Phaser.Utils.Objects.GetValue;var eh=function(t,e){return t.setInteractive(),th(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:th(e,"targets",[t]),targetMode:th(e,"targetMode","parent"),eventEmitter:th(e,"eventEmitter",t),eventNamePrefix:th(e,"inputEventPrefix","child.")},jr.call(t,e),Hr.call(t,e),Vr.call(t,e),Kr.call(t,e),Jn.call(t,e),qn.call(t,e),Qn.call(t,e),t},ih={getSizerConfig:function(t){return void 0===t&&(t=this),Mt(t)},getChildPrevState:function(t){var e=Mt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Dt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=oe(e,"color"),s=oe(e,"lineWidth");var o=oe(e,"name",!1);o&&(r=oe(o,"createTextCallback",ce),n=oe(o,"createTextCallbackScope",void 0),"string"==typeof(h=oe(o,"align","left-top"))&&(h=Yt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new le(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}var d,c,u=this.getAllShownChildren([this]);ue(u,u);for(var p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const ch=Phaser.Utils.Objects.IsPlainObject,uh=Phaser.Utils.Objects.GetValue,ph=Phaser.Display.Align.CENTER,vh={min:0,full:-1};var gh=function(t,e,i,s,r,n,h,a,o,l){var d,c,u,p;me.call(this,t);var v=t.isRexSpace,g=typeof e;if(null===e)return this;if("number"===g);else if("string"===g)e=vh[e];else if(ch(e)){var f;e=uh(f=e,"proportion",void 0),i=uh(f,"align",ph),s=uh(f,"padding",0),r=uh(f,"expand",!1),n=uh(f,"key",void 0),h=uh(f,"index",void 0),t.isRexSizer||(a=uh(f,"minWidth",void 0),o=uh(f,"minHeight",void 0)),l=uh(f,"fitRatio",0),d=uh(f,"offsetX",0),c=uh(f,"offsetY",0),u=uh(f,"offsetOriginX",0),p=uh(f,"offsetOriginY",0)}return"string"==typeof i&&(i=Yt[i]),void 0===e&&(e=v?1:0),void 0===i&&(i=ph),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(v?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(v?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),(f=this.getSizerConfig(t)).proportion=e,f.align=i,f.padding=ge(s),f.expand=r,f.fitRatio=0===e?l:0,f.alignOffsetX=d,f.alignOffsetY=c,f.alignOffsetOriginX=u,f.alignOffsetOriginY=p,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},fh={add:gh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),gh.call(this,new lh(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return ch(i)&&(i.index=t),gh.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=dh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const mh=Et.prototype.clear;var yh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),mh.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,yh.call(this,t),this}},Sh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=Yt[e]),this.getSizerConfig(t).align=e,this}},wh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},Ch={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},Oh={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},Ph={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Ne(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Ie.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d,c,u=this.sizerChildren,p=this.innerLeft,v=this.innerTop,g=this.innerWidth,f=this.innerHeight,m=p,y=v,b=this.startChildIndex,x=0,S=u.length;x0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Xe.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Ae.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&ah.call(this,t,void 0),Ye.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Be.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&ah.call(this,void 0,t),We.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(Ph,fh,xh,Sh,wh,Ch,Oh);var _h=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},Th={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},kh=function(t){return"string"==typeof t&&(t=Th[t]),t};const Eh=Phaser.Utils.Objects.IsPlainObject,Mh=Phaser.Utils.Objects.GetValue;class Rh extends rh{constructor(t,e,i,s,r,n,h){Eh(e)?(e=Mh(h=e,"x",0),i=Mh(h,"y",0),s=Mh(h,"width",void 0),r=Mh(h,"height",void 0),n=Mh(h,"orientation",0)):Eh(s)?(s=Mh(h=s,"width",void 0),r=Mh(h,"height",void 0),n=Mh(h,"orientation",0)):Eh(n)&&(n=Mh(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Mh(h,"space.item",0)),this.setStartChildIndex(Mh(h,"startChildIndex",0)),this.setRTL(Mh(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=kh(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=_h.call(this)),this._childrenProportion}}Object.assign(Rh.prototype,Ph);var Lh=function(t,e,i,s){if(void 0===i)i=0;else{var r=typeof i;"boolean"===r?(s=i,i=0):"string"===r&&(i=Dh[i])}void 0===s?s={}:!0===s&&(s=zh);var n=e.width/t.width,h=e.height/t.height,a=i?Math.max(n,h):Math.min(n,h);return s.width=t.width*a,s.height=t.height*a,s};const Dh={fit:0,FIT:0,envelop:1,ENVELOP:1};var zh={},Ah={},Yh={};const Xh=Phaser.Utils.Objects.IsPlainObject,Bh=Phaser.Utils.Objects.GetValue,Wh=Phaser.Display.Align.CENTER,jh=Phaser.Utils.String.UUID;var Ih={add:function(t,e,i,s,r,n,h,a,o,l){var d,c;me.call(this,t),Xh(e)&&(e=Bh(u=e,"key",void 0),i=Bh(u,"align",Wh),s=Bh(u,"padding",0),r=Bh(u,"expand",!0),t.isRexSizer||(n=Bh(u,"minWidth",t._minWidth),h=Bh(u,"minHeight",t._minHeighted)),a=Bh(u,"offsetX",0),o=Bh(u,"offsetY",0),d=Bh(u,"offsetOriginX",0),c=Bh(u,"offsetOriginY",0),l=Bh(u,"aspectRatio",0));var u,p=void 0!==e;return p||(e=jh()),"string"==typeof i&&(i=Yt[i]),void 0===i&&(i=Wh),void 0===s&&(s=0),void 0===r&&(r=!0),t.isRexSizer||(void 0===n&&(n=t._minWidth),void 0===h&&(h=t._minHeight)),void 0===a&&(a=0),void 0===o&&(o=0),void 0===d&&(d=0),void 0===c&&(c=0),void 0===l?l=0:!0===l&&(l=Q(t)/tt(t)),l>0&&(r=!0,void 0===n&&(n=0),void 0===h&&(h=0)),(u=this.getSizerConfig(t)).align=i,u.padding=ge(s),Xh(r)?(u.expandWidth=Bh(r,"width",!1),u.expandHeight=Bh(r,"height",!1)):(u.expandWidth=r,u.expandHeight=r),t.isRexSizer||(u.expandWidth&&(t.minWidth=void 0===n?Q(t):n),u.expandHeight&&(t.minHeight=void 0===h?tt(t):h)),u.alignOffsetX=a,u.alignOffsetY=o,u.alignOffsetOriginX=d,u.alignOffsetOriginY=c,u.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,p&&this.addChildrenMap(e,t),this}},Fh={remove(t,e){var i;if("string"==typeof t){if(i=t,!(t=this.sizerChildren[i]))return this}else{if(this.getParentSizer(t)!==this)return this;i=this.childToKey(t)}return i&&(delete this.sizerChildren[i],this.childrenMap.hasOwnProperty(i)&&delete this.childrenMap[i]),Oe.call(this,t,e),this},removeAll(t){for(var e in this.sizerChildren)this.remove(e,t);return this},clear(t){for(var e in this.sizerChildren)delete this.sizerChildren[e],this.childrenMap.hasOwnProperty(e)&&delete this.childrenMap[e];return yh.call(this,t),this}},Hh={getChildrenWidth:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var h in r)t=r[h],void 0===(i=this.getChildWidth(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).left+e.right)*this.scaleX,s=Math.max(i,s));return n?void 0:s+(this.space.left+this.space.right)*this.scaleX},getChildrenHeight:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var h in r)t=r[h],void 0===(i=this.getChildHeight(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).top+e.bottom)*this.scaleY,s=Math.max(i,s));return n?void 0:s+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(s.expandWidth){var r=e-(this.space.left+this.space.right)*this.scaleX,n=s.padding;i=r-(n.left+n.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(s.expandHeight){var r=e-(this.space.top+this.space.bottom)*this.scaleY,n=s.padding;i=r-(n.top+n.bottom)*this.scaleY}return i},getChildrenSizers:function(t){void 0===t&&(t=[]);var e,i=this.sizerChildren;for(var s in i)(e=i[s]).isRexSizer&&t.push(e);return t},layoutChildren:function(){var t,e,i,s,r,n,h,a,o,l,d,c,u=this.innerLeft,p=this.innerTop,v=this.innerWidth,g=this.innerHeight,f=this.sizerChildren;for(var m in f)(t=f[m]).rexSizer.hidden||(i=(e=t.rexSizer).padding,mr.call(this,t),l=this.getExpandedChildWidth(t),d=this.getExpandedChildHeight(t),e.aspectRatio>0&&(Ah.width=e.aspectRatio,Ah.height=1,Yh.width=l,Yh.height=d,l=(c=Lh(Ah,Yh,"FIT",!0)).width,d=c.height),t.isRexSizer?(t.runLayout(this,l,d),nh(t,this)):Ne(t,l,d),s=u+i.left*this.scaleX,n=v-(i.left+i.right)*this.scaleX,r=p+i.top*this.scaleY,h=g-(i.top+i.bottom)*this.scaleY,void 0===l&&(l=Q(t)),void 0===d&&(d=tt(t)),a=(e.alignOffsetX+e.alignOffsetOriginX*l)*this.scaleX,o=(e.alignOffsetY+e.alignOffsetOriginY*d)*this.scaleY,yr.call(this,t,s,r,n,h,e.align,a,o))}};Object.assign(Hh,Ih,Fh);const Nh=Phaser.Utils.Objects.IsPlainObject,Gh=Phaser.Utils.Objects.GetValue;class Vh extends rh{constructor(t,e,i,s,r,n){Nh(e)?(e=Gh(n=e,"x",0),i=Gh(n,"y",0),s=Gh(n,"width",void 0),r=Gh(n,"height",void 0)):Nh(s)&&(s=Gh(n=s,"width",void 0),r=Gh(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexOverlapSizer",this.sizerChildren={},this.addChildrenMap("items",this.sizerChildren)}childToKey(t){if("string"!=typeof t)return function(t,e){if(Array.isArray(t))return t.indexOf(e);for(var i in t)if(t[i]===e)return i;return null}(this.sizerChildren,t);var e=t;return this.sizerChildren.hasOwnPropery(e)?e:null}}Object.assign(Vh.prototype,Hh);const Uh=Rh.prototype.add,$h=Rh.prototype.addSpace;var Jh=function(t){var e=!t.isRexSpace,i=!e||this.buttonsExpand?1:0;if(0===this.sizerChildren.length)if(e){!this.buttonsExpand&&("right"===this.buttonsAlign||"center"===this.buttonsAlign||"bottom"===this.buttonsAlign)&&$h.call(this),Uh.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&$h.call(this),this.hasTailSpace=s}else Uh.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;Uh.call(this,t,{index:r,proportion:i,expand:!0})}else Uh.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},Kh={addButton(t){if(ur(t))for(var e=t,i=0,s=e.length;i=0;i--)Qh.call(this,e[i],t);return this}},ea=function(t,e,i){if(t){var s=this.setValueCallback,r=this.setValueCallbackScope;s&&(r?s.call(r,t,e,i):s(t,e,i)),this.fireEvent("button.statechange",t,e,i)}},ia=function(t){var e=this;t._selected=void 0,Object.defineProperty(t,"selected",{get:function(){return t._selected},set:function(i){if(t._selected!==i){var s=t._selected;t._selected=i,ea.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},sa={add(t){return this.buttons.push(t),t._click||(t._click=new wr(t,this.clickConfig),t._click.on("click",(function(t,e,i,s){this.fireEvent("button.click",e,i,s)}),this).on("enable",(function(t,e){this.fireEvent("button.enable",e)}),this).on("disable",(function(t,e){this.fireEvent("button.disable",e)}),this).on("over",(function(t,e,i,s){this.fireEvent("button.over",e,i,s)}),this).on("out",(function(t,e,i,s){this.fireEvent("button.out",e,i,s)}),this).on("down",(function(t,e,i,s){this.fireEvent("button.down",e,i,s)}),this).on("up",(function(t,e,i,s){this.fireEvent("button.up",e,i,s)}),this),t.isRexContainerLite&&t.sendChildToBack(t)),this.buttonsType&&(void 0===t.name&&console.error(`${this.parent.constructor.name}: Option button miss value`),ia.call(this,t)),this},addMultiple(t){for(var e=0,i=t.length;e0},setButtonEnable(t,e){var i=this.buttons;if(void 0===t||"boolean"==typeof t){e=t;for(var s=0,r=i.length;sa.height/2)){r>(o=ma(a.left,a.centerY,t,e))&&(r=o,s=n);var o,l=i[n+1];l&&l.y===a.y||r>(o=ma(a.right,a.centerY,t,e))&&(r=o,s=n+1)}}return s};const ba=Phaser.Utils.Objects.IsPlainObject,xa=Phaser.Utils.Objects.GetValue,Sa=Phaser.Display.Align.CENTER;var wa=function(t,e,i,s){return"\n"===t?(this.addNewLine(),this):(me.call(this,t),ba(e)&&(e=xa(o=e,"padding",0),i=xa(o,"key",void 0),s=xa(o,"index",void 0),r=xa(o,"offsetX",0),n=xa(o,"offsetY",0),h=xa(o,"offsetOriginX",0),a=xa(o,"offsetOriginY",0)),void 0===e&&(e=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===h&&(h=0),void 0===a&&(a=0),(o=this.getSizerConfig(t)).align=Sa,o.padding=ge(e),o.alignOffsetX=r,o.alignOffsetY=n,o.alignOffsetOriginX=h,o.alignOffsetOriginY=a,void 0===s||s>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(s,0,t),void 0!==i&&this.addChildrenMap(i,t),this);var r,n,h,a,o},Ca={add(t,e,i){if(ur(t))for(var s=t,r=0,n=s.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,yh.call(this,t),this}},_a={getChildrenWidth:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=0===this.orientation&&t?this.maxChildWidth:this.rexSizer.resolved?this.wrapResult.width:void 0)?e+(this.space.left+this.space.right)*this.scaleX:void 0);var e},getChildrenHeight:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=1===this.orientation&&t?this.maxChildHeight:this.rexSizer.resolved?this.wrapResult.height:void 0)?e+(this.space.top+this.space.bottom)*this.scaleY:void 0);var e},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;sr&&Da.addNewLine(this)}else for(n=0,h=t.length;n=0;i--)Ba.call(this,e[i],t);return this}};const ja=Phaser.Utils.Objects.GetValue;class Ia extends Ra{constructor(t,e){void 0===e&&(e={});var i=e.space;"number"==typeof i&&(e.space={item:i,line:i}),super(t,e),this.type="rexFixWidthButtons",this.buttonGroup=new da({parent:this,eventEmitter:ja(e,"eventEmitter",this),groupName:ja(e,"groupName",void 0),clickConfig:ja(e,"click",void 0)}).setButtonsType(e);var s=ja(e,"background",void 0),r=ja(e,"buttons",void 0);this.buttonsAlign=ja(e,"align",void 0),s&&this.addBackground(s),r&&this.addButtons(r),this.addChildrenMap("background",s),this.addChildrenMap("buttons",this.buttonGroup.buttons)}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.buttonGroup.destroy(),this.buttonGroup=void 0)}get buttons(){return this.buttonGroup.buttons}get groupName(){return this.buttonGroup.groupName}set groupName(t){this.buttonGroup.groupName=t}get eventEmitter(){return this.buttonGroup.eventEmitter}}Object.assign(Ia.prototype,Aa,Wa,la,ua);var Fa=function(){return Array.prototype.reduce.call(arguments,Ha,0)},Ha=function(t,e){return t+e};const Na=Phaser.Utils.Objects.IsPlainObject,Ga=Phaser.Utils.Objects.GetValue,Va=Phaser.Display.Align.CENTER;var Ua=function(t,e,i,s,r){if("number"==typeof t||"number"==typeof e){if(void 0===t){for(var n=0;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return Ja(this.sizerChildren,null),yh.call(this,t),this}},qa={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)Ja(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},eo={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Xe.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,Ja(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Ja(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},so=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const ro=Phaser.Utils.Objects.IsPlainObject,no=Phaser.Utils.Objects.GetValue;class ho extends rh{constructor(t,e,i,s,r,n,h,a,o,l){ro(e)?(e=no(l=e,"x",0),i=no(l,"y",0),s=no(l,"width",void 0),r=no(l,"height",void 0),n=no(l,"column",l.col||0),h=no(l,"row",0),a=no(l,"columnProportions",0),o=no(l,"rowProportions",0)):ro(s)?(s=no(l=s,"width",void 0),r=no(l,"height",void 0),n=no(l,"column",l.col||0),h=no(l,"row",0),a=no(l,"columnProportions",0),o=no(l,"rowProportions",0)):ro(n)?(n=no(l=n,"column",l.col||0),h=no(l,"row",0),a=no(l,"columnProportions",0),o=no(l,"rowProportions",0)):ro(a)&&(a=no(l=a,"columnProportions",0),o=no(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(no(l,"createCellContainerCallback")),this.setIndentLeft(no(l,"space.indentLeftOdd",0),no(l,"space.indentLeftEven",0)),this.setIndentTop(no(l,"space.indentTopOdd",0),no(l,"space.indentTopEven",0)),this.resetGrid(n,h,a,o,no(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=io.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=so.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(ho.prototype,eo);const ao=ho.prototype.add;var oo={addButton(t,e,i){return ao.call(this,t,e,i,void 0,0,this.buttonsExpand),this.buttonGroup.add(t),this},addButtons(t,e){for(var i=0,s=t;i=0;i--)uo.call(this,e[i],t);return this}};const vo=Phaser.Utils.Objects.GetValue;class go extends ho{constructor(t,e){void 0===e&&(e={});var i=vo(e,"row",0),s=vo(e,"column",e.col||0),r=vo(e,"createCellContainerCallback"),n=vo(e,"buttons",void 0),h=vo(e,"expand",!0),a=h?1:0;if(r&&(e.createCellContainerCallback=void 0),void 0!==n){i=Math.max(i,n.length);for(var o=0,l=n.length;o0&&r.push(o.join("")),r},Uo=0,$o=1,Jo=2,Ko=0,qo=1,Zo=2,Qo=/(?:\r\n|\r|\n)/;const tl={none:Ko,word:qo,char:Zo,character:Zo,mix:3},el=Phaser.Renderer.WebGL.Utils;var il={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,h=r.height,a=el.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,h,e.x,e.y,n/e.resolution,h/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,h,a(e.tintTopLeft,i.alpha*e._alphaTL),a(e.tintTopRight,i.alpha*e._alphaTR),a(e.tintBottomLeft,i.alpha*e._alphaBL),a(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const sl=Phaser.Display.Color;var rl={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,h,a,o,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===h&&(h=0),void 0===a&&(a=0),void 0===o&&(o=c),void 0===l&&(l=u);var p=d.cutX+h,v=d.cutY+a;return this.context.drawImage(d.source.image,p,v,o,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new sl);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var h=i;i=h.red,s=h.green,r=h.blue,n=h.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var a=this.context.createImageData(1,1);return a.data[0]=i,a.data[1]=s,a.data[2]=r,a.data[3]=n,this.context.putImageData(a,t,e),this.dirty=!0,this}},nl=function(t,e,i,s,r,n,h){var a,o=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===h&&(h=e.height);var d=(a=o.exists(i)?o.get(i):o.createCanvas(i,n,h)).getSourceImage();d.width!==n&&(d.width=n),d.height!==h&&(d.height=h);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,h),c.drawImage(e,s,r,n,h),l.gl&&a&&l.canvasToTexture(d,a.source[0].glTexture,!0,0)},hl={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,nl(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};e();const al=Phaser.Display.Canvas.CanvasPool,ol=Phaser.GameObjects.GameObject,ll=Phaser.Utils.String.UUID;class dl extends ol{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=al.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=ll(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){al.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}}const cl=Phaser.GameObjects.Components;Phaser.Class.mixin(dl,[cl.Alpha,cl.BlendMode,cl.Crop,cl.Depth,cl.Flip,cl.GetBounds,cl.Mask,cl.Origin,cl.Pipeline,cl.PostPipeline,cl.ScrollFactor,cl.Tint,cl.Transform,cl.Visible,il,rl,hl]);var ul={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:Es(this.data,t,e)},incData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)+e),this},mulData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)*e),this},clearData(){return this.data&&ft(this.data),this}};class pl{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}}Object.assign(pl.prototype,ul);var vl={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const gl=Phaser.Math.RotateAround;var fl;const ml=Phaser.Geom.Rectangle;var yl,bl=function(t){void 0===yl&&(yl=new ml);var e=t.drawTLX,i=t.drawTLY;return yl.setTo(e,i,t.drawTRX-e,t.drawBLY-i),yl};const xl=Phaser.Math.RotateAround;var Sl,wl=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Sl&&(Sl={}),s=Sl),s.x=e,s.y=i,0!==t.rotation&&xl(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const Cl=Phaser.GameObjects.Components.TransformMatrix;var Ol,Pl,_l={},Tl=function(t,e,i,s,r){var n=wl(e,i,s,!0),h=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=_l);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===Ol&&(Ol=new Cl,Pl=new Cl),t.parentContainer?t.getWorldTransformMatrix(Ol,Pl):Ol.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),Ol.transformPoint(r,n,s),s}(t,n.x,n.y,r);return h},kl=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,h=e.drawCenterY+s;return Tl(t,e,n,h,r)},El={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===fl&&(fl={}),s=fl),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&gl(s,0,0,-i.rotation),s}(t,e,this,!0);return bl(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return kl(this.parent,this,t,e,i)}};Object.assign(El,vl);const Ml=Phaser.Math.DegToRad,Rl=Phaser.Math.RadToDeg,Ll=Phaser.Utils.Objects.GetValue;class Dl extends pl{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return Rl(this._rotation)}set angle(t){this.rotation=Ml(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=Ll(t,"width",void 0),i=Ll(t,"height",void 0),s=Ll(t,"scaleX",void 0),r=Ll(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(Dl.prototype,El);const zl=Phaser.Utils.String.Pad;var Al=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${zl(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},Yl=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Xl=Phaser.Utils.Objects.GetValue;let Bl=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=Xl(t,"x",0),i=Xl(t,"y",0));var s=this.cornerRadius;s.tl=Wl(Xl(t,"tl",void 0),e,i),s.tr=Wl(Xl(t,"tr",void 0),e,i),s.bl=Wl(Xl(t,"bl",void 0),e,i),s.br=Wl(Xl(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){jl(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){jl(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){jl(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){jl(this.cornerRadius.br,t)}};var Wl=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Il(t),t},jl=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Xl(e,"x",0),t.y=Xl(e,"y",0)),Il(t)},Il=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const Fl=Phaser.Math.DegToRad;var Hl=function(t){return!t.hasOwnProperty("convex")||t.convex},Nl=function(t){return t.x>0&&t.y>0},Gl=function(t,e,i,s,r,n,h,a,o){if(a&&h>n?h-=360:!a&&h=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=m.tl,Nl(a)?(o=a.x*g,l=a.y*f,Hl(a)?Gl(t,o,l,o,l,180,270,!1,h):Gl(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,Nl(a)?(o=a.x*g,l=a.y*f,Hl(a)?Gl(t,s-o,l,o,l,270,360,!1,h):Gl(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,Nl(a)?(o=a.x*g,l=a.y*f,Hl(a)?Gl(t,s-o,r-l,o,l,0,90,!1,h):Gl(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,Nl(a)?(o=a.x*g,l=a.y*f,Hl(a)?Gl(t,o,r-l,o,l,90,180,!1,h):Gl(t,0,r,o,l,360,270,!0,h)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,h,u),null!=a)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,a),p.addColorStop(1,d),a=p),e.fillStyle=a,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())},Ul=function(t,e,i,s,r,n,h,a){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),Vl(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}};const $l=Phaser.Utils.Objects.GetValue;class Jl extends Dl{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor($l(e,"color",null),$l(e,"color2",null),$l(e,"horizontalGradient",!0)),this.setStroke($l(e,"stroke",null),$l(e,"strokeThickness",2)),this.setCornerRadius($l(e,"cornerRadius",0),$l(e,"cornerIteration",null))}set color(t){t=Al(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Al(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Al(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,Yl("color2",t,this),Yl("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Yl("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Yl("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){Ul(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Kl=Phaser.Utils.Objects.GetValue;class ql extends Dl{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(Kl(e,"color",null),Kl(e,"color2",null),Kl(e,"horizontalGradient",!0)),this.setStroke(Kl(e,"stroke",null),Kl(e,"strokeThickness",2))}set color(t){t=Al(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Al(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Al(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,Kl(t,"color2",null),Kl(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Kl(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,h=this.parent.height-i.top-i.bottom,a=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?a.createLinearGradient(0,0,n,0):a.createLinearGradient(0,0,0,h)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,a.fillStyle=t,a.fillRect(s,r,n,h));null!=this.stroke&&this.strokeThickness>0&&(a.strokeStyle=this.stroke,a.lineWidth=this.strokeThickness,a.strokeRect(s,r,n,h))}}const Zl=Phaser.Utils.Objects.GetValue;let Ql=class t{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(Zl(t,"bold",!1)),this.setItalic(Zl(t,"italic",!1)),this.setFontSize(Zl(t,"fontSize","16px")),this.setFontFamily(Zl(t,"fontFamily","Courier")),this.setColor(Zl(t,"color","#fff")),this.setStrokeStyle(Zl(t,"stroke",null),Zl(t,"strokeThickness",0)),this.setShadow(Zl(t,"shadowColor",null),Zl(t,"shadowOffsetX",0),Zl(t,"shadowOffsetY",0),Zl(t,"shadowBlur",0)),this.setOffset(Zl(t,"offsetX",0),Zl(t,"offsetY",0)),this.setSpace(Zl(t,"leftSpace",0),Zl(t,"rightSpace",0)),this.setAlign(Zl(t,"align",void 0)),this.setBackgroundColor(Zl(t,"backgroundColor",null)),this.setBackgroundHeight(Zl(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Zl(t,"backgroundBottomY",void 0)),this.setBackgroundLeftX(Zl(t,"backgroundLeftX",0)),this.setBackgroundRightX(Zl(t,"backgroundRightX",0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(Yl("stroke",t,this),Yl("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Yl("shadowOffsetX",t,this),Yl("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),t.hasOwnProperty("backgroundLeftX")&&this.setBackgroundLeftX(t.backgroundLeftX),t.hasOwnProperty("backgroundRightX")&&this.setBackgroundRightX(t.backgroundRightX),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new t(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=Al(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=Al(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=Al(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=Al(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setBackgroundLeftX(t){return this.backgroundLeftX=t,this}setBackgroundRightX(t){return this.backgroundRightX=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}};const td=Phaser.Utils.Array.Remove,ed=Phaser.Utils.Array.Remove,id="text",sd="image",rd="drawer",nd="space",hd="command";var ad=function(t){return t.type===id&&"\n"===t.text},od=function(t){return t.type===id&&"\f"===t.text},ld=function(t){return t.type===id};class dd extends Dl{constructor(t,e,i){super(t,id),this.updateTextFlag=!1,this.style=new Ql(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX+e.backgroundLeftX,s=i,r=this.drawTRX+e.backgroundRightX-i+1;if(r>0){var n=e.backgroundBottomY;null==n&&(n=this.drawBLY);var h=e.backgroundHeight;null==h&&(h=n-this.drawTLY);var a=n-h;t.fillRect(s,a,r,h)}}var o=e.hasFill,l=e.hasStroke;(o||l)&&(e.syncFont(t).syncStyle(t),l&&(e.syncShadow(t),t.strokeText(this.text,0,0)),o&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var cd=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const ud=Phaser.Display.Canvas.CanvasPool;var pd=function(t,e,i,s,r,n,h,a){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===a&&(a=!1),a&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(h){var l=ud.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=h,d.fillRect(0,0,r,n),o.drawImage(l,0,0,r,n,i,s,r,n),ud.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)};Phaser.Display.Canvas.CanvasPool;class vd extends Dl{constructor(t,e,i){super(t,sd),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){pd(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class gd extends Dl{constructor(t,e,i,s){super(t,rd),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class fd extends Dl{constructor(t,e){super(t,nd),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class md extends pl{constructor(t,e,i,s,r){super(t,hd),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}function yd(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>yd(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=yd(t[i]));return e}var bd=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const xd={none:0,word:1,char:2,character:2,mix:3};var Sd=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,h=!r&&!n,a=t.length,o=e,l=s.word,d=0,c=!1;o0&&!a){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=Pd.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=Pd.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=Td(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=Td(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=Td(t,"wrapMode");void 0===c&&(c=Td(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=xd[c]);var u=Td(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=Td(t,"letterSpacing",0),v=Td(t,"hAlign",0),g=Td(t,"vAlign",0),f=Td(t,"justifyPercentage",.25),m=bd({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:h,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,b=0,x=y.length;b0&&(E.push({children:M,width:R}),L=Math.max(L,R)),m.start+=k.length,m.isLastPage=!D&&m.start===T,m.maxLineWidth=L,m.linesHeight=E.length*n;var j=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,I=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,h=t.vAlign,a=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(h=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=Md(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=Md(t,"maxLines",0);var a=0===i,o=Md(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=Md(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=Md(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=Md(t,"letterSpacing",0),p=Md(t,"rtl",!0),v=Md(t,"hAlign",p?2:0),g=Md(t,"vAlign",0),f=bd({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:o,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(k.push({children:E,height:M}),R=Math.max(R,M)),f.start+=T.length,f.isLastPage=f.start===_,f.maxLineHeight=R,f.linesWidth=k.length*n;var X=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,B=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,h=t.vAlign,a=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}a&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,h=i.bottom;return Le(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return Re(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),td(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return ed(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(id);return null===i?i=new dd(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),kl(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const ec=Phaser.Utils.Objects.GetFastValue;var ic={};class sc{constructor(t){this.pools=ec(t,"pools",ic)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new tc),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;ei&&(r=Math.floor(i));for(var n={},h=cc(t,r,e,i,n),a=0;a<=oc&&0!==h;a++){if((r+=h)<0){r=0;break}h=cc(t,r,e,i,n)}return a===oc&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),uc(t,e,i),t},dc=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},cc=function(t,e,i,s,r){var n,h=dc(t,e,r),a=dc(t,e+1,r);if(void 0!==s)if(h.height<=s&&a.height>s)n=0;else{if(h.height>s)return-1;n=Math.floor(s-h.height)}if(h.width<=i&&a.width>i)return 0;if(h.width>i)return-1;var o=Math.floor(i-h.width);return void 0===n?o:Math.min(o,n)},uc=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const pc=Phaser.Utils.Objects.GetValue,vc=Phaser.Utils.Objects.GetValue;class gc extends To{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=vc(e,"background",void 0),r=vc(e,"icon",void 0),n=vc(e,"iconMask",void 0),h=vc(e,"text",void 0),a=vc(e,"action",void 0),o=vc(e,"actionMask",void 0),l=vc(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(h||a)&&(i={right:vc(e,"space.icon",0),top:vc(e,"space.iconTop",0),bottom:vc(e,"space.iconBottom",0),left:vc(e,"space.iconLeft",0)}):(h||a)&&(i={bottom:vc(e,"space.icon",0),left:vc(e,"space.iconLeft",0),right:vc(e,"space.iconRight",0),top:vc(e,"space.iconTop",0)});var d=vc(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=Xo.call(this,r,r,1)),!d){var c=vc(e,"iconSize",void 0);this.setIconSize(vc(e,"iconWidth",c),vc(e,"iconHeight",c))}}if(h){var u=vc(e,"wrapText",!1),p=vc(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),function(t,e){switch(Fo(t)){case 0:switch("string"==typeof e&&(e=tl[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=Go;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=tl[e]||0),t.style.wrapMode=e}}(h,u),e.expandTextWidth=!0,ac(h)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=pc(e,"minWidth",0),s=pc(e,"minHeight",0),r=pc(e,"fitHeight",!1);t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return lc(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),lc(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t})}(h,{fitHeight:!0}));var v,g,f=vc(e,"space.text",0),m=vc(e,"expandTextWidth",!1),y=vc(e,"expandTextHeight",!1);0===this.orientation?(v=m?1:0,a&&(i={right:f}),g=y):(v=y?1:0,a&&(i={bottom:f}),g=m),this.add(h,{proportion:v,expand:g,padding:i})}if(a&&(i=0===this.orientation?{top:vc(e,"space.actionTop",0),bottom:vc(e,"space.actionBottom",0),right:vc(e,"space.actionRight",0)}:{left:vc(e,"space.actionLeft",0),right:vc(e,"space.actionRight",0),bottom:vc(e,"space.actionBottom",0)},d=vc(e,"squareFitAction",!1)?1:0,this.add(a,{proportion:0,padding:i,fitRatio:d}),o&&(o=Xo.call(this,a,a,1)),!d)){var b=vc(e,"actionSize");this.setActionSize(vc(e,"actionWidth",b),vc(e,"actionHeight",b))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",h),this.addChildrenMap("action",a),this.addChildrenMap("actionMask",o)}}var fc=Phaser.Renderer.WebGL.Utils,mc=function(t,e,i,s,r,n){for(var h=fc.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),a=i.pathData,o=i.pathIndexes,l=0;l>>16,a=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+h+","+a+","+o+","+n+")"},wc=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,h=(16711680&r)>>>16,a=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+h+","+a+","+o+","+n+")",t.lineWidth=e.lineWidth};const Cc=Phaser.Renderer.Canvas.SetTransform;var Oc={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=xc(e,i,s),h=r.calcMatrix.copyFrom(n.calc),a=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&mc(r,h,e,l,a,o),e.isStroked&&bc(r,e,l,a,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(Cc(t,r,e,i,s)){var n=e._displayOriginX,h=e._displayOriginY,a=e.pathData,o=a.length-1,l=a[0]-n,d=a[1]-h;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(_c.prototype,Oc);var Tc=function(t){return t.x>0&&t.y>0},kc=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const Ec=Phaser.Math.DegToRad;var Mc=function(t,e,i,s,r,n,h,a,o){h&&n>r?n-=360:!h&&n0,h=0,a=e.length;h=0?t.startAt(h+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(h+n,i):t.startAt(h,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(h,i),t.close(),t};const ku=Phaser.Utils.Objects.GetValue,Eu=Phaser.Utils.Objects.IsPlainObject;class Mu extends(iu($c)){constructor(t,e,i,s,r,n,h,a){Eu(e)?(e=(a=e).x,i=a.y,s=a.width,r=a.height,n=a.barColor,h=a.value):Eu(s)?(s=(a=s).width,r=a.height,n=a.barColor,h=a.value):Eu(n)&&(n=(a=n).barColor,h=a.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===h&&(h=0),super(t,e,i,s,r,a),this.type="rexLineProgress",this.bootProgressBase(a),this.addShape((new _u).setName("trackFill")).addShape((new _u).setName("bar")).addShape((new _u).setName("trackStroke")),this.setTrackColor(ku(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(ku(a,"trackStrokeThickness",2),ku(a,"trackStrokeColor",void 0)),this.setSkewX(ku(a,"skewX",0)),this.setRTL(ku(a,"rtl",!1)),this.setValue(h)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var Ru={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&Tu(s,0,0,e,i,t);var r,n,h=this.getShape("bar");h.fillStyle(this.barColor),h.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),Tu(h,r,0,n,i,t));var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&Tu(a,0,0,e,i,t)}};Object.assign(Mu.prototype,Ru);var Lu=function(t){return null==t||""===t||0===t.length},Du=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(Lu(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(Lu(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,h=e.length;n=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=yd(i),s=yd(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),h=n.width,a=0,o=0,l=i.length;o0?h/a:0,c=n.height,u=0;for(o=0,l=s.length;o0?0:g,b=0,o=0;for(var C=i.length;o0?0:f),f>=1&&g>=1){var O=typeof(m=this.getFrameNameCallback(o,S,e));"string"!==O&&"number"!==O||r.add(m,0,b+n.cutX,x+n.cutY,f,g)}b+=f}x+=g}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,h,a,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/o,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(u,p);if(u>v){var g=(u-v)*o;d>=0?d+=g:d=g,u=v}if(p>v){var f=(p-v)*l;c>=0?c+=f:c=f,p=v}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,x=this.rows.count;b0&&a>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(S,b)?0:1)?this._drawImage(this.textureKey,s,m,y,h,a):this._drawTileSprite(this.textureKey,s,m,y,h,a)),m+=h;y+=a}this._endDraw()},setStretchMode:function(t){return qu(t)?(this.stretchMode.edge=Qu(Zu(t,"edge",0)),this.stretchMode.internal=Qu(Zu(t,"internal",0))):(t=Qu(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return ep.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const sp=Phaser.Utils.Objects.IsPlainObject,rp=Phaser.Utils.Objects.GetValue,np=Phaser.GameObjects;var hp=void 0,ap=function(t,e){if(hp||(hp={},ti(t).events.once("destroy",(function(){for(var t in hp)hp[t].destroy();hp=void 0}))),!hp.hasOwnProperty(e)){var i=ti(t).scene.systemScene;(t=new np[e](i)).setOrigin(0),hp[e]=t}return hp[e]};const op=Phaser.GameObjects.RenderTexture;class lp extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if(sp(i)?(i=rp(d=i,"x",0),s=rp(d,"y",0),r=rp(d,"width",1),n=rp(d,"height",1),h=rp(d,"key",void 0),a=rp(d,"baseFrame",void 0),o=rp(d,"columns",void 0),l=rp(d,"rows",void 0)):sp(r)?(r=rp(d=r,"width",1),n=rp(d,"height",1),h=rp(d,"key",void 0),a=rp(d,"baseFrame",void 0),o=rp(d,"columns",void 0),l=rp(d,"rows",void 0)):sp(h)?(h=rp(d=h,"key",void 0),a=rp(d,"baseFrame",void 0),o=rp(d,"columns",void 0),l=rp(d,"rows",void 0)):sp(a)?(a=rp(d=a,"baseFrame",void 0),o=rp(d,"columns",void 0),l=rp(d,"rows",void 0)):Array.isArray(a)?(d=l,l=o,o=a,a=rp(d,"baseFrame",void 0)):sp(o)&&(o=rp(d=o,"columns",void 0),l=rp(d,"rows",void 0)),void 0===a&&(a=rp(d,"frame",void 0)),void 0===o){var c=rp(d,"leftWidth",void 0),u=rp(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=rp(d,"topHeight",void 0),v=rp(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(rp(d,"getFrameNameCallback",void 0)),this.setStretchMode(rp(d,"stretchMode",0)),this.setPreserveRatio(rp(d,"preserveRatio",!0));var g=rp(d,"maxFixedPartScale",1),f=rp(d,"maxFixedPartScaleX",g),m=rp(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(h,a,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,ip),i}(op,"rexNinePatch")){}var dp={_drawImage:function(t,e,i,s,r,n){var h=ap(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=ap(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(lp.prototype,dp);let cp=class extends ii{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Yu(t,e))return t[e];var i=t.parent;return Yu(i,e)?i[e]:void 0}set(t,e,i){return Yu(t,e)?t[e]=i:Yu(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}};const up=Phaser.Utils.Objects.GetValue;class pp extends lp{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=up(e,"effects",!0);i&&Iu(this,i),this.style=new cp(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(pp.prototype,jc);const vp=["alpha","tint","flipX","flipY"];var gp=function(t,e){if(!e)return t;for(var i=0,s=vp.length;i=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const _=Phaser.Math.DegToRad;var T={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=_(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},k={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=O(t.scaleX,i.scaleX),e.scaleY=O(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},E={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=O(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},L={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},D={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},z={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(t){void 0===t&&(t=!1);var e=this;return this._mask=null,this.setChildMaskVisible(this),this.children.forEach((function(t){t.clearMask&&t.clearMask(!1),t.hasOwnProperty("isRexContainerLite")||e.setChildMaskVisible(t)})),t&&this.mask&&this.mask.destroy(),this}},A=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},B=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const j=Phaser.Utils.Array;var I={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},ke=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const Ee=/(\S+)\[(\d+)\]/i,Me=Phaser.Utils.Objects.GetValue;var Re=function(t,e){return void 0===e?t:t[e]},Le=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Me(e,"left",0),t.right=Me(e,"right",0),t.top=Me(e,"top",0),t.bottom=Me(e,"bottom",0)),t},De={getInnerPadding(t){return Re(this.space,t)},setInnerPadding(t,e){return Le(this.space,t,e),this},getOuterPadding(t){return Re(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Le(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Re(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Le(this.getSizerConfig(t).padding,e,i),this}},ze=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Ae=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Ye=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Xe=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Be=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},We=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},je={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Ie=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?mi:fi,this.repeatCounter=0,this}stop(){return this.state=gi,this}update(t,e){this.state!==gi&&this.state!==bi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=yi)):(this.nowTime=this.duration,this.state=bi):this.nowTime>=0&&(this.state=mi))}get t(){var t;switch(this.state){case gi:case fi:case yi:t=0;break;case mi:t=this.nowTime/this.duration;break;case bi:t=1}return pi(t,0,1)}set t(t){(t=pi(t,-1,1))<0?(this.state=fi,this.nowTime=-this.delay*t):(this.state=mi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===gi}get isDelay(){return this.state===fi}get isCountDown(){return this.state===mi}get isRunning(){return this.state===fi||this.state===mi}get isDone(){return this.state===bi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const gi=0,fi=1,mi=2,yi=3,bi=-1;class xi extends di{constructor(t,e){super(t,e),this.timer=new vi}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const Si=Phaser.Utils.Objects.GetValue,wi=Phaser.Utils.Objects.GetAdvancedValue,Ci=Phaser.Tweens.Builders.GetEaseFunction;class Oi extends xi{resetFromJSON(t){return this.timer.resetFromJSON(Si(t,"timer")),this.setEnable(Si(t,"enable",!0)),this.setTarget(Si(t,"target",this.parent)),this.setDelay(wi(t,"delay",0)),this.setDuration(wi(t,"duration",1e3)),this.setEase(Si(t,"ease","Linear")),this.setRepeat(Si(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Ci(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Pi=Phaser.Utils.Objects.GetValue,_i=Phaser.Utils.Objects.GetAdvancedValue,Ti=Phaser.Math.Linear;let ki=class extends Oi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Pi(t,"mode",0)),this.setScaleRange(_i(t,"start",void 0),_i(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ei[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=_i(t,"x",this.parent.scaleX),this.startY=_i(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=_i(e,"x",void 0),this.endY=_i(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Ti(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Ti(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const Ei={stop:0,destroy:1,yoyo:2};var Mi=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new ki(t,a):r.resetFromJSON(a),r.restart(),r},Ri=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof ki&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new ki(t,h):n.resetFromJSON(h),n.restart(),n},Li=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Di=function(t){return Li(t,"complete")};const zi=Phaser.Utils.Objects.IsPlainObject;var Ai={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(zi(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Mi(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Di(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(zi(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Ri(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Di(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Di(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(zi(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new ki(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Di(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Yi={};Object.assign(Yi,Ai),Yi.onInitScale=function(){Ai.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=xe.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Xi=Phaser.Utils.Objects.GetValue,Bi=Phaser.Utils.Objects.GetAdvancedValue,Wi=Phaser.Math.Linear;class ji extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Xi(t,"mode",0)),this.setAlphaRange(Bi(t,"start",this.parent.alpha),Bi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ii[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Wi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ii={stop:0,destroy:1,yoyo:2},Fi=Phaser.Utils.Objects.IsPlainObject;var Hi=function(t,e,i,s){var r,n;Fi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new ji(t,h):s.resetFromJSON(h),s.restart(),s},Ni=function(t,e,i,s){i instanceof ji&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new ji(t,r):s.resetFromJSON(r),s.restart(),s};const Gi=Phaser.Utils.Objects.IsPlainObject;var Vi={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Gi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Hi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Di(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Gi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Ni(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Di(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Di(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Ui={};Object.assign(Ui,Vi),Ui.onInitFade=function(){Vi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=xe.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const $i=Phaser.Utils.Objects.GetValue,Ji=Phaser.Utils.Objects.GetAdvancedValue,Ki=Phaser.Math.Linear;class qi extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode($i(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ji(t,"x",void 0),i=Ji(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Zi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Ji(i,"startX",void 0),this.startY=Ji(i,"startY",void 0),this.endX=Ji(i,"endX",void 0),this.endY=Ji(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Ki(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ki(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Zi={stop:0,destroy:1,yoyo:2};var Qi=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const ts=Phaser.Utils.Objects.IsPlainObject,es=Phaser.Math.Distance.Between;var is={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(ts(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*es(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof qi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=Qi(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=Qi(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new qi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Di(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Di(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(ts(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*es(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof qi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=Qi(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=Qi(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new qi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Di(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Di(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},ss={};Object.assign(ss,is),ss.onInitEaseMove=function(){is.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=xe.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const rs=Phaser.Utils.Objects.GetValue;class ns extends ai{constructor(t,e){super(t,e),this.timer=new vi,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(rs(t,"timer")),this.setEnable(rs(t,"enable",!0)),this.setMode(rs(t,"mode",1)),this.isRunning=rs(t,"isRunning",!1),this.setMagnitudeMode(rs(t,"magnitudeMode",1)),this.setAxisMode(rs(t,"axis",0)),this.setDuration(rs(t,"duration",500)),this.setMagnitude(rs(t,"magnitude",10)),this.ox=rs(t,"ox",void 0),this.oy=rs(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=hs[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=os[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=as[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=rs(i,"magnitude",void 0),t=rs(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const hs={effect:0,behavior:1},as={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},os={constant:0,decay:1},ls=Phaser.Utils.Objects.IsPlainObject;var ds={shake(t,e,i){if(ls(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new ns(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Di(this._shake)}};const cs=Phaser.Utils.Objects.GetValue,us=Phaser.Math.Linear;class ps extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=cs(t,"key","value");var i=e[this.propertyKey];return this.fromValue=cs(t,"from",i),this.toValue=cs(t,"to",i),this.setEase(cs(t,"ease",this.ease)),this.setDuration(cs(t,"duration",this.duration)),this.setRepeat(cs(t,"repeat",0)),this.setDelay(cs(t,"delay",0)),this.setRepeatDelay(cs(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=us(this.fromValue,this.toValue,i)}}const vs=Phaser.Utils.Objects.IsPlainObject;class gs extends ii{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new ps(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(vs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(vs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var fs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new gs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Li(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},ms=Phaser.Utils.Array.Remove,ys={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var Ys={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=qe(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Xs={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=Xt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=Xt),this.transitOutCallback=t,this}},Bs={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Ws={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},js={};Object.assign(js,Ys,Xs,Bs,Ws);const Is=Phaser.Utils.Objects.GetValue;class Fs extends ii{constructor(t,e){super(t,e),this.setTransitInTime(Is(e,"duration.in",200)),this.setTransitOutTime(Is(e,"duration.out",200)),this.setTransitInCallback(Is(e,"transitIn")),this.setTransitOutCallback(Is(e,"transitOut")),this.oneShotMode=Is(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new As(this,{eventEmitter:!1,initState:Is(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Fs.prototype,js);var Hs=function(t){if(t.parentContainer)return Hs(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?Hs(e):t};class Ns extends ii{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Hs(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Gs=Phaser.GameObjects.Rectangle;class Vs extends Gs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Ns(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Us=Phaser.Utils.Objects.GetValue;class $s extends ii{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Us(t,"hitAreaMode",0)),this.setEnable(Us(t,"enable",!0)),this.setStopMode(Us(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Js[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Js={default:0,fullWindow:1};const Ks=Phaser.Utils.Objects.GetValue;class qs extends Vs{constructor(t,e){super(t,Ks(e,"color",0),Ks(e,"alpha",.8)),this.touchEventStop=new $s(this,{hitAreaMode:1})}}var Zs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Mi(t,e)},scaleDown(t,e){Ri(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Hi(t,e)},fadeOut(t,e){Ni(t,e,!1)}},Qs=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Hi(t,e,t.alpha)},tr=function(t,e){Ni(t,e,!1)},er=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!nt(t,!0).contains(e,i)||r&&!r(t,e,i))};const ir=Phaser.Utils.Objects.GetValue;let sr=class extends Fs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=rr.popUp),null==e.transitOut&&(e.transitOut=rr.scaleDown),e.destroy=ir(e,"destroy",!0),super(t,e);var i=ir(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new qs(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(ir(i,"transitIn",Qs)),this.setCoverTransitOutCallback(ir(i,"transitOut",tr)));var s=ir(e,"touchOutsideClose",!1),r=ir(e,"duration.hold",-1),n=ir(e,"timeOutClose",r>=0),h=ir(e,"anyTouchClose",!1);ir(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),ir(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&er(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=rr[t]),t){case rr.popUp:t=Zs.popUp;break;case rr.fadeIn:t=Zs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=rr[t]),t){case rr.scaleDown:t=Zs.scaleDown;break;case rr.fadeOut:t=Zs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const rr={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var nr=function(t){return t&&"function"==typeof t},hr={modal(t,e){return nr(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new sr(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},ar=function(t,e,i,s,r){nr(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},or={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return ar.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return ar.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return ar.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return ar.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return ar.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return ar.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return ar.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return ar.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return ar.call(this,"shutdown",t,e,i,s),this}},lr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=dr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},dr={},cr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?er(t,e.x,e.y,i,s):!!(r=lr(e,n,!0))&&er(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const Cr={press:0,pointerdown:0,release:1,pointerup:1};var Or={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new wr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},Pr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!_r(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return Tr.length=0,!0;return Tr.length=0,!1},Tr=[];const kr=Phaser.Utils.Objects.GetValue;class Er extends ii{constructor(t,e){super(t,e),this._enable=void 0;var i=kr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(kr(t,"enable",!0)),this.setMode(kr(t,"mode",1)),this.setClickInterval(kr(t,"clickInterval",100)),this.setDragThreshold(kr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Mr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?Pr:cr)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Mr={press:0,pointerdown:0,release:1,pointerup:1};var Rr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Er(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Lr extends zs{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Dr=Phaser.Utils.Objects.GetValue;class zr extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Lr,this.parent.setInteractive(Dr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Dr(t,"enable",!0)),this.setCooldown(Dr(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Ar={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&cr(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new zr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new zr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Yr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Xr=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Qr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===tn&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Qr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=en,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&cr(t,s,e,i)}}const Qr=0,tn=1,en="IDLE",sn=Phaser.Utils.Objects.GetValue,rn=Phaser.Math.Distance.Between;class nn extends Zr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=hn},eventEmitter:!1};this.setRecongizedStateObject(new zs(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(sn(t,"time",250)),this.setTapInterval(sn(t,"tapInterval",200)),this.setDragThreshold(sn(t,"threshold",9)),this.setTapOffset(sn(t,"tapOffset",10));var e=sn(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(sn(t,"maxTaps",void 0)),this.setMinTaps(sn(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case hn:this.state=an;break;case an:var t=this.lastPointer;rn(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=on,this.state=an);break;case on:this.state=an}}onDragEnd(){this.state===an&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=on))}onDrag(){this.state!==hn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=hn)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===an){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=hn):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=on:this.state=hn)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===on&&(this.state=hn)}get isTapped(){return this.state===on}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const hn="IDLE",an="BEGIN",on="RECOGNIZED",ln=Phaser.Utils.Objects.GetValue;class dn extends Zr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=cn},eventEmitter:!1};this.setRecongizedStateObject(new zs(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(ln(t,"threshold",9)),this.setHoldTime(ln(t,"time",251)),this}onDragStart(){this.state=un,0===this.holdTime&&(this.state=pn)}onDragEnd(){this.state=cn}onDrag(){this.state!==cn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=cn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===un&&t-this.pointer.downTime>=this.holdTime&&(this.state=pn)}get isPressed(){return this.state===pn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const cn="IDLE",un="BEGIN",pn="RECOGNIZED";Phaser.Utils.Objects.GetValue;var vn=function(t){return ti(t).loop.delta};const gn=Phaser.Math.Distance.Between,fn=Phaser.Math.Angle.Between;var mn={getDt:function(){return vn(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return gn(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return fn(e.x,e.y,t.x,t.y)}},yn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},bn={};const xn=Phaser.Utils.Objects.GetValue,Sn=Phaser.Math.RadToDeg;class wn extends Zr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=Cn},eventEmitter:!1};this.setRecongizedStateObject(new zs(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(xn(t,"threshold",10)),this.setVelocityThreshold(xn(t,"velocityThreshold",1e3)),this.setDirectionMode(xn(t,"dir","8dir")),this}onDragStart(){this.state=On}onDragEnd(){this.state=Cn}onDrag(){this.state===On&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=Pn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Pn&&(this.state=Cn)}get isSwiped(){return this.state===Pn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=yn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=bn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(Sn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(wn.prototype,mn);const Cn="IDLE",On="BEGIN",Pn="RECOGNIZED",_n=Phaser.Utils.Objects.GetValue,Tn=Phaser.Utils.Array.SpliceOne,kn=Phaser.Math.Distance.Between,En=Phaser.Math.Angle.Between;class Mn{constructor(t,e){var i=qe(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(_n(e,"inputConfig",void 0)),this.setEventEmitter(_n(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(_n(t,"enable",!0)),this.bounds=_n(t,"bounds",void 0),this.tracerState=Ln,this.pointers.length=0,ft(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,ft(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case Ln:this.tracerState=Dn,this.onDrag1Start();break;case Dn:this.tracerState=zn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],Tn(this.pointers,e),this.tracerState){case Dn:this.tracerState=Ln,this.onDrag1End();break;case zn:this.tracerState=Dn,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case Dn:this.onDrag1();break;case zn:this.onDrag2()}}}dragCancel(){return this.tracerState===zn&&this.onDrag2End(),this.pointers.length=0,ft(this.movedState),this.tracerState=Ln,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==zn)return 0;var t=this.pointers[0],e=this.pointers[1];return kn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==zn)return 0;var t=this.pointers[0],e=this.pointers[1];return En(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Rn.x=e.x-i.x,Rn.y=e.y-i.y}else Rn.x=0,Rn.y=0;return Rn}get centerX(){if(this.tracerState!==zn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==zn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==zn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==zn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=An,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&cr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&cr(t,s,e,i)}}Object.assign(Mn.prototype,$e);var Rn={};const Ln=0,Dn=1,zn=2,An="IDLE";Phaser.Utils.Objects.GetValue;const Yn=Phaser.Math.RotateAround;var Xn=function(t,e,i,s){return Yn(t,e,i,s),t.rotation+=s,t},Bn={};const Wn=Phaser.Utils.Objects.GetValue,jn=Phaser.Math.Angle.WrapDegrees,In=Phaser.Math.Angle.ShortestBetween,Fn=Phaser.Math.RadToDeg,Hn=Phaser.Math.DegToRad;var Nn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Bn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=jn(Fn(this.angleBetween));this.angle=In(this.prevAngle,t),this.prevAngle=t,this.state=Un}break;case Un:t=jn(Fn(this.angleBetween)),this.angle=In(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Un}get rotation(){return Hn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Nn);const Gn="IDLE",Vn="BEGIN",Un="RECOGNIZED",$n=Phaser.Utils.Objects.GetValue;var Jn=function(t){var e=$n(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new nn(this,e),this._tap.on("tap",(function(t,e,s){Br(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Br(i.eventEmitter,`${i.eventNamePrefix}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Kn=Phaser.Utils.Objects.GetValue;var qn=function(t){var e=Kn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new dn(this,e),this._press.on("pressstart",(function(t,e,s){Br(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this).on("pressend",(function(t,e,s){Br(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Zn=Phaser.Utils.Objects.GetValue;var Qn=function(t){var e=Zn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new wn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Br(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Br(i.eventEmitter,`${i.eventNamePrefix}swipe`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const th=Phaser.Utils.Objects.GetValue;var eh=function(t,e){return t.setInteractive(),th(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:th(e,"targets",[t]),targetMode:th(e,"targetMode","parent"),eventEmitter:th(e,"eventEmitter",t),eventNamePrefix:th(e,"inputEventPrefix","child.")},jr.call(t,e),Hr.call(t,e),Vr.call(t,e),Kr.call(t,e),Jn.call(t,e),qn.call(t,e),Qn.call(t,e),t},ih={getSizerConfig:function(t){return void 0===t&&(t=this),Mt(t)},getChildPrevState:function(t){var e=Mt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Dt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=oe(e,"color"),s=oe(e,"lineWidth");var o=oe(e,"name",!1);o&&(r=oe(o,"createTextCallback",ce),n=oe(o,"createTextCallbackScope",void 0),"string"==typeof(h=oe(o,"align","left-top"))&&(h=Yt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new le(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}var d,c,u=this.getAllShownChildren([this]);ue(u,u);for(var p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const ch=Phaser.Utils.Objects.IsPlainObject,uh=Phaser.Utils.Objects.GetValue,ph=Phaser.Display.Align.CENTER,vh={min:0,full:-1};var gh=function(t,e,i,s,r,n,h,a,o,l){var d,c,u,p;me.call(this,t);var v=t.isRexSpace,g=typeof e;if(null===e)return this;if("number"===g);else if("string"===g)e=vh[e];else if(ch(e)){var f;e=uh(f=e,"proportion",void 0),i=uh(f,"align",ph),s=uh(f,"padding",0),r=uh(f,"expand",!1),n=uh(f,"key",void 0),h=uh(f,"index",void 0),t.isRexSizer||(a=uh(f,"minWidth",void 0),o=uh(f,"minHeight",void 0)),l=uh(f,"fitRatio",0),d=uh(f,"offsetX",0),c=uh(f,"offsetY",0),u=uh(f,"offsetOriginX",0),p=uh(f,"offsetOriginY",0)}return"string"==typeof i&&(i=Yt[i]),void 0===e&&(e=v?1:0),void 0===i&&(i=ph),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(v?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(v?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),(f=this.getSizerConfig(t)).proportion=e,f.align=i,f.padding=ge(s),f.expand=r,f.fitRatio=0===e?l:0,f.alignOffsetX=d,f.alignOffsetY=c,f.alignOffsetOriginX=u,f.alignOffsetOriginY=p,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},fh={add:gh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),gh.call(this,new lh(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return ch(i)&&(i.index=t),gh.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=dh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const mh=Et.prototype.clear;var yh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),mh.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,yh.call(this,t),this}},Sh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=Yt[e]),this.getSizerConfig(t).align=e,this}},wh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},Ch={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},Oh={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},Ph={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Ne(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Ie.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d,c,u=this.sizerChildren,p=this.innerLeft,v=this.innerTop,g=this.innerWidth,f=this.innerHeight,m=p,y=v,b=this.startChildIndex,x=0,S=u.length;x0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Xe.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Ae.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&ah.call(this,t,void 0),Ye.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Be.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&ah.call(this,void 0,t),We.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(Ph,fh,xh,Sh,wh,Ch,Oh);var _h=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},Th={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},kh=function(t){return"string"==typeof t&&(t=Th[t]),t};const Eh=Phaser.Utils.Objects.IsPlainObject,Mh=Phaser.Utils.Objects.GetValue;class Rh extends rh{constructor(t,e,i,s,r,n,h){Eh(e)?(e=Mh(h=e,"x",0),i=Mh(h,"y",0),s=Mh(h,"width",void 0),r=Mh(h,"height",void 0),n=Mh(h,"orientation",0)):Eh(s)?(s=Mh(h=s,"width",void 0),r=Mh(h,"height",void 0),n=Mh(h,"orientation",0)):Eh(n)&&(n=Mh(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Mh(h,"space.item",0)),this.setStartChildIndex(Mh(h,"startChildIndex",0)),this.setRTL(Mh(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=kh(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=_h.call(this)),this._childrenProportion}}Object.assign(Rh.prototype,Ph);var Lh=function(t,e,i,s){if(void 0===i)i=0;else{var r=typeof i;"boolean"===r?(s=i,i=0):"string"===r&&(i=Dh[i])}void 0===s?s={}:!0===s&&(s=zh);var n=e.width/t.width,h=e.height/t.height,a=i?Math.max(n,h):Math.min(n,h);return s.width=t.width*a,s.height=t.height*a,s};const Dh={fit:0,FIT:0,envelop:1,ENVELOP:1};var zh={},Ah={},Yh={};const Xh=Phaser.Utils.Objects.IsPlainObject,Bh=Phaser.Utils.Objects.GetValue,Wh=Phaser.Display.Align.CENTER,jh=Phaser.Utils.String.UUID;var Ih={add:function(t,e,i,s,r,n,h,a,o,l){var d,c;me.call(this,t),Xh(e)&&(e=Bh(u=e,"key",void 0),i=Bh(u,"align",Wh),s=Bh(u,"padding",0),r=Bh(u,"expand",!0),t.isRexSizer||(n=Bh(u,"minWidth",t._minWidth),h=Bh(u,"minHeight",t._minHeighted)),a=Bh(u,"offsetX",0),o=Bh(u,"offsetY",0),d=Bh(u,"offsetOriginX",0),c=Bh(u,"offsetOriginY",0),l=Bh(u,"aspectRatio",0));var u,p=void 0!==e;return p||(e=jh()),"string"==typeof i&&(i=Yt[i]),void 0===i&&(i=Wh),void 0===s&&(s=0),void 0===r&&(r=!0),t.isRexSizer||(void 0===n&&(n=t._minWidth),void 0===h&&(h=t._minHeight)),void 0===a&&(a=0),void 0===o&&(o=0),void 0===d&&(d=0),void 0===c&&(c=0),void 0===l?l=0:!0===l&&(l=Q(t)/tt(t)),l>0&&(r=!0,void 0===n&&(n=0),void 0===h&&(h=0)),(u=this.getSizerConfig(t)).align=i,u.padding=ge(s),Xh(r)?(u.expandWidth=Bh(r,"width",!1),u.expandHeight=Bh(r,"height",!1)):(u.expandWidth=r,u.expandHeight=r),t.isRexSizer||(u.expandWidth&&(t.minWidth=void 0===n?Q(t):n),u.expandHeight&&(t.minHeight=void 0===h?tt(t):h)),u.alignOffsetX=a,u.alignOffsetY=o,u.alignOffsetOriginX=d,u.alignOffsetOriginY=c,u.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,p&&this.addChildrenMap(e,t),this}},Fh={remove(t,e){var i;if("string"==typeof t){if(i=t,!(t=this.sizerChildren[i]))return this}else{if(this.getParentSizer(t)!==this)return this;i=this.childToKey(t)}return i&&(delete this.sizerChildren[i],this.childrenMap.hasOwnProperty(i)&&delete this.childrenMap[i]),Oe.call(this,t,e),this},removeAll(t){for(var e in this.sizerChildren)this.remove(e,t);return this},clear(t){for(var e in this.sizerChildren)delete this.sizerChildren[e],this.childrenMap.hasOwnProperty(e)&&delete this.childrenMap[e];return yh.call(this,t),this}},Hh={getChildrenWidth:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var h in r)t=r[h],void 0===(i=this.getChildWidth(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).left+e.right)*this.scaleX,s=Math.max(i,s));return n?void 0:s+(this.space.left+this.space.right)*this.scaleX},getChildrenHeight:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var h in r)t=r[h],void 0===(i=this.getChildHeight(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).top+e.bottom)*this.scaleY,s=Math.max(i,s));return n?void 0:s+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(s.expandWidth){var r=e-(this.space.left+this.space.right)*this.scaleX,n=s.padding;i=r-(n.left+n.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(s.expandHeight){var r=e-(this.space.top+this.space.bottom)*this.scaleY,n=s.padding;i=r-(n.top+n.bottom)*this.scaleY}return i},getChildrenSizers:function(t){void 0===t&&(t=[]);var e,i=this.sizerChildren;for(var s in i)(e=i[s]).isRexSizer&&t.push(e);return t},layoutChildren:function(){var t,e,i,s,r,n,h,a,o,l,d,c,u=this.innerLeft,p=this.innerTop,v=this.innerWidth,g=this.innerHeight,f=this.sizerChildren;for(var m in f)(t=f[m]).rexSizer.hidden||(i=(e=t.rexSizer).padding,mr.call(this,t),l=this.getExpandedChildWidth(t),d=this.getExpandedChildHeight(t),e.aspectRatio>0&&(Ah.width=e.aspectRatio,Ah.height=1,Yh.width=l,Yh.height=d,l=(c=Lh(Ah,Yh,"FIT",!0)).width,d=c.height),t.isRexSizer?(t.runLayout(this,l,d),nh(t,this)):Ne(t,l,d),s=u+i.left*this.scaleX,n=v-(i.left+i.right)*this.scaleX,r=p+i.top*this.scaleY,h=g-(i.top+i.bottom)*this.scaleY,void 0===l&&(l=Q(t)),void 0===d&&(d=tt(t)),a=(e.alignOffsetX+e.alignOffsetOriginX*l)*this.scaleX,o=(e.alignOffsetY+e.alignOffsetOriginY*d)*this.scaleY,yr.call(this,t,s,r,n,h,e.align,a,o))}};Object.assign(Hh,Ih,Fh);const Nh=Phaser.Utils.Objects.IsPlainObject,Gh=Phaser.Utils.Objects.GetValue;class Vh extends rh{constructor(t,e,i,s,r,n){Nh(e)?(e=Gh(n=e,"x",0),i=Gh(n,"y",0),s=Gh(n,"width",void 0),r=Gh(n,"height",void 0)):Nh(s)&&(s=Gh(n=s,"width",void 0),r=Gh(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexOverlapSizer",this.sizerChildren={},this.addChildrenMap("items",this.sizerChildren)}childToKey(t){if("string"!=typeof t)return function(t,e){if(Array.isArray(t))return t.indexOf(e);for(var i in t)if(t[i]===e)return i;return null}(this.sizerChildren,t);var e=t;return this.sizerChildren.hasOwnPropery(e)?e:null}}Object.assign(Vh.prototype,Hh);const Uh=Rh.prototype.add,$h=Rh.prototype.addSpace;var Jh=function(t){var e=!t.isRexSpace,i=!e||this.buttonsExpand?1:0;if(0===this.sizerChildren.length)if(e){!this.buttonsExpand&&("right"===this.buttonsAlign||"center"===this.buttonsAlign||"bottom"===this.buttonsAlign)&&$h.call(this),Uh.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&$h.call(this),this.hasTailSpace=s}else Uh.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;Uh.call(this,t,{index:r,proportion:i,expand:!0})}else Uh.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},Kh={addButton(t){if(ur(t))for(var e=t,i=0,s=e.length;i=0;i--)Qh.call(this,e[i],t);return this}},ea=function(t,e,i){if(t){var s=this.setValueCallback,r=this.setValueCallbackScope;s&&(r?s.call(r,t,e,i):s(t,e,i)),this.fireEvent("button.statechange",t,e,i)}},ia=function(t){var e=this;t._selected=void 0,Object.defineProperty(t,"selected",{get:function(){return t._selected},set:function(i){if(t._selected!==i){var s=t._selected;t._selected=i,ea.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},sa={add(t){return this.buttons.push(t),t._click||(t._click=new wr(t,this.clickConfig),t._click.on("click",(function(t,e,i,s){this.fireEvent("button.click",e,i,s)}),this).on("enable",(function(t,e){this.fireEvent("button.enable",e)}),this).on("disable",(function(t,e){this.fireEvent("button.disable",e)}),this).on("over",(function(t,e,i,s){this.fireEvent("button.over",e,i,s)}),this).on("out",(function(t,e,i,s){this.fireEvent("button.out",e,i,s)}),this).on("down",(function(t,e,i,s){this.fireEvent("button.down",e,i,s)}),this).on("up",(function(t,e,i,s){this.fireEvent("button.up",e,i,s)}),this),t.isRexContainerLite&&t.sendChildToBack(t)),this.buttonsType&&(void 0===t.name&&console.error(`${this.parent.constructor.name}: Option button miss value`),ia.call(this,t)),this},addMultiple(t){for(var e=0,i=t.length;e0},setButtonEnable(t,e){var i=this.buttons;if(void 0===t||"boolean"==typeof t){e=t;for(var s=0,r=i.length;sa.height/2)){r>(o=ma(a.left,a.centerY,t,e))&&(r=o,s=n);var o,l=i[n+1];l&&l.y===a.y||r>(o=ma(a.right,a.centerY,t,e))&&(r=o,s=n+1)}}return s};const ba=Phaser.Utils.Objects.IsPlainObject,xa=Phaser.Utils.Objects.GetValue,Sa=Phaser.Display.Align.CENTER;var wa=function(t,e,i,s){return"\n"===t?(this.addNewLine(),this):(me.call(this,t),ba(e)&&(e=xa(o=e,"padding",0),i=xa(o,"key",void 0),s=xa(o,"index",void 0),r=xa(o,"offsetX",0),n=xa(o,"offsetY",0),h=xa(o,"offsetOriginX",0),a=xa(o,"offsetOriginY",0)),void 0===e&&(e=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===h&&(h=0),void 0===a&&(a=0),(o=this.getSizerConfig(t)).align=Sa,o.padding=ge(e),o.alignOffsetX=r,o.alignOffsetY=n,o.alignOffsetOriginX=h,o.alignOffsetOriginY=a,void 0===s||s>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(s,0,t),void 0!==i&&this.addChildrenMap(i,t),this);var r,n,h,a,o},Ca={add(t,e,i){if(ur(t))for(var s=t,r=0,n=s.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,yh.call(this,t),this}},_a={getChildrenWidth:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=0===this.orientation&&t?this.maxChildWidth:this.rexSizer.resolved?this.wrapResult.width:void 0)?e+(this.space.left+this.space.right)*this.scaleX:void 0);var e},getChildrenHeight:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=1===this.orientation&&t?this.maxChildHeight:this.rexSizer.resolved?this.wrapResult.height:void 0)?e+(this.space.top+this.space.bottom)*this.scaleY:void 0);var e},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;sr&&Da.addNewLine(this)}else for(n=0,h=t.length;n=0;i--)Ba.call(this,e[i],t);return this}};const ja=Phaser.Utils.Objects.GetValue;class Ia extends Ra{constructor(t,e){void 0===e&&(e={});var i=e.space;"number"==typeof i&&(e.space={item:i,line:i}),super(t,e),this.type="rexFixWidthButtons",this.buttonGroup=new da({parent:this,eventEmitter:ja(e,"eventEmitter",this),groupName:ja(e,"groupName",void 0),clickConfig:ja(e,"click",void 0)}).setButtonsType(e);var s=ja(e,"background",void 0),r=ja(e,"buttons",void 0);this.buttonsAlign=ja(e,"align",void 0),s&&this.addBackground(s),r&&this.addButtons(r),this.addChildrenMap("background",s),this.addChildrenMap("buttons",this.buttonGroup.buttons)}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.buttonGroup.destroy(),this.buttonGroup=void 0)}get buttons(){return this.buttonGroup.buttons}get groupName(){return this.buttonGroup.groupName}set groupName(t){this.buttonGroup.groupName=t}get eventEmitter(){return this.buttonGroup.eventEmitter}}Object.assign(Ia.prototype,Aa,Wa,la,ua);var Fa=function(){return Array.prototype.reduce.call(arguments,Ha,0)},Ha=function(t,e){return t+e};const Na=Phaser.Utils.Objects.IsPlainObject,Ga=Phaser.Utils.Objects.GetValue,Va=Phaser.Display.Align.CENTER;var Ua=function(t,e,i,s,r){if("number"==typeof t||"number"==typeof e){if(void 0===t){for(var n=0;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return Ja(this.sizerChildren,null),yh.call(this,t),this}},qa={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)Ja(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},eo={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Xe.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,Ja(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Ja(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},so=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const ro=Phaser.Utils.Objects.IsPlainObject,no=Phaser.Utils.Objects.GetValue;class ho extends rh{constructor(t,e,i,s,r,n,h,a,o,l){ro(e)?(e=no(l=e,"x",0),i=no(l,"y",0),s=no(l,"width",void 0),r=no(l,"height",void 0),n=no(l,"column",l.col||0),h=no(l,"row",0),a=no(l,"columnProportions",0),o=no(l,"rowProportions",0)):ro(s)?(s=no(l=s,"width",void 0),r=no(l,"height",void 0),n=no(l,"column",l.col||0),h=no(l,"row",0),a=no(l,"columnProportions",0),o=no(l,"rowProportions",0)):ro(n)?(n=no(l=n,"column",l.col||0),h=no(l,"row",0),a=no(l,"columnProportions",0),o=no(l,"rowProportions",0)):ro(a)&&(a=no(l=a,"columnProportions",0),o=no(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(no(l,"createCellContainerCallback")),this.setIndentLeft(no(l,"space.indentLeftOdd",0),no(l,"space.indentLeftEven",0)),this.setIndentTop(no(l,"space.indentTopOdd",0),no(l,"space.indentTopEven",0)),this.resetGrid(n,h,a,o,no(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=io.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=so.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(ho.prototype,eo);const ao=ho.prototype.add;var oo={addButton(t,e,i){return ao.call(this,t,e,i,void 0,0,this.buttonsExpand),this.buttonGroup.add(t),this},addButtons(t,e){for(var i=0,s=t;i=0;i--)uo.call(this,e[i],t);return this}};const vo=Phaser.Utils.Objects.GetValue;class go extends ho{constructor(t,e){void 0===e&&(e={});var i=vo(e,"row",0),s=vo(e,"column",e.col||0),r=vo(e,"createCellContainerCallback"),n=vo(e,"buttons",void 0),h=vo(e,"expand",!0),a=h?1:0;if(r&&(e.createCellContainerCallback=void 0),void 0!==n){i=Math.max(i,n.length);for(var o=0,l=n.length;o0&&r.push(o.join("")),r},Uo=0,$o=1,Jo=2,Ko=0,qo=1,Zo=2,Qo=/(?:\r\n|\r|\n)/;const tl={none:Ko,word:qo,char:Zo,character:Zo,mix:3},el=Phaser.Renderer.WebGL.Utils;var il={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,h=r.height,a=el.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,h,e.x,e.y,n/e.resolution,h/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,h,a(e.tintTopLeft,i.alpha*e._alphaTL),a(e.tintTopRight,i.alpha*e._alphaTR),a(e.tintBottomLeft,i.alpha*e._alphaBL),a(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const sl=Phaser.Display.Color;var rl={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,h,a,o,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===h&&(h=0),void 0===a&&(a=0),void 0===o&&(o=c),void 0===l&&(l=u);var p=d.cutX+h,v=d.cutY+a;return this.context.drawImage(d.source.image,p,v,o,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new sl);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var h=i;i=h.red,s=h.green,r=h.blue,n=h.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var a=this.context.createImageData(1,1);return a.data[0]=i,a.data[1]=s,a.data[2]=r,a.data[3]=n,this.context.putImageData(a,t,e),this.dirty=!0,this}},nl=function(t,e,i,s,r,n,h){var a,o=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===h&&(h=e.height);var d=(a=o.exists(i)?o.get(i):o.createCanvas(i,n,h)).getSourceImage();d.width!==n&&(d.width=n),d.height!==h&&(d.height=h);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,h),c.drawImage(e,s,r,n,h),l.gl&&a&&l.canvasToTexture(d,a.source[0].glTexture,!0,0)},hl={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,nl(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};e();const al=Phaser.Display.Canvas.CanvasPool,ol=Phaser.GameObjects.GameObject,ll=Phaser.Utils.String.UUID;class dl extends ol{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=al.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=ll(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){al.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}}const cl=Phaser.GameObjects.Components;Phaser.Class.mixin(dl,[cl.Alpha,cl.BlendMode,cl.Crop,cl.Depth,cl.Flip,cl.GetBounds,cl.Mask,cl.Origin,cl.Pipeline,cl.PostPipeline,cl.ScrollFactor,cl.Tint,cl.Transform,cl.Visible,il,rl,hl]);var ul={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:Es(this.data,t,e)},incData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)+e),this},mulData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)*e),this},clearData(){return this.data&&ft(this.data),this}};class pl{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}}Object.assign(pl.prototype,ul);var vl={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const gl=Phaser.Math.RotateAround;var fl;const ml=Phaser.Geom.Rectangle;var yl,bl=function(t){void 0===yl&&(yl=new ml);var e=t.drawTLX,i=t.drawTLY;return yl.setTo(e,i,t.drawTRX-e,t.drawBLY-i),yl};const xl=Phaser.Math.RotateAround;var Sl,wl=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Sl&&(Sl={}),s=Sl),s.x=e,s.y=i,0!==t.rotation&&xl(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const Cl=Phaser.GameObjects.Components.TransformMatrix;var Ol,Pl,_l={},Tl=function(t,e,i,s,r){var n=wl(e,i,s,!0),h=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=_l);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===Ol&&(Ol=new Cl,Pl=new Cl),t.parentContainer?t.getWorldTransformMatrix(Ol,Pl):Ol.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),Ol.transformPoint(r,n,s),s}(t,n.x,n.y,r);return h},kl=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,h=e.drawCenterY+s;return Tl(t,e,n,h,r)},El={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===fl&&(fl={}),s=fl),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&gl(s,0,0,-i.rotation),s}(t,e,this,!0);return bl(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return kl(this.parent,this,t,e,i)}};Object.assign(El,vl);const Ml=Phaser.Math.DegToRad,Rl=Phaser.Math.RadToDeg,Ll=Phaser.Utils.Objects.GetValue;class Dl extends pl{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return Rl(this._rotation)}set angle(t){this.rotation=Ml(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=Ll(t,"width",void 0),i=Ll(t,"height",void 0),s=Ll(t,"scaleX",void 0),r=Ll(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(Dl.prototype,El);const zl=Phaser.Utils.String.Pad;var Al=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${zl(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},Yl=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Xl=Phaser.Utils.Objects.GetValue;let Bl=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=Xl(t,"x",0),i=Xl(t,"y",0));var s=this.cornerRadius;s.tl=Wl(Xl(t,"tl",void 0),e,i),s.tr=Wl(Xl(t,"tr",void 0),e,i),s.bl=Wl(Xl(t,"bl",void 0),e,i),s.br=Wl(Xl(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){jl(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){jl(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){jl(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){jl(this.cornerRadius.br,t)}};var Wl=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Il(t),t},jl=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Xl(e,"x",0),t.y=Xl(e,"y",0)),Il(t)},Il=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const Fl=Phaser.Math.DegToRad;var Hl=function(t){return!t.hasOwnProperty("convex")||t.convex},Nl=function(t){return t.x>0&&t.y>0},Gl=function(t,e,i,s,r,n,h,a,o){if(a&&h>n?h-=360:!a&&h=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=m.tl,Nl(a)?(o=a.x*g,l=a.y*f,Hl(a)?Gl(t,o,l,o,l,180,270,!1,h):Gl(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,Nl(a)?(o=a.x*g,l=a.y*f,Hl(a)?Gl(t,s-o,l,o,l,270,360,!1,h):Gl(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,Nl(a)?(o=a.x*g,l=a.y*f,Hl(a)?Gl(t,s-o,r-l,o,l,0,90,!1,h):Gl(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,Nl(a)?(o=a.x*g,l=a.y*f,Hl(a)?Gl(t,o,r-l,o,l,90,180,!1,h):Gl(t,0,r,o,l,360,270,!0,h)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,h,u),null!=a)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,a),p.addColorStop(1,d),a=p),e.fillStyle=a,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())},Ul=function(t,e,i,s,r,n,h,a){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),Vl(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}};const $l=Phaser.Utils.Objects.GetValue;class Jl extends Dl{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor($l(e,"color",null),$l(e,"color2",null),$l(e,"horizontalGradient",!0)),this.setStroke($l(e,"stroke",null),$l(e,"strokeThickness",2)),this.setCornerRadius($l(e,"cornerRadius",0),$l(e,"cornerIteration",null))}set color(t){t=Al(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Al(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Al(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,Yl("color2",t,this),Yl("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Yl("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Yl("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){Ul(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Kl=Phaser.Utils.Objects.GetValue;class ql extends Dl{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(Kl(e,"color",null),Kl(e,"color2",null),Kl(e,"horizontalGradient",!0)),this.setStroke(Kl(e,"stroke",null),Kl(e,"strokeThickness",2))}set color(t){t=Al(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Al(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Al(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,Kl(t,"color2",null),Kl(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Kl(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,h=this.parent.height-i.top-i.bottom,a=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?a.createLinearGradient(0,0,n,0):a.createLinearGradient(0,0,0,h)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,a.fillStyle=t,a.fillRect(s,r,n,h));null!=this.stroke&&this.strokeThickness>0&&(a.strokeStyle=this.stroke,a.lineWidth=this.strokeThickness,a.strokeRect(s,r,n,h))}}const Zl=Phaser.Utils.Objects.GetValue;let Ql=class t{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(Zl(t,"bold",!1)),this.setItalic(Zl(t,"italic",!1)),this.setFontSize(Zl(t,"fontSize","16px")),this.setFontFamily(Zl(t,"fontFamily","Courier")),this.setColor(Zl(t,"color","#fff")),this.setStrokeStyle(Zl(t,"stroke",null),Zl(t,"strokeThickness",0)),this.setShadow(Zl(t,"shadowColor",null),Zl(t,"shadowOffsetX",0),Zl(t,"shadowOffsetY",0),Zl(t,"shadowBlur",0)),this.setOffset(Zl(t,"offsetX",0),Zl(t,"offsetY",0)),this.setSpace(Zl(t,"leftSpace",0),Zl(t,"rightSpace",0)),this.setAlign(Zl(t,"align",void 0)),this.setBackgroundColor(Zl(t,"backgroundColor",null)),this.setBackgroundHeight(Zl(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Zl(t,"backgroundBottomY",void 0)),this.setBackgroundLeftX(Zl(t,"backgroundLeftX",0)),this.setBackgroundRightX(Zl(t,"backgroundRightX",0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(Yl("stroke",t,this),Yl("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Yl("shadowOffsetX",t,this),Yl("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),t.hasOwnProperty("backgroundLeftX")&&this.setBackgroundLeftX(t.backgroundLeftX),t.hasOwnProperty("backgroundRightX")&&this.setBackgroundRightX(t.backgroundRightX),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new t(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=Al(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=Al(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=Al(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=Al(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setBackgroundLeftX(t){return this.backgroundLeftX=t,this}setBackgroundRightX(t){return this.backgroundRightX=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}};const td=Phaser.Utils.Array.Remove,ed=Phaser.Utils.Array.Remove,id="text",sd="image",rd="drawer",nd="space",hd="command";var ad=function(t){return t.type===id&&"\n"===t.text},od=function(t){return t.type===id&&"\f"===t.text},ld=function(t){return t.type===id};class dd extends Dl{constructor(t,e,i){super(t,id),this.updateTextFlag=!1,this.style=new Ql(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX+e.backgroundLeftX,s=i,r=this.drawTRX+e.backgroundRightX-i+1;if(r>0){var n=e.backgroundBottomY;null==n&&(n=this.drawBLY);var h=e.backgroundHeight;null==h&&(h=n-this.drawTLY);var a=n-h;t.fillRect(s,a,r,h)}}var o=e.hasFill,l=e.hasStroke;(o||l)&&(e.syncFont(t).syncStyle(t),l&&(e.syncShadow(t),t.strokeText(this.text,0,0)),o&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var cd=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const ud=Phaser.Display.Canvas.CanvasPool;var pd=function(t,e,i,s,r,n,h,a){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===a&&(a=!1),a&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(h){var l=ud.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=h,d.fillRect(0,0,r,n),o.drawImage(l,0,0,r,n,i,s,r,n),ud.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)};Phaser.Display.Canvas.CanvasPool;class vd extends Dl{constructor(t,e,i){super(t,sd),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){pd(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class gd extends Dl{constructor(t,e,i,s){super(t,rd),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class fd extends Dl{constructor(t,e){super(t,nd),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class md extends pl{constructor(t,e,i,s,r){super(t,hd),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}function yd(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>yd(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=yd(t[i]));return e}var bd=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const xd={none:0,word:1,char:2,character:2,mix:3};var Sd=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,h=!r&&!n,a=t.length,o=e,l=s.word,d=0,c=!1;o0&&!a){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=Pd.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=Pd.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=Td(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=Td(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=Td(t,"wrapMode");void 0===c&&(c=Td(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=xd[c]);var u=Td(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=Td(t,"letterSpacing",0),v=Td(t,"hAlign",0),g=Td(t,"vAlign",0),f=Td(t,"justifyPercentage",.25),m=bd({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:h,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,b=0,x=y.length;b0&&(E.push({children:M,width:R}),L=Math.max(L,R)),m.start+=k.length,m.isLastPage=!D&&m.start===T,m.maxLineWidth=L,m.linesHeight=E.length*n;var j=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,I=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,h=t.vAlign,a=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(h=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=Md(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=Md(t,"maxLines",0);var a=0===i,o=Md(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=Md(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=Md(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=Md(t,"letterSpacing",0),p=Md(t,"rtl",!0),v=Md(t,"hAlign",p?2:0),g=Md(t,"vAlign",0),f=bd({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:o,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(k.push({children:E,height:M}),R=Math.max(R,M)),f.start+=T.length,f.isLastPage=f.start===_,f.maxLineHeight=R,f.linesWidth=k.length*n;var X=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,B=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,h=t.vAlign,a=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}a&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,h=i.bottom;return Le(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return Re(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),td(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return ed(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(id);return null===i?i=new dd(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),kl(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const ec=Phaser.Utils.Objects.GetFastValue;var ic={};class sc{constructor(t){this.pools=ec(t,"pools",ic)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new tc),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;ei&&(r=Math.floor(i));for(var n={},h=cc(t,r,e,i,n),a=0;a<=oc&&0!==h;a++){if((r+=h)<0){r=0;break}h=cc(t,r,e,i,n)}return a===oc&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),uc(t,e,i),t},dc=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},cc=function(t,e,i,s,r){var n,h=dc(t,e,r),a=dc(t,e+1,r);if(void 0!==s)if(h.height<=s&&a.height>s)n=0;else{if(h.height>s)return-1;n=Math.floor(s-h.height)}if(h.width<=i&&a.width>i)return 0;if(h.width>i)return-1;var o=Math.floor(i-h.width);return void 0===n?o:Math.min(o,n)},uc=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const pc=Phaser.Utils.Objects.GetValue,vc=Phaser.Utils.Objects.GetValue;class gc extends To{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=vc(e,"background",void 0),r=vc(e,"icon",void 0),n=vc(e,"iconMask",void 0),h=vc(e,"text",void 0),a=vc(e,"action",void 0),o=vc(e,"actionMask",void 0),l=vc(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(h||a)&&(i={right:vc(e,"space.icon",0),top:vc(e,"space.iconTop",0),bottom:vc(e,"space.iconBottom",0),left:vc(e,"space.iconLeft",0)}):(h||a)&&(i={bottom:vc(e,"space.icon",0),left:vc(e,"space.iconLeft",0),right:vc(e,"space.iconRight",0),top:vc(e,"space.iconTop",0)});var d=vc(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=Xo.call(this,r,r,1)),!d){var c=vc(e,"iconSize",void 0);this.setIconSize(vc(e,"iconWidth",c),vc(e,"iconHeight",c))}}if(h){var u=vc(e,"wrapText",!1),p=vc(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),function(t,e){switch(Fo(t)){case 0:switch("string"==typeof e&&(e=tl[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=Go;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=tl[e]||0),t.style.wrapMode=e}}(h,u),e.expandTextWidth=!0,ac(h)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=pc(e,"minWidth",0),s=pc(e,"minHeight",0),r=pc(e,"fitHeight",!1);t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return lc(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),lc(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t})}(h,{fitHeight:!0}));var v,g,f=vc(e,"space.text",0),m=vc(e,"expandTextWidth",!1),y=vc(e,"expandTextHeight",!1);0===this.orientation?(v=m?1:0,a&&(i={right:f}),g=y):(v=y?1:0,a&&(i={bottom:f}),g=m),this.add(h,{proportion:v,expand:g,padding:i})}if(a&&(i=0===this.orientation?{top:vc(e,"space.actionTop",0),bottom:vc(e,"space.actionBottom",0),right:vc(e,"space.actionRight",0)}:{left:vc(e,"space.actionLeft",0),right:vc(e,"space.actionRight",0),bottom:vc(e,"space.actionBottom",0)},d=vc(e,"squareFitAction",!1)?1:0,this.add(a,{proportion:0,padding:i,fitRatio:d}),o&&(o=Xo.call(this,a,a,1)),!d)){var b=vc(e,"actionSize");this.setActionSize(vc(e,"actionWidth",b),vc(e,"actionHeight",b))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",h),this.addChildrenMap("action",a),this.addChildrenMap("actionMask",o)}}var fc=Phaser.Renderer.WebGL.Utils,mc=function(t,e,i,s,r,n){for(var h=fc.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),a=i.pathData,o=i.pathIndexes,l=0;l>>16,a=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+h+","+a+","+o+","+n+")"},wc=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,h=(16711680&r)>>>16,a=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+h+","+a+","+o+","+n+")",t.lineWidth=e.lineWidth};const Cc=Phaser.Renderer.Canvas.SetTransform;var Oc={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=xc(e,i,s),h=r.calcMatrix.copyFrom(n.calc),a=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&mc(r,h,e,l,a,o),e.isStroked&&bc(r,e,l,a,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(Cc(t,r,e,i,s)){var n=e._displayOriginX,h=e._displayOriginY,a=e.pathData,o=a.length-1,l=a[0]-n,d=a[1]-h;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(_c.prototype,Oc);var Tc=function(t){return t.x>0&&t.y>0},kc=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const Ec=Phaser.Math.DegToRad;var Mc=function(t,e,i,s,r,n,h,a,o){h&&n>r?n-=360:!h&&n0,h=0,a=e.length;h=0?t.startAt(h+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(h+n,i):t.startAt(h,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(h,i),t.close(),t};const Eu=Phaser.Utils.Objects.GetValue,Mu=Phaser.Utils.Objects.IsPlainObject;class Ru extends(iu($c)){constructor(t,e,i,s,r,n,h,a){Mu(e)?(e=(a=e).x,i=a.y,s=a.width,r=a.height,n=a.barColor,h=a.value):Mu(s)?(s=(a=s).width,r=a.height,n=a.barColor,h=a.value):Mu(n)&&(n=(a=n).barColor,h=a.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===h&&(h=0),super(t,e,i,s,r,a),this.type="rexLineProgress",this.bootProgressBase(a),this.addShape((new Tu).setName("trackFill")).addShape((new Tu).setName("bar")).addShape((new Tu).setName("trackStroke")),this.setTrackColor(Eu(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(Eu(a,"trackStrokeThickness",2),Eu(a,"trackStrokeColor",void 0)),this.setSkewX(Eu(a,"skewX",0)),this.setRTL(Eu(a,"rtl",!1)),this.setValue(h)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var Lu={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&ku(s,0,0,e,i,t);var r,n,h=this.getShape("bar");h.fillStyle(this.barColor),h.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),ku(h,r,0,n,i,t));var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&ku(a,0,0,e,i,t)}};Object.assign(Ru.prototype,Lu);var Du=function(t){return null==t||""===t||0===t.length},zu=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(Du(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(Du(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,h=e.length;n=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=yd(i),s=yd(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),h=n.width,a=0,o=0,l=i.length;o0?h/a:0,c=n.height,u=0;for(o=0,l=s.length;o0?0:g,b=0,o=0;for(var C=i.length;o0?0:f),f>=1&&g>=1){var O=typeof(m=this.getFrameNameCallback(o,S,e));"string"!==O&&"number"!==O||r.add(m,0,b+n.cutX,x+n.cutY,f,g)}b+=f}x+=g}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,h,a,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/o,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(u,p);if(u>v){var g=(u-v)*o;d>=0?d+=g:d=g,u=v}if(p>v){var f=(p-v)*l;c>=0?c+=f:c=f,p=v}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,x=this.rows.count;b0&&a>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(S,b)?0:1)?this._drawImage(this.textureKey,s,m,y,h,a):this._drawTileSprite(this.textureKey,s,m,y,h,a)),m+=h;y+=a}this._endDraw()},setStretchMode:function(t){return Zu(t)?(this.stretchMode.edge=tp(Qu(t,"edge",0)),this.stretchMode.internal=tp(Qu(t,"internal",0))):(t=tp(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return ip.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const rp=Phaser.Utils.Objects.IsPlainObject,np=Phaser.Utils.Objects.GetValue,hp=Phaser.GameObjects;var ap=void 0,op=function(t,e){if(ap||(ap={},ti(t).events.once("destroy",(function(){for(var t in ap)ap[t].destroy();ap=void 0}))),!ap.hasOwnProperty(e)){var i=ti(t).scene.systemScene;(t=new hp[e](i)).setOrigin(0),ap[e]=t}return ap[e]};const lp=Phaser.GameObjects.RenderTexture;class dp extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if(rp(i)?(i=np(d=i,"x",0),s=np(d,"y",0),r=np(d,"width",1),n=np(d,"height",1),h=np(d,"key",void 0),a=np(d,"baseFrame",void 0),o=np(d,"columns",void 0),l=np(d,"rows",void 0)):rp(r)?(r=np(d=r,"width",1),n=np(d,"height",1),h=np(d,"key",void 0),a=np(d,"baseFrame",void 0),o=np(d,"columns",void 0),l=np(d,"rows",void 0)):rp(h)?(h=np(d=h,"key",void 0),a=np(d,"baseFrame",void 0),o=np(d,"columns",void 0),l=np(d,"rows",void 0)):rp(a)?(a=np(d=a,"baseFrame",void 0),o=np(d,"columns",void 0),l=np(d,"rows",void 0)):Array.isArray(a)?(d=l,l=o,o=a,a=np(d,"baseFrame",void 0)):rp(o)&&(o=np(d=o,"columns",void 0),l=np(d,"rows",void 0)),void 0===a&&(a=np(d,"frame",void 0)),void 0===o){var c=np(d,"leftWidth",void 0),u=np(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=np(d,"topHeight",void 0),v=np(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(np(d,"getFrameNameCallback",void 0)),this.setStretchMode(np(d,"stretchMode",0)),this.setPreserveRatio(np(d,"preserveRatio",!0));var g=np(d,"maxFixedPartScale",1),f=np(d,"maxFixedPartScaleX",g),m=np(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(h,a,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,sp),i}(lp,"rexNinePatch")){}var cp={_drawImage:function(t,e,i,s,r,n){var h=op(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=op(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(dp.prototype,cp);let up=class extends ii{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Xu(t,e))return t[e];var i=t.parent;return Xu(i,e)?i[e]:void 0}set(t,e,i){return Xu(t,e)?t[e]=i:Xu(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}};const pp=Phaser.Utils.Objects.GetValue;class vp extends dp{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=pp(e,"effects",!0);i&&Fu(this,i),this.style=new up(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(vp.prototype,jc);const gp=["alpha","tint","flipX","flipY"];var fp=function(t,e){if(!e)return t;for(var i=0,s=gp.length;i * @copyright 2018 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */const Tp=Phaser.Display.Canvas.CanvasPool;var kp=function(t){var e=Tp.create(this),i=e.getContext("2d",{willReadFrequently:!0});t.syncFont(e,i);var s=i.measureText(t.testString);if("actualBoundingBoxAscent"in s){var r=s.actualBoundingBoxAscent,n=s.actualBoundingBoxDescent,h={ascent:r,descent:n,fontSize:r+n};return Tp.remove(e),h}var a=Math.ceil(s.width*t.baselineX),o=a,l=2*o;if(o=o*t.baselineY|0,e.width=a,e.height=l,i.fillStyle="#f00",i.fillRect(0,0,a,l),i.font=t._font,i.textBaseline="alphabetic",i.fillStyle="#000",i.fillText(t.testString,0,o),h={ascent:0,descent:0,fontSize:0},!i.getImageData(0,0,a,l))return h.ascent=o,h.descent=o+6,h.fontSize=h.ascent+h.descent,Tp.remove(e),h;var d,c,u=i.getImageData(0,0,a,l).data,p=u.length,v=4*a,g=0,f=!1;for(d=0;do;d--){for(c=0;c0&&this.wrapMode!==Ko&&0===this.wrapWidth}setStyle(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wordWrap")){var s=t.wordWrap;s.hasOwnProperty("width")&&(t.wrap={mode:"word",width:s.width})}if(t&&t.hasOwnProperty("wrap")){var r=t.wrap;if(r.hasOwnProperty("mode")){var n=r.mode;"string"==typeof n&&(r.mode=tl[n])}else r.hasOwnProperty("width")&&(r.mode=1)}t&&t.rtl&&i&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var h=this.propertyMap;for(var a in h){var o=h[a],l=o[0],d=i?o[1]:this[a],c=o[2];if("wrapCallback"===a||"wrapCallbackScope"===a)this[a]=Mp(t,l,d);else{var u=Ep(t,l,d);c&&(u=c(u)),this[a]=u}}var p=Mp(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var v=Mp(t,"fill",null);null!==v&&(this.color=Al(v));var g=Mp(t,"metrics",!1);return g?this.metrics={ascent:Mp(g,"ascent",0),descent:Mp(g,"descent",0),fontSize:Mp(g,"fontSize",0)}:!e&&this.metrics||(this.metrics=kp(this)),e?this.parent.updateText():this.parent}syncFont(t,e){e.font=this._font}syncStyle(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"}syncShadow(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)}update(t){return t&&(this._font=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim(),this.metrics=kp(this)),this.parent.updateText(t)}buildFont(){var t=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim();return t!==this._font&&(this._font=t),this}setFont(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=Mp(t,"fontFamily","Courier"),this.fontSize=Mp(t,"fontSize","16px"),this.fontStyle=Mp(t,"fontStyle","")),this.update(!0)}setFontFamily(t){return this.fontFamily=t,this.update(!0)}setFontStyle(t){return this.fontStyle=t,this.update(!0)}setFontSize(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}setTestString(t){return this.testString=t,this.update(!0)}setFixedSize(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}setResolution(t){return this.resolution=t,this.update(!1)}setXOffset(t){return this.xOffset=t,this.update(!1)}setBackgroundColor(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=Al(t,this.parent.canvas,this.parent.context),this.backgroundColor2=Al(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=Al(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}setBackgroundCornerRadius(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}setFill(t){return this.color=Al(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=Al(t,this.parent.canvas,this.parent.context),this.update(!1)}setStroke(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=Al(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}setShadow(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===n&&(n=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=Al(i,this.parent.canvas,this.parent.context),this.shadowBlur=s,this.shadowStroke=r,this.shadowFill=n,this.update(!1)}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}setShadowColor(t){return void 0===t&&(t="#000"),this.shadowColor=Al(t,this.parent.canvas,this.parent.context),this.update(!1)}setShadowBlur(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}setShadowStroke(t){return this.shadowStroke=t,this.update(!1)}setShadowFill(t){return this.shadowFill=t,this.update(!1)}setUnderline(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=Al(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}setUnderlineColor(t){return void 0===t&&(t="#000"),this.underlineColor=Al(t,this.parent.canvas,this.parent.context),this.update(!1)}setUnderlineThickness(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}setUnderlineOffset(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}setStrikethrough(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=Al(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}setStrikethroughColor(t){return void 0===t&&(t="#000"),this.strikethroughColor=Al(t,this.parent.canvas,this.parent.context),this.update(!1)}setStrikethroughThickness(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}setStrikethroughOffset(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}setWrapMode(t){return"string"==typeof t&&(t=tl[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}setWrapWidth(t){return this.wrapWidth=t,this.update(!1)}setAlign(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}setHAlign(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}setVAlign(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}setMaxLines(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}getTextMetrics(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}setTextMetrics(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=Mp(e,"fontFamily",this.fontFamily),this.fontSize=Mp(e,"fontSize",this.fontSize),this.fontStyle=Mp(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}get lineHeight(){return this.metrics.fontSize+this.parent.lineSpacing}toJSON(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}destroy(){this.parent=void 0}}var Lp={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var h=this.defaultStyle;this.clear(),Ul(this,h.backgroundColor,h.backgroundStrokeColor,h.backgroundStrokeLineWidth,h.backgroundCornerRadius,h.backgroundColor2,h.backgroundHorizontalGradient,h.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var a,o,l,d,c,u,p=h.halign,v=h.valign,g=h.lineHeight,f=r.lines,m=f.length,y=h.maxLines;y>0&&m>y?(o=y,l="center"===v?Math.floor((m-o)/2):"bottom"===v?m-o:0):(o=m,l=0),d=l+o;var b=this.rtl,x=b?this.parent.width:void 0;u="center"===v?Math.max((s-o*g)/2,0):"bottom"===v?Math.max(s-o*g-2,0):0,u+=e;for(var S=l;S0){var a=this.defaultStyle.metrics,o=i-a.ascent,l=a.fontSize;this.drawRectangle(e,o,t.width,l,h.bgcolor,h)}if(h.underlineThickness>0&&t.width>0){var d=i+h.underlineOffset-h.underlineThickness/2;this.drawLine(e,d,t.width,h.underlineThickness,h.underlineColor,h)}if(t.isTextPen&&(h.buildFont(),h.syncFont(r,n),h.syncStyle(r,n),this.drawText(e,i,t.text,h)),t.isImagePen&&this.drawImage(e,i,t.prop.img,t.prop.color,h),h.strikethroughThickness>0&&t.width>0&&(d=i+h.strikethroughOffset-h.strikethroughThickness/2,this.drawLine(e,d,t.width,h.strikethroughThickness,h.strikethroughColor,h)),n.restore(),t.hasAreaMarker&&t.width>0){var c,u=t.prop.area;if(u)c={key:u};else{var p=t.prop.url;c={key:`url:${p}`,url:p}}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,c)}},clear(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawRectangle(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var h=this.context;h.fillStyle=r,h.fillRect(t,e,i,s)},drawLine(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var h=this.context;n.syncShadow(h,n.shadowStroke);var a=h.lineCap;h.lineCap="butt",h.strokeStyle=r,h.lineWidth=s,h.beginPath(),h.moveTo(t,e),h.lineTo(t+i,e),h.stroke(),h.lineCap=a},drawText(t,e,i,s){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;s.stroke&&"none"!==s.stroke&&s.strokeThickness>0&&(s.syncShadow(r,s.shadowStroke),r.strokeText(i,t,e)),s.color&&"none"!==s.color&&(s.syncShadow(r,s.shadowFill),r.fillText(i,t,e))},drawImage(t,e,i,s,r){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,s,this.autoRound)}};const Dp=Phaser.Utils.Objects.GetValue,zp=Uo,Ap=$o;class Yp{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=Dp(t,"text",""),this.x=Dp(t,"x",0),this.y=Dp(t,"y",0),this.width=Dp(t,"width",0);var e=Dp(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=Dp(t,"newLineMode",0),this.startIndex=Dp(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===Ap&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==zp&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===Ap&&(t+=1),t}get endIndex(){return this.startIndex+this.rawTextLength}get lastX(){return this.x+this.width}get isTextPen(){return""!==this.text}get isImagePen(){return!!this.prop.img}get hasAreaMarker(){return!!this.prop.area||!!this.prop.url}}const Xp=Phaser.Utils.Objects.GetFastValue,Bp=Uo,Wp=Jo;class jp{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=Xp(t,"tagToText",Xt),this.tagToTextScope=Xp(t,"tagToTextScope",void 0)}destroy(){this.clear(),this.tagToText=void 0,this.tagToTextScope=void 0}clear(){for(var t=0,e=this.lines.length;t=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}getLineEndIndex(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,s=!1;for(e=t;e>=0&&!(s=null!=(i=this.lines[e])&&i.length>0);e--);return s?i[i.length-1].endIndex:0}getLineWidth(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}getMaxLineWidth(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,s=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}getLineWidths(){for(var t=[],e=0,i=this.lines.length;e=t&&o<=e||(h=h.substring(t-a,e-a)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,h,l,d):c+=this.tagToText(h,l,d),d=l,!(o>=e)));u++);return c}get length(){return this.lines.length}set length(t){this.clear()}}var Ip={};const Fp=Phaser.Geom.Rectangle;var Hp=new tc;class Np{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&rv(g)){""!==b?h.push(n.getLine(b,x,qp)):0===S&&r>0&&h.push(n.getLine("",0,qp)),h.push(...iv(g,e,tv,s,0,n));var C=h.pop();b=C.text,x=C.width,n.freeLine(C)," "===b&&(b="",x=0)}else(m=x+f)>o?(h.push(n.getLine(b,x,qp)),b=g,x=f,o=s):(b+=g,x=m),S===w-1&&h.push(n.getLine(b,x,l))}return h},sv=function(t,e){var i;switch(e){case Qp:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==hv&&i0&&t>e&&(t=e),t}get linesWidth(){return Math.ceil(this.penManager.getMaxLineWidth())}get linesHeight(){var t=this.displayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}get imageManager(){return this.parent.imageManager}get rtl(){return this.parent.style.rtl}newPenManager(){return new jp({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}get tmpPenManager(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}getPlainText(t,e,i){var s;if(null==t)s=this.penManager.plainText;else{var r=this.parser.splitText(t,1);s="";for(var n=0,h=r.length;n=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const Yg=Phaser.Utils.Objects.GetValue,Xg=Phaser.Math.Distance.Between;class Bg extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=Yg(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(Yg(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(Yg(t,"enable",!0)),this.holdThreshold=Yg(t,"holdThreshold",50),this.pointerOutReleaseEnable=Yg(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return vn(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:Xg(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!cr(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!cr(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const Wg=Phaser.Utils.Objects.GetValue;class jg{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(Wg(t,"value",0)),this.setSpeed(Wg(t,"speed",0)),this.setAcceleration(Wg(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class Ig{constructor(){this.value,this.dir,this.movement=new jg}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const Gg={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},Vg=Phaser.Utils.Objects.GetValue;class Ug extends ii{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=Vg(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(Vg(e,"speed",.1)),this.setEnable(Vg(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(Vg(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||cr(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const $g=Phaser.Utils.Objects.GetValue;var Jg=function(t,e,i,s){var r,n,h="Y"===(i=i.toUpperCase()),a=2===t.scrollMode,o=t.childrenMap.child,l=`slider${i}`;if(r=a||s.hasOwnProperty(l)?$g(s,l,void 0):$g(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=h?1:0,n=function(t,e){void 0===e&&(e={});var i=mt(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new zg(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r),n.tickLength=$g(r,"tickLength",void 0);var p=$g(r,"position",0);"string"==typeof p&&(p=Kg[p]);var v,g,f=$g(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=$g(s,"space.slider",void 0))&&(a?f=0:v=$g(s,"space.child",0)),g=void 0===v?"number"==typeof f:"number"==typeof v,h?0===p?(d=2,c=1,u=void 0===v?g?{left:f}:f:{left:$g(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:$g(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:$g(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:$g(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=$g(r,"hideUnscrollableSlider",!1),t[`disableUnscrollableDrag${i}`]=$g(r,"disableUnscrollableDrag",!1),t[`adaptThumb${i}SizeMode`]=$g(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=$g(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`disableUnscrollableDrag${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=$g(s,"scrollDetectionMode");"string"==typeof b&&(b=qg[b]);var x=`scroller${i}`;(m=a||s.hasOwnProperty(x)?$g(s,x,!0):$g(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new Ng(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var S,w,C,O,P,_=$g(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);_&&o&&(void 0!==b&&(_.focus=1===b?2:0),S=new Ug(o,_)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,S),a&&!h||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.disableUnscrollableDrag=t[`disableUnscrollableDrag${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",S)),n&&(a?(w=h?"t":"s",O=`scroll${i}`):(w="t",O="scroll"),n.on("valuechange",(function(e){t[w]=e,t.emit(O,t)}))),y&&(a?(C=`childO${i}`,O=`scroll${i}`):(C="childOY",O="scroll"),y.on("valuechange",(function(e){t[C]=e,t.emit(O,t)}))),S&&(P=a?`addChildO${i}`:"addChildOY",S.on("scroll",(function(e){t[P](-e,!0)})))};const Kg={right:0,left:1,bottom:0,top:1},qg={gameObject:0,rectBounds:1},Zg=Phaser.Utils.Objects.GetValue;var Qg=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=Zg(e,"width"),h=Zg(e,"height");n||Zg(e,"child.expandWidth",!0)||(s[1]=0),h||Zg(e,"child.expandHeight",!0)||(r[1]=0);var a=new ho(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=ng(i,"child"),r=ng(s,"gameObject",void 0);if(r){var n=ng(i,"space.child",0);t.childMargin={};var h=t.childMargin,a={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:h.top=0,h.bottom=0,h.left=0,h.right=0;break;default:h.top=n,h.bottom=n,h.left=n,h.right=n}else switch(t.scrollMode){case 0:h.top=ng(n,"top",0),h.bottom=ng(n,"bottom",0),a.left=ng(n,"left",0),a.right=ng(n,"right",0);break;case 1:h.top=ng(n,"left",0),h.bottom=ng(n,"right",0),a.top=ng(n,"top",0),a.bottom=ng(n,"bottom",0);break;default:h.top=ng(n,"top",0),h.bottom=ng(n,"bottom",0),h.left=ng(n,"left",0),h.right=ng(n,"right",0)}e.add(r,{column:1,row:1,align:ng(s,"align","center"),padding:a,expand:{width:ng(s,"expandWidth",!0),height:ng(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:Jg(t,a,"y",e);break;case 1:Jg(t,a,"x",e);break;default:Jg(t,a,"y",e),Jg(t,a,"x",e)}return a},tf=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}i*="Y"===t?this.scaleY:this.scaleX,s&&s.setBounds(e,i),r&&(r.setEnable(e!==i),r.tickLength&&r.setTick(r.tickLength,e,i))},ef=function(t){switch(this.scrollMode){case 0:case 1:(i=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(i,this.isOverflow),(r=this.childrenMap.scroller)&&this.disableUnscrollableDrag&&r.setEnable(this.isOverflow);break;default:var e=this[`isOverflow${t=t.toUpperCase()}`],i=this.childrenMap[`slider${t}`],s=this[`hideUnscrollableSlider${t}`];i&&s&&this.setChildVisible(i,e);var r=this.childrenMap.scroller,n=this[`disableUnscrollableDrag${t}`];r&&n&&r.setEnable(e)}},sf=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(a=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=a.childrenMap.track,s=a.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&n0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n")}return i}(this.textObject,this.text,this.lines),this.linesCount=this.lines.length,this._textHeight=void 0,this._textVisibleHeight=void 0,this.updateTextObject(),this},updateTextObject:function(){var t=Math.max(Math.floor(lf.call(this,-this.textOY)),0),e=df.call(this,t)+this.textOY,i=cf.call(this,t);return function(t,e){switch(Fo(t)){case 0:var i=(r=t.style).wordWrapWidth,s=r.wordWrapCallback;r.wordWrapWidth=0,r.wordWrapCallback=void 0,t.setText(e),r.wordWrapWidth=i,r.wordWrapCallback=s;break;case 1:var r,n=(r=t.style).wrapMode;r.wrapMode=0,t.setText(e),r.wrapMode=n;break;case 2:var h=t._maxWidth;t._maxWidth=0,t.setText(e),t._maxWidth=h}}(this.textObject,i),this.textObject.rexSizer.offsetY=e,uf.call(this),this},preLayout:function(){return this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,Ie.call(this),this},layoutChildren:function(){var t,e,i,s,r,n,h,a=this.left,o=this.top;(t=this.textObject).rexSizer.hidden||(s=a+(i=(e=t.rexSizer).padding).left*this.scaleX,r=o+i.top*this.scaleY,n=this.width*this.scaleX-(i.left+i.right)*this.scaleX,h=this.height*this.scaleY-(i.top+i.bottom)*this.scaleY,vf.call(this,t,n,h),ae(t,s,r,n,h,e.align),e.preOffsetY=0,uf.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const ff=Phaser.Utils.Objects.IsPlainObject,mf=Phaser.Utils.Objects.GetValue,yf=Phaser.Display.Align.TOP_LEFT;class bf extends rh{constructor(t,e,i,s,r,n){ff(e)?(e=mf(n=e,"x",0),i=mf(n,"y",0),s=mf(n,"width",void 0),r=mf(n,"height",void 0)):ff(s)&&(s=mf(n=s,"width",void 0),r=mf(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexTextBlock",this.textObject=void 0,this.linesCount=0,this.textMask=void 0,this.textObjectType=void 0,this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,this._textObjectRealHeight=0,this.lines=void 0,this.text=mf(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode(mf(n,"clampTextOY",!0)),this.alwaysScrollable=mf(n,"alwaysScrollable",!1);var h=mf(n,"background",void 0),a=mf(n,"text",void 0);void 0===a&&(a=xf(t)),this.textCropEnable=mf(n,"textCrop",!!a.setCrop);var o=mf(n,"textMask",!this.textCropEnable);h&&this.addBackground(h),this.add(a),this.sizerChildren=[a];var l=this.getSizerConfig(a);l.align=yf,l.padding=ge(0),l.expand=!0,this.textObject=a,this.textObjectType=Fo(a),l.preOffsetY=0,l.offsetY=0,o&&(this.textMask=Xo.call(this,this.textObject,this)),this.addChildrenMap("background",h),this.addChildrenMap("text",a)}destroy(t){if(this.scene&&!this.ignoreDestroy){if(this.textObject=void 0,this.textMask=void 0,this.lines){switch(this.textObjectType){case 0:case 2:this.lines.length=0;break;case 1:this.lines.destroy()}this.lines=void 0}super.destroy(t)}}setClampMode(t){return void 0===t&&(t=!0),this.clampTextOY=t,this}get textLineHeight(){if(void 0===this._textLineHeight){var t;switch(this.textObjectType){case 0:case 1:var e=this.textObject.style;t=e.metrics.fontSize+e.strokeThickness;break;case 2:var i=this.textObject.fontSize/this.textObject.fontData.size;t=this.textObject.fontData.lineHeight*i}this._textLineHeight=t}return this._textLineHeight}get textLineSpacing(){if(void 0===this._textLineSpacing){var t;switch(this.textObjectType){case 0:case 1:t=this.textObject.lineSpacing;break;case 2:t=0}this._textLineSpacing=t}return this._textLineSpacing}get visibleLinesCount(){return void 0===this._visibleLinesCount&&(this._visibleLinesCount=Math.floor(lf.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=df.call(this,this.linesCount)),this._textHeight}get textObjectHeight(){return this._textObjectRealHeight-(this.textLineHeight+this.textLineSpacing)}get textVisibleHeight(){if(void 0===this._textVisibleHeight){var t=this.textHeight-this.textObjectHeight;!this.alwaysScrollable&&t<0&&(t=0),this._textVisibleHeight=t}return this._textVisibleHeight}textOYExceedTop(t){return void 0===t&&(t=this.textOY),t>this.topTextOY}textOYExeceedBottom(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:s?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}setTextOY(t){return this.textOY=t,this}set t(t){this.textOY=-this.textVisibleHeight*t}get t(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t}setTextOYByPercentage(t){return this.t=t,this}}var xf=function(t){return t.add.text(0,0,"")};Object.assign(bf.prototype,gf);var Sf={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},wf={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const Cf=Phaser.Utils.Objects.GetValue;class Of extends af{constructor(t,e){void 0===e&&(e={});var i=Cf(e,"text",void 0),s=Cf(e,"textWidth",void 0),r=Cf(e,"textHeight",void 0),n=Cf(e,"textCrop",!!i.setCrop),h=Cf(e,"textMask",!n),a=Cf(e,"content",""),o=new bf(t,{width:s,height:r,text:i,textMask:h,textCrop:n&&!h,content:a,clampTextOY:Cf(e,"clampChildOY",!1),alwaysScrollable:Cf(e,"alwaysScrollable",!1)});t.add.existing(o),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textObjectHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.textHeight}})}(o),e.scrollMode=0,e.type="rexTextArea",e.child={gameObject:o,expandWidth:void 0===s,expandHeight:void 0===r};var l=Cf(e,"space",void 0);l&&(l.child=Cf(l,"text",0)),super(t,e),this.addChildrenMap("text",i)}get text(){return this.childrenMap.child.text}get lineHeight(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.textHeight}}Object.assign(Of.prototype,Sf,wf);const Pf=Phaser.Utils.Objects.GetValue;var _f=function(t,e,i){e=e?yd(e):{};var s=Pf(i,"background",fp),r=Pf(i,"text",Tf),n=Pf(i,"track",fp),h=Pf(i,"thumb",fp);s?e.background=s(t,e.background):delete e.background,r?e.text=r(t,e.text):delete e.text;var a=e.slider;!1!==a&&null!==a&&(void 0===a&&(a={}),n?a.track=n(t,a.track):delete a.track,h?a.thumb=h(t,a.thumb):delete a.thumb,e.slider=a);var o=new Of(t,e);return t.add.existing(o),o},Tf=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("key")&&(i="bitmaptext",e.font=e.key)),i){case"bitmaptext":case"bitmap":s=new ig(t,e);break;case"bbcodetext":case"bbcode":s=new Zv(t,0,0,"",e);break;case"label":s=new Mf(t,e);break;case"textarea":s=_f(t,e);break;default:s=new bp(t,e)}return gp(s,e),t.add.existing(s),s},kf=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("leftWidth")?i="nineSlice":(e.hasOwnProperty("color")||e.hasOwnProperty("strokeColor"))&&(i="roundRectangle")),i){case"nineSlice":s=e.hasOwnProperty("stretchMode")?new pp(t,e):new Gu(t,e);break;case"roundRectangle":s=new Ic(t,e);break;default:s=new Ju(t,e)}return gp(s,e),t.add.existing(s),s};const Ef=Phaser.Utils.Objects.GetValue;class Mf extends gc{constructor(t,e,i){e=function(t,e,i){e=e?yd(e):{};var s=Ef(i,"background",fp),r=Ef(i,"text",Tf),n=Ef(i,"icon",kf),h=Ef(i,"action",kf);return null!==e.background&&s?e.background=s(t,e.background):delete e.background,null!==e.text&&r?e.text=r(t,e.text):delete e.text,null!==e.icon&&n?e.icon=n(t,e.icon):delete e.icon,null!==e.action&&h?e.action=h(t,e.action):delete e.action,e}(t,e,i),super(t,e),this.type="rexSimpleLabel"}setActiveState(t){return Rf(this.getChildren(),"setActiveState",t),this}setHoverState(t){return Rf(this.getChildren(),"setHoverState",t),this}setDisableState(t){return Rf(this.getChildren(),"setDisableState",t),this}}var Rf=function(t,e,i){for(var s=0,r=t.length;so;d--){for(c=0;c0&&this.wrapMode!==Ko&&0===this.wrapWidth}setStyle(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wordWrap")){var s=t.wordWrap;s.hasOwnProperty("width")&&(t.wrap={mode:"word",width:s.width})}if(t&&t.hasOwnProperty("wrap")){var r=t.wrap;if(r.hasOwnProperty("mode")){var n=r.mode;"string"==typeof n&&(r.mode=tl[n])}else r.hasOwnProperty("width")&&(r.mode=1)}t&&t.rtl&&i&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var h=this.propertyMap;for(var a in h){var o=h[a],l=o[0],d=i?o[1]:this[a],c=o[2];if("wrapCallback"===a||"wrapCallbackScope"===a)this[a]=Rp(t,l,d);else{var u=Mp(t,l,d);c&&(u=c(u)),this[a]=u}}var p=Rp(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var v=Rp(t,"fill",null);null!==v&&(this.color=Al(v));var g=Rp(t,"metrics",!1);return g?this.metrics={ascent:Rp(g,"ascent",0),descent:Rp(g,"descent",0),fontSize:Rp(g,"fontSize",0)}:!e&&this.metrics||(this.metrics=Ep(this)),e?this.parent.updateText():this.parent}syncFont(t,e){e.font=this._font}syncStyle(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"}syncShadow(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)}update(t){return t&&(this._font=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim(),this.metrics=Ep(this)),this.parent.updateText(t)}buildFont(){var t=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim();return t!==this._font&&(this._font=t),this}setFont(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=Rp(t,"fontFamily","Courier"),this.fontSize=Rp(t,"fontSize","16px"),this.fontStyle=Rp(t,"fontStyle","")),this.update(!0)}setFontFamily(t){return this.fontFamily=t,this.update(!0)}setFontStyle(t){return this.fontStyle=t,this.update(!0)}setFontSize(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}setTestString(t){return this.testString=t,this.update(!0)}setFixedSize(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}setResolution(t){return this.resolution=t,this.update(!1)}setXOffset(t){return this.xOffset=t,this.update(!1)}setBackgroundColor(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=Al(t,this.parent.canvas,this.parent.context),this.backgroundColor2=Al(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=Al(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}setBackgroundCornerRadius(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}setFill(t){return this.color=Al(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=Al(t,this.parent.canvas,this.parent.context),this.update(!1)}setStroke(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=Al(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}setShadow(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===n&&(n=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=Al(i,this.parent.canvas,this.parent.context),this.shadowBlur=s,this.shadowStroke=r,this.shadowFill=n,this.update(!1)}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}setShadowColor(t){return void 0===t&&(t="#000"),this.shadowColor=Al(t,this.parent.canvas,this.parent.context),this.update(!1)}setShadowBlur(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}setShadowStroke(t){return this.shadowStroke=t,this.update(!1)}setShadowFill(t){return this.shadowFill=t,this.update(!1)}setUnderline(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=Al(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}setUnderlineColor(t){return void 0===t&&(t="#000"),this.underlineColor=Al(t,this.parent.canvas,this.parent.context),this.update(!1)}setUnderlineThickness(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}setUnderlineOffset(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}setStrikethrough(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=Al(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}setStrikethroughColor(t){return void 0===t&&(t="#000"),this.strikethroughColor=Al(t,this.parent.canvas,this.parent.context),this.update(!1)}setStrikethroughThickness(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}setStrikethroughOffset(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}setWrapMode(t){return"string"==typeof t&&(t=tl[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}setWrapWidth(t){return this.wrapWidth=t,this.update(!1)}setAlign(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}setHAlign(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}setVAlign(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}setMaxLines(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}getTextMetrics(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}setTextMetrics(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=Rp(e,"fontFamily",this.fontFamily),this.fontSize=Rp(e,"fontSize",this.fontSize),this.fontStyle=Rp(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}get lineHeight(){return this.metrics.fontSize+this.parent.lineSpacing}toJSON(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}destroy(){this.parent=void 0}}var Dp={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var h=this.defaultStyle;this.clear(),Ul(this,h.backgroundColor,h.backgroundStrokeColor,h.backgroundStrokeLineWidth,h.backgroundCornerRadius,h.backgroundColor2,h.backgroundHorizontalGradient,h.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var a,o,l,d,c,u,p=h.halign,v=h.valign,g=h.lineHeight,f=r.lines,m=f.length,y=h.maxLines;y>0&&m>y?(o=y,l="center"===v?Math.floor((m-o)/2):"bottom"===v?m-o:0):(o=m,l=0),d=l+o;var b=this.rtl,x=b?this.parent.width:void 0;u="center"===v?Math.max((s-o*g)/2,0):"bottom"===v?Math.max(s-o*g-2,0):0,u+=e;for(var S=l;S0){var a=this.defaultStyle.metrics,o=i-a.ascent,l=a.fontSize;this.drawRectangle(e,o,t.width,l,h.bgcolor,h)}if(h.underlineThickness>0&&t.width>0){var d=i+h.underlineOffset-h.underlineThickness/2;this.drawLine(e,d,t.width,h.underlineThickness,h.underlineColor,h)}if(t.isTextPen&&(h.buildFont(),h.syncFont(r,n),h.syncStyle(r,n),this.drawText(e,i,t.text,h)),t.isImagePen&&this.drawImage(e,i,t.prop.img,t.prop.color,h),h.strikethroughThickness>0&&t.width>0&&(d=i+h.strikethroughOffset-h.strikethroughThickness/2,this.drawLine(e,d,t.width,h.strikethroughThickness,h.strikethroughColor,h)),n.restore(),t.hasAreaMarker&&t.width>0){var c,u=t.prop.area;if(u)c={key:u};else{var p=t.prop.url;c={key:`url:${p}`,url:p}}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,c)}},clear(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawRectangle(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var h=this.context;h.fillStyle=r,h.fillRect(t,e,i,s)},drawLine(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var h=this.context;n.syncShadow(h,n.shadowStroke);var a=h.lineCap;h.lineCap="butt",h.strokeStyle=r,h.lineWidth=s,h.beginPath(),h.moveTo(t,e),h.lineTo(t+i,e),h.stroke(),h.lineCap=a},drawText(t,e,i,s){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;s.stroke&&"none"!==s.stroke&&s.strokeThickness>0&&(s.syncShadow(r,s.shadowStroke),r.strokeText(i,t,e)),s.color&&"none"!==s.color&&(s.syncShadow(r,s.shadowFill),r.fillText(i,t,e))},drawImage(t,e,i,s,r){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,s,this.autoRound)}};const zp=Phaser.Utils.Objects.GetValue,Ap=Uo,Yp=$o;class Xp{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=zp(t,"text",""),this.x=zp(t,"x",0),this.y=zp(t,"y",0),this.width=zp(t,"width",0);var e=zp(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=zp(t,"newLineMode",0),this.startIndex=zp(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===Yp&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==Ap&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===Yp&&(t+=1),t}get endIndex(){return this.startIndex+this.rawTextLength}get lastX(){return this.x+this.width}get isTextPen(){return""!==this.text}get isImagePen(){return!!this.prop.img}get hasAreaMarker(){return!!this.prop.area||!!this.prop.url}}const Bp=Phaser.Utils.Objects.GetFastValue,Wp=Uo,jp=Jo;class Ip{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=Bp(t,"tagToText",Xt),this.tagToTextScope=Bp(t,"tagToTextScope",void 0)}destroy(){this.clear(),this.tagToText=void 0,this.tagToTextScope=void 0}clear(){for(var t=0,e=this.lines.length;t=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}getLineEndIndex(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,s=!1;for(e=t;e>=0&&!(s=null!=(i=this.lines[e])&&i.length>0);e--);return s?i[i.length-1].endIndex:0}getLineWidth(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}getMaxLineWidth(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,s=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}getLineWidths(){for(var t=[],e=0,i=this.lines.length;e=t&&o<=e||(h=h.substring(t-a,e-a)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,h,l,d):c+=this.tagToText(h,l,d),d=l,!(o>=e)));u++);return c}get length(){return this.lines.length}set length(t){this.clear()}}var Fp={};const Hp=Phaser.Geom.Rectangle;var Np=new tc;class Gp{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&nv(g)){""!==b?h.push(n.getLine(b,x,Zp)):0===S&&r>0&&h.push(n.getLine("",0,Zp)),h.push(...sv(g,e,ev,s,0,n));var C=h.pop();b=C.text,x=C.width,n.freeLine(C)," "===b&&(b="",x=0)}else(m=x+f)>o?(h.push(n.getLine(b,x,Zp)),b=g,x=f,o=s):(b+=g,x=m),S===w-1&&h.push(n.getLine(b,x,l))}return h},rv=function(t,e){var i;switch(e){case tv:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==av&&i0&&t>e&&(t=e),t}get linesWidth(){return Math.ceil(this.penManager.getMaxLineWidth())}get linesHeight(){var t=this.displayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}get imageManager(){return this.parent.imageManager}get rtl(){return this.parent.style.rtl}newPenManager(){return new Ip({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}get tmpPenManager(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}getPlainText(t,e,i){var s;if(null==t)s=this.penManager.plainText;else{var r=this.parser.splitText(t,1);s="";for(var n=0,h=r.length;n=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const Xg=Phaser.Utils.Objects.GetValue,Bg=Phaser.Math.Distance.Between;class Wg extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=Xg(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(Xg(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(Xg(t,"enable",!0)),this.holdThreshold=Xg(t,"holdThreshold",50),this.pointerOutReleaseEnable=Xg(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return vn(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:Bg(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!cr(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!cr(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const jg=Phaser.Utils.Objects.GetValue;class Ig{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(jg(t,"value",0)),this.setSpeed(jg(t,"speed",0)),this.setAcceleration(jg(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class Fg{constructor(){this.value,this.dir,this.movement=new Ig}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const Vg={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},Ug=Phaser.Utils.Objects.GetValue;class $g extends ii{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=Ug(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(Ug(e,"speed",.1)),this.setEnable(Ug(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(Ug(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||cr(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const Jg=Phaser.Utils.Objects.GetValue;var Kg=function(t,e,i,s){var r,n,h="Y"===(i=i.toUpperCase()),a=2===t.scrollMode,o=t.childrenMap.child,l=`slider${i}`;if(r=a||s.hasOwnProperty(l)?Jg(s,l,void 0):Jg(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=h?1:0,n=function(t,e){void 0===e&&(e={});var i=mt(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new Ag(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r),n.tickLength=Jg(r,"tickLength",void 0);var p=Jg(r,"position",0);"string"==typeof p&&(p=qg[p]);var v,g,f=Jg(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=Jg(s,"space.slider",void 0))&&(a?f=0:v=Jg(s,"space.child",0)),g=void 0===v?"number"==typeof f:"number"==typeof v,h?0===p?(d=2,c=1,u=void 0===v?g?{left:f}:f:{left:Jg(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:Jg(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:Jg(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:Jg(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=Jg(r,"hideUnscrollableSlider",!1),t[`disableUnscrollableDrag${i}`]=Jg(r,"disableUnscrollableDrag",!1),t[`adaptThumb${i}SizeMode`]=Jg(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=Jg(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`disableUnscrollableDrag${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=Jg(s,"scrollDetectionMode");"string"==typeof b&&(b=Zg[b]);var x=`scroller${i}`;(m=a||s.hasOwnProperty(x)?Jg(s,x,!0):Jg(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new Gg(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var S,w,C,O,P,_=Jg(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);_&&o&&(void 0!==b&&(_.focus=1===b?2:0),S=new $g(o,_)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,S),a&&!h||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.disableUnscrollableDrag=t[`disableUnscrollableDrag${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",S)),n&&(a?(w=h?"t":"s",O=`scroll${i}`):(w="t",O="scroll"),n.on("valuechange",(function(e){t[w]=e,t.emit(O,t)}))),y&&(a?(C=`childO${i}`,O=`scroll${i}`):(C="childOY",O="scroll"),y.on("valuechange",(function(e){t[C]=e,t.emit(O,t)}))),S&&(P=a?`addChildO${i}`:"addChildOY",S.on("scroll",(function(e){t[P](-e,!0)})))};const qg={right:0,left:1,bottom:0,top:1},Zg={gameObject:0,rectBounds:1},Qg=Phaser.Utils.Objects.GetValue;var tf=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=Qg(e,"width"),h=Qg(e,"height");n||Qg(e,"child.expandWidth",!0)||(s[1]=0),h||Qg(e,"child.expandHeight",!0)||(r[1]=0);var a=new ho(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=hg(i,"child"),r=hg(s,"gameObject",void 0);if(r){var n=hg(i,"space.child",0);t.childMargin={};var h=t.childMargin,a={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:h.top=0,h.bottom=0,h.left=0,h.right=0;break;default:h.top=n,h.bottom=n,h.left=n,h.right=n}else switch(t.scrollMode){case 0:h.top=hg(n,"top",0),h.bottom=hg(n,"bottom",0),a.left=hg(n,"left",0),a.right=hg(n,"right",0);break;case 1:h.top=hg(n,"left",0),h.bottom=hg(n,"right",0),a.top=hg(n,"top",0),a.bottom=hg(n,"bottom",0);break;default:h.top=hg(n,"top",0),h.bottom=hg(n,"bottom",0),h.left=hg(n,"left",0),h.right=hg(n,"right",0)}e.add(r,{column:1,row:1,align:hg(s,"align","center"),padding:a,expand:{width:hg(s,"expandWidth",!0),height:hg(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:Kg(t,a,"y",e);break;case 1:Kg(t,a,"x",e);break;default:Kg(t,a,"y",e),Kg(t,a,"x",e)}return a},ef=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}i*="Y"===t?this.scaleY:this.scaleX,s&&s.setBounds(e,i),r&&(r.setEnable(e!==i),r.tickLength&&r.setTick(r.tickLength,e,i))},sf=function(t){switch(this.scrollMode){case 0:case 1:(i=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(i,this.isOverflow),(r=this.childrenMap.scroller)&&this.disableUnscrollableDrag&&r.setEnable(this.isOverflow);break;default:var e=this[`isOverflow${t=t.toUpperCase()}`],i=this.childrenMap[`slider${t}`],s=this[`hideUnscrollableSlider${t}`];i&&s&&this.setChildVisible(i,e);var r=this.childrenMap.scroller,n=this[`disableUnscrollableDrag${t}`];r&&n&&r.setEnable(e)}},rf=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(a=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=a.childrenMap.track,s=a.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&n0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n")}return i}(this.textObject,this.text,this.lines),this.linesCount=this.lines.length,this._textHeight=void 0,this._textVisibleHeight=void 0,this.updateTextObject(),this},updateTextObject:function(){var t=Math.max(Math.floor(df.call(this,-this.textOY)),0),e=cf.call(this,t)+this.textOY,i=uf.call(this,t);return function(t,e){switch(Fo(t)){case 0:var i=(r=t.style).wordWrapWidth,s=r.wordWrapCallback;r.wordWrapWidth=0,r.wordWrapCallback=void 0,t.setText(e),r.wordWrapWidth=i,r.wordWrapCallback=s;break;case 1:var r,n=(r=t.style).wrapMode;r.wrapMode=0,t.setText(e),r.wrapMode=n;break;case 2:var h=t._maxWidth;t._maxWidth=0,t.setText(e),t._maxWidth=h}}(this.textObject,i),this.textObject.rexSizer.offsetY=e,pf.call(this),this},preLayout:function(){return this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,Ie.call(this),this},layoutChildren:function(){var t,e,i,s,r,n,h,a=this.left,o=this.top;(t=this.textObject).rexSizer.hidden||(s=a+(i=(e=t.rexSizer).padding).left*this.scaleX,r=o+i.top*this.scaleY,n=this.width*this.scaleX-(i.left+i.right)*this.scaleX,h=this.height*this.scaleY-(i.top+i.bottom)*this.scaleY,gf.call(this,t,n,h),ae(t,s,r,n,h,e.align),e.preOffsetY=0,pf.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const mf=Phaser.Utils.Objects.IsPlainObject,yf=Phaser.Utils.Objects.GetValue,bf=Phaser.Display.Align.TOP_LEFT;class xf extends rh{constructor(t,e,i,s,r,n){mf(e)?(e=yf(n=e,"x",0),i=yf(n,"y",0),s=yf(n,"width",void 0),r=yf(n,"height",void 0)):mf(s)&&(s=yf(n=s,"width",void 0),r=yf(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexTextBlock",this.textObject=void 0,this.linesCount=0,this.textMask=void 0,this.textObjectType=void 0,this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,this._textObjectRealHeight=0,this.lines=void 0,this.text=yf(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode(yf(n,"clampTextOY",!0)),this.alwaysScrollable=yf(n,"alwaysScrollable",!1);var h=yf(n,"background",void 0),a=yf(n,"text",void 0);void 0===a&&(a=Sf(t)),this.textCropEnable=yf(n,"textCrop",!!a.setCrop);var o=yf(n,"textMask",!this.textCropEnable);h&&this.addBackground(h),this.add(a),this.sizerChildren=[a];var l=this.getSizerConfig(a);l.align=bf,l.padding=ge(0),l.expand=!0,this.textObject=a,this.textObjectType=Fo(a),l.preOffsetY=0,l.offsetY=0,o&&(this.textMask=Xo.call(this,this.textObject,this)),this.addChildrenMap("background",h),this.addChildrenMap("text",a)}destroy(t){if(this.scene&&!this.ignoreDestroy){if(this.textObject=void 0,this.textMask=void 0,this.lines){switch(this.textObjectType){case 0:case 2:this.lines.length=0;break;case 1:this.lines.destroy()}this.lines=void 0}super.destroy(t)}}setClampMode(t){return void 0===t&&(t=!0),this.clampTextOY=t,this}get textLineHeight(){if(void 0===this._textLineHeight){var t;switch(this.textObjectType){case 0:case 1:var e=this.textObject.style;t=e.metrics.fontSize+e.strokeThickness;break;case 2:var i=this.textObject.fontSize/this.textObject.fontData.size;t=this.textObject.fontData.lineHeight*i}this._textLineHeight=t}return this._textLineHeight}get textLineSpacing(){if(void 0===this._textLineSpacing){var t;switch(this.textObjectType){case 0:case 1:t=this.textObject.lineSpacing;break;case 2:t=0}this._textLineSpacing=t}return this._textLineSpacing}get visibleLinesCount(){return void 0===this._visibleLinesCount&&(this._visibleLinesCount=Math.floor(df.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=cf.call(this,this.linesCount)),this._textHeight}get textObjectHeight(){return this._textObjectRealHeight-(this.textLineHeight+this.textLineSpacing)}get textVisibleHeight(){if(void 0===this._textVisibleHeight){var t=this.textHeight-this.textObjectHeight;!this.alwaysScrollable&&t<0&&(t=0),this._textVisibleHeight=t}return this._textVisibleHeight}textOYExceedTop(t){return void 0===t&&(t=this.textOY),t>this.topTextOY}textOYExeceedBottom(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:s?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}setTextOY(t){return this.textOY=t,this}set t(t){this.textOY=-this.textVisibleHeight*t}get t(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t}setTextOYByPercentage(t){return this.t=t,this}}var Sf=function(t){return t.add.text(0,0,"")};Object.assign(xf.prototype,ff);var wf={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},Cf={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const Of=Phaser.Utils.Objects.GetValue;class Pf extends of{constructor(t,e){void 0===e&&(e={});var i=Of(e,"text",void 0),s=Of(e,"textWidth",void 0),r=Of(e,"textHeight",void 0),n=Of(e,"textCrop",!!i.setCrop),h=Of(e,"textMask",!n),a=Of(e,"content",""),o=new xf(t,{width:s,height:r,text:i,textMask:h,textCrop:n&&!h,content:a,clampTextOY:Of(e,"clampChildOY",!1),alwaysScrollable:Of(e,"alwaysScrollable",!1)});t.add.existing(o),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textObjectHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.textHeight}})}(o),e.scrollMode=0,e.type="rexTextArea",e.child={gameObject:o,expandWidth:void 0===s,expandHeight:void 0===r};var l=Of(e,"space",void 0);l&&(l.child=Of(l,"text",0)),super(t,e),this.addChildrenMap("text",i)}get text(){return this.childrenMap.child.text}get lineHeight(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.textHeight}}Object.assign(Pf.prototype,wf,Cf);const _f=Phaser.Utils.Objects.GetValue;var Tf=function(t,e,i){e=e?yd(e):{};var s=_f(i,"background",mp),r=_f(i,"text",kf),n=_f(i,"track",mp),h=_f(i,"thumb",mp);s?e.background=s(t,e.background):delete e.background,r?e.text=r(t,e.text):delete e.text;var a=e.slider;!1!==a&&null!==a&&(void 0===a&&(a={}),n?a.track=n(t,a.track):delete a.track,h?a.thumb=h(t,a.thumb):delete a.thumb,e.slider=a);var o=new Pf(t,e);return t.add.existing(o),o},kf=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("key")&&(i="bitmaptext",e.font=e.key)),i){case"bitmaptext":case"bitmap":s=new sg(t,e);break;case"bbcodetext":case"bbcode":s=new Qv(t,0,0,"",e);break;case"label":s=new Rf(t,e);break;case"textarea":s=Tf(t,e);break;default:s=new xp(t,e)}return fp(s,e),t.add.existing(s),s},Ef=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("leftWidth")?i="nineSlice":(e.hasOwnProperty("color")||e.hasOwnProperty("strokeColor"))&&(i="roundRectangle")),i){case"nineSlice":s=e.hasOwnProperty("stretchMode")?new vp(t,e):new Vu(t,e);break;case"roundRectangle":s=new Ic(t,e);break;default:s=new Ku(t,e)}return fp(s,e),t.add.existing(s),s};const Mf=Phaser.Utils.Objects.GetValue;class Rf extends gc{constructor(t,e,i){e=function(t,e,i){e=e?yd(e):{};var s=Mf(i,"background",mp),r=Mf(i,"text",kf),n=Mf(i,"icon",Ef),h=Mf(i,"action",Ef);return null!==e.background&&s?e.background=s(t,e.background):delete e.background,null!==e.text&&r?e.text=r(t,e.text):delete e.text,null!==e.icon&&n?e.icon=n(t,e.icon):delete e.icon,null!==e.action&&h?e.action=h(t,e.action):delete e.action,e}(t,e,i),super(t,e),this.type="rexSimpleLabel"}setActiveState(t){return Lf(this.getChildren(),"setActiveState",t),this}setHoverState(t){return Lf(this.getChildren(),"setHoverState",t),this}setDisableState(t){return Lf(this.getChildren(),"setDisableState",t),this}}var Lf=function(t,e,i){for(var s=0,r=t.length;s>>16,n=(65280&h)>>>8,o=255&h;t.fillStyle="rgba("+a+","+n+","+o+","+r+")"},v=function(t,i,e,s){var h=e||i.strokeColor,r=s||i.strokeAlpha,a=(16711680&h)>>>16,n=(65280&h)>>>8,o=255&h;t.strokeStyle="rgba("+a+","+n+","+o+","+r+")",t.lineWidth=i.lineWidth};const y=Phaser.Geom.Polygon.Earcut;class g extends u{constructor(){super(),this.pathData=[],this.pathIndexes=[],this.closePath=!1}updateData(){return this.pathIndexes=y(this.pathData),super.updateData(),this}webglRender(t,i,e,s,h){this.isFilled&&function(t,i,e,s,h,r){for(var a=l.getTintAppendFloatAlpha(e.fillColor,e.fillAlpha*s),n=e.pathData,o=e.pathIndexes,u=0;u=2){var h=e[s-2],r=e[s-1];if(t===h&&i===r)return e}return e.push(t,i),e};const f=Phaser.Math.DegToRad;var _=function(t,i,e,s,h,r,a,n,o){a&&r>h?r-=360:!a&&r0,a=0,n=i.length;a0;this.dirty=this.dirty||this._radiusTL!==t||this._convexTL!==i,this._convexTL=i,this._radiusTL=Math.abs(t)}get radiusTR(){return this._radiusTR}set radiusTR(t){var i=t>0;this.dirty=this.dirty||this._radiusTR!==t||this._convexTR!==i,this._convexTR=i,this._radiusTR=Math.abs(t)}get radiusBL(){return this._radiusBL}set radiusBL(t){var i=t>0;this.dirty=this.dirty||this._radiusBL!==t||this._convexBL!==i,this._convexBL=i,this._radiusBL=Math.abs(t)}get radiusBR(){return this._radiusBR}set radiusBR(t){var i=t>0;this.dirty=this.dirty||this._radiusBR!==t||this._convexBR!==i,this._convexBR=i,this._radiusBR=Math.abs(t)}get radius(){return Math.max(this.radiusTL,this.radiusTR,this.radiusBL,this.radiusBR)}set radius(t){"number"==typeof t?(this.radiusTL=t,this.radiusTR=t,this.radiusBL=t,this.radiusBR=t):(this.radiusTL=I(t,"tl",0),this.radiusTR=I(t,"tr",0),this.radiusBL=I(t,"bl",0),this.radiusBR=I(t,"br",0))}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}get iterations(){return this._iterations}set iterations(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t}setIterations(t){return this.iterations=t,this}updateData(){var t=this.pathData;t.length=0;var i,e=this.width,s=this.height,h=this.iterations+1;return(i=this.radiusTL)>0?this._convexTL?_(i,i,i,i,180,270,!1,h,t):_(0,0,i,i,90,0,!0,h,t):m(0,0,t),(i=this.radiusTR)>0?this._convexTR?_(e-i,i,i,i,270,360,!1,h,t):_(e,0,i,i,180,90,!0,h,t):m(e,0,t),(i=this.radiusBR)>0?this._convexBR?_(e-i,s-i,i,i,0,90,!1,h,t):_(e,s,i,i,270,180,!0,h,t):m(e,s,t),(i=this.radiusBL)>0?this._convexBL?_(i,s-i,i,i,90,180,!1,h,t):_(0,s,i,i,360,270,!0,h,t):m(0,s,t),t.push(t[0],t[1]),w(this.x,this.y,t),super.updateData(),this}},triangle:class extends u{constructor(t,i,e,s,h,r){void 0===t&&(t=0),void 0===i&&(i=0),void 0===e&&(e=0),void 0===s&&(s=0),void 0===h&&(h=0),void 0===r&&(r=0),super(),this.pathData=[],this.closePath=!0,this.setP0(t,i),this.setP1(e,s),this.setP2(h,r)}get x0(){return this._x0}set x0(t){this.dirty=this.dirty||this._x0!==t,this._x0=t}get y0(){return this._y0}set y0(t){this.dirty=this.dirty||this._y0!==t,this._y0=t}setP0(t,i){return this.x0=t,this.y0=i,this}get x1(){return this._x1}set x1(t){this.dirty=this.dirty||this._x1!==t,this._x1=t}get y1(){return this._y1}set y1(t){this.dirty=this.dirty||this._y1!==t,this._y1=t}setP1(t,i){return this.x1=t,this.y1=i,this}get x2(){return this._x2}set x2(t){this.dirty=this.dirty||this._x2!==t,this._x2=t}get y2(){return this._y2}set y2(t){this.dirty=this.dirty||this._y2!==t,this._y2=t}setP2(t,i){return this.dirty=this.dirty||this.x2!==t||this.y2!==i,this.x2=t,this.y2=i,this}updateData(){return this.pathData.length=0,this.pathData.push(this.x0,this.y0),this.pathData.push(this.x1,this.y1),this.pathData.push(this.x2,this.y2),this.pathData.push(this.x0,this.y0),super.updateData(),this}webglRender(t,i,e,s,h){if(this.isFilled){var r=N(this.fillColor,this.fillAlpha*e),a=this.x0-s,n=this.y0-h,o=this.x1-s,u=this.y1-h,l=this.x2-s,d=this.y2-h,c=i.getX(a,n),v=i.getY(a,n),y=i.getX(o,u),g=i.getY(o,u),m=i.getX(l,d),f=i.getY(l,d);t.batchTri(c,v,y,g,m,f,r,r,r)}this.isStroked&&p(t,this,e,s,h)}canvasRender(t,i,e){var s=this.x1-i,h=this.y1-e,r=this.x2-i,a=this.y2-e,n=this.x3-i,o=this.y3-e;t.beginPath(),t.moveTo(s,h),t.lineTo(r,a),t.lineTo(n,o),t.closePath(),this.isFilled&&(c(t,this),t.fill()),this.isStroked&&(v(t,this),t.stroke())}}},W=Phaser.Utils.Objects.GetValue,J=Phaser.Utils.Objects.IsPlainObject,K=function(){for(var t=this.getShapes(),i=0,e=t.length;i0?-this.delay:0,this.state=this.nowTime>=0?St:Tt,this.repeatCounter=0,this}stop(){return this.state=xt,this}update(t,i){this.state!==xt&&this.state!==wt&&0!==i&&0!==this.timeScale&&(this.nowTime+=i*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=kt)):(this.nowTime=this.duration,this.state=wt):this.nowTime>=0&&(this.state=St))}get t(){var t;switch(this.state){case xt:case Tt:case kt:t=0;break;case St:t=this.nowTime/this.duration;break;case wt:t=1}return Pt(t,0,1)}set t(t){(t=Pt(t,-1,1))<0?(this.state=Tt,this.nowTime=-this.delay*t):(this.state=St,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===xt}get isDelay(){return this.state===Tt}get isCountDown(){return this.state===St}get isRunning(){return this.state===Tt||this.state===St}get isDone(){return this.state===wt}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const xt=0,Tt=1,St=2,kt=3,wt=-1;class Rt extends ft{constructor(t,i){super(t,i),this.timer=new bt}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const Et=Phaser.Utils.Objects.GetValue,At=Phaser.Utils.Objects.GetAdvancedValue,Lt=Phaser.Tweens.Builders.GetEaseFunction;class Ct extends Rt{resetFromJSON(t){return this.timer.resetFromJSON(Et(t,"timer")),this.setEnable(Et(t,"enable",!0)),this.setTarget(Et(t,"target",this.parent)),this.setDelay(At(t,"delay",0)),this.setDuration(At(t,"duration",1e3)),this.setEase(Et(t,"ease","Linear")),this.setRepeat(Et(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Lt(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,i){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var e=this.target,s=this.timer;return s.update(t,i),s.isDelay||this.updateTarget(e,s),this.emit("update",e,this),s.isDone&&this.complete(),this}updateTarget(t,i){}}const Xt=Phaser.Utils.Objects.GetValue,Yt=Phaser.Math.Linear;class Vt extends Ct{constructor(t,i){super(t,i),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var i=this.target;this.propertyKey=Xt(t,"key","value");var e=i[this.propertyKey];return this.fromValue=Xt(t,"from",e),this.toValue=Xt(t,"to",e),this.setEase(Xt(t,"ease",this.ease)),this.setDuration(Xt(t,"duration",this.duration)),this.setRepeat(Xt(t,"repeat",0)),this.setDelay(Xt(t,"delay",0)),this.setRepeatDelay(Xt(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),i[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,i){var e=i.t;e=this.easeFn(e),t[this.propertyKey]=Yt(this.fromValue,this.toValue,e)}}const Ot=Phaser.Math.Percent;var Bt={setEaseValuePropName:function(t){return this.easeValuePropName=t,this},setEaseValueDuration:function(t){return this.easeValueDuration=t,this},setEaseValueFunction:function(t){return this.easeFunction=t,this},stopEaseValue:function(){return this.easeValueTask&&this.easeValueTask.stop(),this},easeValueTo:function(t,i,e){return null==t||(void 0!==i&&(t=Ot(t,i,e)),void 0===this.easeValueTask&&(this.easeValueTask=new Vt(this,{eventEmitter:null})),this.easeValueTask.restart({key:this.easeValuePropName,to:t,duration:this.easeValueDuration,ease:this.easeFunction})),this},easeValueRepeat:function(t,i,e,s){return void 0===e&&(e=-1),void 0===s&&(s=0),void 0===this.easeValueTask&&(this.easeValueTask=new Vt(this,{eventEmitter:null})),this.easeValueTask.restart({key:this.easeValuePropName,from:t,to:i,duration:this.easeValueDuration,ease:this.easeFunction,repeat:e,repeatDelay:s}),this}};const Ft=Phaser.Utils.Objects.GetValue,jt=Phaser.Math.Clamp,Mt=Phaser.Utils.Objects.GetValue,zt=Phaser.Utils.Objects.IsPlainObject;class Gt extends(function(t){class i extends t{bootProgressBase(t){this.eventEmitter=Ft(t,"eventEmitter",this);var i=Ft(t,"valuechangeCallback",null);if(null!==i){var e=Ft(t,"valuechangeCallbackScope",void 0);this.eventEmitter.on("valuechange",i,e)}return this.setEaseValuePropName("value").setEaseValueDuration(Ft(t,"easeValue.duration",0)).setEaseValueFunction(Ft(t,"easeValue.ease","Linear")),this}get value(){return this._value}set value(t){t=jt(t,0,1);var i=this._value,e=i!=t;this.dirty=this.dirty||e,this._value=t,e&&this.eventEmitter.emit("valuechange",this._value,i,this.eventEmitter)}}return Object.assign(i.prototype,at,Bt),i}(st)){constructor(t,i,e,s,h,r){zt(i)&&(i=Mt(r=i,"x",0),e=Mt(r,"y",0),s=Mt(r,"width",2),h=Mt(r,"height",2)),void 0===r&&(r={}),r.type||(r.type="rexCustomProgress"),super(t,i,e,s,h,r),this.bootProgressBase(r),this.setValue(Mt(r,"value",0))}get centerX(){return this.width/2}get centerY(){return this.height/2}get radius(){return Math.min(this.centerX,this.centerY)}}return Gt},"object"==typeof exports&&"undefined"!=typeof module?module.exports=i():"function"==typeof define&&define.amd?define(i):(t="undefined"!=typeof globalThis?globalThis:t||self).rexcustomprogress=i(); +var t,i;t=void 0,i=function(){const t=Phaser.GameObjects.GetCalcMatrix,i=Phaser.Renderer.Canvas.SetTransform;var e={renderWebGL:function(i,e,s,h){e.updateData(),s.addToRenderList(e);var r=i.pipelines.set(e.pipeline),a=t(e,s,h),n=r.calcMatrix.copyFrom(a.calc),o=e._displayOriginX,u=e._displayOriginY,l=s.alpha*e.alpha;i.pipelines.preBatch(e);for(var d,p=e.geom,c=0,v=p.length;c>>16,n=(65280&h)>>>8,o=255&h;t.fillStyle="rgba("+a+","+n+","+o+","+r+")"},v=function(t,i,e,s){var h=e||i.strokeColor,r=s||i.strokeAlpha,a=(16711680&h)>>>16,n=(65280&h)>>>8,o=255&h;t.strokeStyle="rgba("+a+","+n+","+o+","+r+")",t.lineWidth=i.lineWidth};const y=Phaser.Geom.Polygon.Earcut;class g extends u{constructor(){super(),this.pathData=[],this.pathIndexes=[],this.closePath=!1}updateData(){return this.pathIndexes=y(this.pathData),super.updateData(),this}webglRender(t,i,e,s,h){this.isFilled&&function(t,i,e,s,h,r){for(var a=l.getTintAppendFloatAlpha(e.fillColor,e.fillAlpha*s),n=e.pathData,o=e.pathIndexes,u=0;u=2){var h=e[s-2],r=e[s-1];if(t===h&&i===r)return e}return e.push(t,i),e};const f=Phaser.Math.DegToRad;var _=function(t,i,e,s,h,r,a,n,o){a&&r>h?r-=360:!a&&r0,a=0,n=i.length;a0;this.dirty=this.dirty||this._radiusTL!==t||this._convexTL!==i,this._convexTL=i,this._radiusTL=Math.abs(t)}get radiusTR(){return this._radiusTR}set radiusTR(t){var i=t>0;this.dirty=this.dirty||this._radiusTR!==t||this._convexTR!==i,this._convexTR=i,this._radiusTR=Math.abs(t)}get radiusBL(){return this._radiusBL}set radiusBL(t){var i=t>0;this.dirty=this.dirty||this._radiusBL!==t||this._convexBL!==i,this._convexBL=i,this._radiusBL=Math.abs(t)}get radiusBR(){return this._radiusBR}set radiusBR(t){var i=t>0;this.dirty=this.dirty||this._radiusBR!==t||this._convexBR!==i,this._convexBR=i,this._radiusBR=Math.abs(t)}get radius(){return Math.max(this.radiusTL,this.radiusTR,this.radiusBL,this.radiusBR)}set radius(t){"number"==typeof t?(this.radiusTL=t,this.radiusTR=t,this.radiusBL=t,this.radiusBR=t):(this.radiusTL=N(t,"tl",0),this.radiusTR=N(t,"tr",0),this.radiusBL=N(t,"bl",0),this.radiusBR=N(t,"br",0))}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}get iterations(){return this._iterations}set iterations(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t}setIterations(t){return this.iterations=t,this}updateData(){var t=this.pathData;t.length=0;var i,e=this.width,s=this.height,h=this.iterations+1;return(i=this.radiusTL)>0?this._convexTL?_(i,i,i,i,180,270,!1,h,t):_(0,0,i,i,90,0,!0,h,t):m(0,0,t),(i=this.radiusTR)>0?this._convexTR?_(e-i,i,i,i,270,360,!1,h,t):_(e,0,i,i,180,90,!0,h,t):m(e,0,t),(i=this.radiusBR)>0?this._convexBR?_(e-i,s-i,i,i,0,90,!1,h,t):_(e,s,i,i,270,180,!0,h,t):m(e,s,t),(i=this.radiusBL)>0?this._convexBL?_(i,s-i,i,i,90,180,!1,h,t):_(0,s,i,i,360,270,!0,h,t):m(0,s,t),t.push(t[0],t[1]),R(this.x,this.y,t),super.updateData(),this}},triangle:class extends u{constructor(t,i,e,s,h,r){void 0===t&&(t=0),void 0===i&&(i=0),void 0===e&&(e=0),void 0===s&&(s=0),void 0===h&&(h=0),void 0===r&&(r=0),super(),this.pathData=[],this.closePath=!0,this.setP0(t,i),this.setP1(e,s),this.setP2(h,r)}get x0(){return this._x0}set x0(t){this.dirty=this.dirty||this._x0!==t,this._x0=t}get y0(){return this._y0}set y0(t){this.dirty=this.dirty||this._y0!==t,this._y0=t}setP0(t,i){return this.x0=t,this.y0=i,this}get x1(){return this._x1}set x1(t){this.dirty=this.dirty||this._x1!==t,this._x1=t}get y1(){return this._y1}set y1(t){this.dirty=this.dirty||this._y1!==t,this._y1=t}setP1(t,i){return this.x1=t,this.y1=i,this}get x2(){return this._x2}set x2(t){this.dirty=this.dirty||this._x2!==t,this._x2=t}get y2(){return this._y2}set y2(t){this.dirty=this.dirty||this._y2!==t,this._y2=t}setP2(t,i){return this.dirty=this.dirty||this.x2!==t||this.y2!==i,this.x2=t,this.y2=i,this}updateData(){return this.pathData.length=0,this.pathData.push(this.x0,this.y0),this.pathData.push(this.x1,this.y1),this.pathData.push(this.x2,this.y2),this.pathData.push(this.x0,this.y0),super.updateData(),this}webglRender(t,i,e,s,h){if(this.isFilled){var r=U(this.fillColor,this.fillAlpha*e),a=this.x0-s,n=this.y0-h,o=this.x1-s,u=this.y1-h,l=this.x2-s,d=this.y2-h,c=i.getX(a,n),v=i.getY(a,n),y=i.getX(o,u),g=i.getY(o,u),m=i.getX(l,d),f=i.getY(l,d);t.batchTri(c,v,y,g,m,f,r,r,r)}this.isStroked&&p(t,this,e,s,h)}canvasRender(t,i,e){var s=this.x1-i,h=this.y1-e,r=this.x2-i,a=this.y2-e,n=this.x3-i,o=this.y3-e;t.beginPath(),t.moveTo(s,h),t.lineTo(r,a),t.lineTo(n,o),t.closePath(),this.isFilled&&(c(t,this),t.fill()),this.isStroked&&(v(t,this),t.stroke())}}},J=Phaser.Utils.Objects.GetValue,K=Phaser.Utils.Objects.IsPlainObject,q=function(){for(var t=this.getShapes(),i=0,e=t.length;i0?-this.delay:0,this.state=this.nowTime>=0?kt:St,this.repeatCounter=0,this}stop(){return this.state=xt,this}update(t,i){this.state!==xt&&this.state!==Rt&&0!==i&&0!==this.timeScale&&(this.nowTime+=i*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=wt)):(this.nowTime=this.duration,this.state=Rt):this.nowTime>=0&&(this.state=kt))}get t(){var t;switch(this.state){case xt:case St:case wt:t=0;break;case kt:t=this.nowTime/this.duration;break;case Rt:t=1}return bt(t,0,1)}set t(t){(t=bt(t,-1,1))<0?(this.state=St,this.nowTime=-this.delay*t):(this.state=kt,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===xt}get isDelay(){return this.state===St}get isCountDown(){return this.state===kt}get isRunning(){return this.state===St||this.state===kt}get isDone(){return this.state===Rt}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const xt=0,St=1,kt=2,wt=3,Rt=-1;class Et extends _t{constructor(t,i){super(t,i),this.timer=new Tt}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const At=Phaser.Utils.Objects.GetValue,Lt=Phaser.Utils.Objects.GetAdvancedValue,Ct=Phaser.Tweens.Builders.GetEaseFunction;class Xt extends Et{resetFromJSON(t){return this.timer.resetFromJSON(At(t,"timer")),this.setEnable(At(t,"enable",!0)),this.setTarget(At(t,"target",this.parent)),this.setDelay(Lt(t,"delay",0)),this.setDuration(Lt(t,"duration",1e3)),this.setEase(At(t,"ease","Linear")),this.setRepeat(At(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Ct(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,i){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var e=this.target,s=this.timer;return s.update(t,i),s.isDelay||this.updateTarget(e,s),this.emit("update",e,this),s.isDone&&this.complete(),this}updateTarget(t,i){}}const Yt=Phaser.Utils.Objects.GetValue,Vt=Phaser.Math.Linear;class Ot extends Xt{constructor(t,i){super(t,i),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var i=this.target;this.propertyKey=Yt(t,"key","value");var e=i[this.propertyKey];return this.fromValue=Yt(t,"from",e),this.toValue=Yt(t,"to",e),this.setEase(Yt(t,"ease",this.ease)),this.setDuration(Yt(t,"duration",this.duration)),this.setRepeat(Yt(t,"repeat",0)),this.setDelay(Yt(t,"delay",0)),this.setRepeatDelay(Yt(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),i[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,i){var e=i.t;e=this.easeFn(e),t[this.propertyKey]=Vt(this.fromValue,this.toValue,e)}}const Bt=Phaser.Math.Percent;var Ft={setEaseValuePropName:function(t){return this.easeValuePropName=t,this},setEaseValueDuration:function(t){return this.easeValueDuration=t,this},setEaseValueFunction:function(t){return this.easeFunction=t,this},stopEaseValue:function(){return this.easeValueTask&&this.easeValueTask.stop(),this},easeValueTo:function(t,i,e){return null==t||(void 0!==i&&(t=Bt(t,i,e)),void 0===this.easeValueTask&&(this.easeValueTask=new Ot(this,{eventEmitter:null})),this.easeValueTask.restart({key:this.easeValuePropName,to:t,duration:this.easeValueDuration,ease:this.easeFunction})),this},easeValueRepeat:function(t,i,e,s){return void 0===e&&(e=-1),void 0===s&&(s=0),void 0===this.easeValueTask&&(this.easeValueTask=new Ot(this,{eventEmitter:null})),this.easeValueTask.restart({key:this.easeValuePropName,from:t,to:i,duration:this.easeValueDuration,ease:this.easeFunction,repeat:e,repeatDelay:s}),this}};const Mt=Phaser.Utils.Objects.GetValue,jt=Phaser.Math.Clamp,zt=Phaser.Utils.Objects.GetValue,Gt=Phaser.Utils.Objects.IsPlainObject;class It extends(function(t){class i extends t{bootProgressBase(t){this.eventEmitter=Mt(t,"eventEmitter",this);var i=Mt(t,"valuechangeCallback",null);if(null!==i){var e=Mt(t,"valuechangeCallbackScope",void 0);this.eventEmitter.on("valuechange",i,e)}return this.setEaseValuePropName("value").setEaseValueDuration(Mt(t,"easeValue.duration",0)).setEaseValueFunction(Mt(t,"easeValue.ease","Linear")),this}get value(){return this._value}set value(t){t=jt(t,0,1);var i=this._value,e=i!=t;this.dirty=this.dirty||e,this._value=t,e&&this.eventEmitter.emit("valuechange",this._value,i,this.eventEmitter)}}return Object.assign(i.prototype,nt,Ft),i}(ht)){constructor(t,i,e,s,h,r){Gt(i)&&(i=zt(r=i,"x",0),e=zt(r,"y",0),s=zt(r,"width",2),h=zt(r,"height",2)),void 0===r&&(r={}),r.type||(r.type="rexCustomProgress"),super(t,i,e,s,h,r),this.bootProgressBase(r),this.setValue(zt(r,"value",0))}get centerX(){return this.width/2}get centerY(){return this.height/2}get radius(){return Math.min(this.centerX,this.centerY)}}return It},"object"==typeof exports&&"undefined"!=typeof module?module.exports=i():"function"==typeof define&&define.amd?define(i):(t="undefined"!=typeof globalThis?globalThis:t||self).rexcustomprogress=i(); diff --git a/dist/rexcustomprogressplugin.js b/dist/rexcustomprogressplugin.js index 8eb958bee6..1fb017eda2 100644 --- a/dist/rexcustomprogressplugin.js +++ b/dist/rexcustomprogressplugin.js @@ -1083,6 +1083,32 @@ return pathData; }; + //import CatmullRomInterpolation from '../../utils/math/interpolation/CatmullRomInterpolation.js'; + + const CatmullRomInterpolation = Phaser.Math.Interpolation.CatmullRom; + + var CatmullRomTo = function (points, iterations, pathData) { + var pathDataCnt = pathData.length; + var p0x = pathData[pathDataCnt - 2]; + var p0y = pathData[pathDataCnt - 1]; + + var xList = [p0x]; + var yList = [p0y]; + for (var i = 0, cnt = points.length; i < cnt; i += 2) { + xList.push(points[i]); + yList.push(points[i + 1]); + } + + for (var i = 1, last = iterations - 1; i <= last; i++) { + var t = i / last; + pathData.push( + CatmullRomInterpolation(xList, t), + CatmullRomInterpolation(yList, t) + ); + } + return pathData; + }; + var DuplicateLast = function (pathData) { var len = pathData.length; if (len < 2) { @@ -1194,6 +1220,18 @@ return this; }, + catmullRomTo(...points) { + CatmullRomTo( + points, + this.iterations, + this.pathData + ); + + this.lastPointX = points[points.length-2]; + this.lastPointY = points[points.length-1]; + return this; + }, + close() { // Line to first point var startX = this.pathData[0], @@ -1631,6 +1669,13 @@ return this; } + catmullRomTo(...points) { + this.builder.catmullRomTo(...points); + + this.dirty = true; + return this; + } + close() { this.builder.close(); diff --git a/dist/rexcustomprogressplugin.min.js b/dist/rexcustomprogressplugin.min.js index de3c77c045..d0f288f6f1 100644 --- a/dist/rexcustomprogressplugin.min.js +++ b/dist/rexcustomprogressplugin.min.js @@ -1 +1 @@ -var t,i;t=void 0,i=function(){const t=Phaser.GameObjects.GetCalcMatrix,i=Phaser.Renderer.Canvas.SetTransform;var e={renderWebGL:function(i,e,s,h){e.updateData(),s.addToRenderList(e);var r=i.pipelines.set(e.pipeline),a=t(e,s,h),n=r.calcMatrix.copyFrom(a.calc),o=e._displayOriginX,u=e._displayOriginY,l=s.alpha*e.alpha;i.pipelines.preBatch(e);for(var d,p=e.geom,c=0,v=p.length;c>>16,n=(65280&h)>>>8,o=255&h;t.fillStyle="rgba("+a+","+n+","+o+","+r+")"},v=function(t,i,e,s){var h=e||i.strokeColor,r=s||i.strokeAlpha,a=(16711680&h)>>>16,n=(65280&h)>>>8,o=255&h;t.strokeStyle="rgba("+a+","+n+","+o+","+r+")",t.lineWidth=i.lineWidth};const y=Phaser.Geom.Polygon.Earcut;class g extends u{constructor(){super(),this.pathData=[],this.pathIndexes=[],this.closePath=!1}updateData(){return this.pathIndexes=y(this.pathData),super.updateData(),this}webglRender(t,i,e,s,h){this.isFilled&&function(t,i,e,s,h,r){for(var a=l.getTintAppendFloatAlpha(e.fillColor,e.fillAlpha*s),n=e.pathData,o=e.pathIndexes,u=0;u=2){var h=e[s-2],r=e[s-1];if(t===h&&i===r)return e}return e.push(t,i),e};const f=Phaser.Math.DegToRad;var _=function(t,i,e,s,h,r,a,n,o){a&&r>h?r-=360:!a&&r0,a=0,n=i.length;a0;this.dirty=this.dirty||this._radiusTL!==t||this._convexTL!==i,this._convexTL=i,this._radiusTL=Math.abs(t)}get radiusTR(){return this._radiusTR}set radiusTR(t){var i=t>0;this.dirty=this.dirty||this._radiusTR!==t||this._convexTR!==i,this._convexTR=i,this._radiusTR=Math.abs(t)}get radiusBL(){return this._radiusBL}set radiusBL(t){var i=t>0;this.dirty=this.dirty||this._radiusBL!==t||this._convexBL!==i,this._convexBL=i,this._radiusBL=Math.abs(t)}get radiusBR(){return this._radiusBR}set radiusBR(t){var i=t>0;this.dirty=this.dirty||this._radiusBR!==t||this._convexBR!==i,this._convexBR=i,this._radiusBR=Math.abs(t)}get radius(){return Math.max(this.radiusTL,this.radiusTR,this.radiusBL,this.radiusBR)}set radius(t){"number"==typeof t?(this.radiusTL=t,this.radiusTR=t,this.radiusBL=t,this.radiusBR=t):(this.radiusTL=I(t,"tl",0),this.radiusTR=I(t,"tr",0),this.radiusBL=I(t,"bl",0),this.radiusBR=I(t,"br",0))}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}get iterations(){return this._iterations}set iterations(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t}setIterations(t){return this.iterations=t,this}updateData(){var t=this.pathData;t.length=0;var i,e=this.width,s=this.height,h=this.iterations+1;return(i=this.radiusTL)>0?this._convexTL?_(i,i,i,i,180,270,!1,h,t):_(0,0,i,i,90,0,!0,h,t):m(0,0,t),(i=this.radiusTR)>0?this._convexTR?_(e-i,i,i,i,270,360,!1,h,t):_(e,0,i,i,180,90,!0,h,t):m(e,0,t),(i=this.radiusBR)>0?this._convexBR?_(e-i,s-i,i,i,0,90,!1,h,t):_(e,s,i,i,270,180,!0,h,t):m(e,s,t),(i=this.radiusBL)>0?this._convexBL?_(i,s-i,i,i,90,180,!1,h,t):_(0,s,i,i,360,270,!0,h,t):m(0,s,t),t.push(t[0],t[1]),w(this.x,this.y,t),super.updateData(),this}},triangle:class extends u{constructor(t,i,e,s,h,r){void 0===t&&(t=0),void 0===i&&(i=0),void 0===e&&(e=0),void 0===s&&(s=0),void 0===h&&(h=0),void 0===r&&(r=0),super(),this.pathData=[],this.closePath=!0,this.setP0(t,i),this.setP1(e,s),this.setP2(h,r)}get x0(){return this._x0}set x0(t){this.dirty=this.dirty||this._x0!==t,this._x0=t}get y0(){return this._y0}set y0(t){this.dirty=this.dirty||this._y0!==t,this._y0=t}setP0(t,i){return this.x0=t,this.y0=i,this}get x1(){return this._x1}set x1(t){this.dirty=this.dirty||this._x1!==t,this._x1=t}get y1(){return this._y1}set y1(t){this.dirty=this.dirty||this._y1!==t,this._y1=t}setP1(t,i){return this.x1=t,this.y1=i,this}get x2(){return this._x2}set x2(t){this.dirty=this.dirty||this._x2!==t,this._x2=t}get y2(){return this._y2}set y2(t){this.dirty=this.dirty||this._y2!==t,this._y2=t}setP2(t,i){return this.dirty=this.dirty||this.x2!==t||this.y2!==i,this.x2=t,this.y2=i,this}updateData(){return this.pathData.length=0,this.pathData.push(this.x0,this.y0),this.pathData.push(this.x1,this.y1),this.pathData.push(this.x2,this.y2),this.pathData.push(this.x0,this.y0),super.updateData(),this}webglRender(t,i,e,s,h){if(this.isFilled){var r=U(this.fillColor,this.fillAlpha*e),a=this.x0-s,n=this.y0-h,o=this.x1-s,u=this.y1-h,l=this.x2-s,d=this.y2-h,c=i.getX(a,n),v=i.getY(a,n),y=i.getX(o,u),g=i.getY(o,u),m=i.getX(l,d),f=i.getY(l,d);t.batchTri(c,v,y,g,m,f,r,r,r)}this.isStroked&&p(t,this,e,s,h)}canvasRender(t,i,e){var s=this.x1-i,h=this.y1-e,r=this.x2-i,a=this.y2-e,n=this.x3-i,o=this.y3-e;t.beginPath(),t.moveTo(s,h),t.lineTo(r,a),t.lineTo(n,o),t.closePath(),this.isFilled&&(c(t,this),t.fill()),this.isStroked&&(v(t,this),t.stroke())}}},W=Phaser.Utils.Objects.GetValue,J=Phaser.Utils.Objects.IsPlainObject,K=function(){for(var t=this.getShapes(),i=0,e=t.length;i0?-this.delay:0,this.state=this.nowTime>=0?St:Tt,this.repeatCounter=0,this}stop(){return this.state=xt,this}update(t,i){this.state!==xt&&this.state!==wt&&0!==i&&0!==this.timeScale&&(this.nowTime+=i*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=kt)):(this.nowTime=this.duration,this.state=wt):this.nowTime>=0&&(this.state=St))}get t(){var t;switch(this.state){case xt:case Tt:case kt:t=0;break;case St:t=this.nowTime/this.duration;break;case wt:t=1}return Dt(t,0,1)}set t(t){(t=Dt(t,-1,1))<0?(this.state=Tt,this.nowTime=-this.delay*t):(this.state=St,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===xt}get isDelay(){return this.state===Tt}get isCountDown(){return this.state===St}get isRunning(){return this.state===Tt||this.state===St}get isDone(){return this.state===wt}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const xt=0,Tt=1,St=2,kt=3,wt=-1;class Rt extends ft{constructor(t,i){super(t,i),this.timer=new bt}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const Et=Phaser.Utils.Objects.GetValue,At=Phaser.Utils.Objects.GetAdvancedValue,Lt=Phaser.Tweens.Builders.GetEaseFunction;class Ct extends Rt{resetFromJSON(t){return this.timer.resetFromJSON(Et(t,"timer")),this.setEnable(Et(t,"enable",!0)),this.setTarget(Et(t,"target",this.parent)),this.setDelay(At(t,"delay",0)),this.setDuration(At(t,"duration",1e3)),this.setEase(Et(t,"ease","Linear")),this.setRepeat(Et(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Lt(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,i){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var e=this.target,s=this.timer;return s.update(t,i),s.isDelay||this.updateTarget(e,s),this.emit("update",e,this),s.isDone&&this.complete(),this}updateTarget(t,i){}}const Ot=Phaser.Utils.Objects.GetValue,Vt=Phaser.Math.Linear;class Xt extends Ct{constructor(t,i){super(t,i),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var i=this.target;this.propertyKey=Ot(t,"key","value");var e=i[this.propertyKey];return this.fromValue=Ot(t,"from",e),this.toValue=Ot(t,"to",e),this.setEase(Ot(t,"ease",this.ease)),this.setDuration(Ot(t,"duration",this.duration)),this.setRepeat(Ot(t,"repeat",0)),this.setDelay(Ot(t,"delay",0)),this.setRepeatDelay(Ot(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),i[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,i){var e=i.t;e=this.easeFn(e),t[this.propertyKey]=Vt(this.fromValue,this.toValue,e)}}const Yt=Phaser.Math.Percent;var jt={setEaseValuePropName:function(t){return this.easeValuePropName=t,this},setEaseValueDuration:function(t){return this.easeValueDuration=t,this},setEaseValueFunction:function(t){return this.easeFunction=t,this},stopEaseValue:function(){return this.easeValueTask&&this.easeValueTask.stop(),this},easeValueTo:function(t,i,e){return null==t||(void 0!==i&&(t=Yt(t,i,e)),void 0===this.easeValueTask&&(this.easeValueTask=new Xt(this,{eventEmitter:null})),this.easeValueTask.restart({key:this.easeValuePropName,to:t,duration:this.easeValueDuration,ease:this.easeFunction})),this},easeValueRepeat:function(t,i,e,s){return void 0===e&&(e=-1),void 0===s&&(s=0),void 0===this.easeValueTask&&(this.easeValueTask=new Xt(this,{eventEmitter:null})),this.easeValueTask.restart({key:this.easeValuePropName,from:t,to:i,duration:this.easeValueDuration,ease:this.easeFunction,repeat:e,repeatDelay:s}),this}};const Bt=Phaser.Utils.Objects.GetValue,Ft=Phaser.Math.Clamp,Mt=Phaser.Utils.Objects.GetValue,Gt=Phaser.Utils.Objects.IsPlainObject;class zt extends(function(t){class i extends t{bootProgressBase(t){this.eventEmitter=Bt(t,"eventEmitter",this);var i=Bt(t,"valuechangeCallback",null);if(null!==i){var e=Bt(t,"valuechangeCallbackScope",void 0);this.eventEmitter.on("valuechange",i,e)}return this.setEaseValuePropName("value").setEaseValueDuration(Bt(t,"easeValue.duration",0)).setEaseValueFunction(Bt(t,"easeValue.ease","Linear")),this}get value(){return this._value}set value(t){t=Ft(t,0,1);var i=this._value,e=i!=t;this.dirty=this.dirty||e,this._value=t,e&&this.eventEmitter.emit("valuechange",this._value,i,this.eventEmitter)}}return Object.assign(i.prototype,at,jt),i}(st)){constructor(t,i,e,s,h,r){Gt(i)&&(i=Mt(r=i,"x",0),e=Mt(r,"y",0),s=Mt(r,"width",2),h=Mt(r,"height",2)),void 0===r&&(r={}),r.type||(r.type="rexCustomProgress"),super(t,i,e,s,h,r),this.bootProgressBase(r),this.setValue(Mt(r,"value",0))}get centerX(){return this.width/2}get centerY(){return this.height/2}get radius(){return Math.min(this.centerX,this.centerY)}}function It(t,i,e,s,h){var r=new zt(this.scene,t,i,e,s,h);return this.scene.add.existing(r),r}const Ut=Phaser.Utils.Objects.GetAdvancedValue,Nt=Phaser.GameObjects.BuildGameObject;function Wt(t,i){void 0===t&&(t={}),void 0!==i&&(t.add=i);var e=Ut(t,"width",void 0),s=Ut(t,"height",e),h=new zt(this.scene,0,0,e,s,t);return Nt(this.scene,h,t),h}var Jt=function(t){return null==t||""===t||0===t.length};class Kt extends Phaser.Plugins.BasePlugin{constructor(t){super(t),t.registerGameObject("rexCustomProgress",It,Wt)}start(){this.game.events.on("destroy",this.destroy,this)}}return function(t,i,e,s){if(void 0===s&&(s="."),"object"==typeof t)if(Jt(i)){if(null==e)return;"object"==typeof e&&(t=e)}else{"string"==typeof i&&(i=i.split(s));var h=i.pop(),r=function(t,i,e){var s=t;if(Jt(i));else{var h;"string"==typeof i&&(i=i.split("."));for(var r=0,a=i.length;r>>16,n=(65280&h)>>>8,o=255&h;t.fillStyle="rgba("+a+","+n+","+o+","+r+")"},v=function(t,i,e,s){var h=e||i.strokeColor,r=s||i.strokeAlpha,a=(16711680&h)>>>16,n=(65280&h)>>>8,o=255&h;t.strokeStyle="rgba("+a+","+n+","+o+","+r+")",t.lineWidth=i.lineWidth};const g=Phaser.Geom.Polygon.Earcut;class y extends u{constructor(){super(),this.pathData=[],this.pathIndexes=[],this.closePath=!1}updateData(){return this.pathIndexes=g(this.pathData),super.updateData(),this}webglRender(t,i,e,s,h){this.isFilled&&function(t,i,e,s,h,r){for(var a=l.getTintAppendFloatAlpha(e.fillColor,e.fillAlpha*s),n=e.pathData,o=e.pathIndexes,u=0;u=2){var h=e[s-2],r=e[s-1];if(t===h&&i===r)return e}return e.push(t,i),e};const f=Phaser.Math.DegToRad;var _=function(t,i,e,s,h,r,a,n,o){a&&r>h?r-=360:!a&&r0,a=0,n=i.length;a0;this.dirty=this.dirty||this._radiusTL!==t||this._convexTL!==i,this._convexTL=i,this._radiusTL=Math.abs(t)}get radiusTR(){return this._radiusTR}set radiusTR(t){var i=t>0;this.dirty=this.dirty||this._radiusTR!==t||this._convexTR!==i,this._convexTR=i,this._radiusTR=Math.abs(t)}get radiusBL(){return this._radiusBL}set radiusBL(t){var i=t>0;this.dirty=this.dirty||this._radiusBL!==t||this._convexBL!==i,this._convexBL=i,this._radiusBL=Math.abs(t)}get radiusBR(){return this._radiusBR}set radiusBR(t){var i=t>0;this.dirty=this.dirty||this._radiusBR!==t||this._convexBR!==i,this._convexBR=i,this._radiusBR=Math.abs(t)}get radius(){return Math.max(this.radiusTL,this.radiusTR,this.radiusBL,this.radiusBR)}set radius(t){"number"==typeof t?(this.radiusTL=t,this.radiusTR=t,this.radiusBL=t,this.radiusBR=t):(this.radiusTL=U(t,"tl",0),this.radiusTR=U(t,"tr",0),this.radiusBL=U(t,"bl",0),this.radiusBR=U(t,"br",0))}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}get iterations(){return this._iterations}set iterations(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t}setIterations(t){return this.iterations=t,this}updateData(){var t=this.pathData;t.length=0;var i,e=this.width,s=this.height,h=this.iterations+1;return(i=this.radiusTL)>0?this._convexTL?_(i,i,i,i,180,270,!1,h,t):_(0,0,i,i,90,0,!0,h,t):m(0,0,t),(i=this.radiusTR)>0?this._convexTR?_(e-i,i,i,i,270,360,!1,h,t):_(e,0,i,i,180,90,!0,h,t):m(e,0,t),(i=this.radiusBR)>0?this._convexBR?_(e-i,s-i,i,i,0,90,!1,h,t):_(e,s,i,i,270,180,!0,h,t):m(e,s,t),(i=this.radiusBL)>0?this._convexBL?_(i,s-i,i,i,90,180,!1,h,t):_(0,s,i,i,360,270,!0,h,t):m(0,s,t),t.push(t[0],t[1]),R(this.x,this.y,t),super.updateData(),this}},triangle:class extends u{constructor(t,i,e,s,h,r){void 0===t&&(t=0),void 0===i&&(i=0),void 0===e&&(e=0),void 0===s&&(s=0),void 0===h&&(h=0),void 0===r&&(r=0),super(),this.pathData=[],this.closePath=!0,this.setP0(t,i),this.setP1(e,s),this.setP2(h,r)}get x0(){return this._x0}set x0(t){this.dirty=this.dirty||this._x0!==t,this._x0=t}get y0(){return this._y0}set y0(t){this.dirty=this.dirty||this._y0!==t,this._y0=t}setP0(t,i){return this.x0=t,this.y0=i,this}get x1(){return this._x1}set x1(t){this.dirty=this.dirty||this._x1!==t,this._x1=t}get y1(){return this._y1}set y1(t){this.dirty=this.dirty||this._y1!==t,this._y1=t}setP1(t,i){return this.x1=t,this.y1=i,this}get x2(){return this._x2}set x2(t){this.dirty=this.dirty||this._x2!==t,this._x2=t}get y2(){return this._y2}set y2(t){this.dirty=this.dirty||this._y2!==t,this._y2=t}setP2(t,i){return this.dirty=this.dirty||this.x2!==t||this.y2!==i,this.x2=t,this.y2=i,this}updateData(){return this.pathData.length=0,this.pathData.push(this.x0,this.y0),this.pathData.push(this.x1,this.y1),this.pathData.push(this.x2,this.y2),this.pathData.push(this.x0,this.y0),super.updateData(),this}webglRender(t,i,e,s,h){if(this.isFilled){var r=N(this.fillColor,this.fillAlpha*e),a=this.x0-s,n=this.y0-h,o=this.x1-s,u=this.y1-h,l=this.x2-s,d=this.y2-h,c=i.getX(a,n),v=i.getY(a,n),g=i.getX(o,u),y=i.getY(o,u),m=i.getX(l,d),f=i.getY(l,d);t.batchTri(c,v,g,y,m,f,r,r,r)}this.isStroked&&p(t,this,e,s,h)}canvasRender(t,i,e){var s=this.x1-i,h=this.y1-e,r=this.x2-i,a=this.y2-e,n=this.x3-i,o=this.y3-e;t.beginPath(),t.moveTo(s,h),t.lineTo(r,a),t.lineTo(n,o),t.closePath(),this.isFilled&&(c(t,this),t.fill()),this.isStroked&&(v(t,this),t.stroke())}}},J=Phaser.Utils.Objects.GetValue,K=Phaser.Utils.Objects.IsPlainObject,q=function(){for(var t=this.getShapes(),i=0,e=t.length;i0?-this.delay:0,this.state=this.nowTime>=0?kt:St,this.repeatCounter=0,this}stop(){return this.state=Tt,this}update(t,i){this.state!==Tt&&this.state!==Rt&&0!==i&&0!==this.timeScale&&(this.nowTime+=i*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=wt)):(this.nowTime=this.duration,this.state=Rt):this.nowTime>=0&&(this.state=kt))}get t(){var t;switch(this.state){case Tt:case St:case wt:t=0;break;case kt:t=this.nowTime/this.duration;break;case Rt:t=1}return bt(t,0,1)}set t(t){(t=bt(t,-1,1))<0?(this.state=St,this.nowTime=-this.delay*t):(this.state=kt,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===Tt}get isDelay(){return this.state===St}get isCountDown(){return this.state===kt}get isRunning(){return this.state===St||this.state===kt}get isDone(){return this.state===Rt}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const Tt=0,St=1,kt=2,wt=3,Rt=-1;class Et extends _t{constructor(t,i){super(t,i),this.timer=new xt}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const At=Phaser.Utils.Objects.GetValue,Lt=Phaser.Utils.Objects.GetAdvancedValue,Ct=Phaser.Tweens.Builders.GetEaseFunction;class Ot extends Et{resetFromJSON(t){return this.timer.resetFromJSON(At(t,"timer")),this.setEnable(At(t,"enable",!0)),this.setTarget(At(t,"target",this.parent)),this.setDelay(Lt(t,"delay",0)),this.setDuration(Lt(t,"duration",1e3)),this.setEase(At(t,"ease","Linear")),this.setRepeat(At(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Ct(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,i){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var e=this.target,s=this.timer;return s.update(t,i),s.isDelay||this.updateTarget(e,s),this.emit("update",e,this),s.isDone&&this.complete(),this}updateTarget(t,i){}}const Xt=Phaser.Utils.Objects.GetValue,Yt=Phaser.Math.Linear;class Vt extends Ot{constructor(t,i){super(t,i),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var i=this.target;this.propertyKey=Xt(t,"key","value");var e=i[this.propertyKey];return this.fromValue=Xt(t,"from",e),this.toValue=Xt(t,"to",e),this.setEase(Xt(t,"ease",this.ease)),this.setDuration(Xt(t,"duration",this.duration)),this.setRepeat(Xt(t,"repeat",0)),this.setDelay(Xt(t,"delay",0)),this.setRepeatDelay(Xt(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),i[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,i){var e=i.t;e=this.easeFn(e),t[this.propertyKey]=Yt(this.fromValue,this.toValue,e)}}const jt=Phaser.Math.Percent;var Bt={setEaseValuePropName:function(t){return this.easeValuePropName=t,this},setEaseValueDuration:function(t){return this.easeValueDuration=t,this},setEaseValueFunction:function(t){return this.easeFunction=t,this},stopEaseValue:function(){return this.easeValueTask&&this.easeValueTask.stop(),this},easeValueTo:function(t,i,e){return null==t||(void 0!==i&&(t=jt(t,i,e)),void 0===this.easeValueTask&&(this.easeValueTask=new Vt(this,{eventEmitter:null})),this.easeValueTask.restart({key:this.easeValuePropName,to:t,duration:this.easeValueDuration,ease:this.easeFunction})),this},easeValueRepeat:function(t,i,e,s){return void 0===e&&(e=-1),void 0===s&&(s=0),void 0===this.easeValueTask&&(this.easeValueTask=new Vt(this,{eventEmitter:null})),this.easeValueTask.restart({key:this.easeValuePropName,from:t,to:i,duration:this.easeValueDuration,ease:this.easeFunction,repeat:e,repeatDelay:s}),this}};const Ft=Phaser.Utils.Objects.GetValue,Mt=Phaser.Math.Clamp,Gt=Phaser.Utils.Objects.GetValue,zt=Phaser.Utils.Objects.IsPlainObject;class It extends(function(t){class i extends t{bootProgressBase(t){this.eventEmitter=Ft(t,"eventEmitter",this);var i=Ft(t,"valuechangeCallback",null);if(null!==i){var e=Ft(t,"valuechangeCallbackScope",void 0);this.eventEmitter.on("valuechange",i,e)}return this.setEaseValuePropName("value").setEaseValueDuration(Ft(t,"easeValue.duration",0)).setEaseValueFunction(Ft(t,"easeValue.ease","Linear")),this}get value(){return this._value}set value(t){t=Mt(t,0,1);var i=this._value,e=i!=t;this.dirty=this.dirty||e,this._value=t,e&&this.eventEmitter.emit("valuechange",this._value,i,this.eventEmitter)}}return Object.assign(i.prototype,nt,Bt),i}(ht)){constructor(t,i,e,s,h,r){zt(i)&&(i=Gt(r=i,"x",0),e=Gt(r,"y",0),s=Gt(r,"width",2),h=Gt(r,"height",2)),void 0===r&&(r={}),r.type||(r.type="rexCustomProgress"),super(t,i,e,s,h,r),this.bootProgressBase(r),this.setValue(Gt(r,"value",0))}get centerX(){return this.width/2}get centerY(){return this.height/2}get radius(){return Math.min(this.centerX,this.centerY)}}function Ut(t,i,e,s,h){var r=new It(this.scene,t,i,e,s,h);return this.scene.add.existing(r),r}const Nt=Phaser.Utils.Objects.GetAdvancedValue,Wt=Phaser.GameObjects.BuildGameObject;function Jt(t,i){void 0===t&&(t={}),void 0!==i&&(t.add=i);var e=Nt(t,"width",void 0),s=Nt(t,"height",e),h=new It(this.scene,0,0,e,s,t);return Wt(this.scene,h,t),h}var Kt=function(t){return null==t||""===t||0===t.length};class qt extends Phaser.Plugins.BasePlugin{constructor(t){super(t),t.registerGameObject("rexCustomProgress",Ut,Jt)}start(){this.game.events.on("destroy",this.destroy,this)}}return function(t,i,e,s){if(void 0===s&&(s="."),"object"==typeof t)if(Kt(i)){if(null==e)return;"object"==typeof e&&(t=e)}else{"string"==typeof i&&(i=i.split(s));var h=i.pop(),r=function(t,i,e){var s=t;if(Kt(i));else{var h;"string"==typeof i&&(i=i.split("."));for(var r=0,a=i.length;r>>16,n=(65280&h)>>>8,o=255&h;t.fillStyle="rgba("+a+","+n+","+o+","+r+")"},y=function(t,i,s,e){var h=s||i.strokeColor,r=e||i.strokeAlpha,a=(16711680&h)>>>16,n=(65280&h)>>>8,o=255&h;t.strokeStyle="rgba("+a+","+n+","+o+","+r+")",t.lineWidth=i.lineWidth};const g=Phaser.Geom.Polygon.Earcut;class v extends l{constructor(){super(),this.pathData=[],this.pathIndexes=[],this.closePath=!1}updateData(){return this.pathIndexes=g(this.pathData),super.updateData(),this}webglRender(t,i,s,e,h){this.isFilled&&function(t,i,s,e,h,r){for(var a=d.getTintAppendFloatAlpha(s.fillColor,s.fillAlpha*e),n=s.pathData,o=s.pathIndexes,l=0;l=2){var h=s[e-2],r=s[e-1];if(t===h&&i===r)return s}return s.push(t,i),s};const _=Phaser.Math.DegToRad;var D=function(t,i,s,e,h,r,a,n,o){a&&r>h?r-=360:!a&&r0,a=0,n=i.length;a0;this.dirty=this.dirty||this._radiusTL!==t||this._convexTL!==i,this._convexTL=i,this._radiusTL=Math.abs(t)}get radiusTR(){return this._radiusTR}set radiusTR(t){var i=t>0;this.dirty=this.dirty||this._radiusTR!==t||this._convexTR!==i,this._convexTR=i,this._radiusTR=Math.abs(t)}get radiusBL(){return this._radiusBL}set radiusBL(t){var i=t>0;this.dirty=this.dirty||this._radiusBL!==t||this._convexBL!==i,this._convexBL=i,this._radiusBL=Math.abs(t)}get radiusBR(){return this._radiusBR}set radiusBR(t){var i=t>0;this.dirty=this.dirty||this._radiusBR!==t||this._convexBR!==i,this._convexBR=i,this._radiusBR=Math.abs(t)}get radius(){return Math.max(this.radiusTL,this.radiusTR,this.radiusBL,this.radiusBR)}set radius(t){"number"==typeof t?(this.radiusTL=t,this.radiusTR=t,this.radiusBL=t,this.radiusBR=t):(this.radiusTL=U(t,"tl",0),this.radiusTR=U(t,"tr",0),this.radiusBL=U(t,"bl",0),this.radiusBR=U(t,"br",0))}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}get iterations(){return this._iterations}set iterations(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t}setIterations(t){return this.iterations=t,this}updateData(){var t=this.pathData;t.length=0;var i,s=this.width,e=this.height,h=this.iterations+1;return(i=this.radiusTL)>0?this._convexTL?D(i,i,i,i,180,270,!1,h,t):D(0,0,i,i,90,0,!0,h,t):f(0,0,t),(i=this.radiusTR)>0?this._convexTR?D(s-i,i,i,i,270,360,!1,h,t):D(s,0,i,i,180,90,!0,h,t):f(s,0,t),(i=this.radiusBR)>0?this._convexBR?D(s-i,e-i,i,i,0,90,!1,h,t):D(s,e,i,i,270,180,!0,h,t):f(s,e,t),(i=this.radiusBL)>0?this._convexBL?D(i,e-i,i,i,90,180,!1,h,t):D(0,e,i,i,360,270,!0,h,t):f(0,e,t),t.push(t[0],t[1]),k(this.x,this.y,t),super.updateData(),this}},triangle:class extends l{constructor(t,i,s,e,h,r){void 0===t&&(t=0),void 0===i&&(i=0),void 0===s&&(s=0),void 0===e&&(e=0),void 0===h&&(h=0),void 0===r&&(r=0),super(),this.pathData=[],this.closePath=!0,this.setP0(t,i),this.setP1(s,e),this.setP2(h,r)}get x0(){return this._x0}set x0(t){this.dirty=this.dirty||this._x0!==t,this._x0=t}get y0(){return this._y0}set y0(t){this.dirty=this.dirty||this._y0!==t,this._y0=t}setP0(t,i){return this.x0=t,this.y0=i,this}get x1(){return this._x1}set x1(t){this.dirty=this.dirty||this._x1!==t,this._x1=t}get y1(){return this._y1}set y1(t){this.dirty=this.dirty||this._y1!==t,this._y1=t}setP1(t,i){return this.x1=t,this.y1=i,this}get x2(){return this._x2}set x2(t){this.dirty=this.dirty||this._x2!==t,this._x2=t}get y2(){return this._y2}set y2(t){this.dirty=this.dirty||this._y2!==t,this._y2=t}setP2(t,i){return this.dirty=this.dirty||this.x2!==t||this.y2!==i,this.x2=t,this.y2=i,this}updateData(){return this.pathData.length=0,this.pathData.push(this.x0,this.y0),this.pathData.push(this.x1,this.y1),this.pathData.push(this.x2,this.y2),this.pathData.push(this.x0,this.y0),super.updateData(),this}webglRender(t,i,s,e,h){if(this.isFilled){var r=V(this.fillColor,this.fillAlpha*s),a=this.x0-e,n=this.y0-h,o=this.x1-e,l=this.y1-h,d=this.x2-e,u=this.y2-h,c=i.getX(a,n),y=i.getY(a,n),g=i.getX(o,l),v=i.getY(o,l),f=i.getX(d,u),_=i.getY(d,u);t.batchTri(c,y,g,v,f,_,r,r,r)}this.isStroked&&p(t,this,s,e,h)}canvasRender(t,i,s){var e=this.x1-i,h=this.y1-s,r=this.x2-i,a=this.y2-s,n=this.x3-i,o=this.y3-s;t.beginPath(),t.moveTo(e,h),t.lineTo(r,a),t.lineTo(n,o),t.closePath(),this.isFilled&&(c(t,this),t.fill()),this.isStroked&&(y(t,this),t.stroke())}}},N=Phaser.Utils.Objects.GetValue,E=Phaser.Utils.Objects.IsPlainObject,H=function(){for(var t=this.getShapes(),i=0,s=t.length;i>>16,n=(65280&h)>>>8,o=255&h;t.fillStyle="rgba("+a+","+n+","+o+","+r+")"},y=function(t,i,s,e){var h=s||i.strokeColor,r=e||i.strokeAlpha,a=(16711680&h)>>>16,n=(65280&h)>>>8,o=255&h;t.strokeStyle="rgba("+a+","+n+","+o+","+r+")",t.lineWidth=i.lineWidth};const g=Phaser.Geom.Polygon.Earcut;class v extends l{constructor(){super(),this.pathData=[],this.pathIndexes=[],this.closePath=!1}updateData(){return this.pathIndexes=g(this.pathData),super.updateData(),this}webglRender(t,i,s,e,h){this.isFilled&&function(t,i,s,e,h,r){for(var a=d.getTintAppendFloatAlpha(s.fillColor,s.fillAlpha*e),n=s.pathData,o=s.pathIndexes,l=0;l=2){var h=s[e-2],r=s[e-1];if(t===h&&i===r)return s}return s.push(t,i),s};const _=Phaser.Math.DegToRad;var D=function(t,i,s,e,h,r,a,n,o){a&&r>h?r-=360:!a&&r0,a=0,n=i.length;a0;this.dirty=this.dirty||this._radiusTL!==t||this._convexTL!==i,this._convexTL=i,this._radiusTL=Math.abs(t)}get radiusTR(){return this._radiusTR}set radiusTR(t){var i=t>0;this.dirty=this.dirty||this._radiusTR!==t||this._convexTR!==i,this._convexTR=i,this._radiusTR=Math.abs(t)}get radiusBL(){return this._radiusBL}set radiusBL(t){var i=t>0;this.dirty=this.dirty||this._radiusBL!==t||this._convexBL!==i,this._convexBL=i,this._radiusBL=Math.abs(t)}get radiusBR(){return this._radiusBR}set radiusBR(t){var i=t>0;this.dirty=this.dirty||this._radiusBR!==t||this._convexBR!==i,this._convexBR=i,this._radiusBR=Math.abs(t)}get radius(){return Math.max(this.radiusTL,this.radiusTR,this.radiusBL,this.radiusBR)}set radius(t){"number"==typeof t?(this.radiusTL=t,this.radiusTR=t,this.radiusBL=t,this.radiusBR=t):(this.radiusTL=V(t,"tl",0),this.radiusTR=V(t,"tr",0),this.radiusBL=V(t,"bl",0),this.radiusBR=V(t,"br",0))}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}get iterations(){return this._iterations}set iterations(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t}setIterations(t){return this.iterations=t,this}updateData(){var t=this.pathData;t.length=0;var i,s=this.width,e=this.height,h=this.iterations+1;return(i=this.radiusTL)>0?this._convexTL?D(i,i,i,i,180,270,!1,h,t):D(0,0,i,i,90,0,!0,h,t):f(0,0,t),(i=this.radiusTR)>0?this._convexTR?D(s-i,i,i,i,270,360,!1,h,t):D(s,0,i,i,180,90,!0,h,t):f(s,0,t),(i=this.radiusBR)>0?this._convexBR?D(s-i,e-i,i,i,0,90,!1,h,t):D(s,e,i,i,270,180,!0,h,t):f(s,e,t),(i=this.radiusBL)>0?this._convexBL?D(i,e-i,i,i,90,180,!1,h,t):D(0,e,i,i,360,270,!0,h,t):f(0,e,t),t.push(t[0],t[1]),k(this.x,this.y,t),super.updateData(),this}},triangle:class extends l{constructor(t,i,s,e,h,r){void 0===t&&(t=0),void 0===i&&(i=0),void 0===s&&(s=0),void 0===e&&(e=0),void 0===h&&(h=0),void 0===r&&(r=0),super(),this.pathData=[],this.closePath=!0,this.setP0(t,i),this.setP1(s,e),this.setP2(h,r)}get x0(){return this._x0}set x0(t){this.dirty=this.dirty||this._x0!==t,this._x0=t}get y0(){return this._y0}set y0(t){this.dirty=this.dirty||this._y0!==t,this._y0=t}setP0(t,i){return this.x0=t,this.y0=i,this}get x1(){return this._x1}set x1(t){this.dirty=this.dirty||this._x1!==t,this._x1=t}get y1(){return this._y1}set y1(t){this.dirty=this.dirty||this._y1!==t,this._y1=t}setP1(t,i){return this.x1=t,this.y1=i,this}get x2(){return this._x2}set x2(t){this.dirty=this.dirty||this._x2!==t,this._x2=t}get y2(){return this._y2}set y2(t){this.dirty=this.dirty||this._y2!==t,this._y2=t}setP2(t,i){return this.dirty=this.dirty||this.x2!==t||this.y2!==i,this.x2=t,this.y2=i,this}updateData(){return this.pathData.length=0,this.pathData.push(this.x0,this.y0),this.pathData.push(this.x1,this.y1),this.pathData.push(this.x2,this.y2),this.pathData.push(this.x0,this.y0),super.updateData(),this}webglRender(t,i,s,e,h){if(this.isFilled){var r=q(this.fillColor,this.fillAlpha*s),a=this.x0-e,n=this.y0-h,o=this.x1-e,l=this.y1-h,d=this.x2-e,u=this.y2-h,c=i.getX(a,n),y=i.getY(a,n),g=i.getX(o,l),v=i.getY(o,l),f=i.getX(d,u),_=i.getY(d,u);t.batchTri(c,y,g,v,f,_,r,r,r)}this.isStroked&&p(t,this,s,e,h)}canvasRender(t,i,s){var e=this.x1-i,h=this.y1-s,r=this.x2-i,a=this.y2-s,n=this.x3-i,o=this.y3-s;t.beginPath(),t.moveTo(e,h),t.lineTo(r,a),t.lineTo(n,o),t.closePath(),this.isFilled&&(c(t,this),t.fill()),this.isStroked&&(y(t,this),t.stroke())}}},E=Phaser.Utils.Objects.GetValue,H=Phaser.Utils.Objects.IsPlainObject,Q=function(){for(var t=this.getShapes(),i=0,s=t.length;i>>16,n=(65280&h)>>>8,o=255&h;t.fillStyle="rgba("+a+","+n+","+o+","+r+")"},y=function(t,i,s,e){var h=s||i.strokeColor,r=e||i.strokeAlpha,a=(16711680&h)>>>16,n=(65280&h)>>>8,o=255&h;t.strokeStyle="rgba("+a+","+n+","+o+","+r+")",t.lineWidth=i.lineWidth};const g=Phaser.Geom.Polygon.Earcut;class v extends l{constructor(){super(),this.pathData=[],this.pathIndexes=[],this.closePath=!1}updateData(){return this.pathIndexes=g(this.pathData),super.updateData(),this}webglRender(t,i,s,e,h){this.isFilled&&function(t,i,s,e,h,r){for(var a=d.getTintAppendFloatAlpha(s.fillColor,s.fillAlpha*e),n=s.pathData,o=s.pathIndexes,l=0;l=2){var h=s[e-2],r=s[e-1];if(t===h&&i===r)return s}return s.push(t,i),s};const _=Phaser.Math.DegToRad;var P=function(t,i,s,e,h,r,a,n,o){a&&r>h?r-=360:!a&&r0,a=0,n=i.length;a0;this.dirty=this.dirty||this._radiusTL!==t||this._convexTL!==i,this._convexTL=i,this._radiusTL=Math.abs(t)}get radiusTR(){return this._radiusTR}set radiusTR(t){var i=t>0;this.dirty=this.dirty||this._radiusTR!==t||this._convexTR!==i,this._convexTR=i,this._radiusTR=Math.abs(t)}get radiusBL(){return this._radiusBL}set radiusBL(t){var i=t>0;this.dirty=this.dirty||this._radiusBL!==t||this._convexBL!==i,this._convexBL=i,this._radiusBL=Math.abs(t)}get radiusBR(){return this._radiusBR}set radiusBR(t){var i=t>0;this.dirty=this.dirty||this._radiusBR!==t||this._convexBR!==i,this._convexBR=i,this._radiusBR=Math.abs(t)}get radius(){return Math.max(this.radiusTL,this.radiusTR,this.radiusBL,this.radiusBR)}set radius(t){"number"==typeof t?(this.radiusTL=t,this.radiusTR=t,this.radiusBL=t,this.radiusBR=t):(this.radiusTL=U(t,"tl",0),this.radiusTR=U(t,"tr",0),this.radiusBL=U(t,"bl",0),this.radiusBR=U(t,"br",0))}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}get iterations(){return this._iterations}set iterations(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t}setIterations(t){return this.iterations=t,this}updateData(){var t=this.pathData;t.length=0;var i,s=this.width,e=this.height,h=this.iterations+1;return(i=this.radiusTL)>0?this._convexTL?P(i,i,i,i,180,270,!1,h,t):P(0,0,i,i,90,0,!0,h,t):f(0,0,t),(i=this.radiusTR)>0?this._convexTR?P(s-i,i,i,i,270,360,!1,h,t):P(s,0,i,i,180,90,!0,h,t):f(s,0,t),(i=this.radiusBR)>0?this._convexBR?P(s-i,e-i,i,i,0,90,!1,h,t):P(s,e,i,i,270,180,!0,h,t):f(s,e,t),(i=this.radiusBL)>0?this._convexBL?P(i,e-i,i,i,90,180,!1,h,t):P(0,e,i,i,360,270,!0,h,t):f(0,e,t),t.push(t[0],t[1]),k(this.x,this.y,t),super.updateData(),this}},triangle:class extends l{constructor(t,i,s,e,h,r){void 0===t&&(t=0),void 0===i&&(i=0),void 0===s&&(s=0),void 0===e&&(e=0),void 0===h&&(h=0),void 0===r&&(r=0),super(),this.pathData=[],this.closePath=!0,this.setP0(t,i),this.setP1(s,e),this.setP2(h,r)}get x0(){return this._x0}set x0(t){this.dirty=this.dirty||this._x0!==t,this._x0=t}get y0(){return this._y0}set y0(t){this.dirty=this.dirty||this._y0!==t,this._y0=t}setP0(t,i){return this.x0=t,this.y0=i,this}get x1(){return this._x1}set x1(t){this.dirty=this.dirty||this._x1!==t,this._x1=t}get y1(){return this._y1}set y1(t){this.dirty=this.dirty||this._y1!==t,this._y1=t}setP1(t,i){return this.x1=t,this.y1=i,this}get x2(){return this._x2}set x2(t){this.dirty=this.dirty||this._x2!==t,this._x2=t}get y2(){return this._y2}set y2(t){this.dirty=this.dirty||this._y2!==t,this._y2=t}setP2(t,i){return this.dirty=this.dirty||this.x2!==t||this.y2!==i,this.x2=t,this.y2=i,this}updateData(){return this.pathData.length=0,this.pathData.push(this.x0,this.y0),this.pathData.push(this.x1,this.y1),this.pathData.push(this.x2,this.y2),this.pathData.push(this.x0,this.y0),super.updateData(),this}webglRender(t,i,s,e,h){if(this.isFilled){var r=V(this.fillColor,this.fillAlpha*s),a=this.x0-e,n=this.y0-h,o=this.x1-e,l=this.y1-h,d=this.x2-e,u=this.y2-h,c=i.getX(a,n),y=i.getY(a,n),g=i.getX(o,l),v=i.getY(o,l),f=i.getX(d,u),_=i.getY(d,u);t.batchTri(c,y,g,v,f,_,r,r,r)}this.isStroked&&p(t,this,s,e,h)}canvasRender(t,i,s){var e=this.x1-i,h=this.y1-s,r=this.x2-i,a=this.y2-s,n=this.x3-i,o=this.y3-s;t.beginPath(),t.moveTo(e,h),t.lineTo(r,a),t.lineTo(n,o),t.closePath(),this.isFilled&&(c(t,this),t.fill()),this.isStroked&&(y(t,this),t.stroke())}}},N=Phaser.Utils.Objects.GetValue,E=Phaser.Utils.Objects.IsPlainObject,H=function(){for(var t=this.getShapes(),i=0,s=t.length;i>>16,n=(65280&h)>>>8,o=255&h;t.fillStyle="rgba("+a+","+n+","+o+","+r+")"},g=function(t,i,s,e){var h=s||i.strokeColor,r=e||i.strokeAlpha,a=(16711680&h)>>>16,n=(65280&h)>>>8,o=255&h;t.strokeStyle="rgba("+a+","+n+","+o+","+r+")",t.lineWidth=i.lineWidth};const y=Phaser.Geom.Polygon.Earcut;class v extends l{constructor(){super(),this.pathData=[],this.pathIndexes=[],this.closePath=!1}updateData(){return this.pathIndexes=y(this.pathData),super.updateData(),this}webglRender(t,i,s,e,h){this.isFilled&&function(t,i,s,e,h,r){for(var a=d.getTintAppendFloatAlpha(s.fillColor,s.fillAlpha*e),n=s.pathData,o=s.pathIndexes,l=0;l=2){var h=s[e-2],r=s[e-1];if(t===h&&i===r)return s}return s.push(t,i),s};const _=Phaser.Math.DegToRad;var P=function(t,i,s,e,h,r,a,n,o){a&&r>h?r-=360:!a&&r0,a=0,n=i.length;a0;this.dirty=this.dirty||this._radiusTL!==t||this._convexTL!==i,this._convexTL=i,this._radiusTL=Math.abs(t)}get radiusTR(){return this._radiusTR}set radiusTR(t){var i=t>0;this.dirty=this.dirty||this._radiusTR!==t||this._convexTR!==i,this._convexTR=i,this._radiusTR=Math.abs(t)}get radiusBL(){return this._radiusBL}set radiusBL(t){var i=t>0;this.dirty=this.dirty||this._radiusBL!==t||this._convexBL!==i,this._convexBL=i,this._radiusBL=Math.abs(t)}get radiusBR(){return this._radiusBR}set radiusBR(t){var i=t>0;this.dirty=this.dirty||this._radiusBR!==t||this._convexBR!==i,this._convexBR=i,this._radiusBR=Math.abs(t)}get radius(){return Math.max(this.radiusTL,this.radiusTR,this.radiusBL,this.radiusBR)}set radius(t){"number"==typeof t?(this.radiusTL=t,this.radiusTR=t,this.radiusBL=t,this.radiusBR=t):(this.radiusTL=V(t,"tl",0),this.radiusTR=V(t,"tr",0),this.radiusBL=V(t,"bl",0),this.radiusBR=V(t,"br",0))}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}get iterations(){return this._iterations}set iterations(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t}setIterations(t){return this.iterations=t,this}updateData(){var t=this.pathData;t.length=0;var i,s=this.width,e=this.height,h=this.iterations+1;return(i=this.radiusTL)>0?this._convexTL?P(i,i,i,i,180,270,!1,h,t):P(0,0,i,i,90,0,!0,h,t):f(0,0,t),(i=this.radiusTR)>0?this._convexTR?P(s-i,i,i,i,270,360,!1,h,t):P(s,0,i,i,180,90,!0,h,t):f(s,0,t),(i=this.radiusBR)>0?this._convexBR?P(s-i,e-i,i,i,0,90,!1,h,t):P(s,e,i,i,270,180,!0,h,t):f(s,e,t),(i=this.radiusBL)>0?this._convexBL?P(i,e-i,i,i,90,180,!1,h,t):P(0,e,i,i,360,270,!0,h,t):f(0,e,t),t.push(t[0],t[1]),k(this.x,this.y,t),super.updateData(),this}},triangle:class extends l{constructor(t,i,s,e,h,r){void 0===t&&(t=0),void 0===i&&(i=0),void 0===s&&(s=0),void 0===e&&(e=0),void 0===h&&(h=0),void 0===r&&(r=0),super(),this.pathData=[],this.closePath=!0,this.setP0(t,i),this.setP1(s,e),this.setP2(h,r)}get x0(){return this._x0}set x0(t){this.dirty=this.dirty||this._x0!==t,this._x0=t}get y0(){return this._y0}set y0(t){this.dirty=this.dirty||this._y0!==t,this._y0=t}setP0(t,i){return this.x0=t,this.y0=i,this}get x1(){return this._x1}set x1(t){this.dirty=this.dirty||this._x1!==t,this._x1=t}get y1(){return this._y1}set y1(t){this.dirty=this.dirty||this._y1!==t,this._y1=t}setP1(t,i){return this.x1=t,this.y1=i,this}get x2(){return this._x2}set x2(t){this.dirty=this.dirty||this._x2!==t,this._x2=t}get y2(){return this._y2}set y2(t){this.dirty=this.dirty||this._y2!==t,this._y2=t}setP2(t,i){return this.dirty=this.dirty||this.x2!==t||this.y2!==i,this.x2=t,this.y2=i,this}updateData(){return this.pathData.length=0,this.pathData.push(this.x0,this.y0),this.pathData.push(this.x1,this.y1),this.pathData.push(this.x2,this.y2),this.pathData.push(this.x0,this.y0),super.updateData(),this}webglRender(t,i,s,e,h){if(this.isFilled){var r=q(this.fillColor,this.fillAlpha*s),a=this.x0-e,n=this.y0-h,o=this.x1-e,l=this.y1-h,d=this.x2-e,u=this.y2-h,c=i.getX(a,n),g=i.getY(a,n),y=i.getX(o,l),v=i.getY(o,l),f=i.getX(d,u),_=i.getY(d,u);t.batchTri(c,g,y,v,f,_,r,r,r)}this.isStroked&&p(t,this,s,e,h)}canvasRender(t,i,s){var e=this.x1-i,h=this.y1-s,r=this.x2-i,a=this.y2-s,n=this.x3-i,o=this.y3-s;t.beginPath(),t.moveTo(e,h),t.lineTo(r,a),t.lineTo(n,o),t.closePath(),this.isFilled&&(c(t,this),t.fill()),this.isStroked&&(g(t,this),t.stroke())}}},E=Phaser.Utils.Objects.GetValue,H=Phaser.Utils.Objects.IsPlainObject,Q=function(){for(var t=this.getShapes(),i=0,s=t.length;i0?-this.delay:0,this.state=this.nowTime>=0?S:b,this.repeatCounter=0,this}stop(){return this.state=x,this}update(t,i){this.state!==x&&this.state!==R&&0!==i&&0!==this.timeScale&&(this.nowTime+=i*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=k)):(this.nowTime=this.duration,this.state=R):this.nowTime>=0&&(this.state=S))}get t(){var t;switch(this.state){case x:case b:case k:t=0;break;case S:t=this.nowTime/this.duration;break;case R:t=1}return P(t,0,1)}set t(t){(t=P(t,-1,1))<0?(this.state=b,this.nowTime=-this.delay*t):(this.state=S,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===x}get isDelay(){return this.state===b}get isCountDown(){return this.state===S}get isRunning(){return this.state===b||this.state===S}get isDone(){return this.state===R}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const x=0,b=1,S=2,k=3,R=-1;class w extends m{constructor(t,i){super(t,i),this.timer=new T}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const E=Phaser.Utils.Objects.GetValue,A=Phaser.Utils.Objects.GetAdvancedValue,C=Phaser.Tweens.Builders.GetEaseFunction;class L extends w{resetFromJSON(t){return this.timer.resetFromJSON(E(t,"timer")),this.setEnable(E(t,"enable",!0)),this.setTarget(E(t,"target",this.parent)),this.setDelay(A(t,"delay",0)),this.setDuration(A(t,"duration",1e3)),this.setEase(E(t,"ease","Linear")),this.setRepeat(E(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=C(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,i){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var s=this.target,e=this.timer;return e.update(t,i),e.isDelay||this.updateTarget(s,e),this.emit("update",s,this),e.isDone&&this.complete(),this}updateTarget(t,i){}}const X=Phaser.Utils.Objects.GetValue,Y=Phaser.Math.Linear;class B extends L{constructor(t,i){super(t,i),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var i=this.target;this.propertyKey=X(t,"key","value");var s=i[this.propertyKey];return this.fromValue=X(t,"from",s),this.toValue=X(t,"to",s),this.setEase(X(t,"ease",this.ease)),this.setDuration(X(t,"duration",this.duration)),this.setRepeat(X(t,"repeat",0)),this.setDelay(X(t,"delay",0)),this.setRepeatDelay(X(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),i[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,i){var s=i.t;s=this.easeFn(s),t[this.propertyKey]=Y(this.fromValue,this.toValue,s)}}var O={start:function(t){return this.easeValueTask||(this.easeValueTask=new B(this,{eventEmitter:null})),void 0!==t&&(this.duration=t,this.easeValueTask.stop()),this.easeValueTask.isRunning||(this.easeValueTask.restart({key:"value",from:0,to:1,duration:this.duration,ease:this.ease,repeat:-1,delay:this.delay,repeatDelay:this.repeatDelay}),this.setDirty()),this},stop:function(){return this.easeValueTask?(this.easeValueTask.stop(),this.setDirty(),this):this},pause:function(){return this.easeValueTask?(this.easeValueTask.pause(),this.setDirty(),this):this},resume:function(){return this.easeValueTask?(this.easeValueTask.pause(),this.setDirty(),this):this}};const F=Phaser.Utils.Objects.GetValue;class j extends a{constructor(t,i){super(t,F(i,"x",0),F(i,"y",0),F(i,"width",64),F(i,"height",64)),this.resetFromConfig(i,!0),this.buildShapes(i),F(i,"start",!0)&&this.start()}resetFromConfig(t,i){var s;return void 0===i&&(i=!1),s=i?1e3:this.duration,this.setDuration(F(t,"duration",s)),s=i?"Linear":this.ease,this.setEase(F(t,"ease",s)),s=i?0:this.delay,this.setDelay(F(t,"delay",s)),s=i?0:this.repeatDelay,this.setRepeatDelay(F(t,"repeatDelay",s)),s=i?16777215:this.color,this.setColor(F(t,"color",s)),s=i?0:this.value,this.setValue(F(t,"value",s)),this}buildShapes(){}get centerX(){return this.width/2}get centerY(){return this.height/2}get radius(){return Math.min(this.centerX,this.centerY)}get color(){return this._color}set color(t){this.isColorChanged=this.isColorChanged||this._color!==t,this.dirty=this.dirty||this.isColorChanged,this._color=t,this.setShapesColor(t)}setColor(t){return this.color=t,this}setShapesColor(t){}get value(){return this._value}set value(t){t=Phaser.Math.Clamp(t,0,1),this.dirty=this.dirty||this._value!=t,this._value=t}setValue(t){return this.value=t,this}setDuration(t){return this.duration=t,this}setDelay(t){return this.delay=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return this.ease=t,this}get isRunning(){return!!this.tweenTask&&this.tweenTask.isRunning}}Object.assign(j.prototype,O);var M={fillStyle:function(t,i){return null==t?this.isFilled=!1:(void 0===i&&(i=1),this.isFilled=!0,this.fillColor=t,this.fillAlpha=i),this},lineStyle:function(t,i,s){return null==t||null==i?this.isStroked=!1:(void 0===s&&(s=1),this.isStroked=!0,this.lineWidth=t,this.strokeColor=i,this.strokeAlpha=s),this}},V={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,i){if(this.enableData(),1===arguments.length){var s=t;for(t in s)this.data[t]=s[t]}else this.data[t]=i;return this},getData(t,i){return this.enableData(),void 0===t?this.data:function(t,i,s){if(!t||"number"==typeof t)return s;if("string"==typeof i){if(t.hasOwnProperty(i))return t[i];if(-1===i.indexOf("."))return s;i=i.split(".")}for(var e=i,h=t,r=s,a=0;a>>16,n=(65280&h)>>>8,o=255&h;t.fillStyle="rgba("+a+","+n+","+o+","+r+")"},N=function(t,i,s,e){var h=s||i.strokeColor,r=e||i.strokeAlpha,a=(16711680&h)>>>16,n=(65280&h)>>>8,o=255&h;t.strokeStyle="rgba("+a+","+n+","+o+","+r+")",t.lineWidth=i.lineWidth};const J=Phaser.Geom.Polygon.Earcut;class K extends z{constructor(){super(),this.pathData=[],this.pathIndexes=[],this.closePath=!1}updateData(){return this.pathIndexes=J(this.pathData),super.updateData(),this}webglRender(t,i,s,e,h){this.isFilled&&function(t,i,s,e,h,r){for(var a=G.getTintAppendFloatAlpha(s.fillColor,s.fillAlpha*e),n=s.pathData,o=s.pathIndexes,u=0;u=2){var h=s[e-2],r=s[e-1];if(t===h&&i===r)return s}return s.push(t,i),s};const H=Phaser.Math.DegToRad;var Q=function(t,i,s,e,h,r,a,n,o){a&&r>h?r-=360:!a&&r0,a=0,n=i.length;a0;this.dirty=this.dirty||this._radiusTL!==t||this._convexTL!==i,this._convexTL=i,this._radiusTL=Math.abs(t)}get radiusTR(){return this._radiusTR}set radiusTR(t){var i=t>0;this.dirty=this.dirty||this._radiusTR!==t||this._convexTR!==i,this._convexTR=i,this._radiusTR=Math.abs(t)}get radiusBL(){return this._radiusBL}set radiusBL(t){var i=t>0;this.dirty=this.dirty||this._radiusBL!==t||this._convexBL!==i,this._convexBL=i,this._radiusBL=Math.abs(t)}get radiusBR(){return this._radiusBR}set radiusBR(t){var i=t>0;this.dirty=this.dirty||this._radiusBR!==t||this._convexBR!==i,this._convexBR=i,this._radiusBR=Math.abs(t)}get radius(){return Math.max(this.radiusTL,this.radiusTR,this.radiusBL,this.radiusBR)}set radius(t){"number"==typeof t?(this.radiusTL=t,this.radiusTR=t,this.radiusBL=t,this.radiusBR=t):(this.radiusTL=Pt(t,"tl",0),this.radiusTR=Pt(t,"tr",0),this.radiusBL=Pt(t,"bl",0),this.radiusBR=Pt(t,"br",0))}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}get iterations(){return this._iterations}set iterations(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t}setIterations(t){return this.iterations=t,this}updateData(){var t=this.pathData;t.length=0;var i,s=this.width,e=this.height,h=this.iterations+1;return(i=this.radiusTL)>0?this._convexTL?Q(i,i,i,i,180,270,!1,h,t):Q(0,0,i,i,90,0,!0,h,t):q(0,0,t),(i=this.radiusTR)>0?this._convexTR?Q(s-i,i,i,i,270,360,!1,h,t):Q(s,0,i,i,180,90,!0,h,t):q(s,0,t),(i=this.radiusBR)>0?this._convexBR?Q(s-i,e-i,i,i,0,90,!1,h,t):Q(s,e,i,i,270,180,!0,h,t):q(s,e,t),(i=this.radiusBL)>0?this._convexBL?Q(i,e-i,i,i,90,180,!1,h,t):Q(0,e,i,i,360,270,!0,h,t):q(0,e,t),t.push(t[0],t[1]),rt(this.x,this.y,t),super.updateData(),this}},triangle:class extends z{constructor(t,i,s,e,h,r){void 0===t&&(t=0),void 0===i&&(i=0),void 0===s&&(s=0),void 0===e&&(e=0),void 0===h&&(h=0),void 0===r&&(r=0),super(),this.pathData=[],this.closePath=!0,this.setP0(t,i),this.setP1(s,e),this.setP2(h,r)}get x0(){return this._x0}set x0(t){this.dirty=this.dirty||this._x0!==t,this._x0=t}get y0(){return this._y0}set y0(t){this.dirty=this.dirty||this._y0!==t,this._y0=t}setP0(t,i){return this.x0=t,this.y0=i,this}get x1(){return this._x1}set x1(t){this.dirty=this.dirty||this._x1!==t,this._x1=t}get y1(){return this._y1}set y1(t){this.dirty=this.dirty||this._y1!==t,this._y1=t}setP1(t,i){return this.x1=t,this.y1=i,this}get x2(){return this._x2}set x2(t){this.dirty=this.dirty||this._x2!==t,this._x2=t}get y2(){return this._y2}set y2(t){this.dirty=this.dirty||this._y2!==t,this._y2=t}setP2(t,i){return this.dirty=this.dirty||this.x2!==t||this.y2!==i,this.x2=t,this.y2=i,this}updateData(){return this.pathData.length=0,this.pathData.push(this.x0,this.y0),this.pathData.push(this.x1,this.y1),this.pathData.push(this.x2,this.y2),this.pathData.push(this.x0,this.y0),super.updateData(),this}webglRender(t,i,s,e,h){if(this.isFilled){var r=Tt(this.fillColor,this.fillAlpha*s),a=this.x0-e,n=this.y0-h,o=this.x1-e,u=this.y1-h,l=this.x2-e,d=this.y2-h,p=i.getX(a,n),c=i.getY(a,n),y=i.getX(o,u),g=i.getY(o,u),v=i.getX(l,d),_=i.getY(l,d);t.batchTri(p,c,y,g,v,_,r,r,r)}this.isStroked&&U(t,this,s,e,h)}canvasRender(t,i,s){var e=this.x1-i,h=this.y1-s,r=this.x2-i,a=this.y2-s,n=this.x3-i,o=this.y3-s;t.beginPath(),t.moveTo(e,h),t.lineTo(r,a),t.lineTo(n,o),t.closePath(),this.isFilled&&(W(t,this),t.fill()),this.isStroked&&(N(t,this),t.stroke())}}},bt=Phaser.Utils.Objects.GetValue,St=Phaser.Utils.Objects.IsPlainObject,kt=function(){for(var t=this.getShapes(),i=0,s=t.length;i0?-this.delay:0,this.state=this.nowTime>=0?S:b,this.repeatCounter=0,this}stop(){return this.state=x,this}update(t,i){this.state!==x&&this.state!==R&&0!==i&&0!==this.timeScale&&(this.nowTime+=i*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=k)):(this.nowTime=this.duration,this.state=R):this.nowTime>=0&&(this.state=S))}get t(){var t;switch(this.state){case x:case b:case k:t=0;break;case S:t=this.nowTime/this.duration;break;case R:t=1}return P(t,0,1)}set t(t){(t=P(t,-1,1))<0?(this.state=b,this.nowTime=-this.delay*t):(this.state=S,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===x}get isDelay(){return this.state===b}get isCountDown(){return this.state===S}get isRunning(){return this.state===b||this.state===S}get isDone(){return this.state===R}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const x=0,b=1,S=2,k=3,R=-1;class w extends _{constructor(t,i){super(t,i),this.timer=new T}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const E=Phaser.Utils.Objects.GetValue,A=Phaser.Utils.Objects.GetAdvancedValue,C=Phaser.Tweens.Builders.GetEaseFunction;class L extends w{resetFromJSON(t){return this.timer.resetFromJSON(E(t,"timer")),this.setEnable(E(t,"enable",!0)),this.setTarget(E(t,"target",this.parent)),this.setDelay(A(t,"delay",0)),this.setDuration(A(t,"duration",1e3)),this.setEase(E(t,"ease","Linear")),this.setRepeat(E(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=C(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,i){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var s=this.target,e=this.timer;return e.update(t,i),e.isDelay||this.updateTarget(s,e),this.emit("update",s,this),e.isDone&&this.complete(),this}updateTarget(t,i){}}const X=Phaser.Utils.Objects.GetValue,Y=Phaser.Math.Linear;class B extends L{constructor(t,i){super(t,i),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var i=this.target;this.propertyKey=X(t,"key","value");var s=i[this.propertyKey];return this.fromValue=X(t,"from",s),this.toValue=X(t,"to",s),this.setEase(X(t,"ease",this.ease)),this.setDuration(X(t,"duration",this.duration)),this.setRepeat(X(t,"repeat",0)),this.setDelay(X(t,"delay",0)),this.setRepeatDelay(X(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),i[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,i){var s=i.t;s=this.easeFn(s),t[this.propertyKey]=Y(this.fromValue,this.toValue,s)}}var O={start:function(t){return this.easeValueTask||(this.easeValueTask=new B(this,{eventEmitter:null})),void 0!==t&&(this.duration=t,this.easeValueTask.stop()),this.easeValueTask.isRunning||(this.easeValueTask.restart({key:"value",from:0,to:1,duration:this.duration,ease:this.ease,repeat:-1,delay:this.delay,repeatDelay:this.repeatDelay}),this.setDirty()),this},stop:function(){return this.easeValueTask?(this.easeValueTask.stop(),this.setDirty(),this):this},pause:function(){return this.easeValueTask?(this.easeValueTask.pause(),this.setDirty(),this):this},resume:function(){return this.easeValueTask?(this.easeValueTask.pause(),this.setDirty(),this):this}};const F=Phaser.Utils.Objects.GetValue;class M extends a{constructor(t,i){super(t,F(i,"x",0),F(i,"y",0),F(i,"width",64),F(i,"height",64)),this.resetFromConfig(i,!0),this.buildShapes(i),F(i,"start",!0)&&this.start()}resetFromConfig(t,i){var s;return void 0===i&&(i=!1),s=i?1e3:this.duration,this.setDuration(F(t,"duration",s)),s=i?"Linear":this.ease,this.setEase(F(t,"ease",s)),s=i?0:this.delay,this.setDelay(F(t,"delay",s)),s=i?0:this.repeatDelay,this.setRepeatDelay(F(t,"repeatDelay",s)),s=i?16777215:this.color,this.setColor(F(t,"color",s)),s=i?0:this.value,this.setValue(F(t,"value",s)),this}buildShapes(){}get centerX(){return this.width/2}get centerY(){return this.height/2}get radius(){return Math.min(this.centerX,this.centerY)}get color(){return this._color}set color(t){this.isColorChanged=this.isColorChanged||this._color!==t,this.dirty=this.dirty||this.isColorChanged,this._color=t,this.setShapesColor(t)}setColor(t){return this.color=t,this}setShapesColor(t){}get value(){return this._value}set value(t){t=Phaser.Math.Clamp(t,0,1),this.dirty=this.dirty||this._value!=t,this._value=t}setValue(t){return this.value=t,this}setDuration(t){return this.duration=t,this}setDelay(t){return this.delay=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return this.ease=t,this}get isRunning(){return!!this.tweenTask&&this.tweenTask.isRunning}}Object.assign(M.prototype,O);var j={fillStyle:function(t,i){return null==t?this.isFilled=!1:(void 0===i&&(i=1),this.isFilled=!0,this.fillColor=t,this.fillAlpha=i),this},lineStyle:function(t,i,s){return null==t||null==i?this.isStroked=!1:(void 0===s&&(s=1),this.isStroked=!0,this.lineWidth=t,this.strokeColor=i,this.strokeAlpha=s),this}},V={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,i){if(this.enableData(),1===arguments.length){var s=t;for(t in s)this.data[t]=s[t]}else this.data[t]=i;return this},getData(t,i){return this.enableData(),void 0===t?this.data:function(t,i,s){if(!t||"number"==typeof t)return s;if("string"==typeof i){if(t.hasOwnProperty(i))return t[i];if(-1===i.indexOf("."))return s;i=i.split(".")}for(var e=i,h=t,r=s,a=0;a>>16,n=(65280&h)>>>8,o=255&h;t.fillStyle="rgba("+a+","+n+","+o+","+r+")"},N=function(t,i,s,e){var h=s||i.strokeColor,r=e||i.strokeAlpha,a=(16711680&h)>>>16,n=(65280&h)>>>8,o=255&h;t.strokeStyle="rgba("+a+","+n+","+o+","+r+")",t.lineWidth=i.lineWidth};const J=Phaser.Geom.Polygon.Earcut;class K extends z{constructor(){super(),this.pathData=[],this.pathIndexes=[],this.closePath=!1}updateData(){return this.pathIndexes=J(this.pathData),super.updateData(),this}webglRender(t,i,s,e,h){this.isFilled&&function(t,i,s,e,h,r){for(var a=G.getTintAppendFloatAlpha(s.fillColor,s.fillAlpha*e),n=s.pathData,o=s.pathIndexes,u=0;u=2){var h=s[e-2],r=s[e-1];if(t===h&&i===r)return s}return s.push(t,i),s};const H=Phaser.Math.DegToRad;var Q=function(t,i,s,e,h,r,a,n,o){a&&r>h?r-=360:!a&&r0,a=0,n=i.length;a0;this.dirty=this.dirty||this._radiusTL!==t||this._convexTL!==i,this._convexTL=i,this._radiusTL=Math.abs(t)}get radiusTR(){return this._radiusTR}set radiusTR(t){var i=t>0;this.dirty=this.dirty||this._radiusTR!==t||this._convexTR!==i,this._convexTR=i,this._radiusTR=Math.abs(t)}get radiusBL(){return this._radiusBL}set radiusBL(t){var i=t>0;this.dirty=this.dirty||this._radiusBL!==t||this._convexBL!==i,this._convexBL=i,this._radiusBL=Math.abs(t)}get radiusBR(){return this._radiusBR}set radiusBR(t){var i=t>0;this.dirty=this.dirty||this._radiusBR!==t||this._convexBR!==i,this._convexBR=i,this._radiusBR=Math.abs(t)}get radius(){return Math.max(this.radiusTL,this.radiusTR,this.radiusBL,this.radiusBR)}set radius(t){"number"==typeof t?(this.radiusTL=t,this.radiusTR=t,this.radiusBL=t,this.radiusBR=t):(this.radiusTL=Tt(t,"tl",0),this.radiusTR=Tt(t,"tr",0),this.radiusBL=Tt(t,"bl",0),this.radiusBR=Tt(t,"br",0))}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}get iterations(){return this._iterations}set iterations(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t}setIterations(t){return this.iterations=t,this}updateData(){var t=this.pathData;t.length=0;var i,s=this.width,e=this.height,h=this.iterations+1;return(i=this.radiusTL)>0?this._convexTL?Q(i,i,i,i,180,270,!1,h,t):Q(0,0,i,i,90,0,!0,h,t):q(0,0,t),(i=this.radiusTR)>0?this._convexTR?Q(s-i,i,i,i,270,360,!1,h,t):Q(s,0,i,i,180,90,!0,h,t):q(s,0,t),(i=this.radiusBR)>0?this._convexBR?Q(s-i,e-i,i,i,0,90,!1,h,t):Q(s,e,i,i,270,180,!0,h,t):q(s,e,t),(i=this.radiusBL)>0?this._convexBL?Q(i,e-i,i,i,90,180,!1,h,t):Q(0,e,i,i,360,270,!0,h,t):q(0,e,t),t.push(t[0],t[1]),at(this.x,this.y,t),super.updateData(),this}},triangle:class extends z{constructor(t,i,s,e,h,r){void 0===t&&(t=0),void 0===i&&(i=0),void 0===s&&(s=0),void 0===e&&(e=0),void 0===h&&(h=0),void 0===r&&(r=0),super(),this.pathData=[],this.closePath=!0,this.setP0(t,i),this.setP1(s,e),this.setP2(h,r)}get x0(){return this._x0}set x0(t){this.dirty=this.dirty||this._x0!==t,this._x0=t}get y0(){return this._y0}set y0(t){this.dirty=this.dirty||this._y0!==t,this._y0=t}setP0(t,i){return this.x0=t,this.y0=i,this}get x1(){return this._x1}set x1(t){this.dirty=this.dirty||this._x1!==t,this._x1=t}get y1(){return this._y1}set y1(t){this.dirty=this.dirty||this._y1!==t,this._y1=t}setP1(t,i){return this.x1=t,this.y1=i,this}get x2(){return this._x2}set x2(t){this.dirty=this.dirty||this._x2!==t,this._x2=t}get y2(){return this._y2}set y2(t){this.dirty=this.dirty||this._y2!==t,this._y2=t}setP2(t,i){return this.dirty=this.dirty||this.x2!==t||this.y2!==i,this.x2=t,this.y2=i,this}updateData(){return this.pathData.length=0,this.pathData.push(this.x0,this.y0),this.pathData.push(this.x1,this.y1),this.pathData.push(this.x2,this.y2),this.pathData.push(this.x0,this.y0),super.updateData(),this}webglRender(t,i,s,e,h){if(this.isFilled){var r=xt(this.fillColor,this.fillAlpha*s),a=this.x0-e,n=this.y0-h,o=this.x1-e,u=this.y1-h,l=this.x2-e,d=this.y2-h,p=i.getX(a,n),c=i.getY(a,n),y=i.getX(o,u),g=i.getY(o,u),v=i.getX(l,d),m=i.getY(l,d);t.batchTri(p,c,y,g,v,m,r,r,r)}this.isStroked&&U(t,this,s,e,h)}canvasRender(t,i,s){var e=this.x1-i,h=this.y1-s,r=this.x2-i,a=this.y2-s,n=this.x3-i,o=this.y3-s;t.beginPath(),t.moveTo(e,h),t.lineTo(r,a),t.lineTo(n,o),t.closePath(),this.isFilled&&(W(t,this),t.fill()),this.isStroked&&(N(t,this),t.stroke())}}},St=Phaser.Utils.Objects.GetValue,kt=Phaser.Utils.Objects.IsPlainObject,Rt=function(){for(var t=this.getShapes(),i=0,s=t.length;i=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const k=Phaser.Math.DegToRad;var _={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=k(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},T={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=O(t.scaleX,i.scaleX),e.scaleY=O(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},E={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=O(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},D={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},R={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},L={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},X={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(t){void 0===t&&(t=!1);var e=this;return this._mask=null,this.setChildMaskVisible(this),this.children.forEach((function(t){t.clearMask&&t.clearMask(!1),t.hasOwnProperty("isRexContainerLite")||e.setChildMaskVisible(t)})),t&&this.mask&&this.mask.destroy(),this}},Y=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},W=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const j=Phaser.Utils.Array;var I={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Ee=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const Me=/(\S+)\[(\d+)\]/i,De=Phaser.Utils.Objects.GetValue;var Re=function(t,e){return void 0===e?t:t[e]},Le=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=De(e,"left",0),t.right=De(e,"right",0),t.top=De(e,"top",0),t.bottom=De(e,"bottom",0)),t},Xe={getInnerPadding(t){return Re(this.space,t)},setInnerPadding(t,e){return Le(this.space,t,e),this},getOuterPadding(t){return Re(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Le(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Re(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Le(this.getSizerConfig(t).padding,e,i),this}},Ye=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},ze=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Ae=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},We=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Be=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},je=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Ie={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Fe=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?bi:mi,this.repeatCounter=0,this}stop(){return this.state=fi,this}update(t,e){this.state!==fi&&this.state!==Ci&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=yi)):(this.nowTime=this.duration,this.state=Ci):this.nowTime>=0&&(this.state=bi))}get t(){var t;switch(this.state){case fi:case mi:case yi:t=0;break;case bi:t=this.nowTime/this.duration;break;case Ci:t=1}return vi(t,0,1)}set t(t){(t=vi(t,-1,1))<0?(this.state=mi,this.nowTime=-this.delay*t):(this.state=bi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===fi}get isDelay(){return this.state===mi}get isCountDown(){return this.state===bi}get isRunning(){return this.state===mi||this.state===bi}get isDone(){return this.state===Ci}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const fi=0,mi=1,bi=2,yi=3,Ci=-1;class xi extends ci{constructor(t,e){super(t,e),this.timer=new gi}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const Si=Phaser.Utils.Objects.GetValue,wi=Phaser.Utils.Objects.GetAdvancedValue,Oi=Phaser.Tweens.Builders.GetEaseFunction;class Pi extends xi{resetFromJSON(t){return this.timer.resetFromJSON(Si(t,"timer")),this.setEnable(Si(t,"enable",!0)),this.setTarget(Si(t,"target",this.parent)),this.setDelay(wi(t,"delay",0)),this.setDuration(wi(t,"duration",1e3)),this.setEase(Si(t,"ease","Linear")),this.setRepeat(Si(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Oi(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const ki=Phaser.Utils.Objects.GetValue,_i=Phaser.Utils.Objects.GetAdvancedValue,Ti=Phaser.Math.Linear;let Ei=class extends Pi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(ki(t,"mode",0)),this.setScaleRange(_i(t,"start",void 0),_i(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Mi[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=_i(t,"x",this.parent.scaleX),this.startY=_i(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=_i(e,"x",void 0),this.endY=_i(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Ti(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Ti(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const Mi={stop:0,destroy:1,yoyo:2};var Di=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new Ei(t,a):r.resetFromJSON(a),r.restart(),r},Ri=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Ei&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new Ei(t,h):n.resetFromJSON(h),n.restart(),n},Li=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Xi=function(t){return Li(t,"complete")};const Yi=Phaser.Utils.Objects.IsPlainObject;var zi={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Yi(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Di(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Xi(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Yi(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Ri(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Xi(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Xi(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Yi(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new Ei(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Xi(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Ai={};Object.assign(Ai,zi),Ai.onInitScale=function(){zi.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=xe.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Wi=Phaser.Utils.Objects.GetValue,Bi=Phaser.Utils.Objects.GetAdvancedValue,ji=Phaser.Math.Linear;class Ii extends Pi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Wi(t,"mode",0)),this.setAlphaRange(Bi(t,"start",this.parent.alpha),Bi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Fi[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=ji(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Fi={stop:0,destroy:1,yoyo:2},Hi=Phaser.Utils.Objects.IsPlainObject;var Gi=function(t,e,i,s){var r,n;Hi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Ii(t,h):s.resetFromJSON(h),s.restart(),s},Vi=function(t,e,i,s){i instanceof Ii&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Ii(t,r):s.resetFromJSON(r),s.restart(),s};const Ni=Phaser.Utils.Objects.IsPlainObject;var Ui={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Ni(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Gi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Xi(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Ni(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Vi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Xi(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Xi(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},$i={};Object.assign($i,Ui),$i.onInitFade=function(){Ui.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=xe.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Ji=Phaser.Utils.Objects.GetValue,qi=Phaser.Utils.Objects.GetAdvancedValue,Ki=Phaser.Math.Linear;class Zi extends Pi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Ji(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=qi(t,"x",void 0),i=qi(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Qi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=qi(i,"startX",void 0),this.startY=qi(i,"startY",void 0),this.endX=qi(i,"endX",void 0),this.endY=qi(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Ki(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ki(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Qi={stop:0,destroy:1,yoyo:2};var ts=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const es=Phaser.Utils.Objects.IsPlainObject,is=Phaser.Math.Distance.Between;var ss={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(es(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*is(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Zi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=ts(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=ts(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Zi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Xi(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Xi(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(es(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*is(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Zi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=ts(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=ts(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Zi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Xi(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Xi(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},rs={};Object.assign(rs,ss),rs.onInitEaseMove=function(){ss.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=xe.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const ns=Phaser.Utils.Objects.GetValue;class hs extends oi{constructor(t,e){super(t,e),this.timer=new gi,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(ns(t,"timer")),this.setEnable(ns(t,"enable",!0)),this.setMode(ns(t,"mode",1)),this.isRunning=ns(t,"isRunning",!1),this.setMagnitudeMode(ns(t,"magnitudeMode",1)),this.setAxisMode(ns(t,"axis",0)),this.setDuration(ns(t,"duration",500)),this.setMagnitude(ns(t,"magnitude",10)),this.ox=ns(t,"ox",void 0),this.oy=ns(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=as[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ls[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=os[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=ns(i,"magnitude",void 0),t=ns(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const as={effect:0,behavior:1},os={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ls={constant:0,decay:1},ds=Phaser.Utils.Objects.IsPlainObject;var cs={shake(t,e,i){if(ds(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new hs(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Xi(this._shake)}};const us=Phaser.Utils.Objects.GetValue,ps=Phaser.Math.Linear;class vs extends Pi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=us(t,"key","value");var i=e[this.propertyKey];return this.fromValue=us(t,"from",i),this.toValue=us(t,"to",i),this.setEase(us(t,"ease",this.ease)),this.setDuration(us(t,"duration",this.duration)),this.setRepeat(us(t,"repeat",0)),this.setDelay(us(t,"delay",0)),this.setRepeatDelay(us(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=ps(this.fromValue,this.toValue,i)}}const gs=Phaser.Utils.Objects.IsPlainObject;class fs extends si{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new vs(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(gs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(gs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var ms={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new fs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Li(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},bs=Phaser.Utils.Array.Remove,ys={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var As={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Ze(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Ws={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=Wt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=Wt),this.transitOutCallback=t,this}},Bs={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},js={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Is={};Object.assign(Is,As,Ws,Bs,js);const Fs=Phaser.Utils.Objects.GetValue;class Hs extends si{constructor(t,e){super(t,e),this.setTransitInTime(Fs(e,"duration.in",200)),this.setTransitOutTime(Fs(e,"duration.out",200)),this.setTransitInCallback(Fs(e,"transitIn")),this.setTransitOutCallback(Fs(e,"transitOut")),this.oneShotMode=Fs(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new zs(this,{eventEmitter:!1,initState:Fs(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Hs.prototype,Is);var Gs=function(t){if(t.parentContainer)return Gs(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?Gs(e):t};class Vs extends si{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Gs(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Ns=Phaser.GameObjects.Rectangle;class Us extends Ns{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Vs(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const $s=Phaser.Utils.Objects.GetValue;class Js extends si{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode($s(t,"hitAreaMode",0)),this.setEnable($s(t,"enable",!0)),this.setStopMode($s(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=qs[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var qs={default:0,fullWindow:1};const Ks=Phaser.Utils.Objects.GetValue;class Zs extends Us{constructor(t,e){super(t,Ks(e,"color",0),Ks(e,"alpha",.8)),this.touchEventStop=new Js(this,{hitAreaMode:1})}}var Qs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Di(t,e)},scaleDown(t,e){Ri(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Gi(t,e)},fadeOut(t,e){Vi(t,e,!1)}},tr=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Gi(t,e,t.alpha)},er=function(t,e){Vi(t,e,!1)},ir=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!nt(t,!0).contains(e,i)||r&&!r(t,e,i))};const sr=Phaser.Utils.Objects.GetValue;let rr=class extends Hs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=nr.popUp),null==e.transitOut&&(e.transitOut=nr.scaleDown),e.destroy=sr(e,"destroy",!0),super(t,e);var i=sr(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Zs(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(sr(i,"transitIn",tr)),this.setCoverTransitOutCallback(sr(i,"transitOut",er)));var s=sr(e,"touchOutsideClose",!1),r=sr(e,"duration.hold",-1),n=sr(e,"timeOutClose",r>=0),h=sr(e,"anyTouchClose",!1);sr(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),sr(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&ir(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=nr[t]),t){case nr.popUp:t=Qs.popUp;break;case nr.fadeIn:t=Qs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=nr[t]),t){case nr.scaleDown:t=Qs.scaleDown;break;case nr.fadeOut:t=Qs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const nr={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var hr=function(t){return t&&"function"==typeof t},ar={modal(t,e){return hr(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new rr(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},or=function(t,e,i,s,r){hr(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},lr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return or.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return or.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return or.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return or.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return or.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return or.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return or.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return or.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return or.call(this,"shutdown",t,e,i,s),this}},dr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=cr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},cr={},ur=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?ir(t,e.x,e.y,i,s):!!(r=dr(e,n,!0))&&ir(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const Or={press:0,pointerdown:0,release:1,pointerup:1};var Pr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new wr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},kr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!_r(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return Tr.length=0,!0;return Tr.length=0,!1},Tr=[];const Er=Phaser.Utils.Objects.GetValue;class Mr extends si{constructor(t,e){super(t,e),this._enable=void 0;var i=Er(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Er(t,"enable",!0)),this.setMode(Er(t,"mode",1)),this.setClickInterval(Er(t,"clickInterval",100)),this.setDragThreshold(Er(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Dr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?kr:ur)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Dr={press:0,pointerdown:0,release:1,pointerup:1};var Rr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Mr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Lr extends Ys{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Xr=Phaser.Utils.Objects.GetValue;class Yr extends si{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Lr,this.parent.setInteractive(Xr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Xr(t,"enable",!0)),this.setCooldown(Xr(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var zr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&ur(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Yr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Yr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Ar={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Wr=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=tn,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===en&&this.onDragEnd(),this.pointer=void 0,this.tracerState=tn,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=sn,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&ur(t,s,e,i)}}const tn=0,en=1,sn="IDLE",rn=Phaser.Utils.Objects.GetValue,nn=Phaser.Math.Distance.Between;class hn extends Qr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=an},eventEmitter:!1};this.setRecongizedStateObject(new Ys(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(rn(t,"time",250)),this.setTapInterval(rn(t,"tapInterval",200)),this.setDragThreshold(rn(t,"threshold",9)),this.setTapOffset(rn(t,"tapOffset",10));var e=rn(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(rn(t,"maxTaps",void 0)),this.setMinTaps(rn(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case an:this.state=on;break;case on:var t=this.lastPointer;nn(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=ln,this.state=on);break;case ln:this.state=on}}onDragEnd(){this.state===on&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=ln))}onDrag(){this.state!==an&&this.pointer.getDistance()>this.dragThreshold&&(this.state=an)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===on){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=an):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=ln:this.state=an)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===ln&&(this.state=an)}get isTapped(){return this.state===ln}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const an="IDLE",on="BEGIN",ln="RECOGNIZED",dn=Phaser.Utils.Objects.GetValue;class cn extends Qr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=un},eventEmitter:!1};this.setRecongizedStateObject(new Ys(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(dn(t,"threshold",9)),this.setHoldTime(dn(t,"time",251)),this}onDragStart(){this.state=pn,0===this.holdTime&&(this.state=vn)}onDragEnd(){this.state=un}onDrag(){this.state!==un&&this.pointer.getDistance()>this.dragThreshold&&(this.state=un)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===pn&&t-this.pointer.downTime>=this.holdTime&&(this.state=vn)}get isPressed(){return this.state===vn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const un="IDLE",pn="BEGIN",vn="RECOGNIZED";Phaser.Utils.Objects.GetValue;var gn=function(t){return ei(t).loop.delta};const fn=Phaser.Math.Distance.Between,mn=Phaser.Math.Angle.Between;var bn={getDt:function(){return gn(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return fn(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return mn(e.x,e.y,t.x,t.y)}},yn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},Cn={};const xn=Phaser.Utils.Objects.GetValue,Sn=Phaser.Math.RadToDeg;class wn extends Qr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=On},eventEmitter:!1};this.setRecongizedStateObject(new Ys(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(xn(t,"threshold",10)),this.setVelocityThreshold(xn(t,"velocityThreshold",1e3)),this.setDirectionMode(xn(t,"dir","8dir")),this}onDragStart(){this.state=Pn}onDragEnd(){this.state=On}onDrag(){this.state===Pn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=kn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===kn&&(this.state=On)}get isSwiped(){return this.state===kn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=yn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=Cn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(Sn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(wn.prototype,bn);const On="IDLE",Pn="BEGIN",kn="RECOGNIZED",_n=Phaser.Utils.Objects.GetValue,Tn=Phaser.Utils.Array.SpliceOne,En=Phaser.Math.Distance.Between,Mn=Phaser.Math.Angle.Between;class Dn{constructor(t,e){var i=Ze(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(_n(e,"inputConfig",void 0)),this.setEventEmitter(_n(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(_n(t,"enable",!0)),this.bounds=_n(t,"bounds",void 0),this.tracerState=Ln,this.pointers.length=0,mt(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,mt(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case Ln:this.tracerState=Xn,this.onDrag1Start();break;case Xn:this.tracerState=Yn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],Tn(this.pointers,e),this.tracerState){case Xn:this.tracerState=Ln,this.onDrag1End();break;case Yn:this.tracerState=Xn,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case Xn:this.onDrag1();break;case Yn:this.onDrag2()}}}dragCancel(){return this.tracerState===Yn&&this.onDrag2End(),this.pointers.length=0,mt(this.movedState),this.tracerState=Ln,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Yn)return 0;var t=this.pointers[0],e=this.pointers[1];return En(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Yn)return 0;var t=this.pointers[0],e=this.pointers[1];return Mn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Rn.x=e.x-i.x,Rn.y=e.y-i.y}else Rn.x=0,Rn.y=0;return Rn}get centerX(){if(this.tracerState!==Yn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Yn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Yn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Yn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=zn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&ur(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&ur(t,s,e,i)}}Object.assign(Dn.prototype,Je);var Rn={};const Ln=0,Xn=1,Yn=2,zn="IDLE";Phaser.Utils.Objects.GetValue;const An=Phaser.Math.RotateAround;var Wn=function(t,e,i,s){return An(t,e,i,s),t.rotation+=s,t},Bn={};const jn=Phaser.Utils.Objects.GetValue,In=Phaser.Math.Angle.WrapDegrees,Fn=Phaser.Math.Angle.ShortestBetween,Hn=Phaser.Math.RadToDeg,Gn=Phaser.Math.DegToRad;var Vn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Bn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=In(Hn(this.angleBetween));this.angle=Fn(this.prevAngle,t),this.prevAngle=t,this.state=$n}break;case $n:t=In(Hn(this.angleBetween)),this.angle=Fn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===$n}get rotation(){return Gn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Vn);const Nn="IDLE",Un="BEGIN",$n="RECOGNIZED",Jn=Phaser.Utils.Objects.GetValue;var qn=function(t){var e=Jn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new hn(this,e),this._tap.on("tap",(function(t,e,s){Br(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Br(i.eventEmitter,`${i.eventNamePrefix}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Kn=Phaser.Utils.Objects.GetValue;var Zn=function(t){var e=Kn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new cn(this,e),this._press.on("pressstart",(function(t,e,s){Br(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this).on("pressend",(function(t,e,s){Br(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Qn=Phaser.Utils.Objects.GetValue;var th=function(t){var e=Qn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new wn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Br(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Br(i.eventEmitter,`${i.eventNamePrefix}swipe`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const eh=Phaser.Utils.Objects.GetValue;var ih=function(t,e){return t.setInteractive(),eh(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:eh(e,"targets",[t]),targetMode:eh(e,"targetMode","parent"),eventEmitter:eh(e,"eventEmitter",t),eventNamePrefix:eh(e,"inputEventPrefix","child.")},Ir.call(t,e),Gr.call(t,e),Ur.call(t,e),Kr.call(t,e),qn.call(t,e),Zn.call(t,e),th.call(t,e),t},sh={getSizerConfig:function(t){return void 0===t&&(t=this),Dt(t)},getChildPrevState:function(t){var e=Dt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Xt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=le(e,"color"),s=le(e,"lineWidth");var o=le(e,"name",!1);o&&(r=le(o,"createTextCallback",ue),n=le(o,"createTextCallbackScope",void 0),"string"==typeof(h=le(o,"align","left-top"))&&(h=At[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new de(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}var d,c,u=this.getAllShownChildren([this]);pe(u,u);for(var p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const uh=Phaser.Utils.Objects.IsPlainObject,ph=Phaser.Utils.Objects.GetValue,vh=Phaser.Display.Align.CENTER,gh={min:0,full:-1};var fh=function(t,e,i,s,r,n,h,a,o,l){var d,c,u,p;be.call(this,t);var v=t.isRexSpace,g=typeof e;if(null===e)return this;if("number"===g);else if("string"===g)e=gh[e];else if(uh(e)){var f;e=ph(f=e,"proportion",void 0),i=ph(f,"align",vh),s=ph(f,"padding",0),r=ph(f,"expand",!1),n=ph(f,"key",void 0),h=ph(f,"index",void 0),t.isRexSizer||(a=ph(f,"minWidth",void 0),o=ph(f,"minHeight",void 0)),l=ph(f,"fitRatio",0),d=ph(f,"offsetX",0),c=ph(f,"offsetY",0),u=ph(f,"offsetOriginX",0),p=ph(f,"offsetOriginY",0)}return"string"==typeof i&&(i=At[i]),void 0===e&&(e=v?1:0),void 0===i&&(i=vh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(v?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(v?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),(f=this.getSizerConfig(t)).proportion=e,f.align=i,f.padding=fe(s),f.expand=r,f.fitRatio=0===e?l:0,f.alignOffsetX=d,f.alignOffsetY=c,f.alignOffsetOriginX=u,f.alignOffsetOriginY=p,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},mh={add:fh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),fh.call(this,new dh(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return uh(i)&&(i.index=t),fh.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=ch.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const bh=Mt.prototype.clear;var yh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),bh.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,yh.call(this,t),this}},Sh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=At[e]),this.getSizerConfig(t).align=e,this}},wh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},Oh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},Ph={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},kh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Ve(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Fe.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d,c,u=this.sizerChildren,p=this.innerLeft,v=this.innerTop,g=this.innerWidth,f=this.innerHeight,m=p,b=v,y=this.startChildIndex,C=0,x=u.length;C0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=We.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||ze.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&oh.call(this,t,void 0),Ae.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Be.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&oh.call(this,void 0,t),je.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(kh,mh,xh,Sh,wh,Oh,Ph);var _h=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},Th={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},Eh=function(t){return"string"==typeof t&&(t=Th[t]),t};const Mh=Phaser.Utils.Objects.IsPlainObject,Dh=Phaser.Utils.Objects.GetValue;class Rh extends nh{constructor(t,e,i,s,r,n,h){Mh(e)?(e=Dh(h=e,"x",0),i=Dh(h,"y",0),s=Dh(h,"width",void 0),r=Dh(h,"height",void 0),n=Dh(h,"orientation",0)):Mh(s)?(s=Dh(h=s,"width",void 0),r=Dh(h,"height",void 0),n=Dh(h,"orientation",0)):Mh(n)&&(n=Dh(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Dh(h,"space.item",0)),this.setStartChildIndex(Dh(h,"startChildIndex",0)),this.setRTL(Dh(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=Eh(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=_h.call(this)),this._childrenProportion}}Object.assign(Rh.prototype,kh);var Lh=function(t,e,i){if(t){var s=null==e,r=null==i;return s&&r||(s||(t.displayWidth=e),r||(t.displayHeight=i),s&&(t.scaleX=t.scaleY),r&&(t.scaleY=t.scaleX)),t}},Xh={appendText:function(t,e){var i;return t||0===t||(t=""),void 0===e&&(e=!0),Array.isArray(t)&&(t=t.join("\n")),(i=e?`${this.text}\n${t}`:`${this.text}${t}`)!=this.text&&this.setText(i),this},resetDisplayContent:function(t){void 0===t?t={}:"string"==typeof t&&(t={text:t});var e=t.text||"";this.setText(e);var i=this.childrenMap.icon;if(i){t.icon?this.show(i):this.hide(i);var s=t.iconSize;s&&(this.setChildDisplaySize(i,s,s),void 0!==this.iconWidth&&this.setIconSize(s)),!0!==t.icon&&this.setIconTexture(t.icon,t.iconFrame)}var r=this.childrenMap.action;if(r){t.action?this.show(r):this.hide(r);var n=t.actionSize;n&&(this.setChildDisplaySize(r,n,n),void 0!==this.actionWidth&&this.setActionSize(n)),!0!==t.action&&this.setActionTexture(t.action,t.actionFrame)}return this}};class Yh extends Rh{get text(){var t=this.childrenMap.text;return t?t.text:""}set text(t){var e=this.childrenMap.text;e&&e.setText(t)}setText(t){return this.text=t,this}setIconTexture(t,e){var i=this.childrenMap.icon;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.iconWidth&&void 0!==this.iconHeight&&(Lh(i,this.iconWidth,this.iconHeight),this.resetChildScaleState(i)),this):this}setTexture(t,e){return this.setIconTexture(t,e),this}setIconSize(t,e){return void 0===e&&(e=t),this.iconWidth=t,this.iconHeight=e,this}get texture(){var t=this.childrenMap.icon;if(t)return t.texture}get frame(){var t=this.childrenMap.icon;if(t)return t.frame}setActionTexture(t,e){var i=this.childrenMap.action;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.actionWidth&&void 0!==this.actionHeight&&(Lh(i,this.actionWidth,this.actionHeight),this.resetChildScaleState(i)),this):this}get actionTexture(){var t=this.childrenMap.action;if(t)return t.texture}get actionFrame(){var t=this.childrenMap.action;if(t)return t.frame}setActionSize(t,e){return void 0===e&&(e=t),this.actionWidth=t,this.actionHeight=e,this}preLayout(){var t=this.childrenMap.icon;t&&void 0!==this.iconWidth&&void 0!==this.iconHeight&&Lh(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&Lh(e,this.actionWidth,this.actionHeight),super.preLayout()}postLayout(t,e,i){var s=this.childrenMap.iconMask;s&&(s.setPosition(),this.resetChildPositionState(s));var r=this.childrenMap.actionMask;return r&&(r.setPosition(),this.resetChildPositionState(r)),super.postLayout(t,e,i),this}resize(t,e){super.resize(t,e);var i=this.childrenMap.iconMask;i&&i.resize();var s=this.childrenMap.actionMask;return s&&s.resize(),this}}Object.assign(Yh.prototype,Xh);const zh=Phaser.GameObjects.Graphics.prototype.setPosition,Ah=Phaser.Geom.Rectangle,Wh=Phaser.Geom.Circle;var Bh=function(t,e,i,s,r){this.geom=function(t,e,i,s,r,n,h){if(1===t){s=s.left;var a=-e*(r-.5),o=-i*(n-.5),l=Math.min(e,i)/2+s;void 0!==h&&h instanceof Wh||(h=new Wh),h.setTo(a,o,l)}else{var d=-e*r-s.left,c=-i*n-s.top,u=e+s.left+s.right,p=i+s.top+s.bottom;void 0!==h&&h instanceof Ah||(h=new Ah),h.setTo(d,c,u,p)}return h}(this.shapeType,t,e,i,s,r,this.geom),this.clear().fillStyle(16777215),1===this.shapeType?this.fillCircleShape(this.geom):this.fillRectShape(this.geom)},jh=function(t,e){for(var i in t){if(!(i in e))return!1;if(t[i]!==e[i])return!1}for(var i in e)if(!(i in t))return!1;return!0},Ih={setPosition:function(t,e){var i=this.parent;return void 0===t&&(t=i.x),void 0===e&&(e=i.y),zh.call(this,t,e),this},resize:function(t,e,i){var s=this.parent;void 0===t&&(t=s.width),void 0===e&&(e=s.height),void 0===i?i=this.padding:"number"==typeof i&&(i=GetBoundsConfig(i));var r=this.width!==t||this.height!==e,n=this.padding!==i&&!jh(this.padding,i);return r||n?(this.width=t,this.height=e,n&&bt(i,this.padding),this.originX=s.originX,this.originY=s.originY,Bh.call(this,t,e,i,s.originX,s.originY),this):this},setOrigin:function(t,e){void 0===e&&(e=t);var i=this.parent;return void 0===t&&(t=i.originX),void 0===e&&(e=i.originY),this.originX===t&&this.originY===e||(this.originX=t,this.originY=e,Bh.call(this,this.width,this.height,this.padding,t,e)),this},contains:function(t,e){return t-=this.x,e-=this.y,this.geom.contains(t,e)}};const Fh=Phaser.GameObjects.Graphics;class Hh extends Fh{constructor(t,e,i){void 0===e&&(e=0),"string"==typeof e&&(e=Gh[e]),super(t.scene),this.parent=t,this.shapeType=e,this.padding=fe(i),this.setPosition().resize().setVisible(!1)}destroy(){return this.parent=void 0,super.destroy(),this}}const Gh={rectangle:0,circle:1};Object.assign(Hh.prototype,Ih);var Vh=function(t,e,i,s){var r=new Hh(e,i,s);if(t&&!t.isRexSizer){var n=r.createGeometryMask();t.setMask(n),this.once("destroy",(function(){t.setMask(),n.destroy()}))}return this.pin(r),r};const Nh=Phaser.GameObjects.Text;var Uh=function(t){return t instanceof Nh};const $h=Phaser.GameObjects.BitmapText;var Jh=function(t){return t instanceof $h},qh=/^[\x00-\x7F]+$/,Kh=function(t){return qh.test(t)},Zh=function(t,e){for(var i=[],s=t.split("\n"),r=e.style,n=r.wordWrapWidth,h=r.hasOwnProperty("wrapMode")?r.wrapMode:3,a=e.context,o=0,l=s.length;o0&&r.push(o.join("")),r},ta=2;const ea={none:0,word:1,char:ta,character:ta,mix:3};var ia=function(t,e){var i=function(t){return Jh(t)?2:Uh(t)?0:1}(t);switch(i){case 0:switch("string"==typeof e&&(e=ea[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=Zh;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=ea[e]||0),t.style.wrapMode=e}};const sa=Phaser.Renderer.WebGL.Utils;var ra={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,h=r.height,a=sa.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,h,e.x,e.y,n/e.resolution,h/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,h,a(e.tintTopLeft,i.alpha*e._alphaTL),a(e.tintTopRight,i.alpha*e._alphaTR),a(e.tintBottomLeft,i.alpha*e._alphaBL),a(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const na=Phaser.Display.Color;var ha={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,h,a,o,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===h&&(h=0),void 0===a&&(a=0),void 0===o&&(o=c),void 0===l&&(l=u);var p=d.cutX+h,v=d.cutY+a;return this.context.drawImage(d.source.image,p,v,o,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new na);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var h=i;i=h.red,s=h.green,r=h.blue,n=h.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var a=this.context.createImageData(1,1);return a.data[0]=i,a.data[1]=s,a.data[2]=r,a.data[3]=n,this.context.putImageData(a,t,e),this.dirty=!0,this}},aa={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,function(t,e,i,s,r,n,h){var a,o=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===h&&(h=e.height);var d=(a=o.exists(i)?o.get(i):o.createCanvas(i,n,h)).getSourceImage();d.width!==n&&(d.width=n),d.height!==h&&(d.height=h);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,h),c.drawImage(e,s,r,n,h),l.gl&&a&&l.canvasToTexture(d,a.source[0].glTexture,!0,0)}(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};e();const oa=Phaser.Display.Canvas.CanvasPool,la=Phaser.GameObjects.GameObject,da=Phaser.Utils.String.UUID;class ca extends la{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=oa.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=da(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){oa.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}}const ua=Phaser.GameObjects.Components;Phaser.Class.mixin(ca,[ua.Alpha,ua.BlendMode,ua.Crop,ua.Depth,ua.Flip,ua.GetBounds,ua.Mask,ua.Origin,ua.Pipeline,ua.PostPipeline,ua.ScrollFactor,ua.Tint,ua.Transform,ua.Visible,ra,ha,aa]);var pa={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:Ms(this.data,t,e)},incData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)+e),this},mulData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)*e),this},clearData(){return this.data&&mt(this.data),this}};class va{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}}Object.assign(va.prototype,pa);var ga={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const fa=Phaser.Math.RotateAround;var ma;const ba=Phaser.Geom.Rectangle;var ya,Ca=function(t){void 0===ya&&(ya=new ba);var e=t.drawTLX,i=t.drawTLY;return ya.setTo(e,i,t.drawTRX-e,t.drawBLY-i),ya};const xa=Phaser.Math.RotateAround;var Sa,wa=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Sa&&(Sa={}),s=Sa),s.x=e,s.y=i,0!==t.rotation&&xa(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const Oa=Phaser.GameObjects.Components.TransformMatrix;var Pa,ka,_a={},Ta=function(t,e,i,s,r){var n=wa(e,i,s,!0),h=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=_a);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===Pa&&(Pa=new Oa,ka=new Oa),t.parentContainer?t.getWorldTransformMatrix(Pa,ka):Pa.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),Pa.transformPoint(r,n,s),s}(t,n.x,n.y,r);return h},Ea=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,h=e.drawCenterY+s;return Ta(t,e,n,h,r)},Ma={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===ma&&(ma={}),s=ma),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&fa(s,0,0,-i.rotation),s}(t,e,this,!0);return Ca(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return Ea(this.parent,this,t,e,i)}};Object.assign(Ma,ga);const Da=Phaser.Math.DegToRad,Ra=Phaser.Math.RadToDeg,La=Phaser.Utils.Objects.GetValue;class Xa extends va{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return Ra(this._rotation)}set angle(t){this.rotation=Da(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=La(t,"width",void 0),i=La(t,"height",void 0),s=La(t,"scaleX",void 0),r=La(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(Xa.prototype,Ma);const Ya=Phaser.Utils.String.Pad;var za=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${Ya(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},Aa=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Wa=Phaser.Utils.Objects.GetValue;let Ba=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=Wa(t,"x",0),i=Wa(t,"y",0));var s=this.cornerRadius;s.tl=ja(Wa(t,"tl",void 0),e,i),s.tr=ja(Wa(t,"tr",void 0),e,i),s.bl=ja(Wa(t,"bl",void 0),e,i),s.br=ja(Wa(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Ia(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Ia(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Ia(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Ia(this.cornerRadius.br,t)}};var ja=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Fa(t),t},Ia=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Wa(e,"x",0),t.y=Wa(e,"y",0)),Fa(t)},Fa=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const Ha=Phaser.Math.DegToRad;var Ga=function(t){return!t.hasOwnProperty("convex")||t.convex},Va=function(t){return t.x>0&&t.y>0},Na=function(t,e,i,s,r,n,h,a,o){if(a&&h>n?h-=360:!a&&h=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=m.tl,Va(a)?(o=a.x*g,l=a.y*f,Ga(a)?Na(t,o,l,o,l,180,270,!1,h):Na(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,Va(a)?(o=a.x*g,l=a.y*f,Ga(a)?Na(t,s-o,l,o,l,270,360,!1,h):Na(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,Va(a)?(o=a.x*g,l=a.y*f,Ga(a)?Na(t,s-o,r-l,o,l,0,90,!1,h):Na(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,Va(a)?(o=a.x*g,l=a.y*f,Ga(a)?Na(t,o,r-l,o,l,90,180,!1,h):Na(t,0,r,o,l,360,270,!0,h)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,h,u),null!=a)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,a),p.addColorStop(1,d),a=p),e.fillStyle=a,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())};const $a=Phaser.Utils.Objects.GetValue;class Ja extends Xa{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor($a(e,"color",null),$a(e,"color2",null),$a(e,"horizontalGradient",!0)),this.setStroke($a(e,"stroke",null),$a(e,"strokeThickness",2)),this.setCornerRadius($a(e,"cornerRadius",0),$a(e,"cornerIteration",null))}set color(t){t=za(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=za(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=za(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,Aa("color2",t,this),Aa("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Aa("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Aa("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){!function(t,e,i,s,r,n,h,a){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),Ua(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}}(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const qa=Phaser.Utils.Objects.GetValue;class Ka extends Xa{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(qa(e,"color",null),qa(e,"color2",null),qa(e,"horizontalGradient",!0)),this.setStroke(qa(e,"stroke",null),qa(e,"strokeThickness",2))}set color(t){t=za(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=za(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=za(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,qa(t,"color2",null),qa(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,qa(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,h=this.parent.height-i.top-i.bottom,a=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?a.createLinearGradient(0,0,n,0):a.createLinearGradient(0,0,0,h)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,a.fillStyle=t,a.fillRect(s,r,n,h));null!=this.stroke&&this.strokeThickness>0&&(a.strokeStyle=this.stroke,a.lineWidth=this.strokeThickness,a.strokeRect(s,r,n,h))}}const Za=Phaser.Utils.Objects.GetValue;class Qa{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(Za(t,"bold",!1)),this.setItalic(Za(t,"italic",!1)),this.setFontSize(Za(t,"fontSize","16px")),this.setFontFamily(Za(t,"fontFamily","Courier")),this.setColor(Za(t,"color","#fff")),this.setStrokeStyle(Za(t,"stroke",null),Za(t,"strokeThickness",0)),this.setShadow(Za(t,"shadowColor",null),Za(t,"shadowOffsetX",0),Za(t,"shadowOffsetY",0),Za(t,"shadowBlur",0)),this.setOffset(Za(t,"offsetX",0),Za(t,"offsetY",0)),this.setSpace(Za(t,"leftSpace",0),Za(t,"rightSpace",0)),this.setAlign(Za(t,"align",void 0)),this.setBackgroundColor(Za(t,"backgroundColor",null)),this.setBackgroundHeight(Za(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Za(t,"backgroundBottomY",void 0)),this.setBackgroundLeftX(Za(t,"backgroundLeftX",0)),this.setBackgroundRightX(Za(t,"backgroundRightX",0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(Aa("stroke",t,this),Aa("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Aa("shadowOffsetX",t,this),Aa("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),t.hasOwnProperty("backgroundLeftX")&&this.setBackgroundLeftX(t.backgroundLeftX),t.hasOwnProperty("backgroundRightX")&&this.setBackgroundRightX(t.backgroundRightX),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new Qa(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=za(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=za(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=za(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=za(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setBackgroundLeftX(t){return this.backgroundLeftX=t,this}setBackgroundRightX(t){return this.backgroundRightX=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}}const to=Phaser.Utils.Array.Remove,eo=Phaser.Utils.Array.Remove,io="text",so="image",ro="drawer",no="space",ho="command";var ao=function(t){return t.type===io&&"\n"===t.text},oo=function(t){return t.type===io&&"\f"===t.text},lo=function(t){return t.type===io};class co extends Xa{constructor(t,e,i){super(t,io),this.updateTextFlag=!1,this.style=new Qa(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX+e.backgroundLeftX,s=i,r=this.drawTRX+e.backgroundRightX-i+1;if(r>0){var n=e.backgroundBottomY;null==n&&(n=this.drawBLY);var h=e.backgroundHeight;null==h&&(h=n-this.drawTLY);var a=n-h;t.fillRect(s,a,r,h)}}var o=e.hasFill,l=e.hasStroke;(o||l)&&(e.syncFont(t).syncStyle(t),l&&(e.syncShadow(t),t.strokeText(this.text,0,0)),o&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var uo=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const po=Phaser.Display.Canvas.CanvasPool;Phaser.Display.Canvas.CanvasPool;class vo extends Xa{constructor(t,e,i){super(t,so),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){!function(t,e,i,s,r,n,h,a){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===a&&(a=!1),a&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(h){var l=po.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=h,d.fillRect(0,0,r,n),o.drawImage(l,0,0,r,n,i,s,r,n),po.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)}(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class go extends Xa{constructor(t,e,i,s){super(t,ro),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class fo extends Xa{constructor(t,e){super(t,no),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class mo extends va{constructor(t,e,i,s,r){super(t,ho),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}function bo(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>bo(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=bo(t[i]));return e}var yo=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const Co={none:0,word:1,char:2,character:2,mix:3};var xo=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,h=!r&&!n,a=t.length,o=e,l=s.word,d=0,c=!1;o0&&!a){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=Po.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=Po.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=_o(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=_o(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=_o(t,"wrapMode");void 0===c&&(c=_o(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=Co[c]);var u=_o(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=_o(t,"letterSpacing",0),v=_o(t,"hAlign",0),g=_o(t,"vAlign",0),f=_o(t,"justifyPercentage",.25),m=yo({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:h,lineHeight:n,wrapWidth:u,wrapMode:c}),b=this.children,y=0,C=b.length;y0&&(E.push({children:M,width:D}),R=Math.max(R,D)),m.start+=T.length,m.isLastPage=!L&&m.start===_,m.maxLineWidth=R,m.linesHeight=E.length*n;var j=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,I=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,h=t.vAlign,a=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(h=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=Mo(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=Mo(t,"maxLines",0);var a=0===i,o=Mo(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=Mo(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=Mo(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=Mo(t,"letterSpacing",0),p=Mo(t,"rtl",!0),v=Mo(t,"hAlign",p?2:0),g=Mo(t,"vAlign",0),f=yo({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:o,wrapHeight:c,rtl:p}),m=this.children,b=0,y=m.length;b0&&(T.push({children:E,height:M}),D=Math.max(D,M)),f.start+=_.length,f.isLastPage=f.start===k,f.maxLineHeight=D,f.linesWidth=T.length*n;var A=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,W=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,h=t.vAlign,a=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}a&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,h=i.bottom;return Le(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return Re(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),to(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return eo(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(io);return null===i?i=new co(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),Ea(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const el=Phaser.Utils.Objects.GetFastValue;var il={};class sl{constructor(t){this.pools=el(t,"pools",il)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new tl),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;ei&&(r=Math.floor(i));for(var n={},h=cl(t,r,e,i,n),a=0;a<=ol&&0!==h;a++){if((r+=h)<0){r=0;break}h=cl(t,r,e,i,n)}return a===ol&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),ul(t,e,i),t},dl=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},cl=function(t,e,i,s,r){var n,h=dl(t,e,r),a=dl(t,e+1,r);if(void 0!==s)if(h.height<=s&&a.height>s)n=0;else{if(h.height>s)return-1;n=Math.floor(s-h.height)}if(h.width<=i&&a.width>i)return 0;if(h.width>i)return-1;var o=Math.floor(i-h.width);return void 0===n?o:Math.min(o,n)},ul=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const pl=Phaser.Utils.Objects.GetValue,vl=Phaser.Utils.Objects.GetValue;class gl extends Yh{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=vl(e,"background",void 0),r=vl(e,"icon",void 0),n=vl(e,"iconMask",void 0),h=vl(e,"text",void 0),a=vl(e,"action",void 0),o=vl(e,"actionMask",void 0),l=vl(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(h||a)&&(i={right:vl(e,"space.icon",0),top:vl(e,"space.iconTop",0),bottom:vl(e,"space.iconBottom",0),left:vl(e,"space.iconLeft",0)}):(h||a)&&(i={bottom:vl(e,"space.icon",0),left:vl(e,"space.iconLeft",0),right:vl(e,"space.iconRight",0),top:vl(e,"space.iconTop",0)});var d=vl(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=Vh.call(this,r,r,1)),!d){var c=vl(e,"iconSize",void 0);this.setIconSize(vl(e,"iconWidth",c),vl(e,"iconHeight",c))}}if(h){var u=vl(e,"wrapText",!1),p=vl(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),ia(h,u),e.expandTextWidth=!0,al(h)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=pl(e,"minWidth",0),s=pl(e,"minHeight",0),r=pl(e,"fitHeight",!1);t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return ll(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),ll(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t})}(h,{fitHeight:!0}));var v,g,f=vl(e,"space.text",0),m=vl(e,"expandTextWidth",!1),b=vl(e,"expandTextHeight",!1);0===this.orientation?(v=m?1:0,a&&(i={right:f}),g=b):(v=b?1:0,a&&(i={bottom:f}),g=m),this.add(h,{proportion:v,expand:g,padding:i})}if(a&&(i=0===this.orientation?{top:vl(e,"space.actionTop",0),bottom:vl(e,"space.actionBottom",0),right:vl(e,"space.actionRight",0)}:{left:vl(e,"space.actionLeft",0),right:vl(e,"space.actionRight",0),bottom:vl(e,"space.actionBottom",0)},d=vl(e,"squareFitAction",!1)?1:0,this.add(a,{proportion:0,padding:i,fitRatio:d}),o&&(o=Vh.call(this,a,a,1)),!d)){var y=vl(e,"actionSize");this.setActionSize(vl(e,"actionWidth",y),vl(e,"actionHeight",y))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",h),this.addChildrenMap("action",a),this.addChildrenMap("actionMask",o)}}var fl={setWrapEnable(t){return void 0===t&&(t=!0),this.listWrapEnable=t,this},setCreateButtonCallback(t){return this.listCreateButtonCallback=t,this},setCreateListBackgroundCallback(t){return this.listCreateBackgroundCallback=t,this},setCreateListSliderTrackCallback(t){return this.listCreateSliderTrackCallback=t,this},setCreateListSliderThumbCallback(t){return this.listCreateSliderThumbCallback=t,this},setListSliderAdaptThumbSizeEnable(t){return void 0===t&&(t=!0),this.listSliderAdaptThumbSizeEnable=t,this},setListScrollerConfig(t){return void 0===t&&(t={}),this.listScrollerConfig=t,this},setListMouseWheelScrollerConfig(t){return this.listMouseWheelScrollerConfig=t,this},setButtonClickCallback(t){return this.listOnButtonClick=t,this},setButtonOverCallback(t){return this.listOnButtonOver=t,this},setButtonOutCallback(t){return this.listOnButtonOut=t,this},setListExpandDirection(t){return"string"==typeof t&&(t=ml[t]),this.listExpandDirection=t,this},setListEaseInDuration(t){return void 0===t&&(t=0),this.listEaseInDuration=t,this},setListEaseOutDuration(t){return void 0===t&&(t=0),this.listEaseOutDuration=t,this},setListTransitInCallback(t){return this.listTransitInCallback=t,this},settListTransitOutCallback(t){return this.listTransitOutCallback=t,this},setListBounds(t){return this.listBounds=t,this},setListWidth(t){return this.listWidth=t,this},setListHeight(t){return this.listHeight=t,this},setListSize(t,e){return this.setListWidth(t).setListHeight(e),this},setListMaxHeight(t){return this.listMaxHeight=t,this},setListAlignmentMode(t){return this.listAlignMode=t,this},setListAlignmentSide(t){return void 0===t&&(t=""),this.listAlignSide=t,this},setListSpace(t){return void 0===t&&(t={}),this.listSpace=t,this},setListDraggable(t){return void 0===t&&(t=!0),this.listDraggable=t,this}};const ml={down:0,up:1},bl=Rh.prototype.add,yl=Rh.prototype.addSpace;var Cl=function(t){var e=!t.isRexSpace,i=!e||this.buttonsExpand?1:0;if(0===this.sizerChildren.length)if(e){!this.buttonsExpand&&("right"===this.buttonsAlign||"center"===this.buttonsAlign||"bottom"===this.buttonsAlign)&&yl.call(this),bl.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&yl.call(this),this.hasTailSpace=s}else bl.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;bl.call(this,t,{index:r,proportion:i,expand:!0})}else bl.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},xl={addButton(t){if(pr(t))for(var e=t,i=0,s=e.length;i=0;i--)Ol.call(this,e[i],t);return this}},kl=function(t,e,i){if(t){var s=this.setValueCallback,r=this.setValueCallbackScope;s&&(r?s.call(r,t,e,i):s(t,e,i)),this.fireEvent("button.statechange",t,e,i)}},_l=function(t){var e=this;t._selected=void 0,Object.defineProperty(t,"selected",{get:function(){return t._selected},set:function(i){if(t._selected!==i){var s=t._selected;t._selected=i,kl.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},Tl={add(t){return this.buttons.push(t),t._click||(t._click=new wr(t,this.clickConfig),t._click.on("click",(function(t,e,i,s){this.fireEvent("button.click",e,i,s)}),this).on("enable",(function(t,e){this.fireEvent("button.enable",e)}),this).on("disable",(function(t,e){this.fireEvent("button.disable",e)}),this).on("over",(function(t,e,i,s){this.fireEvent("button.over",e,i,s)}),this).on("out",(function(t,e,i,s){this.fireEvent("button.out",e,i,s)}),this).on("down",(function(t,e,i,s){this.fireEvent("button.down",e,i,s)}),this).on("up",(function(t,e,i,s){this.fireEvent("button.up",e,i,s)}),this),t.isRexContainerLite&&t.sendChildToBack(t)),this.buttonsType&&(void 0===t.name&&console.error(`${this.parent.constructor.name}: Option button miss value`),_l.call(this,t)),this},addMultiple(t){for(var e=0,i=t.length;e0},setButtonEnable(t,e){var i=this.buttons;if(void 0===t||"boolean"==typeof t){e=t;for(var s=0,r=i.length;sa.height/2)){r>(o=Fl(a.left,a.centerY,t,e))&&(r=o,s=n);var o,l=i[n+1];l&&l.y===a.y||r>(o=Fl(a.right,a.centerY,t,e))&&(r=o,s=n+1)}}return s};const Gl=Phaser.Utils.Objects.IsPlainObject,Vl=Phaser.Utils.Objects.GetValue,Nl=Phaser.Display.Align.CENTER;var Ul=function(t,e,i,s){return"\n"===t?(this.addNewLine(),this):(be.call(this,t),Gl(e)&&(e=Vl(o=e,"padding",0),i=Vl(o,"key",void 0),s=Vl(o,"index",void 0),r=Vl(o,"offsetX",0),n=Vl(o,"offsetY",0),h=Vl(o,"offsetOriginX",0),a=Vl(o,"offsetOriginY",0)),void 0===e&&(e=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===h&&(h=0),void 0===a&&(a=0),(o=this.getSizerConfig(t)).align=Nl,o.padding=fe(e),o.alignOffsetX=r,o.alignOffsetY=n,o.alignOffsetOriginX=h,o.alignOffsetOriginY=a,void 0===s||s>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(s,0,t),void 0!==i&&this.addChildrenMap(i,t),this);var r,n,h,a,o},$l={add(t,e,i){if(pr(t))for(var s=t,r=0,n=s.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,yh.call(this,t),this}},Kl={getChildrenWidth:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=0===this.orientation&&t?this.maxChildWidth:this.rexSizer.resolved?this.wrapResult.width:void 0)?e+(this.space.left+this.space.right)*this.scaleX:void 0);var e},getChildrenHeight:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=1===this.orientation&&t?this.maxChildHeight:this.rexSizer.resolved?this.wrapResult.height:void 0)?e+(this.space.top+this.space.bottom)*this.scaleY:void 0);var e},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;sr&&rd.addNewLine(this)}else for(n=0,h=t.length;n=0;i--)ld.call(this,e[i],t);return this}};const cd=Phaser.Utils.Objects.GetValue;class ud extends id{constructor(t,e){void 0===e&&(e={});var i=e.space;"number"==typeof i&&(e.space={item:i,line:i}),super(t,e),this.type="rexFixWidthButtons",this.buttonGroup=new Yl({parent:this,eventEmitter:cd(e,"eventEmitter",this),groupName:cd(e,"groupName",void 0),clickConfig:cd(e,"click",void 0)}).setButtonsType(e);var s=cd(e,"background",void 0),r=cd(e,"buttons",void 0);this.buttonsAlign=cd(e,"align",void 0),s&&this.addBackground(s),r&&this.addButtons(r),this.addChildrenMap("background",s),this.addChildrenMap("buttons",this.buttonGroup.buttons)}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.buttonGroup.destroy(),this.buttonGroup=void 0)}get buttons(){return this.buttonGroup.buttons}get groupName(){return this.buttonGroup.groupName}set groupName(t){this.buttonGroup.groupName=t}get eventEmitter(){return this.buttonGroup.eventEmitter}}Object.assign(ud.prototype,hd,dd,Xl,Al);var pd={v:0,vertical:0,y:0,h:1,horizontal:1,x:1,xy:2,vh:2},vd=function(t,e){void 0===e&&(e="scrollMode"),t.hasOwnProperty(e)||(t[e]=gd(t));var i=t[e];return"string"==typeof i&&(i=pd[i]),i},gd=function(t){var e=!!t.sliderY||!!t.scrollerY,i=!!t.sliderX||!!t.scrollerX;return e&&i?2:e?0:i?1:0},fd=function(){return Array.prototype.reduce.call(arguments,md,0)},md=function(t,e){return t+e};const bd=Phaser.Utils.Objects.IsPlainObject,yd=Phaser.Utils.Objects.GetValue,Cd=Phaser.Display.Align.CENTER;var xd=function(t,e,i,s,r){if("number"==typeof t||"number"==typeof e){if(void 0===t){for(var n=0;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return wd(this.sizerChildren,null),yh.call(this,t),this}},Pd={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)wd(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},Ed={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=We.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,wd(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)wd(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},Dd=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const Rd=Phaser.Utils.Objects.IsPlainObject,Ld=Phaser.Utils.Objects.GetValue;class Xd extends nh{constructor(t,e,i,s,r,n,h,a,o,l){Rd(e)?(e=Ld(l=e,"x",0),i=Ld(l,"y",0),s=Ld(l,"width",void 0),r=Ld(l,"height",void 0),n=Ld(l,"column",l.col||0),h=Ld(l,"row",0),a=Ld(l,"columnProportions",0),o=Ld(l,"rowProportions",0)):Rd(s)?(s=Ld(l=s,"width",void 0),r=Ld(l,"height",void 0),n=Ld(l,"column",l.col||0),h=Ld(l,"row",0),a=Ld(l,"columnProportions",0),o=Ld(l,"rowProportions",0)):Rd(n)?(n=Ld(l=n,"column",l.col||0),h=Ld(l,"row",0),a=Ld(l,"columnProportions",0),o=Ld(l,"rowProportions",0)):Rd(a)&&(a=Ld(l=a,"columnProportions",0),o=Ld(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(Ld(l,"createCellContainerCallback")),this.setIndentLeft(Ld(l,"space.indentLeftOdd",0),Ld(l,"space.indentLeftEven",0)),this.setIndentTop(Ld(l,"space.indentTopOdd",0),Ld(l,"space.indentTopEven",0)),this.resetGrid(n,h,a,o,Ld(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=Md.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=Dd.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(Xd.prototype,Ed);const Yd=Phaser.Utils.Objects.GetValue;var zd=Phaser.Renderer.WebGL.Utils,Ad=function(t,e,i,s,r,n){for(var h=zd.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),a=i.pathData,o=i.pathIndexes,l=0;l>>16,a=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+h+","+a+","+o+","+n+")"},Fd=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,h=(16711680&r)>>>16,a=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+h+","+a+","+o+","+n+")",t.lineWidth=e.lineWidth};const Hd=Phaser.Renderer.Canvas.SetTransform;var Gd={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=jd(e,i,s),h=r.calcMatrix.copyFrom(n.calc),a=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&Ad(r,h,e,l,a,o),e.isStroked&&Bd(r,e,l,a,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(Hd(t,r,e,i,s)){var n=e._displayOriginX,h=e._displayOriginY,a=e.pathData,o=a.length-1,l=a[0]-n,d=a[1]-h;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(Nd.prototype,Gd);var Ud=function(t){return t.x>0&&t.y>0},$d=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const Jd=Phaser.Math.DegToRad;var qd=function(t,e,i,s,r,n,h,a,o){h&&n>r?n-=360:!h&&n0,h=0,a=e.length;h=0?t.startAt(h+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(h+n,i):t.startAt(h,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(h,i),t.close(),t};const $c=Phaser.Utils.Objects.GetValue,Jc=Phaser.Utils.Objects.IsPlainObject;class qc extends(Sc(vc)){constructor(t,e,i,s,r,n,h,a){Jc(e)?(e=(a=e).x,i=a.y,s=a.width,r=a.height,n=a.barColor,h=a.value):Jc(s)?(s=(a=s).width,r=a.height,n=a.barColor,h=a.value):Jc(n)&&(n=(a=n).barColor,h=a.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===h&&(h=0),super(t,e,i,s,r,a),this.type="rexLineProgress",this.bootProgressBase(a),this.addShape((new Nc).setName("trackFill")).addShape((new Nc).setName("bar")).addShape((new Nc).setName("trackStroke")),this.setTrackColor($c(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke($c(a,"trackStrokeThickness",2),$c(a,"trackStrokeColor",void 0)),this.setSkewX($c(a,"skewX",0)),this.setRTL($c(a,"rtl",!1)),this.setValue(h)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var Kc={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&Uc(s,0,0,e,i,t);var r,n,h=this.getShape("bar");h.fillStyle(this.barColor),h.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),Uc(h,r,0,n,i,t));var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&Uc(a,0,0,e,i,t)}};Object.assign(qc.prototype,Kc);var Zc=function(t){return null==t||""===t||0===t.length},Qc=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(Zc(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(Zc(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,h=e.length;n=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=bo(i),s=bo(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),h=n.width,a=0,o=0,l=i.length;o0?h/a:0,c=n.height,u=0;for(o=0,l=s.length;o0?0:g,y=0,o=0;for(var w=i.length;o0?0:f),f>=1&&g>=1){var O=typeof(m=this.getFrameNameCallback(o,x,e));"string"!==O&&"number"!==O||r.add(m,0,y+n.cutX,C+n.cutY,f,g)}y+=f}C+=g}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,h,a,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/o,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(u,p);if(u>v){var g=(u-v)*o;d>=0?d+=g:d=g,u=v}if(p>v){var f=(p-v)*l;c>=0?c+=f:c=f,p=v}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,b=0;this._beginDraw();for(var y=0,C=this.rows.count;y0&&a>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(x,y)?0:1)?this._drawImage(this.textureKey,s,m,b,h,a):this._drawTileSprite(this.textureKey,s,m,b,h,a)),m+=h;b+=a}this._endDraw()},setStretchMode:function(t){return mu(t)?(this.stretchMode.edge=yu(bu(t,"edge",0)),this.stretchMode.internal=yu(bu(t,"internal",0))):(t=yu(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return xu.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const wu=Phaser.Utils.Objects.IsPlainObject,Ou=Phaser.Utils.Objects.GetValue,Pu=Phaser.GameObjects;var ku=void 0,_u=function(t,e){if(ku||(ku={},ei(t).events.once("destroy",(function(){for(var t in ku)ku[t].destroy();ku=void 0}))),!ku.hasOwnProperty(e)){var i=ei(t).scene.systemScene;(t=new Pu[e](i)).setOrigin(0),ku[e]=t}return ku[e]};const Tu=Phaser.GameObjects.RenderTexture;class Eu extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if(wu(i)?(i=Ou(d=i,"x",0),s=Ou(d,"y",0),r=Ou(d,"width",1),n=Ou(d,"height",1),h=Ou(d,"key",void 0),a=Ou(d,"baseFrame",void 0),o=Ou(d,"columns",void 0),l=Ou(d,"rows",void 0)):wu(r)?(r=Ou(d=r,"width",1),n=Ou(d,"height",1),h=Ou(d,"key",void 0),a=Ou(d,"baseFrame",void 0),o=Ou(d,"columns",void 0),l=Ou(d,"rows",void 0)):wu(h)?(h=Ou(d=h,"key",void 0),a=Ou(d,"baseFrame",void 0),o=Ou(d,"columns",void 0),l=Ou(d,"rows",void 0)):wu(a)?(a=Ou(d=a,"baseFrame",void 0),o=Ou(d,"columns",void 0),l=Ou(d,"rows",void 0)):Array.isArray(a)?(d=l,l=o,o=a,a=Ou(d,"baseFrame",void 0)):wu(o)&&(o=Ou(d=o,"columns",void 0),l=Ou(d,"rows",void 0)),void 0===a&&(a=Ou(d,"frame",void 0)),void 0===o){var c=Ou(d,"leftWidth",void 0),u=Ou(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=Ou(d,"topHeight",void 0),v=Ou(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(Ou(d,"getFrameNameCallback",void 0)),this.setStretchMode(Ou(d,"stretchMode",0)),this.setPreserveRatio(Ou(d,"preserveRatio",!0));var g=Ou(d,"maxFixedPartScale",1),f=Ou(d,"maxFixedPartScaleX",g),m=Ou(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(h,a,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,Su),i}(Tu,"rexNinePatch")){}var Mu={_drawImage:function(t,e,i,s,r,n){var h=_u(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=_u(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(Eu.prototype,Mu);class Du extends si{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(iu(t,e))return t[e];var i=t.parent;return iu(i,e)?i[e]:void 0}set(t,e,i){return iu(t,e)?t[e]=i:iu(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}}const Ru=Phaser.Utils.Objects.GetValue;class Lu extends Eu{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=Ru(e,"effects",!0);i&&au(this,i),this.style=new Du(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Lu.prototype,hc);const Xu=["alpha","tint","flipX","flipY"];var Yu=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("barColor")?i="bar":e.hasOwnProperty("leftWidth")?i="nineSlice":e.hasOwnProperty("key")&&(i="image")),i){case"bar":s=new tu(t,e);break;case"image":s=new gu(t,e);break;case"nineSlice":s=e.hasOwnProperty("stretchMode")?new Lu(t,e):new cu(t,e);break;default:s=new ac(t,e)}return function(t,e){if(!e)return t;for(var i=0,s=Xu.length;i=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const up=Phaser.Utils.Objects.GetValue,pp=Phaser.Math.Distance.Between;class vp extends si{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=up(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(up(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(up(t,"enable",!0)),this.holdThreshold=up(t,"holdThreshold",50),this.pointerOutReleaseEnable=up(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return gn(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:pp(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!ur(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!ur(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const gp=Phaser.Utils.Objects.GetValue;class fp{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(gp(t,"value",0)),this.setSpeed(gp(t,"speed",0)),this.setAcceleration(gp(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class mp{constructor(){this.value,this.dir,this.movement=new fp}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const xp={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},Sp=Phaser.Utils.Objects.GetValue;class wp extends si{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=Sp(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(Sp(e,"speed",.1)),this.setEnable(Sp(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(Sp(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||ur(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const Op=Phaser.Utils.Objects.GetValue;var Pp=function(t,e,i,s){var r,n,h="Y"===(i=i.toUpperCase()),a=2===t.scrollMode,o=t.childrenMap.child,l=`slider${i}`;if(r=a||s.hasOwnProperty(l)?Op(s,l,void 0):Op(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=h?1:0,n=function(t,e){void 0===e&&(e={});var i=bt(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new dp(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r),n.tickLength=Op(r,"tickLength",void 0);var p=Op(r,"position",0);"string"==typeof p&&(p=kp[p]);var v,g,f=Op(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=Op(s,"space.slider",void 0))&&(a?f=0:v=Op(s,"space.child",0)),g=void 0===v?"number"==typeof f:"number"==typeof v,h?0===p?(d=2,c=1,u=void 0===v?g?{left:f}:f:{left:Op(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:Op(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:Op(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:Op(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=Op(r,"hideUnscrollableSlider",!1),t[`disableUnscrollableDrag${i}`]=Op(r,"disableUnscrollableDrag",!1),t[`adaptThumb${i}SizeMode`]=Op(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=Op(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`disableUnscrollableDrag${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,b,y=Op(s,"scrollDetectionMode");"string"==typeof y&&(y=_p[y]);var C=`scroller${i}`;(m=a||s.hasOwnProperty(C)?Op(s,C,!0):Op(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==y&&(m.rectBoundsInteractive=1===y),b=new Cp(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var x,S,w,O,P,k=Op(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);k&&o&&(void 0!==y&&(k.focus=1===y?2:0),x=new wp(o,k)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,b),t.addChildrenMap(`mouseWheelScroller${i}`,x),a&&!h||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.disableUnscrollableDrag=t[`disableUnscrollableDrag${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",b),t.addChildrenMap("mouseWheelScroller",x)),n&&(a?(S=h?"t":"s",O=`scroll${i}`):(S="t",O="scroll"),n.on("valuechange",(function(e){t[S]=e,t.emit(O,t)}))),b&&(a?(w=`childO${i}`,O=`scroll${i}`):(w="childOY",O="scroll"),b.on("valuechange",(function(e){t[w]=e,t.emit(O,t)}))),x&&(P=a?`addChildO${i}`:"addChildOY",x.on("scroll",(function(e){t[P](-e,!0)})))};const kp={right:0,left:1,bottom:0,top:1},_p={gameObject:0,rectBounds:1},Tp=Phaser.Utils.Objects.GetValue;var Ep=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=Tp(e,"width"),h=Tp(e,"height");n||Tp(e,"child.expandWidth",!0)||(s[1]=0),h||Tp(e,"child.expandHeight",!0)||(r[1]=0);var a=new Xd(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=Yd(i,"child"),r=Yd(s,"gameObject",void 0);if(r){var n=Yd(i,"space.child",0);t.childMargin={};var h=t.childMargin,a={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:h.top=0,h.bottom=0,h.left=0,h.right=0;break;default:h.top=n,h.bottom=n,h.left=n,h.right=n}else switch(t.scrollMode){case 0:h.top=Yd(n,"top",0),h.bottom=Yd(n,"bottom",0),a.left=Yd(n,"left",0),a.right=Yd(n,"right",0);break;case 1:h.top=Yd(n,"left",0),h.bottom=Yd(n,"right",0),a.top=Yd(n,"top",0),a.bottom=Yd(n,"bottom",0);break;default:h.top=Yd(n,"top",0),h.bottom=Yd(n,"bottom",0),h.left=Yd(n,"left",0),h.right=Yd(n,"right",0)}e.add(r,{column:1,row:1,align:Yd(s,"align","center"),padding:a,expand:{width:Yd(s,"expandWidth",!0),height:Yd(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:Pp(t,a,"y",e);break;case 1:Pp(t,a,"x",e);break;default:Pp(t,a,"y",e),Pp(t,a,"x",e)}return a},Mp=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}i*="Y"===t?this.scaleY:this.scaleX,s&&s.setBounds(e,i),r&&(r.setEnable(e!==i),r.tickLength&&r.setTick(r.tickLength,e,i))},Dp=function(t){switch(this.scrollMode){case 0:case 1:(i=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(i,this.isOverflow),(r=this.childrenMap.scroller)&&this.disableUnscrollableDrag&&r.setEnable(this.isOverflow);break;default:var e=this[`isOverflow${t=t.toUpperCase()}`],i=this.childrenMap[`slider${t}`],s=this[`hideUnscrollableSlider${t}`];i&&s&&this.setChildVisible(i,e);var r=this.childrenMap.scroller,n=this[`disableUnscrollableDrag${t}`];r&&n&&r.setEnable(e)}},Rp=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(a=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=a.childrenMap.track,s=a.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&nthis.topChildOY}childOYExeceedBottom(t){return void 0===t&&(t=this.childOY),tthis.leftChildOX}childOXExeceedRight(t){return void 0===t&&(t=this.childOX),tthis.childHeight?t=0:s?t=e:r&&(t=i)),this._childOY!==t&&(this._childOY=t,this.resetChildPosition()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}get childOX(){return this._childOX}set childOX(t){var e=this.leftChildOX,i=this.rightChildOX,s=this.childOXExceedLeft(t),r=this.childOXExeceedRight(t);this.clampChildOX&&(this.childVisibleWidth>this.childWidth?t=0:s?t=e:r&&(t=i)),this._childOX!==t&&(this._childOX=t,this.resetChildPosition()),s&&(this.execeedLeftState||this.emit("execeedleft",this,t,e)),this.execeedLeftState=s,r&&(this.execeedRightState||this.emit("execeedright",this,t,i)),this.execeedRightState=r}setChildOY(t){return this.childOY=t,this}setChildOX(t){return this.childOX=t,this}set t(t){this.childOY=-this.visibleHeight*t}get t(){var t=this.visibleHeight;return 0===t?0:this.childOY/-t}set s(t){this.childOX=-this.visibleWidth*t}get s(){var t=this.visibleWidth;return 0===t?0:this.childOX/-t}setChildOYByPercentage(t){return this.t=t,this}setChildOXByPercentage(t){return this.s=t,this}}Object.assign(Qp.prototype,Jp);const tv=["top","bottom","centerY","center"],ev=["left","right","centerX","center"];var iv=function(t,e,i){var s,r="Y"===(e=e.toUpperCase()),n=this.childrenMap.child;if(r){if(i)for(var h=0,a=tv.length;h=0?0:Math.abs(l)<=Math.abs(d)?l:d}}else{if(i)for(h=0,a=ev.length;h=0?0:Math.abs(c)<=Math.abs(u)?c:u}}switch(this.scrollMode){case 0:case 1:this.childOY+=s;break;default:this[`childO${e}`]+=s}};const sv=Phaser.Utils.Objects.GetValue;class rv extends zp{constructor(t,e){void 0===e&&(e={});var i=vd(e),s=sv(e,"panel",void 0);void 0===s&&(s={}),s.scrollMode=i,s.clampChildOY=sv(e,"clampChildOY",!1),s.clampChildOX=sv(e,"clampChildOX",!1);var r,n,h=new Qp(t,s);switch(t.add.existing(h),i){case 0:r=sv(e,"expand.panel",!0),n=!0;break;case 1:r=!0,n=sv(e,"expand.panel",!0);break;default:r=!0,n=!0}e.type="rexScrollablePanel",e.child={gameObject:h,expandWidth:r,expandHeight:n,align:sv(e,"align.panel","center")};var a=sv(e,"space",void 0);a&&(a.child=sv(a,"panel",0)),super(t,e),this.addChildrenMap("panel",h.child),this.addChildrenMap("panelLayer",h.maskLayer),this.addChildrenMap("mask",h.maskGameObject),this.addChildrenMap("scrollableBlock",h)}setChildrenInteractive(t){return void 0===t&&(t={}),t.hasOwnProperty("eventEmitter")||(t.eventEmitter=this),t.hasOwnProperty("targets")||(t.targets=[this.childrenMap.panel]),ih(this.childrenMap.child,t),this}}var nv={scrollToChild:function(t,e){if(!this.hasChild(t))return this;switch(this.scrollMode){case 0:iv.call(this,t,"y",e);break;case 1:iv.call(this,t,"x",e);break;default:iv.call(this,t,"y",e),iv.call(this,t,"x",e)}return this}};Object.assign(rv.prototype,nv);const hv=Phaser.Utils.Objects.GetValue;var av=function(){var t,e=this.scene,i=this.listCreateBackgroundCallback;i&&(t=i.call(this,e),e.add.existing(t));var s=[],r=this.listCreateButtonCallback;if(r)for(var n=this.options,h=0,a=n.length;h0||this.listMaxHeight>0)){if(s=ov(e,u,this.listWrapEnable),this.listMaxHeight>0&&(s.layout(),s.height<=this.listMaxHeight&&(d=s)),!d){0===c&&(c=this.listMaxHeight);var p=lv(e,this.listCreateSliderTrackCallback),v=lv(e,this.listCreateSliderThumbCallback);d=new rv(e,{height:c,scrollMode:0,panel:{child:s,mask:{padding:1}},slider:{track:p,thumb:v,adaptThumbSize:this.listSliderAdaptThumbSizeEnable},scrollDetectionMode:1,scroller:this.listScrollerConfig,mouseWheelScroller:this.listMouseWheelScrollerConfig,space:{panel:hv(this.listSpace,"panel",0)}}),e.add.existing(d)}}else u.height=c,s=ov(e,u,this.listWrapEnable),d=s;return t&&d.addBackground(t,"background"),this.listDraggable&&d.setDraggable(!0),d!==s&&s.on("button.over",(function(t,e,i,s){d.emit("button.over",t,e,i,s)})).on("button.out",(function(t,e,i,s){d.emit("button.out",t,e,i,s)})).on("button.click",(function(t,e,i,s){d.emit("button.click",t,e,i,s)})),d},ov=function(t,e,i){var s;return i?(e.orientation="x",s=new ud(t,e)):(e.orientation="y",s=new Bl(t,e)),t.add.existing(s),s},lv=function(t,e,i){var s;return e&&(s=e.call(i,t),t.add.existing(s)),s},dv=function(t,e){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return!0;if(-1!==e.indexOf(".")){for(var i=e.split("."),s=t,r=0;rC.bottom&&(l=c.getTopLeft().y,t.setOrigin(0,1).setPosition(o+u,l+p))};const pv={down:0,up:1},vv=Phaser.Utils.Objects.GetValue;class gv extends Hs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=function(t,e){Di(t,e,"y","Cubic")}),null==e.transitOut&&(e.transitOut=function(t,e){!function(t,e,i,s,r){void 0===s&&(s="Linear");var n={mode:0};switch(i){case 0:case"x":n.end={x:0};break;case 1:case"y":n.end={y:0};break;default:n.end=0}n.duration=e,n.ease=s,void 0===r?r=new Ei(t,n):r.resetFromJSON(n),r.restart()}(t,e,"y","Linear")}),e.manualClose=!0,e.clickOutsideClose=!0,e.destroy=!0,super(t,e),uv(t,e),t.isRexSizer&&t.layout();var i=vv(e,"touchOutsideClose",!1),s=vv(e,"anyTouchClose",!1);s&&(i=!1),s?this.once("open",this.anyTouchClose,this):i&&this.once("open",this.touchOutsideClose,this),this.requestOpen()}shutdown(t){this.isShutdown||(this.scene.input.off("pointerup",this.touchCloseCallback,this),super.shutdown(t))}touchOutsideClose(){return this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&ir(this.parent,t.worldX,t.worldY)||this.requestClose()}onOpen(){this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.parent,this),super.onClose()}}var fv={focusNextButton(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;return t=void 0===e?0:(e+1)%this.listPanel.getButtons().length,this.emitButtonOver(t),this},focusPrevButton(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;if(void 0===e)t=0;else{var i=this.listPanel.getButtons().length;t=(e-1+i)%i}return this.emitButtonOver(t),this}},mv={openListPanel:function(){if(this.listPanel)return this;if(0===this.options.length)return this;var t,e=av.call(this);e.on("button.over",(function(t,i,s,r){this.currentOverIndex=i,this.listOnButtonOver&&this.listOnButtonOver.call(this,t,i,s,r),this.emit("button.over",this,e,t,i,s,r)}),this).on("button.out",(function(t,i,s,r){this.currentOverIndex===i&&(this.currentOverIndex=void 0),this.listOnButtonOut&&this.listOnButtonOut.call(this,t,i,s,r),this.emit("button.out",this,e,t,i,s,r)}),this),t=this.listAlignMode&&"label"!==this.listAlignMode?this.getElement(this.listAlignMode):this;var i=new gv(e,{duration:{in:this.listEaseInDuration,out:this.listEaseOutDuration},transitIn:this.listTransitInCallback,transitOut:this.listTransitOutCallback,expandDirection:this.listExpandDirection,alignTargetX:t,alignTargetY:this,alignSide:this.listAlignSide,bounds:this.listBounds}).on("open",(function(){e.on("button.click",(function(t,i,s,r){this.listOnButtonClick&&this.listOnButtonClick.call(this,t,i,s,r),this.emit("button.click",this,e,t,i,s,r),this.dropDownBehavior.requestClose()}),this),this.emit("list.open",this,e)}),this).on("close",(function(){this.listPanel=void 0,this.dropDownBehavior=void 0,this.emit("list.close",this)}),this);return e.onClickOutside((function(){i.requestClose()})),this.listPanel=e,this.dropDownBehavior=i,this.pin(e),this},closeListPanel:function(){return this.dropDownBehavior?(this.dropDownBehavior.requestClose(),this.currentOverIndex=void 0,this):this},toggleListPanel:function(){return this.listPanel?this.closeListPanel():this.openListPanel(),this},emitButtonClick:function(t){if(void 0===t&&(t=this.currentOverIndex),void 0===t)return this;var e=this.listPanel,i=e?e.getButton(t):this.options[t];return this.listOnButtonClick&&this.listOnButtonClick.call(this,i,t),this.emit("button.click",this,e,i,t),this},emitButtonOver:function(t){var e=this.listPanel;return e?(e.emitButtonOver(t),this):this}};Object.assign(mv,fl,fv);const bv=Phaser.Utils.Objects.GetValue;class yv extends gl{constructor(t,e){super(t,e),this.type="rexDropDownList",this.timer=void 0,this.listPanel=void 0,this.currentOverIndex=void 0,this.setOptions(bv(e,"options"));var i=bv(e,"list");this.setWrapEnable(bv(i,"wrap",!1)),this.setCreateButtonCallback(bv(i,"createButtonCallback")),this.setCreateListBackgroundCallback(bv(i,"createBackgroundCallback")),this.setCreateListSliderTrackCallback(bv(i,"createTrackCallback")),this.setCreateListSliderThumbCallback(bv(i,"createThumbCallback")),this.setListSliderAdaptThumbSizeEnable(bv(i,"sliderAdaptThumbSize",!1)),this.setListScrollerConfig(bv(i,"scroller")),this.setListMouseWheelScrollerConfig(bv(i,"mouseWheelScroller")),this.setButtonClickCallback(bv(i,"onButtonClick")),this.setButtonOverCallback(bv(i,"onButtonOver")),this.setButtonOutCallback(bv(i,"onButtonOut")),this.setListExpandDirection(bv(i,"expandDirection")),this.setListEaseInDuration(bv(i,"easeIn",500)),this.setListEaseOutDuration(bv(i,"easeOut",100)),this.setListTransitInCallback(bv(i,"transitIn")),this.settListTransitOutCallback(bv(i,"transitOut")),this.setListMaxHeight(bv(i,"maxHeight",0)),this.setListSize(bv(i,"width"),bv(i,"height",0)),this.setListAlignmentMode(bv(i,"alignParent","text")),this.setListAlignmentSide(bv(i,"alignSide","")),this.setListBounds(bv(i,"bounds")),this.setListSpace(bv(i,"space")),this.setListDraggable(bv(i,"draggable",!1)),this.setValueChangeCallback(bv(e,"setValueCallback"),bv(e,"setValueCallbackScope")),this.setValue(bv(e,"value")),this.onClick(this.toggleListPanel,this)}destroy(t){this.scene&&!this.ignoreDestroy&&(this.listPanel&&(this.listPanel.destroy(t),this.listPanel=void 0),super.destroy(t))}get isOpened(){return!!this.listPanel}setOptions(t){return void 0===t&&(t=[]),this.options=t,this}setValueChangeCallback(t,e){return this.valueChangeCallback=t,this.valueChangeCallbackScope=e,this}setValue(t){return this.value=t,this}get value(){return this._value}set value(t){if(this._value!==t){var e=this._value;this._value=t;var i=this.valueChangeCallback,s=this.valueChangeCallbackScope;i&&(s?i.call(s,this,t,e):i(this,t,e)),this.emit("valuechange",this,t,e)}}}return Object.assign(yv.prototype,mv),yv},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rexdropdownlist=e(); +var t,e;t=void 0,e=function(){var t=!1,e=function(e){t||(void 0===e&&(e=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const k=Phaser.Math.DegToRad;var _={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=k(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},T={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=O(t.scaleX,i.scaleX),e.scaleY=O(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},E={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=O(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},D={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},R={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},L={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},X={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(t){void 0===t&&(t=!1);var e=this;return this._mask=null,this.setChildMaskVisible(this),this.children.forEach((function(t){t.clearMask&&t.clearMask(!1),t.hasOwnProperty("isRexContainerLite")||e.setChildMaskVisible(t)})),t&&this.mask&&this.mask.destroy(),this}},Y=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},W=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const j=Phaser.Utils.Array;var I={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Ee=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const Me=/(\S+)\[(\d+)\]/i,De=Phaser.Utils.Objects.GetValue;var Re=function(t,e){return void 0===e?t:t[e]},Le=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=De(e,"left",0),t.right=De(e,"right",0),t.top=De(e,"top",0),t.bottom=De(e,"bottom",0)),t},Xe={getInnerPadding(t){return Re(this.space,t)},setInnerPadding(t,e){return Le(this.space,t,e),this},getOuterPadding(t){return Re(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Le(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Re(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Le(this.getSizerConfig(t).padding,e,i),this}},Ye=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},ze=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Ae=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},We=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Be=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},je=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Ie={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Fe=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?bi:mi,this.repeatCounter=0,this}stop(){return this.state=fi,this}update(t,e){this.state!==fi&&this.state!==Ci&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=yi)):(this.nowTime=this.duration,this.state=Ci):this.nowTime>=0&&(this.state=bi))}get t(){var t;switch(this.state){case fi:case mi:case yi:t=0;break;case bi:t=this.nowTime/this.duration;break;case Ci:t=1}return vi(t,0,1)}set t(t){(t=vi(t,-1,1))<0?(this.state=mi,this.nowTime=-this.delay*t):(this.state=bi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===fi}get isDelay(){return this.state===mi}get isCountDown(){return this.state===bi}get isRunning(){return this.state===mi||this.state===bi}get isDone(){return this.state===Ci}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const fi=0,mi=1,bi=2,yi=3,Ci=-1;class xi extends ci{constructor(t,e){super(t,e),this.timer=new gi}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const Si=Phaser.Utils.Objects.GetValue,wi=Phaser.Utils.Objects.GetAdvancedValue,Oi=Phaser.Tweens.Builders.GetEaseFunction;class Pi extends xi{resetFromJSON(t){return this.timer.resetFromJSON(Si(t,"timer")),this.setEnable(Si(t,"enable",!0)),this.setTarget(Si(t,"target",this.parent)),this.setDelay(wi(t,"delay",0)),this.setDuration(wi(t,"duration",1e3)),this.setEase(Si(t,"ease","Linear")),this.setRepeat(Si(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Oi(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const ki=Phaser.Utils.Objects.GetValue,_i=Phaser.Utils.Objects.GetAdvancedValue,Ti=Phaser.Math.Linear;let Ei=class extends Pi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(ki(t,"mode",0)),this.setScaleRange(_i(t,"start",void 0),_i(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Mi[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=_i(t,"x",this.parent.scaleX),this.startY=_i(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=_i(e,"x",void 0),this.endY=_i(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Ti(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Ti(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const Mi={stop:0,destroy:1,yoyo:2};var Di=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new Ei(t,a):r.resetFromJSON(a),r.restart(),r},Ri=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Ei&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new Ei(t,h):n.resetFromJSON(h),n.restart(),n},Li=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Xi=function(t){return Li(t,"complete")};const Yi=Phaser.Utils.Objects.IsPlainObject;var zi={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Yi(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Di(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Xi(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Yi(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Ri(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Xi(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Xi(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Yi(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new Ei(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Xi(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Ai={};Object.assign(Ai,zi),Ai.onInitScale=function(){zi.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=xe.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Wi=Phaser.Utils.Objects.GetValue,Bi=Phaser.Utils.Objects.GetAdvancedValue,ji=Phaser.Math.Linear;class Ii extends Pi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Wi(t,"mode",0)),this.setAlphaRange(Bi(t,"start",this.parent.alpha),Bi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Fi[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=ji(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Fi={stop:0,destroy:1,yoyo:2},Hi=Phaser.Utils.Objects.IsPlainObject;var Gi=function(t,e,i,s){var r,n;Hi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Ii(t,h):s.resetFromJSON(h),s.restart(),s},Vi=function(t,e,i,s){i instanceof Ii&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Ii(t,r):s.resetFromJSON(r),s.restart(),s};const Ni=Phaser.Utils.Objects.IsPlainObject;var Ui={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Ni(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Gi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Xi(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Ni(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Vi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Xi(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Xi(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},$i={};Object.assign($i,Ui),$i.onInitFade=function(){Ui.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=xe.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Ji=Phaser.Utils.Objects.GetValue,qi=Phaser.Utils.Objects.GetAdvancedValue,Ki=Phaser.Math.Linear;class Zi extends Pi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Ji(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=qi(t,"x",void 0),i=qi(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Qi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=qi(i,"startX",void 0),this.startY=qi(i,"startY",void 0),this.endX=qi(i,"endX",void 0),this.endY=qi(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Ki(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ki(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Qi={stop:0,destroy:1,yoyo:2};var ts=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const es=Phaser.Utils.Objects.IsPlainObject,is=Phaser.Math.Distance.Between;var ss={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(es(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*is(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Zi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=ts(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=ts(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Zi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Xi(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Xi(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(es(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*is(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Zi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=ts(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=ts(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Zi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Xi(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Xi(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},rs={};Object.assign(rs,ss),rs.onInitEaseMove=function(){ss.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=xe.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const ns=Phaser.Utils.Objects.GetValue;class hs extends oi{constructor(t,e){super(t,e),this.timer=new gi,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(ns(t,"timer")),this.setEnable(ns(t,"enable",!0)),this.setMode(ns(t,"mode",1)),this.isRunning=ns(t,"isRunning",!1),this.setMagnitudeMode(ns(t,"magnitudeMode",1)),this.setAxisMode(ns(t,"axis",0)),this.setDuration(ns(t,"duration",500)),this.setMagnitude(ns(t,"magnitude",10)),this.ox=ns(t,"ox",void 0),this.oy=ns(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=as[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ls[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=os[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=ns(i,"magnitude",void 0),t=ns(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const as={effect:0,behavior:1},os={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ls={constant:0,decay:1},ds=Phaser.Utils.Objects.IsPlainObject;var cs={shake(t,e,i){if(ds(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new hs(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Xi(this._shake)}};const us=Phaser.Utils.Objects.GetValue,ps=Phaser.Math.Linear;class vs extends Pi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=us(t,"key","value");var i=e[this.propertyKey];return this.fromValue=us(t,"from",i),this.toValue=us(t,"to",i),this.setEase(us(t,"ease",this.ease)),this.setDuration(us(t,"duration",this.duration)),this.setRepeat(us(t,"repeat",0)),this.setDelay(us(t,"delay",0)),this.setRepeatDelay(us(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=ps(this.fromValue,this.toValue,i)}}const gs=Phaser.Utils.Objects.IsPlainObject;class fs extends si{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new vs(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(gs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(gs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var ms={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new fs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Li(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},bs=Phaser.Utils.Array.Remove,ys={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var As={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Ze(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Ws={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=Wt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=Wt),this.transitOutCallback=t,this}},Bs={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},js={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Is={};Object.assign(Is,As,Ws,Bs,js);const Fs=Phaser.Utils.Objects.GetValue;class Hs extends si{constructor(t,e){super(t,e),this.setTransitInTime(Fs(e,"duration.in",200)),this.setTransitOutTime(Fs(e,"duration.out",200)),this.setTransitInCallback(Fs(e,"transitIn")),this.setTransitOutCallback(Fs(e,"transitOut")),this.oneShotMode=Fs(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new zs(this,{eventEmitter:!1,initState:Fs(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Hs.prototype,Is);var Gs=function(t){if(t.parentContainer)return Gs(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?Gs(e):t};class Vs extends si{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Gs(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Ns=Phaser.GameObjects.Rectangle;class Us extends Ns{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Vs(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const $s=Phaser.Utils.Objects.GetValue;class Js extends si{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode($s(t,"hitAreaMode",0)),this.setEnable($s(t,"enable",!0)),this.setStopMode($s(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=qs[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var qs={default:0,fullWindow:1};const Ks=Phaser.Utils.Objects.GetValue;class Zs extends Us{constructor(t,e){super(t,Ks(e,"color",0),Ks(e,"alpha",.8)),this.touchEventStop=new Js(this,{hitAreaMode:1})}}var Qs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Di(t,e)},scaleDown(t,e){Ri(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Gi(t,e)},fadeOut(t,e){Vi(t,e,!1)}},tr=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Gi(t,e,t.alpha)},er=function(t,e){Vi(t,e,!1)},ir=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!nt(t,!0).contains(e,i)||r&&!r(t,e,i))};const sr=Phaser.Utils.Objects.GetValue;let rr=class extends Hs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=nr.popUp),null==e.transitOut&&(e.transitOut=nr.scaleDown),e.destroy=sr(e,"destroy",!0),super(t,e);var i=sr(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Zs(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(sr(i,"transitIn",tr)),this.setCoverTransitOutCallback(sr(i,"transitOut",er)));var s=sr(e,"touchOutsideClose",!1),r=sr(e,"duration.hold",-1),n=sr(e,"timeOutClose",r>=0),h=sr(e,"anyTouchClose",!1);sr(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),sr(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&ir(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=nr[t]),t){case nr.popUp:t=Qs.popUp;break;case nr.fadeIn:t=Qs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=nr[t]),t){case nr.scaleDown:t=Qs.scaleDown;break;case nr.fadeOut:t=Qs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const nr={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var hr=function(t){return t&&"function"==typeof t},ar={modal(t,e){return hr(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new rr(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},or=function(t,e,i,s,r){hr(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},lr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return or.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return or.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return or.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return or.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return or.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return or.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return or.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return or.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return or.call(this,"shutdown",t,e,i,s),this}},dr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=cr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},cr={},ur=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?ir(t,e.x,e.y,i,s):!!(r=dr(e,n,!0))&&ir(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const Or={press:0,pointerdown:0,release:1,pointerup:1};var Pr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new wr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},kr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!_r(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return Tr.length=0,!0;return Tr.length=0,!1},Tr=[];const Er=Phaser.Utils.Objects.GetValue;class Mr extends si{constructor(t,e){super(t,e),this._enable=void 0;var i=Er(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Er(t,"enable",!0)),this.setMode(Er(t,"mode",1)),this.setClickInterval(Er(t,"clickInterval",100)),this.setDragThreshold(Er(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Dr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?kr:ur)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Dr={press:0,pointerdown:0,release:1,pointerup:1};var Rr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Mr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Lr extends Ys{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Xr=Phaser.Utils.Objects.GetValue;class Yr extends si{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Lr,this.parent.setInteractive(Xr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Xr(t,"enable",!0)),this.setCooldown(Xr(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var zr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&ur(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Yr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Yr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Ar={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Wr=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=tn,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===en&&this.onDragEnd(),this.pointer=void 0,this.tracerState=tn,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=sn,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&ur(t,s,e,i)}}const tn=0,en=1,sn="IDLE",rn=Phaser.Utils.Objects.GetValue,nn=Phaser.Math.Distance.Between;class hn extends Qr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=an},eventEmitter:!1};this.setRecongizedStateObject(new Ys(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(rn(t,"time",250)),this.setTapInterval(rn(t,"tapInterval",200)),this.setDragThreshold(rn(t,"threshold",9)),this.setTapOffset(rn(t,"tapOffset",10));var e=rn(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(rn(t,"maxTaps",void 0)),this.setMinTaps(rn(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case an:this.state=on;break;case on:var t=this.lastPointer;nn(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=ln,this.state=on);break;case ln:this.state=on}}onDragEnd(){this.state===on&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=ln))}onDrag(){this.state!==an&&this.pointer.getDistance()>this.dragThreshold&&(this.state=an)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===on){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=an):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=ln:this.state=an)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===ln&&(this.state=an)}get isTapped(){return this.state===ln}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const an="IDLE",on="BEGIN",ln="RECOGNIZED",dn=Phaser.Utils.Objects.GetValue;class cn extends Qr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=un},eventEmitter:!1};this.setRecongizedStateObject(new Ys(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(dn(t,"threshold",9)),this.setHoldTime(dn(t,"time",251)),this}onDragStart(){this.state=pn,0===this.holdTime&&(this.state=vn)}onDragEnd(){this.state=un}onDrag(){this.state!==un&&this.pointer.getDistance()>this.dragThreshold&&(this.state=un)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===pn&&t-this.pointer.downTime>=this.holdTime&&(this.state=vn)}get isPressed(){return this.state===vn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const un="IDLE",pn="BEGIN",vn="RECOGNIZED";Phaser.Utils.Objects.GetValue;var gn=function(t){return ei(t).loop.delta};const fn=Phaser.Math.Distance.Between,mn=Phaser.Math.Angle.Between;var bn={getDt:function(){return gn(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return fn(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return mn(e.x,e.y,t.x,t.y)}},yn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},Cn={};const xn=Phaser.Utils.Objects.GetValue,Sn=Phaser.Math.RadToDeg;class wn extends Qr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=On},eventEmitter:!1};this.setRecongizedStateObject(new Ys(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(xn(t,"threshold",10)),this.setVelocityThreshold(xn(t,"velocityThreshold",1e3)),this.setDirectionMode(xn(t,"dir","8dir")),this}onDragStart(){this.state=Pn}onDragEnd(){this.state=On}onDrag(){this.state===Pn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=kn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===kn&&(this.state=On)}get isSwiped(){return this.state===kn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=yn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=Cn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(Sn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(wn.prototype,bn);const On="IDLE",Pn="BEGIN",kn="RECOGNIZED",_n=Phaser.Utils.Objects.GetValue,Tn=Phaser.Utils.Array.SpliceOne,En=Phaser.Math.Distance.Between,Mn=Phaser.Math.Angle.Between;class Dn{constructor(t,e){var i=Ze(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(_n(e,"inputConfig",void 0)),this.setEventEmitter(_n(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(_n(t,"enable",!0)),this.bounds=_n(t,"bounds",void 0),this.tracerState=Ln,this.pointers.length=0,mt(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,mt(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case Ln:this.tracerState=Xn,this.onDrag1Start();break;case Xn:this.tracerState=Yn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],Tn(this.pointers,e),this.tracerState){case Xn:this.tracerState=Ln,this.onDrag1End();break;case Yn:this.tracerState=Xn,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case Xn:this.onDrag1();break;case Yn:this.onDrag2()}}}dragCancel(){return this.tracerState===Yn&&this.onDrag2End(),this.pointers.length=0,mt(this.movedState),this.tracerState=Ln,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Yn)return 0;var t=this.pointers[0],e=this.pointers[1];return En(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Yn)return 0;var t=this.pointers[0],e=this.pointers[1];return Mn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Rn.x=e.x-i.x,Rn.y=e.y-i.y}else Rn.x=0,Rn.y=0;return Rn}get centerX(){if(this.tracerState!==Yn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Yn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Yn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Yn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=zn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&ur(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&ur(t,s,e,i)}}Object.assign(Dn.prototype,Je);var Rn={};const Ln=0,Xn=1,Yn=2,zn="IDLE";Phaser.Utils.Objects.GetValue;const An=Phaser.Math.RotateAround;var Wn=function(t,e,i,s){return An(t,e,i,s),t.rotation+=s,t},Bn={};const jn=Phaser.Utils.Objects.GetValue,In=Phaser.Math.Angle.WrapDegrees,Fn=Phaser.Math.Angle.ShortestBetween,Hn=Phaser.Math.RadToDeg,Gn=Phaser.Math.DegToRad;var Vn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Bn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=In(Hn(this.angleBetween));this.angle=Fn(this.prevAngle,t),this.prevAngle=t,this.state=$n}break;case $n:t=In(Hn(this.angleBetween)),this.angle=Fn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===$n}get rotation(){return Gn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Vn);const Nn="IDLE",Un="BEGIN",$n="RECOGNIZED",Jn=Phaser.Utils.Objects.GetValue;var qn=function(t){var e=Jn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new hn(this,e),this._tap.on("tap",(function(t,e,s){Br(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Br(i.eventEmitter,`${i.eventNamePrefix}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Kn=Phaser.Utils.Objects.GetValue;var Zn=function(t){var e=Kn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new cn(this,e),this._press.on("pressstart",(function(t,e,s){Br(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this).on("pressend",(function(t,e,s){Br(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Qn=Phaser.Utils.Objects.GetValue;var th=function(t){var e=Qn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new wn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Br(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Br(i.eventEmitter,`${i.eventNamePrefix}swipe`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const eh=Phaser.Utils.Objects.GetValue;var ih=function(t,e){return t.setInteractive(),eh(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:eh(e,"targets",[t]),targetMode:eh(e,"targetMode","parent"),eventEmitter:eh(e,"eventEmitter",t),eventNamePrefix:eh(e,"inputEventPrefix","child.")},Ir.call(t,e),Gr.call(t,e),Ur.call(t,e),Kr.call(t,e),qn.call(t,e),Zn.call(t,e),th.call(t,e),t},sh={getSizerConfig:function(t){return void 0===t&&(t=this),Dt(t)},getChildPrevState:function(t){var e=Dt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Xt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=le(e,"color"),s=le(e,"lineWidth");var o=le(e,"name",!1);o&&(r=le(o,"createTextCallback",ue),n=le(o,"createTextCallbackScope",void 0),"string"==typeof(h=le(o,"align","left-top"))&&(h=At[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new de(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}var d,c,u=this.getAllShownChildren([this]);pe(u,u);for(var p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const uh=Phaser.Utils.Objects.IsPlainObject,ph=Phaser.Utils.Objects.GetValue,vh=Phaser.Display.Align.CENTER,gh={min:0,full:-1};var fh=function(t,e,i,s,r,n,h,a,o,l){var d,c,u,p;be.call(this,t);var v=t.isRexSpace,g=typeof e;if(null===e)return this;if("number"===g);else if("string"===g)e=gh[e];else if(uh(e)){var f;e=ph(f=e,"proportion",void 0),i=ph(f,"align",vh),s=ph(f,"padding",0),r=ph(f,"expand",!1),n=ph(f,"key",void 0),h=ph(f,"index",void 0),t.isRexSizer||(a=ph(f,"minWidth",void 0),o=ph(f,"minHeight",void 0)),l=ph(f,"fitRatio",0),d=ph(f,"offsetX",0),c=ph(f,"offsetY",0),u=ph(f,"offsetOriginX",0),p=ph(f,"offsetOriginY",0)}return"string"==typeof i&&(i=At[i]),void 0===e&&(e=v?1:0),void 0===i&&(i=vh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(v?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(v?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),(f=this.getSizerConfig(t)).proportion=e,f.align=i,f.padding=fe(s),f.expand=r,f.fitRatio=0===e?l:0,f.alignOffsetX=d,f.alignOffsetY=c,f.alignOffsetOriginX=u,f.alignOffsetOriginY=p,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},mh={add:fh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),fh.call(this,new dh(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return uh(i)&&(i.index=t),fh.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=ch.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const bh=Mt.prototype.clear;var yh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),bh.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,yh.call(this,t),this}},Sh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=At[e]),this.getSizerConfig(t).align=e,this}},wh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},Oh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},Ph={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},kh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Ve(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Fe.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d,c,u=this.sizerChildren,p=this.innerLeft,v=this.innerTop,g=this.innerWidth,f=this.innerHeight,m=p,b=v,y=this.startChildIndex,C=0,x=u.length;C0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=We.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||ze.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&oh.call(this,t,void 0),Ae.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Be.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&oh.call(this,void 0,t),je.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(kh,mh,xh,Sh,wh,Oh,Ph);var _h=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},Th={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},Eh=function(t){return"string"==typeof t&&(t=Th[t]),t};const Mh=Phaser.Utils.Objects.IsPlainObject,Dh=Phaser.Utils.Objects.GetValue;class Rh extends nh{constructor(t,e,i,s,r,n,h){Mh(e)?(e=Dh(h=e,"x",0),i=Dh(h,"y",0),s=Dh(h,"width",void 0),r=Dh(h,"height",void 0),n=Dh(h,"orientation",0)):Mh(s)?(s=Dh(h=s,"width",void 0),r=Dh(h,"height",void 0),n=Dh(h,"orientation",0)):Mh(n)&&(n=Dh(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Dh(h,"space.item",0)),this.setStartChildIndex(Dh(h,"startChildIndex",0)),this.setRTL(Dh(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=Eh(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=_h.call(this)),this._childrenProportion}}Object.assign(Rh.prototype,kh);var Lh=function(t,e,i){if(t){var s=null==e,r=null==i;return s&&r||(s||(t.displayWidth=e),r||(t.displayHeight=i),s&&(t.scaleX=t.scaleY),r&&(t.scaleY=t.scaleX)),t}},Xh={appendText:function(t,e){var i;return t||0===t||(t=""),void 0===e&&(e=!0),Array.isArray(t)&&(t=t.join("\n")),(i=e?`${this.text}\n${t}`:`${this.text}${t}`)!=this.text&&this.setText(i),this},resetDisplayContent:function(t){void 0===t?t={}:"string"==typeof t&&(t={text:t});var e=t.text||"";this.setText(e);var i=this.childrenMap.icon;if(i){t.icon?this.show(i):this.hide(i);var s=t.iconSize;s&&(this.setChildDisplaySize(i,s,s),void 0!==this.iconWidth&&this.setIconSize(s)),!0!==t.icon&&this.setIconTexture(t.icon,t.iconFrame)}var r=this.childrenMap.action;if(r){t.action?this.show(r):this.hide(r);var n=t.actionSize;n&&(this.setChildDisplaySize(r,n,n),void 0!==this.actionWidth&&this.setActionSize(n)),!0!==t.action&&this.setActionTexture(t.action,t.actionFrame)}return this}};class Yh extends Rh{get text(){var t=this.childrenMap.text;return t?t.text:""}set text(t){var e=this.childrenMap.text;e&&e.setText(t)}setText(t){return this.text=t,this}setIconTexture(t,e){var i=this.childrenMap.icon;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.iconWidth&&void 0!==this.iconHeight&&(Lh(i,this.iconWidth,this.iconHeight),this.resetChildScaleState(i)),this):this}setTexture(t,e){return this.setIconTexture(t,e),this}setIconSize(t,e){return void 0===e&&(e=t),this.iconWidth=t,this.iconHeight=e,this}get texture(){var t=this.childrenMap.icon;if(t)return t.texture}get frame(){var t=this.childrenMap.icon;if(t)return t.frame}setActionTexture(t,e){var i=this.childrenMap.action;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.actionWidth&&void 0!==this.actionHeight&&(Lh(i,this.actionWidth,this.actionHeight),this.resetChildScaleState(i)),this):this}get actionTexture(){var t=this.childrenMap.action;if(t)return t.texture}get actionFrame(){var t=this.childrenMap.action;if(t)return t.frame}setActionSize(t,e){return void 0===e&&(e=t),this.actionWidth=t,this.actionHeight=e,this}preLayout(){var t=this.childrenMap.icon;t&&void 0!==this.iconWidth&&void 0!==this.iconHeight&&Lh(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&Lh(e,this.actionWidth,this.actionHeight),super.preLayout()}postLayout(t,e,i){var s=this.childrenMap.iconMask;s&&(s.setPosition(),this.resetChildPositionState(s));var r=this.childrenMap.actionMask;return r&&(r.setPosition(),this.resetChildPositionState(r)),super.postLayout(t,e,i),this}resize(t,e){super.resize(t,e);var i=this.childrenMap.iconMask;i&&i.resize();var s=this.childrenMap.actionMask;return s&&s.resize(),this}}Object.assign(Yh.prototype,Xh);const zh=Phaser.GameObjects.Graphics.prototype.setPosition,Ah=Phaser.Geom.Rectangle,Wh=Phaser.Geom.Circle;var Bh=function(t,e,i,s,r){this.geom=function(t,e,i,s,r,n,h){if(1===t){s=s.left;var a=-e*(r-.5),o=-i*(n-.5),l=Math.min(e,i)/2+s;void 0!==h&&h instanceof Wh||(h=new Wh),h.setTo(a,o,l)}else{var d=-e*r-s.left,c=-i*n-s.top,u=e+s.left+s.right,p=i+s.top+s.bottom;void 0!==h&&h instanceof Ah||(h=new Ah),h.setTo(d,c,u,p)}return h}(this.shapeType,t,e,i,s,r,this.geom),this.clear().fillStyle(16777215),1===this.shapeType?this.fillCircleShape(this.geom):this.fillRectShape(this.geom)},jh=function(t,e){for(var i in t){if(!(i in e))return!1;if(t[i]!==e[i])return!1}for(var i in e)if(!(i in t))return!1;return!0},Ih={setPosition:function(t,e){var i=this.parent;return void 0===t&&(t=i.x),void 0===e&&(e=i.y),zh.call(this,t,e),this},resize:function(t,e,i){var s=this.parent;void 0===t&&(t=s.width),void 0===e&&(e=s.height),void 0===i?i=this.padding:"number"==typeof i&&(i=GetBoundsConfig(i));var r=this.width!==t||this.height!==e,n=this.padding!==i&&!jh(this.padding,i);return r||n?(this.width=t,this.height=e,n&&bt(i,this.padding),this.originX=s.originX,this.originY=s.originY,Bh.call(this,t,e,i,s.originX,s.originY),this):this},setOrigin:function(t,e){void 0===e&&(e=t);var i=this.parent;return void 0===t&&(t=i.originX),void 0===e&&(e=i.originY),this.originX===t&&this.originY===e||(this.originX=t,this.originY=e,Bh.call(this,this.width,this.height,this.padding,t,e)),this},contains:function(t,e){return t-=this.x,e-=this.y,this.geom.contains(t,e)}};const Fh=Phaser.GameObjects.Graphics;class Hh extends Fh{constructor(t,e,i){void 0===e&&(e=0),"string"==typeof e&&(e=Gh[e]),super(t.scene),this.parent=t,this.shapeType=e,this.padding=fe(i),this.setPosition().resize().setVisible(!1)}destroy(){return this.parent=void 0,super.destroy(),this}}const Gh={rectangle:0,circle:1};Object.assign(Hh.prototype,Ih);var Vh=function(t,e,i,s){var r=new Hh(e,i,s);if(t&&!t.isRexSizer){var n=r.createGeometryMask();t.setMask(n),this.once("destroy",(function(){t.setMask(),n.destroy()}))}return this.pin(r),r};const Nh=Phaser.GameObjects.Text;var Uh=function(t){return t instanceof Nh};const $h=Phaser.GameObjects.BitmapText;var Jh=function(t){return t instanceof $h},qh=/^[\x00-\x7F]+$/,Kh=function(t){return qh.test(t)},Zh=function(t,e){for(var i=[],s=t.split("\n"),r=e.style,n=r.wordWrapWidth,h=r.hasOwnProperty("wrapMode")?r.wrapMode:3,a=e.context,o=0,l=s.length;o0&&r.push(o.join("")),r},ta=2;const ea={none:0,word:1,char:ta,character:ta,mix:3};var ia=function(t,e){var i=function(t){return Jh(t)?2:Uh(t)?0:1}(t);switch(i){case 0:switch("string"==typeof e&&(e=ea[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=Zh;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=ea[e]||0),t.style.wrapMode=e}};const sa=Phaser.Renderer.WebGL.Utils;var ra={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,h=r.height,a=sa.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,h,e.x,e.y,n/e.resolution,h/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,h,a(e.tintTopLeft,i.alpha*e._alphaTL),a(e.tintTopRight,i.alpha*e._alphaTR),a(e.tintBottomLeft,i.alpha*e._alphaBL),a(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const na=Phaser.Display.Color;var ha={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,h,a,o,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===h&&(h=0),void 0===a&&(a=0),void 0===o&&(o=c),void 0===l&&(l=u);var p=d.cutX+h,v=d.cutY+a;return this.context.drawImage(d.source.image,p,v,o,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new na);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var h=i;i=h.red,s=h.green,r=h.blue,n=h.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var a=this.context.createImageData(1,1);return a.data[0]=i,a.data[1]=s,a.data[2]=r,a.data[3]=n,this.context.putImageData(a,t,e),this.dirty=!0,this}},aa={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,function(t,e,i,s,r,n,h){var a,o=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===h&&(h=e.height);var d=(a=o.exists(i)?o.get(i):o.createCanvas(i,n,h)).getSourceImage();d.width!==n&&(d.width=n),d.height!==h&&(d.height=h);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,h),c.drawImage(e,s,r,n,h),l.gl&&a&&l.canvasToTexture(d,a.source[0].glTexture,!0,0)}(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};e();const oa=Phaser.Display.Canvas.CanvasPool,la=Phaser.GameObjects.GameObject,da=Phaser.Utils.String.UUID;class ca extends la{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=oa.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=da(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){oa.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}}const ua=Phaser.GameObjects.Components;Phaser.Class.mixin(ca,[ua.Alpha,ua.BlendMode,ua.Crop,ua.Depth,ua.Flip,ua.GetBounds,ua.Mask,ua.Origin,ua.Pipeline,ua.PostPipeline,ua.ScrollFactor,ua.Tint,ua.Transform,ua.Visible,ra,ha,aa]);var pa={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:Ms(this.data,t,e)},incData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)+e),this},mulData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)*e),this},clearData(){return this.data&&mt(this.data),this}};class va{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}}Object.assign(va.prototype,pa);var ga={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const fa=Phaser.Math.RotateAround;var ma;const ba=Phaser.Geom.Rectangle;var ya,Ca=function(t){void 0===ya&&(ya=new ba);var e=t.drawTLX,i=t.drawTLY;return ya.setTo(e,i,t.drawTRX-e,t.drawBLY-i),ya};const xa=Phaser.Math.RotateAround;var Sa,wa=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Sa&&(Sa={}),s=Sa),s.x=e,s.y=i,0!==t.rotation&&xa(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const Oa=Phaser.GameObjects.Components.TransformMatrix;var Pa,ka,_a={},Ta=function(t,e,i,s,r){var n=wa(e,i,s,!0),h=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=_a);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===Pa&&(Pa=new Oa,ka=new Oa),t.parentContainer?t.getWorldTransformMatrix(Pa,ka):Pa.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),Pa.transformPoint(r,n,s),s}(t,n.x,n.y,r);return h},Ea=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,h=e.drawCenterY+s;return Ta(t,e,n,h,r)},Ma={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===ma&&(ma={}),s=ma),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&fa(s,0,0,-i.rotation),s}(t,e,this,!0);return Ca(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return Ea(this.parent,this,t,e,i)}};Object.assign(Ma,ga);const Da=Phaser.Math.DegToRad,Ra=Phaser.Math.RadToDeg,La=Phaser.Utils.Objects.GetValue;class Xa extends va{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return Ra(this._rotation)}set angle(t){this.rotation=Da(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=La(t,"width",void 0),i=La(t,"height",void 0),s=La(t,"scaleX",void 0),r=La(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(Xa.prototype,Ma);const Ya=Phaser.Utils.String.Pad;var za=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${Ya(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},Aa=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Wa=Phaser.Utils.Objects.GetValue;let Ba=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=Wa(t,"x",0),i=Wa(t,"y",0));var s=this.cornerRadius;s.tl=ja(Wa(t,"tl",void 0),e,i),s.tr=ja(Wa(t,"tr",void 0),e,i),s.bl=ja(Wa(t,"bl",void 0),e,i),s.br=ja(Wa(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Ia(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Ia(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Ia(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Ia(this.cornerRadius.br,t)}};var ja=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Fa(t),t},Ia=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Wa(e,"x",0),t.y=Wa(e,"y",0)),Fa(t)},Fa=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const Ha=Phaser.Math.DegToRad;var Ga=function(t){return!t.hasOwnProperty("convex")||t.convex},Va=function(t){return t.x>0&&t.y>0},Na=function(t,e,i,s,r,n,h,a,o){if(a&&h>n?h-=360:!a&&h=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=m.tl,Va(a)?(o=a.x*g,l=a.y*f,Ga(a)?Na(t,o,l,o,l,180,270,!1,h):Na(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,Va(a)?(o=a.x*g,l=a.y*f,Ga(a)?Na(t,s-o,l,o,l,270,360,!1,h):Na(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,Va(a)?(o=a.x*g,l=a.y*f,Ga(a)?Na(t,s-o,r-l,o,l,0,90,!1,h):Na(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,Va(a)?(o=a.x*g,l=a.y*f,Ga(a)?Na(t,o,r-l,o,l,90,180,!1,h):Na(t,0,r,o,l,360,270,!0,h)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,h,u),null!=a)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,a),p.addColorStop(1,d),a=p),e.fillStyle=a,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())};const $a=Phaser.Utils.Objects.GetValue;class Ja extends Xa{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor($a(e,"color",null),$a(e,"color2",null),$a(e,"horizontalGradient",!0)),this.setStroke($a(e,"stroke",null),$a(e,"strokeThickness",2)),this.setCornerRadius($a(e,"cornerRadius",0),$a(e,"cornerIteration",null))}set color(t){t=za(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=za(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=za(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,Aa("color2",t,this),Aa("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Aa("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Aa("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){!function(t,e,i,s,r,n,h,a){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),Ua(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}}(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const qa=Phaser.Utils.Objects.GetValue;class Ka extends Xa{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(qa(e,"color",null),qa(e,"color2",null),qa(e,"horizontalGradient",!0)),this.setStroke(qa(e,"stroke",null),qa(e,"strokeThickness",2))}set color(t){t=za(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=za(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=za(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,qa(t,"color2",null),qa(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,qa(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,h=this.parent.height-i.top-i.bottom,a=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?a.createLinearGradient(0,0,n,0):a.createLinearGradient(0,0,0,h)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,a.fillStyle=t,a.fillRect(s,r,n,h));null!=this.stroke&&this.strokeThickness>0&&(a.strokeStyle=this.stroke,a.lineWidth=this.strokeThickness,a.strokeRect(s,r,n,h))}}const Za=Phaser.Utils.Objects.GetValue;class Qa{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(Za(t,"bold",!1)),this.setItalic(Za(t,"italic",!1)),this.setFontSize(Za(t,"fontSize","16px")),this.setFontFamily(Za(t,"fontFamily","Courier")),this.setColor(Za(t,"color","#fff")),this.setStrokeStyle(Za(t,"stroke",null),Za(t,"strokeThickness",0)),this.setShadow(Za(t,"shadowColor",null),Za(t,"shadowOffsetX",0),Za(t,"shadowOffsetY",0),Za(t,"shadowBlur",0)),this.setOffset(Za(t,"offsetX",0),Za(t,"offsetY",0)),this.setSpace(Za(t,"leftSpace",0),Za(t,"rightSpace",0)),this.setAlign(Za(t,"align",void 0)),this.setBackgroundColor(Za(t,"backgroundColor",null)),this.setBackgroundHeight(Za(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Za(t,"backgroundBottomY",void 0)),this.setBackgroundLeftX(Za(t,"backgroundLeftX",0)),this.setBackgroundRightX(Za(t,"backgroundRightX",0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(Aa("stroke",t,this),Aa("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Aa("shadowOffsetX",t,this),Aa("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),t.hasOwnProperty("backgroundLeftX")&&this.setBackgroundLeftX(t.backgroundLeftX),t.hasOwnProperty("backgroundRightX")&&this.setBackgroundRightX(t.backgroundRightX),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new Qa(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=za(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=za(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=za(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=za(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setBackgroundLeftX(t){return this.backgroundLeftX=t,this}setBackgroundRightX(t){return this.backgroundRightX=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}}const to=Phaser.Utils.Array.Remove,eo=Phaser.Utils.Array.Remove,io="text",so="image",ro="drawer",no="space",ho="command";var ao=function(t){return t.type===io&&"\n"===t.text},oo=function(t){return t.type===io&&"\f"===t.text},lo=function(t){return t.type===io};class co extends Xa{constructor(t,e,i){super(t,io),this.updateTextFlag=!1,this.style=new Qa(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX+e.backgroundLeftX,s=i,r=this.drawTRX+e.backgroundRightX-i+1;if(r>0){var n=e.backgroundBottomY;null==n&&(n=this.drawBLY);var h=e.backgroundHeight;null==h&&(h=n-this.drawTLY);var a=n-h;t.fillRect(s,a,r,h)}}var o=e.hasFill,l=e.hasStroke;(o||l)&&(e.syncFont(t).syncStyle(t),l&&(e.syncShadow(t),t.strokeText(this.text,0,0)),o&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var uo=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const po=Phaser.Display.Canvas.CanvasPool;Phaser.Display.Canvas.CanvasPool;class vo extends Xa{constructor(t,e,i){super(t,so),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){!function(t,e,i,s,r,n,h,a){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===a&&(a=!1),a&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(h){var l=po.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=h,d.fillRect(0,0,r,n),o.drawImage(l,0,0,r,n,i,s,r,n),po.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)}(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class go extends Xa{constructor(t,e,i,s){super(t,ro),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class fo extends Xa{constructor(t,e){super(t,no),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class mo extends va{constructor(t,e,i,s,r){super(t,ho),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}function bo(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>bo(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=bo(t[i]));return e}var yo=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const Co={none:0,word:1,char:2,character:2,mix:3};var xo=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,h=!r&&!n,a=t.length,o=e,l=s.word,d=0,c=!1;o0&&!a){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=Po.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=Po.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=_o(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=_o(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=_o(t,"wrapMode");void 0===c&&(c=_o(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=Co[c]);var u=_o(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=_o(t,"letterSpacing",0),v=_o(t,"hAlign",0),g=_o(t,"vAlign",0),f=_o(t,"justifyPercentage",.25),m=yo({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:h,lineHeight:n,wrapWidth:u,wrapMode:c}),b=this.children,y=0,C=b.length;y0&&(E.push({children:M,width:D}),R=Math.max(R,D)),m.start+=T.length,m.isLastPage=!L&&m.start===_,m.maxLineWidth=R,m.linesHeight=E.length*n;var j=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,I=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,h=t.vAlign,a=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(h=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=Mo(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=Mo(t,"maxLines",0);var a=0===i,o=Mo(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=Mo(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=Mo(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=Mo(t,"letterSpacing",0),p=Mo(t,"rtl",!0),v=Mo(t,"hAlign",p?2:0),g=Mo(t,"vAlign",0),f=yo({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:o,wrapHeight:c,rtl:p}),m=this.children,b=0,y=m.length;b0&&(T.push({children:E,height:M}),D=Math.max(D,M)),f.start+=_.length,f.isLastPage=f.start===k,f.maxLineHeight=D,f.linesWidth=T.length*n;var A=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,W=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,h=t.vAlign,a=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}a&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,h=i.bottom;return Le(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return Re(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),to(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return eo(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(io);return null===i?i=new co(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),Ea(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const el=Phaser.Utils.Objects.GetFastValue;var il={};class sl{constructor(t){this.pools=el(t,"pools",il)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new tl),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;ei&&(r=Math.floor(i));for(var n={},h=cl(t,r,e,i,n),a=0;a<=ol&&0!==h;a++){if((r+=h)<0){r=0;break}h=cl(t,r,e,i,n)}return a===ol&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),ul(t,e,i),t},dl=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},cl=function(t,e,i,s,r){var n,h=dl(t,e,r),a=dl(t,e+1,r);if(void 0!==s)if(h.height<=s&&a.height>s)n=0;else{if(h.height>s)return-1;n=Math.floor(s-h.height)}if(h.width<=i&&a.width>i)return 0;if(h.width>i)return-1;var o=Math.floor(i-h.width);return void 0===n?o:Math.min(o,n)},ul=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const pl=Phaser.Utils.Objects.GetValue,vl=Phaser.Utils.Objects.GetValue;class gl extends Yh{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=vl(e,"background",void 0),r=vl(e,"icon",void 0),n=vl(e,"iconMask",void 0),h=vl(e,"text",void 0),a=vl(e,"action",void 0),o=vl(e,"actionMask",void 0),l=vl(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(h||a)&&(i={right:vl(e,"space.icon",0),top:vl(e,"space.iconTop",0),bottom:vl(e,"space.iconBottom",0),left:vl(e,"space.iconLeft",0)}):(h||a)&&(i={bottom:vl(e,"space.icon",0),left:vl(e,"space.iconLeft",0),right:vl(e,"space.iconRight",0),top:vl(e,"space.iconTop",0)});var d=vl(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=Vh.call(this,r,r,1)),!d){var c=vl(e,"iconSize",void 0);this.setIconSize(vl(e,"iconWidth",c),vl(e,"iconHeight",c))}}if(h){var u=vl(e,"wrapText",!1),p=vl(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),ia(h,u),e.expandTextWidth=!0,al(h)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=pl(e,"minWidth",0),s=pl(e,"minHeight",0),r=pl(e,"fitHeight",!1);t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return ll(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),ll(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t})}(h,{fitHeight:!0}));var v,g,f=vl(e,"space.text",0),m=vl(e,"expandTextWidth",!1),b=vl(e,"expandTextHeight",!1);0===this.orientation?(v=m?1:0,a&&(i={right:f}),g=b):(v=b?1:0,a&&(i={bottom:f}),g=m),this.add(h,{proportion:v,expand:g,padding:i})}if(a&&(i=0===this.orientation?{top:vl(e,"space.actionTop",0),bottom:vl(e,"space.actionBottom",0),right:vl(e,"space.actionRight",0)}:{left:vl(e,"space.actionLeft",0),right:vl(e,"space.actionRight",0),bottom:vl(e,"space.actionBottom",0)},d=vl(e,"squareFitAction",!1)?1:0,this.add(a,{proportion:0,padding:i,fitRatio:d}),o&&(o=Vh.call(this,a,a,1)),!d)){var y=vl(e,"actionSize");this.setActionSize(vl(e,"actionWidth",y),vl(e,"actionHeight",y))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",h),this.addChildrenMap("action",a),this.addChildrenMap("actionMask",o)}}var fl={setWrapEnable(t){return void 0===t&&(t=!0),this.listWrapEnable=t,this},setCreateButtonCallback(t){return this.listCreateButtonCallback=t,this},setCreateListBackgroundCallback(t){return this.listCreateBackgroundCallback=t,this},setCreateListSliderTrackCallback(t){return this.listCreateSliderTrackCallback=t,this},setCreateListSliderThumbCallback(t){return this.listCreateSliderThumbCallback=t,this},setListSliderAdaptThumbSizeEnable(t){return void 0===t&&(t=!0),this.listSliderAdaptThumbSizeEnable=t,this},setListScrollerConfig(t){return void 0===t&&(t={}),this.listScrollerConfig=t,this},setListMouseWheelScrollerConfig(t){return this.listMouseWheelScrollerConfig=t,this},setButtonClickCallback(t){return this.listOnButtonClick=t,this},setButtonOverCallback(t){return this.listOnButtonOver=t,this},setButtonOutCallback(t){return this.listOnButtonOut=t,this},setListExpandDirection(t){return"string"==typeof t&&(t=ml[t]),this.listExpandDirection=t,this},setListEaseInDuration(t){return void 0===t&&(t=0),this.listEaseInDuration=t,this},setListEaseOutDuration(t){return void 0===t&&(t=0),this.listEaseOutDuration=t,this},setListTransitInCallback(t){return this.listTransitInCallback=t,this},settListTransitOutCallback(t){return this.listTransitOutCallback=t,this},setListBounds(t){return this.listBounds=t,this},setListWidth(t){return this.listWidth=t,this},setListHeight(t){return this.listHeight=t,this},setListSize(t,e){return this.setListWidth(t).setListHeight(e),this},setListMaxHeight(t){return this.listMaxHeight=t,this},setListAlignmentMode(t){return this.listAlignMode=t,this},setListAlignmentSide(t){return void 0===t&&(t=""),this.listAlignSide=t,this},setListSpace(t){return void 0===t&&(t={}),this.listSpace=t,this},setListDraggable(t){return void 0===t&&(t=!0),this.listDraggable=t,this}};const ml={down:0,up:1},bl=Rh.prototype.add,yl=Rh.prototype.addSpace;var Cl=function(t){var e=!t.isRexSpace,i=!e||this.buttonsExpand?1:0;if(0===this.sizerChildren.length)if(e){!this.buttonsExpand&&("right"===this.buttonsAlign||"center"===this.buttonsAlign||"bottom"===this.buttonsAlign)&&yl.call(this),bl.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&yl.call(this),this.hasTailSpace=s}else bl.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;bl.call(this,t,{index:r,proportion:i,expand:!0})}else bl.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},xl={addButton(t){if(pr(t))for(var e=t,i=0,s=e.length;i=0;i--)Ol.call(this,e[i],t);return this}},kl=function(t,e,i){if(t){var s=this.setValueCallback,r=this.setValueCallbackScope;s&&(r?s.call(r,t,e,i):s(t,e,i)),this.fireEvent("button.statechange",t,e,i)}},_l=function(t){var e=this;t._selected=void 0,Object.defineProperty(t,"selected",{get:function(){return t._selected},set:function(i){if(t._selected!==i){var s=t._selected;t._selected=i,kl.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},Tl={add(t){return this.buttons.push(t),t._click||(t._click=new wr(t,this.clickConfig),t._click.on("click",(function(t,e,i,s){this.fireEvent("button.click",e,i,s)}),this).on("enable",(function(t,e){this.fireEvent("button.enable",e)}),this).on("disable",(function(t,e){this.fireEvent("button.disable",e)}),this).on("over",(function(t,e,i,s){this.fireEvent("button.over",e,i,s)}),this).on("out",(function(t,e,i,s){this.fireEvent("button.out",e,i,s)}),this).on("down",(function(t,e,i,s){this.fireEvent("button.down",e,i,s)}),this).on("up",(function(t,e,i,s){this.fireEvent("button.up",e,i,s)}),this),t.isRexContainerLite&&t.sendChildToBack(t)),this.buttonsType&&(void 0===t.name&&console.error(`${this.parent.constructor.name}: Option button miss value`),_l.call(this,t)),this},addMultiple(t){for(var e=0,i=t.length;e0},setButtonEnable(t,e){var i=this.buttons;if(void 0===t||"boolean"==typeof t){e=t;for(var s=0,r=i.length;sa.height/2)){r>(o=Fl(a.left,a.centerY,t,e))&&(r=o,s=n);var o,l=i[n+1];l&&l.y===a.y||r>(o=Fl(a.right,a.centerY,t,e))&&(r=o,s=n+1)}}return s};const Gl=Phaser.Utils.Objects.IsPlainObject,Vl=Phaser.Utils.Objects.GetValue,Nl=Phaser.Display.Align.CENTER;var Ul=function(t,e,i,s){return"\n"===t?(this.addNewLine(),this):(be.call(this,t),Gl(e)&&(e=Vl(o=e,"padding",0),i=Vl(o,"key",void 0),s=Vl(o,"index",void 0),r=Vl(o,"offsetX",0),n=Vl(o,"offsetY",0),h=Vl(o,"offsetOriginX",0),a=Vl(o,"offsetOriginY",0)),void 0===e&&(e=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===h&&(h=0),void 0===a&&(a=0),(o=this.getSizerConfig(t)).align=Nl,o.padding=fe(e),o.alignOffsetX=r,o.alignOffsetY=n,o.alignOffsetOriginX=h,o.alignOffsetOriginY=a,void 0===s||s>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(s,0,t),void 0!==i&&this.addChildrenMap(i,t),this);var r,n,h,a,o},$l={add(t,e,i){if(pr(t))for(var s=t,r=0,n=s.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,yh.call(this,t),this}},Kl={getChildrenWidth:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=0===this.orientation&&t?this.maxChildWidth:this.rexSizer.resolved?this.wrapResult.width:void 0)?e+(this.space.left+this.space.right)*this.scaleX:void 0);var e},getChildrenHeight:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=1===this.orientation&&t?this.maxChildHeight:this.rexSizer.resolved?this.wrapResult.height:void 0)?e+(this.space.top+this.space.bottom)*this.scaleY:void 0);var e},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;sr&&rd.addNewLine(this)}else for(n=0,h=t.length;n=0;i--)ld.call(this,e[i],t);return this}};const cd=Phaser.Utils.Objects.GetValue;class ud extends id{constructor(t,e){void 0===e&&(e={});var i=e.space;"number"==typeof i&&(e.space={item:i,line:i}),super(t,e),this.type="rexFixWidthButtons",this.buttonGroup=new Yl({parent:this,eventEmitter:cd(e,"eventEmitter",this),groupName:cd(e,"groupName",void 0),clickConfig:cd(e,"click",void 0)}).setButtonsType(e);var s=cd(e,"background",void 0),r=cd(e,"buttons",void 0);this.buttonsAlign=cd(e,"align",void 0),s&&this.addBackground(s),r&&this.addButtons(r),this.addChildrenMap("background",s),this.addChildrenMap("buttons",this.buttonGroup.buttons)}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.buttonGroup.destroy(),this.buttonGroup=void 0)}get buttons(){return this.buttonGroup.buttons}get groupName(){return this.buttonGroup.groupName}set groupName(t){this.buttonGroup.groupName=t}get eventEmitter(){return this.buttonGroup.eventEmitter}}Object.assign(ud.prototype,hd,dd,Xl,Al);var pd={v:0,vertical:0,y:0,h:1,horizontal:1,x:1,xy:2,vh:2},vd=function(t,e){void 0===e&&(e="scrollMode"),t.hasOwnProperty(e)||(t[e]=gd(t));var i=t[e];return"string"==typeof i&&(i=pd[i]),i},gd=function(t){var e=!!t.sliderY||!!t.scrollerY,i=!!t.sliderX||!!t.scrollerX;return e&&i?2:e?0:i?1:0},fd=function(){return Array.prototype.reduce.call(arguments,md,0)},md=function(t,e){return t+e};const bd=Phaser.Utils.Objects.IsPlainObject,yd=Phaser.Utils.Objects.GetValue,Cd=Phaser.Display.Align.CENTER;var xd=function(t,e,i,s,r){if("number"==typeof t||"number"==typeof e){if(void 0===t){for(var n=0;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return wd(this.sizerChildren,null),yh.call(this,t),this}},Pd={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)wd(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},Ed={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=We.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,wd(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)wd(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},Dd=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const Rd=Phaser.Utils.Objects.IsPlainObject,Ld=Phaser.Utils.Objects.GetValue;class Xd extends nh{constructor(t,e,i,s,r,n,h,a,o,l){Rd(e)?(e=Ld(l=e,"x",0),i=Ld(l,"y",0),s=Ld(l,"width",void 0),r=Ld(l,"height",void 0),n=Ld(l,"column",l.col||0),h=Ld(l,"row",0),a=Ld(l,"columnProportions",0),o=Ld(l,"rowProportions",0)):Rd(s)?(s=Ld(l=s,"width",void 0),r=Ld(l,"height",void 0),n=Ld(l,"column",l.col||0),h=Ld(l,"row",0),a=Ld(l,"columnProportions",0),o=Ld(l,"rowProportions",0)):Rd(n)?(n=Ld(l=n,"column",l.col||0),h=Ld(l,"row",0),a=Ld(l,"columnProportions",0),o=Ld(l,"rowProportions",0)):Rd(a)&&(a=Ld(l=a,"columnProportions",0),o=Ld(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(Ld(l,"createCellContainerCallback")),this.setIndentLeft(Ld(l,"space.indentLeftOdd",0),Ld(l,"space.indentLeftEven",0)),this.setIndentTop(Ld(l,"space.indentTopOdd",0),Ld(l,"space.indentTopEven",0)),this.resetGrid(n,h,a,o,Ld(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=Md.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=Dd.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(Xd.prototype,Ed);const Yd=Phaser.Utils.Objects.GetValue;var zd=Phaser.Renderer.WebGL.Utils,Ad=function(t,e,i,s,r,n){for(var h=zd.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),a=i.pathData,o=i.pathIndexes,l=0;l>>16,a=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+h+","+a+","+o+","+n+")"},Fd=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,h=(16711680&r)>>>16,a=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+h+","+a+","+o+","+n+")",t.lineWidth=e.lineWidth};const Hd=Phaser.Renderer.Canvas.SetTransform;var Gd={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=jd(e,i,s),h=r.calcMatrix.copyFrom(n.calc),a=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&Ad(r,h,e,l,a,o),e.isStroked&&Bd(r,e,l,a,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(Hd(t,r,e,i,s)){var n=e._displayOriginX,h=e._displayOriginY,a=e.pathData,o=a.length-1,l=a[0]-n,d=a[1]-h;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(Nd.prototype,Gd);var Ud=function(t){return t.x>0&&t.y>0},$d=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const Jd=Phaser.Math.DegToRad;var qd=function(t,e,i,s,r,n,h,a,o){h&&n>r?n-=360:!h&&n0,h=0,a=e.length;h=0?t.startAt(h+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(h+n,i):t.startAt(h,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(h,i),t.close(),t};const Jc=Phaser.Utils.Objects.GetValue,qc=Phaser.Utils.Objects.IsPlainObject;class Kc extends(Sc(vc)){constructor(t,e,i,s,r,n,h,a){qc(e)?(e=(a=e).x,i=a.y,s=a.width,r=a.height,n=a.barColor,h=a.value):qc(s)?(s=(a=s).width,r=a.height,n=a.barColor,h=a.value):qc(n)&&(n=(a=n).barColor,h=a.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===h&&(h=0),super(t,e,i,s,r,a),this.type="rexLineProgress",this.bootProgressBase(a),this.addShape((new Uc).setName("trackFill")).addShape((new Uc).setName("bar")).addShape((new Uc).setName("trackStroke")),this.setTrackColor(Jc(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(Jc(a,"trackStrokeThickness",2),Jc(a,"trackStrokeColor",void 0)),this.setSkewX(Jc(a,"skewX",0)),this.setRTL(Jc(a,"rtl",!1)),this.setValue(h)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var Zc={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&$c(s,0,0,e,i,t);var r,n,h=this.getShape("bar");h.fillStyle(this.barColor),h.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),$c(h,r,0,n,i,t));var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&$c(a,0,0,e,i,t)}};Object.assign(Kc.prototype,Zc);var Qc=function(t){return null==t||""===t||0===t.length},tu=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(Qc(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(Qc(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,h=e.length;n=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=bo(i),s=bo(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),h=n.width,a=0,o=0,l=i.length;o0?h/a:0,c=n.height,u=0;for(o=0,l=s.length;o0?0:g,y=0,o=0;for(var w=i.length;o0?0:f),f>=1&&g>=1){var O=typeof(m=this.getFrameNameCallback(o,x,e));"string"!==O&&"number"!==O||r.add(m,0,y+n.cutX,C+n.cutY,f,g)}y+=f}C+=g}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,h,a,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/o,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(u,p);if(u>v){var g=(u-v)*o;d>=0?d+=g:d=g,u=v}if(p>v){var f=(p-v)*l;c>=0?c+=f:c=f,p=v}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,b=0;this._beginDraw();for(var y=0,C=this.rows.count;y0&&a>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(x,y)?0:1)?this._drawImage(this.textureKey,s,m,b,h,a):this._drawTileSprite(this.textureKey,s,m,b,h,a)),m+=h;b+=a}this._endDraw()},setStretchMode:function(t){return bu(t)?(this.stretchMode.edge=Cu(yu(t,"edge",0)),this.stretchMode.internal=Cu(yu(t,"internal",0))):(t=Cu(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Su.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const Ou=Phaser.Utils.Objects.IsPlainObject,Pu=Phaser.Utils.Objects.GetValue,ku=Phaser.GameObjects;var _u=void 0,Tu=function(t,e){if(_u||(_u={},ei(t).events.once("destroy",(function(){for(var t in _u)_u[t].destroy();_u=void 0}))),!_u.hasOwnProperty(e)){var i=ei(t).scene.systemScene;(t=new ku[e](i)).setOrigin(0),_u[e]=t}return _u[e]};const Eu=Phaser.GameObjects.RenderTexture;class Mu extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if(Ou(i)?(i=Pu(d=i,"x",0),s=Pu(d,"y",0),r=Pu(d,"width",1),n=Pu(d,"height",1),h=Pu(d,"key",void 0),a=Pu(d,"baseFrame",void 0),o=Pu(d,"columns",void 0),l=Pu(d,"rows",void 0)):Ou(r)?(r=Pu(d=r,"width",1),n=Pu(d,"height",1),h=Pu(d,"key",void 0),a=Pu(d,"baseFrame",void 0),o=Pu(d,"columns",void 0),l=Pu(d,"rows",void 0)):Ou(h)?(h=Pu(d=h,"key",void 0),a=Pu(d,"baseFrame",void 0),o=Pu(d,"columns",void 0),l=Pu(d,"rows",void 0)):Ou(a)?(a=Pu(d=a,"baseFrame",void 0),o=Pu(d,"columns",void 0),l=Pu(d,"rows",void 0)):Array.isArray(a)?(d=l,l=o,o=a,a=Pu(d,"baseFrame",void 0)):Ou(o)&&(o=Pu(d=o,"columns",void 0),l=Pu(d,"rows",void 0)),void 0===a&&(a=Pu(d,"frame",void 0)),void 0===o){var c=Pu(d,"leftWidth",void 0),u=Pu(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=Pu(d,"topHeight",void 0),v=Pu(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(Pu(d,"getFrameNameCallback",void 0)),this.setStretchMode(Pu(d,"stretchMode",0)),this.setPreserveRatio(Pu(d,"preserveRatio",!0));var g=Pu(d,"maxFixedPartScale",1),f=Pu(d,"maxFixedPartScaleX",g),m=Pu(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(h,a,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,wu),i}(Eu,"rexNinePatch")){}var Du={_drawImage:function(t,e,i,s,r,n){var h=Tu(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=Tu(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(Mu.prototype,Du);class Ru extends si{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(su(t,e))return t[e];var i=t.parent;return su(i,e)?i[e]:void 0}set(t,e,i){return su(t,e)?t[e]=i:su(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}}const Lu=Phaser.Utils.Objects.GetValue;class Xu extends Mu{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=Lu(e,"effects",!0);i&&ou(this,i),this.style=new Ru(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Xu.prototype,hc);const Yu=["alpha","tint","flipX","flipY"];var zu=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("barColor")?i="bar":e.hasOwnProperty("leftWidth")?i="nineSlice":e.hasOwnProperty("key")&&(i="image")),i){case"bar":s=new eu(t,e);break;case"image":s=new fu(t,e);break;case"nineSlice":s=e.hasOwnProperty("stretchMode")?new Xu(t,e):new uu(t,e);break;default:s=new ac(t,e)}return function(t,e){if(!e)return t;for(var i=0,s=Yu.length;i=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const pp=Phaser.Utils.Objects.GetValue,vp=Phaser.Math.Distance.Between;class gp extends si{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=pp(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(pp(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(pp(t,"enable",!0)),this.holdThreshold=pp(t,"holdThreshold",50),this.pointerOutReleaseEnable=pp(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return gn(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:vp(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!ur(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!ur(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const fp=Phaser.Utils.Objects.GetValue;class mp{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(fp(t,"value",0)),this.setSpeed(fp(t,"speed",0)),this.setAcceleration(fp(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class bp{constructor(){this.value,this.dir,this.movement=new mp}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const Sp={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},wp=Phaser.Utils.Objects.GetValue;class Op extends si{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=wp(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(wp(e,"speed",.1)),this.setEnable(wp(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(wp(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||ur(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const Pp=Phaser.Utils.Objects.GetValue;var kp=function(t,e,i,s){var r,n,h="Y"===(i=i.toUpperCase()),a=2===t.scrollMode,o=t.childrenMap.child,l=`slider${i}`;if(r=a||s.hasOwnProperty(l)?Pp(s,l,void 0):Pp(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=h?1:0,n=function(t,e){void 0===e&&(e={});var i=bt(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new cp(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r),n.tickLength=Pp(r,"tickLength",void 0);var p=Pp(r,"position",0);"string"==typeof p&&(p=_p[p]);var v,g,f=Pp(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=Pp(s,"space.slider",void 0))&&(a?f=0:v=Pp(s,"space.child",0)),g=void 0===v?"number"==typeof f:"number"==typeof v,h?0===p?(d=2,c=1,u=void 0===v?g?{left:f}:f:{left:Pp(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:Pp(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:Pp(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:Pp(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=Pp(r,"hideUnscrollableSlider",!1),t[`disableUnscrollableDrag${i}`]=Pp(r,"disableUnscrollableDrag",!1),t[`adaptThumb${i}SizeMode`]=Pp(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=Pp(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`disableUnscrollableDrag${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,b,y=Pp(s,"scrollDetectionMode");"string"==typeof y&&(y=Tp[y]);var C=`scroller${i}`;(m=a||s.hasOwnProperty(C)?Pp(s,C,!0):Pp(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==y&&(m.rectBoundsInteractive=1===y),b=new xp(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var x,S,w,O,P,k=Pp(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);k&&o&&(void 0!==y&&(k.focus=1===y?2:0),x=new Op(o,k)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,b),t.addChildrenMap(`mouseWheelScroller${i}`,x),a&&!h||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.disableUnscrollableDrag=t[`disableUnscrollableDrag${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",b),t.addChildrenMap("mouseWheelScroller",x)),n&&(a?(S=h?"t":"s",O=`scroll${i}`):(S="t",O="scroll"),n.on("valuechange",(function(e){t[S]=e,t.emit(O,t)}))),b&&(a?(w=`childO${i}`,O=`scroll${i}`):(w="childOY",O="scroll"),b.on("valuechange",(function(e){t[w]=e,t.emit(O,t)}))),x&&(P=a?`addChildO${i}`:"addChildOY",x.on("scroll",(function(e){t[P](-e,!0)})))};const _p={right:0,left:1,bottom:0,top:1},Tp={gameObject:0,rectBounds:1},Ep=Phaser.Utils.Objects.GetValue;var Mp=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=Ep(e,"width"),h=Ep(e,"height");n||Ep(e,"child.expandWidth",!0)||(s[1]=0),h||Ep(e,"child.expandHeight",!0)||(r[1]=0);var a=new Xd(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=Yd(i,"child"),r=Yd(s,"gameObject",void 0);if(r){var n=Yd(i,"space.child",0);t.childMargin={};var h=t.childMargin,a={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:h.top=0,h.bottom=0,h.left=0,h.right=0;break;default:h.top=n,h.bottom=n,h.left=n,h.right=n}else switch(t.scrollMode){case 0:h.top=Yd(n,"top",0),h.bottom=Yd(n,"bottom",0),a.left=Yd(n,"left",0),a.right=Yd(n,"right",0);break;case 1:h.top=Yd(n,"left",0),h.bottom=Yd(n,"right",0),a.top=Yd(n,"top",0),a.bottom=Yd(n,"bottom",0);break;default:h.top=Yd(n,"top",0),h.bottom=Yd(n,"bottom",0),h.left=Yd(n,"left",0),h.right=Yd(n,"right",0)}e.add(r,{column:1,row:1,align:Yd(s,"align","center"),padding:a,expand:{width:Yd(s,"expandWidth",!0),height:Yd(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:kp(t,a,"y",e);break;case 1:kp(t,a,"x",e);break;default:kp(t,a,"y",e),kp(t,a,"x",e)}return a},Dp=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}i*="Y"===t?this.scaleY:this.scaleX,s&&s.setBounds(e,i),r&&(r.setEnable(e!==i),r.tickLength&&r.setTick(r.tickLength,e,i))},Rp=function(t){switch(this.scrollMode){case 0:case 1:(i=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(i,this.isOverflow),(r=this.childrenMap.scroller)&&this.disableUnscrollableDrag&&r.setEnable(this.isOverflow);break;default:var e=this[`isOverflow${t=t.toUpperCase()}`],i=this.childrenMap[`slider${t}`],s=this[`hideUnscrollableSlider${t}`];i&&s&&this.setChildVisible(i,e);var r=this.childrenMap.scroller,n=this[`disableUnscrollableDrag${t}`];r&&n&&r.setEnable(e)}},Lp=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(a=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=a.childrenMap.track,s=a.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&nthis.topChildOY}childOYExeceedBottom(t){return void 0===t&&(t=this.childOY),tthis.leftChildOX}childOXExeceedRight(t){return void 0===t&&(t=this.childOX),tthis.childHeight?t=0:s?t=e:r&&(t=i)),this._childOY!==t&&(this._childOY=t,this.resetChildPosition()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}get childOX(){return this._childOX}set childOX(t){var e=this.leftChildOX,i=this.rightChildOX,s=this.childOXExceedLeft(t),r=this.childOXExeceedRight(t);this.clampChildOX&&(this.childVisibleWidth>this.childWidth?t=0:s?t=e:r&&(t=i)),this._childOX!==t&&(this._childOX=t,this.resetChildPosition()),s&&(this.execeedLeftState||this.emit("execeedleft",this,t,e)),this.execeedLeftState=s,r&&(this.execeedRightState||this.emit("execeedright",this,t,i)),this.execeedRightState=r}setChildOY(t){return this.childOY=t,this}setChildOX(t){return this.childOX=t,this}set t(t){this.childOY=-this.visibleHeight*t}get t(){var t=this.visibleHeight;return 0===t?0:this.childOY/-t}set s(t){this.childOX=-this.visibleWidth*t}get s(){var t=this.visibleWidth;return 0===t?0:this.childOX/-t}setChildOYByPercentage(t){return this.t=t,this}setChildOXByPercentage(t){return this.s=t,this}}Object.assign(tv.prototype,qp);const ev=["top","bottom","centerY","center"],iv=["left","right","centerX","center"];var sv=function(t,e,i){var s,r="Y"===(e=e.toUpperCase()),n=this.childrenMap.child;if(r){if(i)for(var h=0,a=ev.length;h=0?0:Math.abs(l)<=Math.abs(d)?l:d}}else{if(i)for(h=0,a=iv.length;h=0?0:Math.abs(c)<=Math.abs(u)?c:u}}switch(this.scrollMode){case 0:case 1:this.childOY+=s;break;default:this[`childO${e}`]+=s}};const rv=Phaser.Utils.Objects.GetValue;class nv extends Ap{constructor(t,e){void 0===e&&(e={});var i=vd(e),s=rv(e,"panel",void 0);void 0===s&&(s={}),s.scrollMode=i,s.clampChildOY=rv(e,"clampChildOY",!1),s.clampChildOX=rv(e,"clampChildOX",!1);var r,n,h=new tv(t,s);switch(t.add.existing(h),i){case 0:r=rv(e,"expand.panel",!0),n=!0;break;case 1:r=!0,n=rv(e,"expand.panel",!0);break;default:r=!0,n=!0}e.type="rexScrollablePanel",e.child={gameObject:h,expandWidth:r,expandHeight:n,align:rv(e,"align.panel","center")};var a=rv(e,"space",void 0);a&&(a.child=rv(a,"panel",0)),super(t,e),this.addChildrenMap("panel",h.child),this.addChildrenMap("panelLayer",h.maskLayer),this.addChildrenMap("mask",h.maskGameObject),this.addChildrenMap("scrollableBlock",h)}setChildrenInteractive(t){return void 0===t&&(t={}),t.hasOwnProperty("eventEmitter")||(t.eventEmitter=this),t.hasOwnProperty("targets")||(t.targets=[this.childrenMap.panel]),ih(this.childrenMap.child,t),this}}var hv={scrollToChild:function(t,e){if(!this.hasChild(t))return this;switch(this.scrollMode){case 0:sv.call(this,t,"y",e);break;case 1:sv.call(this,t,"x",e);break;default:sv.call(this,t,"y",e),sv.call(this,t,"x",e)}return this}};Object.assign(nv.prototype,hv);const av=Phaser.Utils.Objects.GetValue;var ov=function(){var t,e=this.scene,i=this.listCreateBackgroundCallback;i&&(t=i.call(this,e),e.add.existing(t));var s=[],r=this.listCreateButtonCallback;if(r)for(var n=this.options,h=0,a=n.length;h0||this.listMaxHeight>0)){if(s=lv(e,u,this.listWrapEnable),this.listMaxHeight>0&&(s.layout(),s.height<=this.listMaxHeight&&(d=s)),!d){0===c&&(c=this.listMaxHeight);var p=dv(e,this.listCreateSliderTrackCallback),v=dv(e,this.listCreateSliderThumbCallback);d=new nv(e,{height:c,scrollMode:0,panel:{child:s,mask:{padding:1}},slider:{track:p,thumb:v,adaptThumbSize:this.listSliderAdaptThumbSizeEnable},scrollDetectionMode:1,scroller:this.listScrollerConfig,mouseWheelScroller:this.listMouseWheelScrollerConfig,space:{panel:av(this.listSpace,"panel",0)}}),e.add.existing(d)}}else u.height=c,s=lv(e,u,this.listWrapEnable),d=s;return t&&d.addBackground(t,"background"),this.listDraggable&&d.setDraggable(!0),d!==s&&s.on("button.over",(function(t,e,i,s){d.emit("button.over",t,e,i,s)})).on("button.out",(function(t,e,i,s){d.emit("button.out",t,e,i,s)})).on("button.click",(function(t,e,i,s){d.emit("button.click",t,e,i,s)})),d},lv=function(t,e,i){var s;return i?(e.orientation="x",s=new ud(t,e)):(e.orientation="y",s=new Bl(t,e)),t.add.existing(s),s},dv=function(t,e,i){var s;return e&&(s=e.call(i,t),t.add.existing(s)),s},cv=function(t,e){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return!0;if(-1!==e.indexOf(".")){for(var i=e.split("."),s=t,r=0;rC.bottom&&(l=c.getTopLeft().y,t.setOrigin(0,1).setPosition(o+u,l+p))};const vv={down:0,up:1},gv=Phaser.Utils.Objects.GetValue;class fv extends Hs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=function(t,e){Di(t,e,"y","Cubic")}),null==e.transitOut&&(e.transitOut=function(t,e){!function(t,e,i,s,r){void 0===s&&(s="Linear");var n={mode:0};switch(i){case 0:case"x":n.end={x:0};break;case 1:case"y":n.end={y:0};break;default:n.end=0}n.duration=e,n.ease=s,void 0===r?r=new Ei(t,n):r.resetFromJSON(n),r.restart()}(t,e,"y","Linear")}),e.manualClose=!0,e.clickOutsideClose=!0,e.destroy=!0,super(t,e),pv(t,e),t.isRexSizer&&t.layout();var i=gv(e,"touchOutsideClose",!1),s=gv(e,"anyTouchClose",!1);s&&(i=!1),s?this.once("open",this.anyTouchClose,this):i&&this.once("open",this.touchOutsideClose,this),this.requestOpen()}shutdown(t){this.isShutdown||(this.scene.input.off("pointerup",this.touchCloseCallback,this),super.shutdown(t))}touchOutsideClose(){return this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&ir(this.parent,t.worldX,t.worldY)||this.requestClose()}onOpen(){this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.parent,this),super.onClose()}}var mv={focusNextButton(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;return t=void 0===e?0:(e+1)%this.listPanel.getButtons().length,this.emitButtonOver(t),this},focusPrevButton(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;if(void 0===e)t=0;else{var i=this.listPanel.getButtons().length;t=(e-1+i)%i}return this.emitButtonOver(t),this}},bv={openListPanel:function(){if(this.listPanel)return this;if(0===this.options.length)return this;var t,e=ov.call(this);e.on("button.over",(function(t,i,s,r){this.currentOverIndex=i,this.listOnButtonOver&&this.listOnButtonOver.call(this,t,i,s,r),this.emit("button.over",this,e,t,i,s,r)}),this).on("button.out",(function(t,i,s,r){this.currentOverIndex===i&&(this.currentOverIndex=void 0),this.listOnButtonOut&&this.listOnButtonOut.call(this,t,i,s,r),this.emit("button.out",this,e,t,i,s,r)}),this),t=this.listAlignMode&&"label"!==this.listAlignMode?this.getElement(this.listAlignMode):this;var i=new fv(e,{duration:{in:this.listEaseInDuration,out:this.listEaseOutDuration},transitIn:this.listTransitInCallback,transitOut:this.listTransitOutCallback,expandDirection:this.listExpandDirection,alignTargetX:t,alignTargetY:this,alignSide:this.listAlignSide,bounds:this.listBounds}).on("open",(function(){e.on("button.click",(function(t,i,s,r){this.listOnButtonClick&&this.listOnButtonClick.call(this,t,i,s,r),this.emit("button.click",this,e,t,i,s,r),this.dropDownBehavior.requestClose()}),this),this.emit("list.open",this,e)}),this).on("close",(function(){this.listPanel=void 0,this.dropDownBehavior=void 0,this.emit("list.close",this)}),this);return e.onClickOutside((function(){i.requestClose()})),this.listPanel=e,this.dropDownBehavior=i,this.pin(e),this},closeListPanel:function(){return this.dropDownBehavior?(this.dropDownBehavior.requestClose(),this.currentOverIndex=void 0,this):this},toggleListPanel:function(){return this.listPanel?this.closeListPanel():this.openListPanel(),this},emitButtonClick:function(t){if(void 0===t&&(t=this.currentOverIndex),void 0===t)return this;var e=this.listPanel,i=e?e.getButton(t):this.options[t];return this.listOnButtonClick&&this.listOnButtonClick.call(this,i,t),this.emit("button.click",this,e,i,t),this},emitButtonOver:function(t){var e=this.listPanel;return e?(e.emitButtonOver(t),this):this}};Object.assign(bv,fl,mv);const yv=Phaser.Utils.Objects.GetValue;class Cv extends gl{constructor(t,e){super(t,e),this.type="rexDropDownList",this.timer=void 0,this.listPanel=void 0,this.currentOverIndex=void 0,this.setOptions(yv(e,"options"));var i=yv(e,"list");this.setWrapEnable(yv(i,"wrap",!1)),this.setCreateButtonCallback(yv(i,"createButtonCallback")),this.setCreateListBackgroundCallback(yv(i,"createBackgroundCallback")),this.setCreateListSliderTrackCallback(yv(i,"createTrackCallback")),this.setCreateListSliderThumbCallback(yv(i,"createThumbCallback")),this.setListSliderAdaptThumbSizeEnable(yv(i,"sliderAdaptThumbSize",!1)),this.setListScrollerConfig(yv(i,"scroller")),this.setListMouseWheelScrollerConfig(yv(i,"mouseWheelScroller")),this.setButtonClickCallback(yv(i,"onButtonClick")),this.setButtonOverCallback(yv(i,"onButtonOver")),this.setButtonOutCallback(yv(i,"onButtonOut")),this.setListExpandDirection(yv(i,"expandDirection")),this.setListEaseInDuration(yv(i,"easeIn",500)),this.setListEaseOutDuration(yv(i,"easeOut",100)),this.setListTransitInCallback(yv(i,"transitIn")),this.settListTransitOutCallback(yv(i,"transitOut")),this.setListMaxHeight(yv(i,"maxHeight",0)),this.setListSize(yv(i,"width"),yv(i,"height",0)),this.setListAlignmentMode(yv(i,"alignParent","text")),this.setListAlignmentSide(yv(i,"alignSide","")),this.setListBounds(yv(i,"bounds")),this.setListSpace(yv(i,"space")),this.setListDraggable(yv(i,"draggable",!1)),this.setValueChangeCallback(yv(e,"setValueCallback"),yv(e,"setValueCallbackScope")),this.setValue(yv(e,"value")),this.onClick(this.toggleListPanel,this)}destroy(t){this.scene&&!this.ignoreDestroy&&(this.listPanel&&(this.listPanel.destroy(t),this.listPanel=void 0),super.destroy(t))}get isOpened(){return!!this.listPanel}setOptions(t){return void 0===t&&(t=[]),this.options=t,this}setValueChangeCallback(t,e){return this.valueChangeCallback=t,this.valueChangeCallbackScope=e,this}setValue(t){return this.value=t,this}get value(){return this._value}set value(t){if(this._value!==t){var e=this._value;this._value=t;var i=this.valueChangeCallback,s=this.valueChangeCallbackScope;i&&(s?i.call(s,this,t,e):i(this,t,e)),this.emit("valuechange",this,t,e)}}}return Object.assign(Cv.prototype,bv),Cv},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rexdropdownlist=e(); diff --git a/dist/rexgameobjectshellplugin.js b/dist/rexgameobjectshellplugin.js index 7eaea2f4df..f554a95027 100644 --- a/dist/rexgameobjectshellplugin.js +++ b/dist/rexgameobjectshellplugin.js @@ -26661,6 +26661,32 @@ return pathData; }; + //import CatmullRomInterpolation from '../../utils/math/interpolation/CatmullRomInterpolation.js'; + + const CatmullRomInterpolation = Phaser.Math.Interpolation.CatmullRom; + + var CatmullRomTo = function (points, iterations, pathData) { + var pathDataCnt = pathData.length; + var p0x = pathData[pathDataCnt - 2]; + var p0y = pathData[pathDataCnt - 1]; + + var xList = [p0x]; + var yList = [p0y]; + for (var i = 0, cnt = points.length; i < cnt; i += 2) { + xList.push(points[i]); + yList.push(points[i + 1]); + } + + for (var i = 1, last = iterations - 1; i <= last; i++) { + var t = i / last; + pathData.push( + CatmullRomInterpolation(xList, t), + CatmullRomInterpolation(yList, t) + ); + } + return pathData; + }; + var DuplicateLast = function (pathData) { var len = pathData.length; if (len < 2) { @@ -26772,6 +26798,18 @@ return this; }, + catmullRomTo(...points) { + CatmullRomTo( + points, + this.iterations, + this.pathData + ); + + this.lastPointX = points[points.length-2]; + this.lastPointY = points[points.length-1]; + return this; + }, + close() { // Line to first point var startX = this.pathData[0], @@ -27209,6 +27247,13 @@ return this; } + catmullRomTo(...points) { + this.builder.catmullRomTo(...points); + + this.dirty = true; + return this; + } + close() { this.builder.close(); diff --git a/dist/rexgameobjectshellplugin.min.js b/dist/rexgameobjectshellplugin.min.js index 7505b44943..85bb6d24a8 100644 --- a/dist/rexgameobjectshellplugin.min.js +++ b/dist/rexgameobjectshellplugin.min.js @@ -1,11 +1,11 @@ -var t,e;t=void 0,e=function(){class t{constructor(t){this.scene=t,this.displayList=t.sys.displayList,this.updateList=t.sys.updateList,t.events.once("destroy",this.destroy,this)}destroy(){this.scene=null,this.displayList=null,this.updateList=null}static register(e,i){t.prototype[e]=i}}var e={setEventEmitter(t,e){return void 0===e&&(e=Phaser.Events.EventEmitter),this._privateEE=!0===t||void 0===t,this._eventEmitter=this._privateEE?new e:t,this},destroyEventEmitter(){return this._eventEmitter&&this._privateEE&&this._eventEmitter.shutdown(),this},getEventEmitter(){return this._eventEmitter},on(){return this._eventEmitter&&this._eventEmitter.on.apply(this._eventEmitter,arguments),this},once(){return this._eventEmitter&&this._eventEmitter.once.apply(this._eventEmitter,arguments),this},off(){return this._eventEmitter&&this._eventEmitter.off.apply(this._eventEmitter,arguments),this},emit(t){return this._eventEmitter&&t&&this._eventEmitter.emit.apply(this._eventEmitter,arguments),this},addListener(){return this._eventEmitter&&this._eventEmitter.addListener.apply(this._eventEmitter,arguments),this},removeListener(){return this._eventEmitter&&this._eventEmitter.removeListener.apply(this._eventEmitter,arguments),this},removeAllListeners(){return this._eventEmitter&&this._eventEmitter.removeAllListeners.apply(this._eventEmitter,arguments),this},listenerCount(){return this._eventEmitter?this._eventEmitter.listenerCount.apply(this._eventEmitter,arguments):0},listeners(){return this._eventEmitter?this._eventEmitter.listeners.apply(this._eventEmitter,arguments):[]},eventNames(){return this._eventEmitter?this._eventEmitter.eventNames.apply(this._eventEmitter,arguments):[]}};const i=Phaser.Scene;var s=function(t){return t instanceof i},r=function(t){return null==t||"object"!=typeof t?null:s(t)?t:t.scene&&s(t.scene)?t.scene:t.parent&&t.parent.scene&&s(t.parent.scene)?t.parent.scene:null};const n=Phaser.Game;var a=function(t){return t instanceof n},o=function(t){return null==t||"object"!=typeof t?null:a(t)?t:a(t.game)?t.game:s(t)?t.sys.game:s(t.scene)?t.scene.sys.game:void 0};const h=Phaser.Utils.Objects.GetValue;class l{constructor(t,e){this.setParent(t),this.isShutdown=!1,this.setEventEmitter(h(e,"eventEmitter",!0)),this.parent&&(this.parent===this.scene?this.scene.sys.events.once("shutdown",this.onEnvDestroy,this):this.parent===this.game?this.game.events.once("shutdown",this.onEnvDestroy,this):this.parent.once&&this.parent.once("destroy",this.onParentDestroy,this))}shutdown(t){this.isShutdown||(this.parent&&(this.parent===this.scene?this.scene.sys.events.off("shutdown",this.onEnvDestroy,this):this.parent===this.game?this.game.events.off("shutdown",this.onEnvDestroy,this):this.parent.once&&this.parent.off("destroy",this.onParentDestroy,this)),this.destroyEventEmitter(),this.parent=void 0,this.scene=void 0,this.game=void 0,this.isShutdown=!0)}destroy(t){this.shutdown(t)}onEnvDestroy(){this.destroy(!0)}onParentDestroy(t,e){this.destroy(e)}setParent(t){return this.parent=t,this.scene=r(t),this.game=o(t),this}}Object.assign(l.prototype,e);const d=Phaser.Utils.Objects.GetValue;class c extends l{constructor(t,e){super(t,e),this._isRunning=!1,this.isPaused=!1,this.tickingState=!1,this.setTickingMode(d(e,"tickingMode",1))}boot(){2!==this.tickingMode||this.tickingState||this.startTicking()}shutdown(t){this.isShutdown||(this.stop(),this.tickingState&&this.stopTicking(),super.shutdown(t))}setTickingMode(t){"string"==typeof t&&(t=u[t]),this.tickingMode=t}startTicking(){this.tickingState=!0}stopTicking(){this.tickingState=!1}get isRunning(){return this._isRunning}set isRunning(t){this._isRunning!==t&&(this._isRunning=t,1===this.tickingMode&&t!=this.tickingState&&(t?this.startTicking():this.stopTicking()))}start(){return this.isPaused=!1,this.isRunning=!0,this}pause(){return this.isRunning&&(this.isPaused=!0,this.isRunning=!1),this}resume(){return this.isPaused&&(this.isPaused=!1,this.isRunning=!0),this}stop(){return this.isPaused=!1,this.isRunning=!1,this}complete(){this.isPaused=!1,this.isRunning=!1,this.emit("complete",this.parent,this)}}const u={no:0,lazy:1,always:2};var p=function(t){return void 0!==t.displayWidth?t.displayWidth:t.width},g=function(t){return void 0!==t.displayHeight?t.displayHeight:t.height};const v=Phaser.Geom.Rectangle,f=Phaser.Math.Vector2,m=Phaser.Math.RotateAround,y=Phaser.GameObjects.Container;var b=function(t,e){if(void 0===e?e=new v:!0===e&&(void 0===x&&(x=new v),e=x),t.getBounds&&!(t instanceof y))return t.getBounds(e);var i,s,r,n,a,o,h,l;if(t.parentContainer){var d=t.parentContainer.getBoundsTransformMatrix();C(t,e),d.transformPoint(e.x,e.y,e),i=e.x,s=e.y,w(t,e),d.transformPoint(e.x,e.y,e),r=e.x,n=e.y,S(t,e),d.transformPoint(e.x,e.y,e),a=e.x,o=e.y,O(t,e),d.transformPoint(e.x,e.y,e),h=e.x,l=e.y}else C(t,e),i=e.x,s=e.y,w(t,e),r=e.x,n=e.y,S(t,e),a=e.x,o=e.y,O(t,e),h=e.x,l=e.y;return e.x=Math.min(i,r,a,h),e.y=Math.min(s,n,o,l),e.width=Math.max(i,r,a,h)-e.x,e.height=Math.max(s,n,o,l)-e.y,e},x=void 0,C=function(t,e,i){return void 0===e?e=new f:!0===e&&(void 0===P&&(P=new f),e=P),t.getTopLeft?t.getTopLeft(e):(e.x=t.x-p(t)*t.originX,e.y=t.y-g(t)*t.originY,T(t,e,i))},w=function(t,e,i){return void 0===e?e=new f:!0===e&&(void 0===P&&(P=new f),e=P),t.getTopRight?t.getTopRight(e):(e.x=t.x-p(t)*t.originX+p(t),e.y=t.y-g(t)*t.originY,T(t,e,i))},S=function(t,e,i){return void 0===e?e=new f:!0===e&&(void 0===P&&(P=new f),e=P),t.getBottomLeft?t.getBottomLeft(e):(e.x=t.x-p(t)*t.originX,e.y=t.y-g(t)*t.originY+g(t),T(t,e,i))},O=function(t,e,i){return void 0===e?e=new f:!0===e&&(void 0===P&&(P=new f),e=P),t.getBottomRight?t.getBottomRight(e):(e.x=t.x-p(t)*t.originX+p(t),e.y=t.y-g(t)*t.originY+g(t),T(t,e,i))},k=function(t,e,i){void 0===e?e=new f:!0===e&&(void 0===P&&(P=new f),e=P);var s=p(t),r=g(t);return e.x=t.x+s*(.5-t.originX),e.y=t.y+r*(.5-t.originY),T(t,e,i)},P=void 0,T=function(t,e,i){return void 0===i&&(i=!1),0!==t.rotation&&m(e,t.x,t.y,t.rotation),i&&t.parentContainer&&t.parentContainer.getBoundsTransformMatrix().transformPoint(e.x,e.y,e),e},_=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!b(t,!0).contains(e,i)||r&&!r(t,e,i))},M=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=E),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},E={},R=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,a=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return a?_(t,e.x,e.y,i,s):!!(r=M(e,n,!0))&&_(t,r.x,r.y,i,s);for(var o=t.scene.input.manager,h=o.pointersTotal,l=o.pointers,d=0;d0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=A,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===B&&this.onDragEnd(),this.pointer=void 0,this.tracerState=A,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=j,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&R(t,s,e,i)}}const A=0,B=1,j="IDLE";function W(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var z={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function s(){}function r(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function n(t,e,s,n,a){if("function"!=typeof s)throw new TypeError("The listener must be a function");var o=new r(s,n||t,a),h=i?i+e:e;return t._events[h]?t._events[h].fn?t._events[h]=[t._events[h],o]:t._events[h].push(o):(t._events[h]=o,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new s:delete t._events[e]}function o(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(i=!1)),o.prototype.eventNames=function(){var t,s,r=[];if(0===this._eventsCount)return r;for(s in t=this._events)e.call(t,s)&&r.push(i?s.slice(1):s);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(t)):r},o.prototype.listeners=function(t){var e=i?i+t:t,s=this._events[e];if(!s)return[];if(s.fn)return[s.fn];for(var r=0,n=s.length,a=new Array(n);rthis.tapOffset&&(this.state=Q,this.state=q);break;case Q:this.state=q}}onDragEnd(){this.state===q&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=Q))}onDrag(){this.state!==J&&this.pointer.getDistance()>this.dragThreshold&&(this.state=J)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===q){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=J):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=Q:this.state=J)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Q&&(this.state=J)}get isTapped(){return this.state===Q}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const J="IDLE",q="BEGIN",Q="RECOGNIZED",tt=Phaser.Utils.Objects.GetValue;class et extends D{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=it},eventEmitter:!1};this.setRecongizedStateObject(new N(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(tt(t,"threshold",9)),this.setHoldTime(tt(t,"time",251)),this}onDragStart(){this.state=st,0===this.holdTime&&(this.state=rt)}onDragEnd(){this.state=it}onDrag(){this.state!==it&&this.pointer.getDistance()>this.dragThreshold&&(this.state=it)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===st&&t-this.pointer.downTime>=this.holdTime&&(this.state=rt)}get isPressed(){return this.state===rt}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const it="IDLE",st="BEGIN",rt="RECOGNIZED",nt=Phaser.Utils.Objects.GetValue;class at extends D{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{},BEGIN:{enter:function(){var t=i.pointer;i.startX=t.x,i.startY=t.y,i.startWorldX=t.worldX,i.startWorldY=t.worldY}},RECOGNIZED:{enter:function(){i.emit("panstart",i,i.gameObject,i.lastPointer)},exit:function(){var t=i.lastPointer;i.endX=t.x,i.endY=t.y;var e=M(t,i.pointerCamera,!0);i.endWorldX=e.x,i.endWorldY=e.y,i.emit("panend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=ot},eventEmitter:!1};this.setRecongizedStateObject(new N(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(nt(t,"threshold",10)),this}onDragStart(){this.state=ht,0===this.dragThreshold&&(this.state=lt)}onDragEnd(){this.state=ot}onDrag(){switch(this.state){case ht:if(this.pointer.getDistance()>=this.dragThreshold){this.state=lt,this.dx=0,this.dy=0,this.dWorldX=0,this.dWorldY=0;var t=this.pointer;this.x=t.x,this.y=t.y,this.worldX=t.worldX,this.worldY=t.worldY}break;case lt:var e=this.pointerCamera,i=this.pointer.position,s=this.pointer.prevPosition;this.dx=i.x-s.x,this.dy=i.y-s.y,this.dWorldX=this.dx/e.zoom,this.dWorldY=this.dy/e.zoom,t=this.pointer,this.x=t.x,this.y=t.y;var r=M(t,e,!0);this.worldX=r.x,this.worldY=r.y,this.emit("pan",this,this.gameObject,this.lastPointer)}}get isPanned(){return this.state===lt}setDragThreshold(t){return this.dragThreshold=t,this}}const ot="IDLE",ht="BEGIN",lt="RECOGNIZED";var dt=function(t){return o(t).loop.delta};const ct=Phaser.Math.Distance.Between,ut=Phaser.Math.Angle.Between;var pt={getDt:function(){return dt(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return ct(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return ut(e.x,e.y,t.x,t.y)}},gt={"up&down":0,"left&right":1,"4dir":2,"8dir":3},vt={};const ft=Phaser.Utils.Objects.GetValue,mt=Phaser.Math.RadToDeg;class yt extends D{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=bt},eventEmitter:!1};this.setRecongizedStateObject(new N(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(ft(t,"threshold",10)),this.setVelocityThreshold(ft(t,"velocityThreshold",1e3)),this.setDirectionMode(ft(t,"dir","8dir")),this}onDragStart(){this.state=xt}onDragEnd(){this.state=bt}onDrag(){this.state===xt&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=Ct))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Ct&&(this.state=bt)}get isSwiped(){return this.state===Ct}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=gt[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=vt),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(mt(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(yt.prototype,pt);const bt="IDLE",xt="BEGIN",Ct="RECOGNIZED";var wt=function(t){if("object"!=typeof t||null===t)return t;if(Array.isArray(t))t.length=0;else for(var e in t)delete t[e];return t};const St=Phaser.Utils.Objects.GetValue,Ot=Phaser.Utils.Array.SpliceOne,kt=Phaser.Math.Distance.Between,Pt=Phaser.Math.Angle.Between;class Tt{constructor(t,e){var i=r(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(St(e,"inputConfig",void 0)),this.setEventEmitter(St(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(St(t,"enable",!0)),this.bounds=St(t,"bounds",void 0),this.tracerState=Mt,this.pointers.length=0,wt(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,wt(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case Mt:this.tracerState=Et,this.onDrag1Start();break;case Et:this.tracerState=Rt,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],Ot(this.pointers,e),this.tracerState){case Et:this.tracerState=Mt,this.onDrag1End();break;case Rt:this.tracerState=Et,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case Et:this.onDrag1();break;case Rt:this.onDrag2()}}}dragCancel(){return this.tracerState===Rt&&this.onDrag2End(),this.pointers.length=0,wt(this.movedState),this.tracerState=Mt,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Rt)return 0;var t=this.pointers[0],e=this.pointers[1];return kt(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Rt)return 0;var t=this.pointers[0],e=this.pointers[1];return Pt(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;_t.x=e.x-i.x,_t.y=e.y-i.y}else _t.x=0,_t.y=0;return _t}get centerX(){if(this.tracerState!==Rt)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Rt)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Rt)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Rt)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Lt,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&R(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&R(t,s,e,i)}}Object.assign(Tt.prototype,e);var _t={};const Mt=0,Et=1,Rt=2,Lt="IDLE",Dt=Phaser.Utils.Objects.GetValue;class At extends Tt{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.prevDistance=void 0,i.scaleFactor=1}},BEGIN:{},RECOGNIZED:{enter:function(){i.emit("pinchstart",i)},exit:function(){i.emit("pinchend",i)}}},init:function(){this.state=Bt},eventEmitter:!1};this.setRecongizedStateObject(new N(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Dt(t,"threshold",0)),this}onDrag2Start(){this.scaleFactor=1,this.prevDistance=this.distanceBetween,this.state=jt,0===this.dragThreshold&&(this.state=Wt)}onDrag2End(){this.state=Bt}onDrag2(){switch(this.state){case jt:if(this.pointers[0].getDistance()>=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=this.distanceBetween;this.scaleFactor=t/this.prevDistance,this.prevDistance=t,this.state=Wt}break;case Wt:t=this.distanceBetween,this.scaleFactor=t/this.prevDistance,this.emit("pinch",this),this.prevDistance=t}}get isPinched(){return this.state===Wt}setDragThreshold(t){return this.dragThreshold=t,this}}const Bt="IDLE",jt="BEGIN",Wt="RECOGNIZED",zt=Phaser.Math.RotateAround;var Yt=function(t,e,i,s){return zt(t,e,i,s),t.rotation+=s,t},It={};const Xt=Phaser.Utils.Objects.GetValue,Ft=Phaser.Math.Angle.WrapDegrees,Vt=Phaser.Math.Angle.ShortestBetween,Gt=Phaser.Math.RadToDeg,Ht=Phaser.Math.DegToRad;var Ut={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=It),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,a=r.y,o=this.rotation;if(Array.isArray(t))for(var h=t,l=0,d=h.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Ft(Gt(this.angleBetween));this.angle=Vt(this.prevAngle,t),this.prevAngle=t,this.state=Kt}break;case Kt:t=Ft(Gt(this.angleBetween)),this.angle=Vt(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Kt}get rotation(){return Ht(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Ut);const Nt="IDLE",$t="BEGIN",Kt="RECOGNIZED";var Zt=function(t,e){var i,s=t.cameras;if(void 0===e)i=s.main;else switch(typeof e){case"string":i=s.getCamera(e);break;case"number":i=s.cameras[e];break;default:i=e}return i};const Jt=Phaser.Utils.Objects.GetValue;class qt extends l{constructor(t,e){void 0===e&&(e={}),super(t,e),this.inputTarget=Jt(e,"inputTarget",t),this.pan=new at(this.inputTarget);var i=Zt(t,Jt(e,"camera"));this.setCamera(i).setEnable(Jt(e,"enable",!0)),this.boot()}boot(){this.pan.on("pan",(function(t){var e=this.camera;if(this.enable&&e){var i=e.zoom;e.scrollX-=t.dx/i,e.scrollY-=t.dy/i}}),this)}shutdown(t){this.isShutdown||(this.inputTarget=void 0,this.pan.destroy(),this.pan=void 0,super.shutdown(t))}setCamera(t){return this.camera=t,this}setEnable=function(t){return void 0===t&&(t=!0),this.enable=t,this}}var Qt=function(t,e,i,s){if(void 0!==i){var r=t.getWorldPoint(i,s);t.zoom=e,function(t){var e=t.width,i=t.height,s=t.zoomX,r=t.zoomY,n=t.matrix,a=t.scrollX,o=t.scrollY;t.useBounds&&(a=t.clampX(a),o=t.clampY(o)),t.scrollX=a,t.scrollY=o;var h=a+.5*e,l=o+.5*i;t.midPoint.set(h,l);var d=e/s,c=i/r;t.worldView.setTo(h-d/2,l-c/2,d,c);var u=e*t.originX,p=i*t.originY;n.applyITRS(t.x+u,t.y+p,t.rotation,s,r),n.translate(-u,-p)}(t);var n=t.getWorldPoint(i,s);t.scrollX-=n.x-r.x,t.scrollY-=n.y-r.y}else t.zoom=e};const te=Phaser.Utils.Objects.GetValue;Phaser.Math.Clamp;class ee extends l{constructor(t,e){void 0===e&&(e={}),super(t,e),this.inputTarget=te(e,"inputTarget",t),this.pinch=new At(this.inputTarget);var i=Zt(t,te(e,"camera"));this.setCamera(i).setEnable(te(e,"enable",!0)).setMinZoom(te(e,"minZoom",void 0)).setMaxZoom(te(e,"maxZoom",void 0)),this.boot()}boot(){this.pinch.on("pinch",(function(t){var e=this.camera;if(this.enable&&e){var i=e.zoom*t.scaleFactor;void 0!==this.minZoom&&ithis.maxZoom&&(i=this.maxZoom);var s=t.pointers[0],r=t.pointers[1],n=(s.x+r.x)/2,a=(s.y+r.y)/2;Qt(e,i,n,a)}}),this)}shutdown(t){this.isShutdown||(this.inputTarget=void 0,this.pinch.destroy(),this.pinch=void 0,super.shutdown(t))}setCamera(t){return this.camera=t,this}setEnable=function(t){return void 0===t&&(t=!0),this.enable=t,this};setMinZoom(t){return this.minZoom=t,this}setMaxZoom(t){return this.maxZoom=t,this}}const ie=Phaser.Input.Keyboard.Key,se=Phaser.Input.Keyboard.KeyCodes,re=["up","down","left","right"];class ne{constructor(t){this.scene=t,this.keys={},this.cursorKeys={},this.noKeyDown=!0;for(var e=0,i=re.length;e=s&&e<=s+o,l=e<=r&&e>=r-o,d=i>=n&&i<=n+o,c=i<=a&&i>=a-o;this.pointerOutBoundsReleaseEnable||(h|=er,d|=ia),this.setKeyState("left",h),this.setKeyState("right",l),this.setKeyState("up",d),this.setKeyState("down",c)}}get up(){return this.upKeyDown}get down(){return this.downKeyDown}get left(){return this.leftKeyDown}get right(){return this.rightKeyDown}get noKey(){return this.noKeyDown}}const pe=Phaser.Utils.Objects.GetValue;class ge extends l{constructor(t,e){void 0===e&&(e={}),super(t,e),this.cursorAtBounds=new ue(t);var i=this.cursorAtBounds.createCursorKeys();this.cameraController=new Phaser.Cameras.Controls.SmoothedKeyControl({left:i.left,right:i.right,up:i.up,down:i.down,acceleration:.06,drag:.003,maxSpeed:.3});var s=Zt(t,pe(e,"camera"));this.setCamera(s).setEnable(pe(e,"enable",!0)),this.boot()}boot(){this.scene.events.on("preupdate",this.updateCameraController,this)}shutdown(t){this.isShutdown||(this.scene.events.off("preupdate",this.updateCameraController,this),this.cursorAtBounds.destroy(),this.cameraController.destroy(),super.shutdown(t))}get camera(){return this.cameraController.camera}set camera(t){this.cameraController.setCamera(t),t?this.cameraController.start():this.cameraController.stop()}setCamera(t){return this.camera=t,this}get enable(){return this.cursorAtBounds.enable}set enable(t){this.cursorAtBounds.enable=t}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}updateCameraController(t,e){this.cameraController.update(e)}}const ve=Phaser.Utils.Objects.GetValue;class fe extends c{constructor(t,e){super(t,e);var i=this.scene?"update":"step";this.tickEventName=ve(e,"tickEventName",i),this.isSceneTicker=!me(this.tickEventName)}startTicking(){super.startTicking(),this.isSceneTicker?this.scene.sys.events.on(this.tickEventName,this.update,this):this.game.events.on(this.tickEventName,this.update,this)}stopTicking(){super.stopTicking(),this.isSceneTicker&&this.scene?this.scene.sys.events.off(this.tickEventName,this.update,this):this.game&&this.game.events.off(this.tickEventName,this.update,this)}}var me=function(t){return"step"===t||"poststep"===t};const ye=Phaser.Utils.Objects.GetValue,be=Phaser.Math.Clamp;class xe{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){this.state=ye(t,"state",Ce),this.timeScale=ye(t,"timeScale",1),this.delay=ye(t,"delay",0),this.repeat=ye(t,"repeat",0),this.repeatCounter=ye(t,"repeatCounter",0),this.repeatDelay=ye(t,"repeatDelay",0),this.duration=ye(t,"duration",0),this.nowTime=ye(t,"nowTime",0),this.justRestart=ye(t,"justRestart",!1)}toJSON(){return{state:this.state,timeScale:this.timeScale,delay:this.delay,repeat:this.repeat,repeatCounter:this.repeatCounter,repeatDelay:this.repeatDelay,duration:this.duration,nowTime:this.nowTime,justRestart:this.justRestart}}destroy(){}setTimeScale(t){return this.timeScale=t,this}setDelay(t){return void 0===t&&(t=0),this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatInfinity(){return this.repeat=-1,this}setRepeatDelay(t){return this.repeatDelay=t,this}start(){return this.nowTime=this.delay>0?-this.delay:0,this.state=this.nowTime>=0?Se:we,this.repeatCounter=0,this}stop(){return this.state=Ce,this}update(t,e){this.state!==Ce&&this.state!==ke&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=Oe)):(this.nowTime=this.duration,this.state=ke):this.nowTime>=0&&(this.state=Se))}get t(){var t;switch(this.state){case Ce:case we:case Oe:t=0;break;case Se:t=this.nowTime/this.duration;break;case ke:t=1}return be(t,0,1)}set t(t){(t=be(t,-1,1))<0?(this.state=we,this.nowTime=-this.delay*t):(this.state=Se,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===Ce}get isDelay(){return this.state===we}get isCountDown(){return this.state===Se}get isRunning(){return this.state===we||this.state===Se}get isDone(){return this.state===ke}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const Ce=0,we=1,Se=2,Oe=3,ke=-1;class Pe extends fe{constructor(t,e){super(t,e),this.timer=new xe}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const Te=Phaser.Utils.Objects.GetValue,_e=Phaser.Utils.Objects.GetAdvancedValue,Me=Phaser.Tweens.Builders.GetEaseFunction;class Ee extends Pe{resetFromJSON(t){return this.timer.resetFromJSON(Te(t,"timer")),this.setEnable(Te(t,"enable",!0)),this.setTarget(Te(t,"target",this.parent)),this.setDelay(_e(t,"delay",0)),this.setDuration(_e(t,"duration",1e3)),this.setEase(Te(t,"ease","Linear")),this.setRepeat(Te(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Me(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Re=Phaser.Math.Linear;class Le extends Ee{constructor(t,e){super(t,e),this.resetFromJSON(e)}start(t){return this.stop(),this.startZoomValue=this.target.zoom,this.endZoomValue=t,this.timer.setDuration(this.duration),super.start(),this}updateTarget(t,e){var i=this.parent,s=Re(this.startZoomValue,this.endZoomValue,e.t);Qt(t,s,i.focusLocalX,i.focusLocalY)}}const De=Phaser.Utils.Objects.GetValue;Phaser.Math.Clamp;class Ae extends l{constructor(t,e){void 0===e&&(e={}),super(t,e),this.easeZoom=new Le(this);var i=Zt(t,De(e,"camera"));this.setEnable(De(e,"enable",!0)).setMinZoom(De(e,"minZoom")).setMaxZoom(De(e,"maxZoom")).setZoomStep(De(e,"zoomStep",.1)).setEaseDuration(De(e,"easeDuration",200)).setCamera(i),this.boot()}boot(){this.scene.input.on("wheel",this.onWheel,this)}shutdown(t){this.isShutdown||(this.scene.input.off("wheel",this.onWheel,this),this.easeZoom.destroy(),this.easeZoom=void 0,this.inputTarget=void 0,super.shutdown(t))}setCamera(t){return this.camera=t,this.resetZoomLevel(),this.easeZoom.stop().setTarget(t||null),this}setEnable=function(t){return void 0===t&&(t=!0),this.enable=t,this};setMinZoom(t){return this.minZoom=t,this}setMaxZoom(t){return this.maxZoom=t,this}setZoomStep(t){return this.zoomStep=t,this}setEaseDuration(t){return this.easeDuration=t,this.easeZoom.setDuration(t),this}resetZoomLevel(){var t=this.camera;return t?(this.zoomLevel=Math.round(Be(t.zoom,this.zoomStep)),this.zoom=t.zoom,this):(this.zoomLevel=void 0,this)}onWheel(t,e,i,s,r,n){var a=this.camera;if(this.enable&&a){var o=void 0!==this.minZoom,h=void 0!==this.maxZoom;o&&this.zoom<=this.minZoom&&s>0||h&&this.zoom>=this.maxZoom&&s<0||(this.zoomLevel+=s<0?1:-1,this.zoom=je(this.zoomLevel,this.zoomStep),o&&this.zoomthis.maxZoom&&(this.zoom=this.maxZoom),this.focusLocalX=t.x,this.focusLocalY=t.y,this.easeZoom.start(this.zoom))}}}var Be=function(t,e){return t>=1?Math.log(t)/Math.log(1+e):-Math.log(t)/Math.log(1-e)},je=function(t,e){return t>=0?Math.pow(1+e,t):Math.pow(1-e,-t)};function We(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>We(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=We(t[i]));return e}const ze=Phaser.Utils.Objects.GetValue;class Ye extends l{constructor(t,e){super(t,e=void 0===e?{}:We(e)),this._enable=!0,this._camera=void 0;var i=ze(e,"enable",!0),s=ze(e,"minZoom"),r=ze(e,"maxZoom");ze(e,"panScroll",!0)&&(this.panScroll=new qt(t,{camera:ze(e,"camera"),inputTarget:ze(e,"inputTarget",t),enable:ze(e,"panScrollEnable",!0)})),ze(e,"pinchZoom",!0)&&(this.pinchZoom=new ee(t,{camera:ze(e,"camera"),inputTarget:ze(e,"inputTarget",t),enable:ze(e,"pinchZoomEnable",!0),minZoom:ze(e,"pinchZoomMin",s),maxZoom:ze(e,"pinchZoomMax",r)})),ze(e,"boundsScroll",!0)&&(this.boundsScroll=new ge(t,{camera:ze(e,"camera"),enable:ze(e,"boundsScrollEnable",!0)})),ze(e,"mouseWheelZoom",!0)&&(this.mouseWheelZoom=new Ae(t,{camera:ze(e,"camera"),enable:ze(e,"mouseWheelZoomEnable",!0),zoomStep:ze(e,"mouseWheelZoomStep",.1),minZoom:ze(e,"mouseWheelZoomMin",s),maxZoom:ze(e,"mouseWheelZoomMax",r)})),this.setEnable(i)}destroy(t){this.panScroll&&this.panScroll.destroy(t),this.pinchZoom&&this.pinchZoom.destroy(t),this.boundsScroll&&this.boundsScroll.destroy(t),this.mouseWheelZoom&&this.mouseWheelZoom.destroy(t),super.destroy(t)}set camera(t){this.panScroll&&this.panScroll.setCamera(t),this.pinchZoom&&this.pinchZoom.setCamera(t),this.boundsScroll&&this.boundsScroll.setCamera(t),this.mouseWheelZoom&&this.mouseWheelZoom.setCamera(t)}get camera(){return this.panScroll?this.panScroll.camera:this.pinchZoom?this.pinchZoom.camera:this.boundsScroll?this.boundsScroll.camera:this.mouseWheelZoom?this.mouseWheelZoom.camera:void 0}setCamera(t){return this.camera=t,this}set panScrollEnable(t){this.panScroll&&(this.panScroll.enable=t)}get panScrollEnable(){return!!this.panScroll&&this.panScroll.enable}setPanScrollEnable=function(t){return void 0===t&&(t=!0),this.panScrollEnable=t,this};set pinchZoomEnable(t){this.pinchZoom&&(this.pinchZoom.enable=t)}get pinchZoomEnable(){return!!this.pinchZoom&&this.pinchZoom.enable}setPinchZoomEnable=function(t){return void 0===t&&(t=!0),this.pinchZoomEnable=t,this};set boundsScrollEnable(t){this.boundsScroll&&(this.boundsScroll.enable=t)}get boundsScrollEnable(){return!!this.boundsScroll&&this.boundsScroll.enable}setBoundsScrollEnable=function(t){return void 0===t&&(t=!0),this.boundsScrollEnable=t,this};set mouseWheelZoomEnable(t){this.mouseWheelZoom&&(this.mouseWheelZoom.enable=t)}get mouseWheelZoomEnable(){if(this.mouseWheelZoom)return this.mouseWheelZoom.enable}setMouseWheelZoomEnable(t){return void 0===t&&(t=!0),this.mouseWheelZoom=t,this}set enable(t){t=!!t,this._enable!==t&&(t?(this.panScrollEnable=this.panScrollEnableSave,this.pinchZoomEnable=this.pinchZoomEnableSave,this.boundsScrollEnable=this.boundsScrollEnableSave,this.mouseWheelZoomEnable=this.mouseWheelZoomEnableSave):(this.panScrollEnableSave=this.panScrollEnable,this.pinchZoomEnableSave=this.pinchZoomEnable,this.boundsScrollEnableSave=this.boundsScrollEnable,this.mouseWheelZoomEnableSave=this.mouseWheelZoomEnable,this.panScrollEnable=!1,this.pinchZoomEnable=!1,this.boundsScrollEnable=!1,this.mouseWheelZoomEnable=!1),this._enable=t)}get enable(){return this._enable}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.enable=!this.enable,this}}var Ie=function(t){return null==t||""===t||0===t.length},Xe=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(Ie(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(Ie(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,a=e.length;n=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return He(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return Ue(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;iqe(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;eqe(t).x,getChildLocalY:t=>qe(t).y};const gi=Phaser.Math.DegToRad;var vi={updateChildRotation(t){var e=qe(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=qe(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return qe(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return qe(t).rotation=gi(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=qe(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>qe(t).rotation},fi={updateChildScale(t){var e=qe(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=qe(t),i=e.parent;return e.scaleX=ui(t.scaleX,i.scaleX),e.scaleY=ui(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=qe(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=qe(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>qe(t).scaleX,getChildLocalScaleY:t=>qe(t).scaleY},mi={updateChildVisible(t){var e=qe(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=qe(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),qe(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),qe(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=qe(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>qe(t).visible},yi={updateChildAlpha(t){var e=qe(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=qe(t),i=e.parent;return e.alpha=ui(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return qe(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=qe(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>qe(t).alpha},bi={updateChildActive(t){var e=qe(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return qe(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),qe(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=qe(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>qe(t).active},xi={updateChildScrollFactor(t){var e=qe(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},Ci={updateCameraFilter(t){var e=qe(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},wi={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(t){void 0===t&&(t=!1);var e=this;return this._mask=null,this.setChildMaskVisible(this),this.children.forEach((function(t){t.clearMask&&t.clearMask(!1),t.hasOwnProperty("isRexContainerLite")||e.setChildMaskVisible(t)})),t&&this.mask&&this.mask.destroy(),this}},Si=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},Pi=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const _i=Phaser.Utils.Array;var Mi={getChildren(t){if(t)for(var e=0,i=this.children.length;e0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,a=1/i.zoom,o=r/2,h=n/2,l=r*a,d=n*a;e.x===o&&e.y===h||e.setPosition(o,h),e.width===l&&e.height===d||e.setSize(l,d)}}}const Bs=Phaser.GameObjects.Rectangle;let js=class extends Bs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new As(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}};t.register("fullWindowRectangle",(function(t,e){var i=new js(this.scene,t,e);return this.scene.add.existing(i),i})),Xe(window,"RexPlugins.GameObjectShell.FullWindowRectangle",js);var Ws={hasProperty(t){var e=this.gameObject;return!!e.hasOwnProperty(t)||void 0!==e[t]},getProperty(t){return this.gameObject[t]},setProperty(t,e){return this.gameObject[t]=e,this},easeProperty(t){var e=t.property,i=t.value,s=t.duration,r=t.delay,n=t.ease,a=t.repeat,o=t.yoyo,h=t.from,l=t.complete,d=t.target;if(void 0===s&&(s=1e3),void 0===r&&(r=0),void 0===n&&(n="Linear"),void 0===a&&(a=0),void 0===o&&(o=!1),void 0===d&&(d=this.gameObject),h){var c=i;i=d[e],d[e]=c}return(t={targets:d,duration:s,delay:r,ease:n,repeat:a,yoyo:o,onComplete:l})[e]=i,this.addTweenTask(e,t),this},addTweenTask(t,e){var i=this.tweens,s=i[t];s&&s.remove();var r=e.onComplete;return e.onComplete=function(){i[t].remove(),i[t]=null,r&&r(e.targets,t)},(s=this.scene.tweens.add(e)).timeScale=this.timeScale,i[t]=s,this},getTweenTask(t){return this.tweens[t]},freeTweens(){var t,e=this.tweens;for(var i in e)(t=e[i])&&t.remove(),e[i]=null;return this}},zs={hasMethod(t){return"function"==typeof this.gameObject[t]},call(t,...e){if(!this.hasMethod(t))return console.warn(`[GameObjectManager] Game object '${this.name}' does not have method '${t}'`),this;var i=this.gameObject;return i[t].apply(i,e),this}},Ys={hasData(t){var e=this.gameObject;return!!e.data&&e.data.has(t)},getData(t){return this.gameObject.getData(t)},setData(t,e){return this.gameObject.setData(t,e),this}};class Is{constructor(t,e,i){this.GOManager=t,this.tweens={},this.effects={},this.setGO(e,i)}get scene(){return this.GOManager.scene}get timeScale(){return this.GOManager.timeScale}destroy(){this.freeGO(),this.GOManager=void 0}freeGO(){return this.freeTweens(),this.gameObject.bob=void 0,this.gameObject.destroy(),this.gameObject=void 0,this}setGO(t,e){return t.goName=e,t.goType=this.GOManager.name,t.bob=this,this.gameObject=t,this.name=e,this.freeTweens(),this}setTimeScale(t){var e=this.tweens;for(var i in e){var s=e[i];s&&(s.timeScale=t)}return this}}Object.assign(Is.prototype,Ws,zs,Ys);var Xs=function(t){for(var e in t)return!1;return!0},Fs=function(t){return t&&"!"!==t.charAt(0)},Vs={has(t){return this.bobs.hasOwnProperty(t)},exists(t){return this.bobs.hasOwnProperty(t)},get(t,e){if(Fs(t))return this.bobs[t];for(var i in void 0===e&&(e=[]),t&&(t=t.substring(1)),this.bobs)t&&i===t||e.push(this.bobs[i]);return e},getFitst(t){for(var e in t&&"!"===t.charAt(0)&&(t=t.substring(1)),this.bobs)if(!t||t!==e)return this.bobs[e];return null},getGO(t,e){var i=this.get(t);return i?Array.isArray(i)?(void 0===e&&(e=[]),i.forEach((function(t){e.push(t.gameObject)})),e):i.gameObject:null},forEachGO(t,e){for(var i in this.bobs){var s=this.bobs[i].gameObject;if(e?t.call(e,s,i,this):t(s,i,this))break}return this},getAllGO(t){for(var e in void 0===t&&(t=[]),this.bobs){var i=this.bobs[e].gameObject;t.push(i)}return t}},Gs=function(t){return t>>16&255},Hs=function(t){return t>>8&255},Us=function(t){return 255&t};const Ns=Phaser.Events.EventEmitter;var $s=function(t,e,i,s,r,n){return void 0===n?n={}:!0===n&&(n=Ks),"number"!=typeof i&&(i=0,s=0),n.x=r.x+r.width*t+i,n.y=r.y+r.height*e+s,n},Ks={},Zs=function(t,e,i,s,r,n,a){if(t.hasOwnProperty("vp"))return t;"function"==typeof i&&(a=i,i=void 0),"function"==typeof r&&(a=r,r=void 0),void 0===i&&(i=.5),void 0===s&&(s=.5),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=$s),function(t){if(t.events)return t;var e=new Ns,i=t.x;Object.defineProperty(t,"x",{get:function(){return i},set:function(s){i!==s&&(i=s,e.emit("update",t))}});var s=t.y;Object.defineProperty(t,"y",{get:function(){return s},set:function(i){s!==i&&(s=i,e.emit("update",t))}});var r=t.width;Object.defineProperty(t,"width",{get:function(){return r},set:function(i){r!==i&&(r=i,e.emit("update",t))}});var n=t.height;Object.defineProperty(t,"height",{get:function(){return n},set:function(i){n!==i&&(n=i,e.emit("update",t))}}),t.events=e}(e);var o=e.events;t.vp=e;var h=function(){a(i,s,r,n,e,t)};o.on("update",h),t.once("destroy",(function(){o.off("update",h),t.vp=void 0})),Object.defineProperty(t,"vpx",{get:function(){return i},set:function(t){i!==t&&(i=t,h())}}),Object.defineProperty(t,"vpy",{get:function(){return s},set:function(t){s!==t&&(s=t,h())}}),Object.defineProperty(t,"vpxOffset",{get:function(){return r},set:function(t){r!==t&&(r=t,h())}}),Object.defineProperty(t,"vpyOffset",{get:function(){return n},set:function(t){n!==t&&(n=t,h())}}),h()},Js=function(t,e){if(!t)return!1;if(t.hasOwnProperty(e))return!0;for(;t;){if(Object.getOwnPropertyDescriptor(t,e))return!0;t=t.__proto__}return!1},qs=function(t){return t.preFX?t.preFX:t.postFX?t.postFX:null},Qs=function(t,e){t._effectSwitchNames||(t._effectSwitchNames=[],t.clearAllEffects=function(){for(var e=t._effectSwitchNames,i=0,s=e.length;i0&&void 0!==t.setTint},useAlphaFadeEffect(t){return(void 0===this.fadeMode||1===this.fadeMode)&&this.fadeTime>0&&void 0!==t.setAlpha},useRevealEffect(t){return this.fadeMode>=2&&this.fadeMode<=5&&this.fadeTime>0&&(t.preFX||t.postFX)},fadeBob(t,e,i,s){var r=t.gameObject;if(this.useTintFadeEffect(r))void 0!==e&&t.setProperty("tintGray",255*e),t.easeProperty({property:"tintGray",value:Math.floor(255*i),duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s});else if(this.useAlphaFadeEffect(r))void 0!==e&&t.setProperty("alpha",e),t.easeProperty({property:"alpha",value:i,duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s});else if(this.useRevealEffect(r)){var n;switch(ir(r,"reveal"),this.fadeMode){case 2:n="revealUp";break;case 3:n="revealDown";break;case 4:n="revealLeft";break;case 5:n="revealRight"}void 0===e&&(e=0),r[n]=e,t.easeProperty({property:n,value:i,duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s}),t.getTweenTask(n).once("complete",(function(){r[n]=null}))}else s&&s(r);return this}},cr={setCamera(t,e){var i=this.get(t);if(!i)return this;var s=Zt(this.scene,e);return s?(i.gameObject.cameraFilter=4294967295^s.id,i.camera=s,this):this},getCamera(t){var e=this.get(t);return e?e.camera:null}},ur={drawGameObjectsBounds:function(t,e){return this.forEachGO((function(i){i.drawBounds?i.drawBounds(t,e):Ji(i,t,e)})),this}};Object.assign(ur,Vs,rr,nr,ar,or,hr,dr,cr);const pr=Phaser.Utils.Objects.GetValue;class gr{constructor(t,e){this.scene=t,this.BobClass=pr(e,"BobClass",Is),this.setCreateGameObjectCallback(pr(e,"createGameObject"),pr(e,"createGameObjectScope")),this.setEventEmitter(pr(e,"eventEmitter",void 0)),this.setGameObjectDepth(pr(e,"depth",void 0));var i=pr(e,"fade",500);"number"==typeof i?(this.setGOFadeMode(),this.setGOFadeTime(i)):(this.setGOFadeMode(pr(i,"mode")),this.setGOFadeTime(pr(i,"time",500)));var s=pr(e,"viewportCoordinate",!1);!1!==s?(this.setViewportCoordinateEnable(pr(e,"enable",!0)),this.setViewport(pr(s,"viewport"))):this.setViewportCoordinateEnable(!1);var r=pr(e,"effectProperties",!1);this.setEffectPropertiesConfig(r),this.setSymbols(pr(e,"symbols")),this.bobs={},this.removedGOs=[],this._timeScale=1,this.name=pr(e,"name")}destroy(t){this.clear(!t),this.createGameObjectCallback=void 0,this.viewport=void 0,this.scene=void 0}set timeScale(t){if(this._timeScale!==t){this._timeScale=t;var e=this.bobs;for(var i in e)e[i].setTimeScale(t)}}get timeScale(){return this._timeScale}setTimeScale(t){return this.timeScale=t,this}setCreateGameObjectCallback(t,e){return this.createGameObjectCallback=t,this.createGameObjectScope=e,this}setGameObjectDepth(t){return this.gameObjectDepth=t,this}setViewportCoordinateEnable(t){return void 0===t&&(t=!0),this.viewportCoordinateEnable=t,this}setEffectPropertiesConfig(t){return void 0===t&&(t=!0),this.effectPropertiesConfig=t,this}setViewport(t){return void 0===t&&(t=le(this.scene,this.scene.cameras.main)),this.viewport=t,this}setSymbols(t){return this.symbols=t,this}get isEmpty(){return Xs(this.bobs)&&0===this.removedGOs.length}}Object.assign(gr.prototype,e,ur);var vr={getLayer(t){return this.getGO(t)},getLayers(t){return void 0===t&&(t=[]),this.forEachGO((function(e){t.push(e)})),Si(t,!1),t},addToLayer(t,e){var i=this.getGO(t);if(i){Array.isArray(e)||(e=[e]);for(var s=0,r=e.length;s=0;e--)this.remove(this.backgroundChildren[e],t);return this}};const Sn=Phaser.Utils.Objects.GetValue;var On=function(t,e){return void 0===e?t:t[e]},kn=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Sn(e,"left",0),t.right=Sn(e,"right",0),t.top=Sn(e,"top",0),t.bottom=Sn(e,"bottom",0)),t},Pn={getInnerPadding(t){return On(this.space,t)},setInnerPadding(t,e){return kn(this.space,t,e),this},getOuterPadding(t){return On(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return kn(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),On(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),kn(this.getSizerConfig(t).padding,e,i),this}},Tn=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},_n=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Mn=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},En=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Rn=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},Ln=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Dn={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},An=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var Ga={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,n){var a=r(t);return a.time.delayedCall(e,(function(){a.game.events.once("poststep",(function(){i.call(s,n)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Ha={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=Rr),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=Rr),this.transitOutCallback=t,this}},Ua={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Na={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},$a={};Object.assign($a,Ga,Ha,Ua,Na);const Ka=Phaser.Utils.Objects.GetValue;class Za extends l{constructor(t,e){super(t,e),this.setTransitInTime(Ka(e,"duration.in",200)),this.setTransitOutTime(Ka(e,"duration.out",200)),this.setTransitInCallback(Ka(e,"transitIn")),this.setTransitOutCallback(Ka(e,"transitOut")),this.oneShotMode=Ka(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Va(this,{eventEmitter:!1,initState:Ka(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Za.prototype,$a);const Ja=Phaser.Utils.Objects.GetValue;class qa extends l{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Ja(t,"hitAreaMode",0)),this.setEnable(Ja(t,"enable",!0)),this.setStopMode(Ja(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Qa[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Qa={default:0,fullWindow:1};const to=Phaser.Utils.Objects.GetValue;class eo extends js{constructor(t,e){super(t,to(e,"color",0),to(e,"alpha",.8)),this.touchEventStop=new qa(this,{hitAreaMode:1})}}var io={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Kn(t,e)},scaleDown(t,e){Zn(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,ha(t,e)},fadeOut(t,e){la(t,e,!1)}},so=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,ha(t,e,t.alpha)},ro=function(t,e){la(t,e,!1)};const no=Phaser.Utils.Objects.GetValue;let ao=class extends Za{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=oo.popUp),null==e.transitOut&&(e.transitOut=oo.scaleDown),e.destroy=no(e,"destroy",!0),super(t,e);var i=no(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new eo(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(no(i,"transitIn",so)),this.setCoverTransitOutCallback(no(i,"transitOut",ro)));var s=no(e,"touchOutsideClose",!1),r=no(e,"duration.hold",-1),n=no(e,"timeOutClose",r>=0),a=no(e,"anyTouchClose",!1);no(e,"manualClose",!1)&&(s=!1,a=!1,n=!1),a&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),a?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),no(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&_(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=oo[t]),t){case oo.popUp:t=io.popUp;break;case oo.fadeIn:t=io.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=oo[t]),t){case oo.scaleDown:t=io.scaleDown;break;case oo.fadeOut:t=io.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const oo={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var ho={modal(t,e){return ws(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new ao(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},lo=function(t,e,i,s,r){ws(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},co={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return lo.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return lo.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return lo.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return lo.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return lo.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return lo.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return lo.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return lo.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return lo.call(this,"shutdown",t,e,i,s),this}},uo=function(t){return"[object Array]"===Object.prototype.toString.call(t)},po=function(t,e,i,s,r){return _(t,e,i,vo(s),r)},go=function(t){return!(t.rexSizer&&t.rexSizer.hidden)},vo=function(t){return t?function(e,i,s){return!!go(e)&&(t(e,i,s),!0)}:go},fo={},mo=function(t){var e,i;this.sizerEventsEnable&&(e=t,void 0===(i=this.getChildPrevState(t))?i={}:!0===i&&(i=fo),i.x=e.x,i.y=e.y,i.scaleX=e.scaleX,i.scaleY=e.scaleY,i.width=e.width,i.height=e.height,i.displayWidth=e.displayWidth,i.displayHeight=e.displayHeight,this.layoutedChildren.push(t))},yo=function(t,e,i,s,r,n,a,o){void 0===a&&(a=0),void 0===o&&(o=0),en(t,e,i,s,r,n),t.x+=a,t.y+=o,this.resetChildPositionState(t),this.sizerEventsEnable&&t.emit("sizer.postlayout",t,this)};const bo=Phaser.Display.Align.CENTER,xo=Phaser.Utils.Objects.IsPlainObject,Co=Phaser.Utils.Objects.GetValue;class wo extends l{constructor(t,e){super(t,e),this._enable=void 0,t.setInteractive(Co(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.isDown=!1,this.isOver=!1,this.setEnable(Co(t,"enable",!0)),this.setMode(Co(t,"mode",1)),this.setClickInterval(Co(t,"clickInterval",100)),this.setDragThreshold(Co(t,"threshold",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPress,this),t.on("pointerup",this.onRelease,this),t.on("pointerout",this.onPointOut,this),t.on("pointermove",this.onMove,this),t.on("pointerover",this.onOver,this),t.on("pointerout",this.onOut,this)}shutdown(t){this.isShutdown||(this.pointer=null,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=So[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}onPress(t,e,i,s){void 0===this.pointer&&(this.pointer=t,this.isDown=!0,this.emit("down",this,this.parent,t,s),0===this.mode&&this.click(t.downTime,t,s))}onRelease(t,e,i,s){this.pointer===t&&(this.isDown=!1,this.emit("up",this,this.parent,t,s),1===this.mode&&this.click(t.upTime,t,s),this.pointer=void 0)}onPointOut(t,e){this.pointer===t&&this.cancel()}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&t.getDistance()>=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const So={press:0,pointerdown:0,release:1,pointerup:1};var Oo={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new wo(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},ko=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!Po(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,a=n.pointersTotal,o=n.pointers,h=0;h0)return To.length=0,!0;return To.length=0,!1},To=[];const _o=Phaser.Utils.Objects.GetValue;class Mo extends l{constructor(t,e){super(t,e),this._enable=void 0;var i=_o(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(_o(t,"enable",!0)),this.setMode(_o(t,"mode",1)),this.setClickInterval(_o(t,"clickInterval",100)),this.setDragThreshold(_o(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Eo[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?ko:R)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Eo={press:0,pointerdown:0,release:1,pointerup:1};var Ro={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Mo(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Lo extends N{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Do=Phaser.Utils.Objects.GetValue;class Ao extends l{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Lo,this.parent.setInteractive(Do(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Do(t,"enable",!0)),this.setCooldown(Do(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Bo={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&R(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Ao(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Ao(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},jo={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Wo=function(t,e,i,s){if("parent"===t){for(var r,n=0,a=e.length;n(i=0===this.orientation?Math.abs(h.left-t):Math.abs(h.top-e))&&(n=i,r=a)}return h=s[s.length-1],n>(i=0===this.orientation?Math.abs(h.right-t):Math.abs(h.bottom-e))&&(n=i,r=a+1),r};const gh=Phaser.Utils.Objects.IsPlainObject,vh=Phaser.Utils.Objects.GetValue,fh=Phaser.Display.Align.CENTER,mh={min:0,full:-1};var yh=function(t,e,i,s,r,n,a,o,h,l){var d,c,u,v;un.call(this,t);var f=t.isRexSpace,m=typeof e;if(null===e)return this;if("number"===m);else if("string"===m)e=mh[e];else if(gh(e)){var y;e=vh(y=e,"proportion",void 0),i=vh(y,"align",fh),s=vh(y,"padding",0),r=vh(y,"expand",!1),n=vh(y,"key",void 0),a=vh(y,"index",void 0),t.isRexSizer||(o=vh(y,"minWidth",void 0),h=vh(y,"minHeight",void 0)),l=vh(y,"fitRatio",0),d=vh(y,"offsetX",0),c=vh(y,"offsetY",0),u=vh(y,"offsetOriginX",0),v=vh(y,"offsetOriginY",0)}return"string"==typeof i&&(i=Er[i]),void 0===e&&(e=f?1:0),void 0===i&&(i=fh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===o&&(f?o=0:t.isRexSizer||(o=t._minWidth)),void 0===h&&(f?h=0:t.isRexSizer||(h=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=p(t)/g(t)),void 0===d&&(d=0),void 0===c&&(c=0),void 0===u&&(u=0),void 0===v&&(v=0),(y=this.getSizerConfig(t)).proportion=e,y.align=i,y.padding=dn(s),y.expand=r,y.fitRatio=0===e?l:0,y.alignOffsetX=d,y.alignOffsetY=c,y.alignOffsetOriginX=u,y.alignOffsetOriginY=v,void 0===a||a>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(a,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===o?p(t):o:t.minHeight=void 0===h?g(t):h),r&&(0===this.orientation?t.minHeight=h:t.minWidth=o)),void 0!==n&&this.addChildrenMap(n,t),this},bh={add:yh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),yh.call(this,new uh(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,o){return gh(i)&&(i.index=t),yh.call(this,e,i,s,r,n,a,t,o),this},insertAtPosition(t,e,i,s,r,n,a,o,h){var l=ph.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,o,h),this}};const xh=ss.prototype.clear;var Ch=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),xh.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,Ch.call(this,t),this}},Oh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=Er[e]),this.getSizerConfig(t).align=e,this}},kh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},Ph={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},Th={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},_h={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,o=this.sizerChildren,h=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=o.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?h=!0:n=0)):n=0,h||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,a+=n)));else for(d=0,c=o.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?h=!0:n=0)):n=0,h||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,a+=n)))}return h?void 0:a+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,a=s.padding;i=n-(a.left+a.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,a=s.padding;i=n-(a.top+a.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Wn(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,An.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,o,h,l,d,c,u=this.sizerChildren,v=this.innerLeft,f=this.innerTop,m=this.innerWidth,y=this.innerHeight,b=v,x=f,C=this.startChildIndex,w=0,S=u.length;w0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=En.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||_n.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&dh.call(this,t,void 0),Mn.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Rn.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&dh.call(this,void 0,t),Ln.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],a=n&&n.isRexSpace;return"center"===t?a||this.insertSpace(r+1):a&&this.remove(n,!0),this}};Object.assign(_h,bh,Sh,Oh,kh,Ph,Th);var Mh=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},Eh={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},Rh=function(t){return"string"==typeof t&&(t=Eh[t]),t};const Lh=Phaser.Utils.Objects.IsPlainObject,Dh=Phaser.Utils.Objects.GetValue;class Ah extends oh{constructor(t,e,i,s,r,n,a){Lh(e)?(e=Dh(a=e,"x",0),i=Dh(a,"y",0),s=Dh(a,"width",void 0),r=Dh(a,"height",void 0),n=Dh(a,"orientation",0)):Lh(s)?(s=Dh(a=s,"width",void 0),r=Dh(a,"height",void 0),n=Dh(a,"orientation",0)):Lh(n)&&(n=Dh(a=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,a),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Dh(a,"space.item",0)),this.setStartChildIndex(Dh(a,"startChildIndex",0)),this.setRTL(Dh(a,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=Rh(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=Mh.call(this)),this._childrenProportion}}Object.assign(Ah.prototype,_h);var Bh=function(t,e,i,s){return e/t<=i?e/(s-1):0},jh=function(t){var e,i,s,r,n,a={lines:[],width:0,height:0},o=this.sizerChildren,h=0,l=a.lines,d=void 0;if(0===this.orientation){for(var c=0,u=o.length;co.height/2)){r>(h=Wh(o.left,o.centerY,t,e))&&(r=h,s=n);var h,l=i[n+1];l&&l.y===o.y||r>(h=Wh(o.right,o.centerY,t,e))&&(r=h,s=n+1)}}return s};const Yh=Phaser.Utils.Objects.IsPlainObject,Ih=Phaser.Utils.Objects.GetValue,Xh=Phaser.Display.Align.CENTER;var Fh=function(t,e,i,s){return"\n"===t?(this.addNewLine(),this):(un.call(this,t),Yh(e)&&(e=Ih(h=e,"padding",0),i=Ih(h,"key",void 0),s=Ih(h,"index",void 0),r=Ih(h,"offsetX",0),n=Ih(h,"offsetY",0),a=Ih(h,"offsetOriginX",0),o=Ih(h,"offsetOriginY",0)),void 0===e&&(e=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=0),void 0===o&&(o=0),(h=this.getSizerConfig(t)).align=Xh,h.padding=dn(e),h.alignOffsetX=r,h.alignOffsetY=n,h.alignOffsetOriginX=a,h.alignOffsetOriginY=o,void 0===s||s>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(s,0,t),void 0!==i&&this.addChildrenMap(i,t),this);var r,n,a,o,h},Vh={add(t,e,i){if(uo(t))for(var s=t,r=0,n=s.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,Ch.call(this,t),this}},Uh={getChildrenWidth:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=0===this.orientation&&t?this.maxChildWidth:this.rexSizer.resolved?this.wrapResult.width:void 0)?e+(this.space.left+this.space.right)*this.scaleX:void 0);var e},getChildrenHeight:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=1===this.orientation&&t?this.maxChildHeight:this.rexSizer.resolved?this.wrapResult.height:void 0)?e+(this.space.top+this.space.bottom)*this.scaleY:void 0);var e},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&r.push(h.join("")),r},Ol=0,kl=1,Pl=2,Tl=0,_l=1,Ml=2,El=/(?:\r\n|\r|\n)/;const Rl={none:Tl,word:_l,char:Ml,character:Ml,mix:3},Ll=Phaser.Renderer.WebGL.Utils;var Dl={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,a=r.height,o=Ll.getTintAppendFloatAlpha,h=t.pipelines.set(e.pipeline,e),l=h.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),h.batchTexture(e,r.glTexture,n,a,e.x,e.y,n/e.resolution,a/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,a,o(e.tintTopLeft,i.alpha*e._alphaTL),o(e.tintTopRight,i.alpha*e._alphaTR),o(e.tintBottomLeft,i.alpha*e._alphaBL),o(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const Al=Phaser.Display.Color;var Bl={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,a,o,h,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===a&&(a=0),void 0===o&&(o=0),void 0===h&&(h=c),void 0===l&&(l=u);var p=d.cutX+a,g=d.cutY+o;return this.context.drawImage(d.source.image,p,g,h,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new Al);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var a=i;i=a.red,s=a.green,r=a.blue,n=a.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var o=this.context.createImageData(1,1);return o.data[0]=i,o.data[1]=s,o.data[2]=r,o.data[3]=n,this.context.putImageData(o,t,e),this.dirty=!0,this}},jl=function(t,e,i,s,r,n,a){var o,h=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===a&&(a=e.height);var d=(o=h.exists(i)?h.get(i):h.createCanvas(i,n,a)).getSourceImage();d.width!==n&&(d.width=n),d.height!==a&&(d.height=a);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,a),c.drawImage(e,s,r,n,a),l.gl&&o&&l.canvasToTexture(d,o.source[0].glTexture,!0,0)},Wl={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,jl(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};Ve();const zl=Phaser.Display.Canvas.CanvasPool,Yl=Phaser.GameObjects.GameObject,Il=Phaser.Utils.String.UUID;let Xl=class extends Yl{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=zl.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=Il(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){zl.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}};const Fl=Phaser.GameObjects.Components;Phaser.Class.mixin(Xl,[Fl.Alpha,Fl.BlendMode,Fl.Crop,Fl.Depth,Fl.Flip,Fl.GetBounds,Fl.Mask,Fl.Origin,Fl.Pipeline,Fl.PostPipeline,Fl.ScrollFactor,Fl.Tint,Fl.Transform,Fl.Visible,Dl,Bl,Wl]);var Vl={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:F(this.data,t,e)},incData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)+e),this},mulData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)*e),this},clearData(){return this.data&&wt(this.data),this}};class Gl{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}}Object.assign(Gl.prototype,Vl);var Hl={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const Ul=Phaser.Math.RotateAround;var Nl;const $l=Phaser.Geom.Rectangle;var Kl,Zl=function(t){void 0===Kl&&(Kl=new $l);var e=t.drawTLX,i=t.drawTLY;return Kl.setTo(e,i,t.drawTRX-e,t.drawBLY-i),Kl};const Jl=Phaser.Math.RotateAround;var ql,Ql=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===ql&&(ql={}),s=ql),s.x=e,s.y=i,0!==t.rotation&&Jl(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const td=Phaser.GameObjects.Components.TransformMatrix;var ed,id,sd={},rd=function(t,e,i,s,r){var n=Ql(e,i,s,!0),a=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=sd);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===ed&&(ed=new td,id=new td),t.parentContainer?t.getWorldTransformMatrix(ed,id):ed.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),ed.transformPoint(r,n,s),s}(t,n.x,n.y,r);return a},nd=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,a=e.drawCenterY+s;return rd(t,e,n,a,r)},ad={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Nl&&(Nl={}),s=Nl),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&Ul(s,0,0,-i.rotation),s}(t,e,this,!0);return Zl(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return nd(this.parent,this,t,e,i)}};Object.assign(ad,Hl);const od=Phaser.Math.DegToRad,hd=Phaser.Math.RadToDeg,ld=Phaser.Utils.Objects.GetValue;class dd extends Gl{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return hd(this._rotation)}set angle(t){this.rotation=od(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=ld(t,"width",void 0),i=ld(t,"height",void 0),s=ld(t,"scaleX",void 0),r=ld(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(dd.prototype,ad);const cd=Phaser.Utils.String.Pad;var ud=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${cd(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},pd=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const gd=Phaser.Utils.Objects.GetValue;let vd=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=gd(t,"x",0),i=gd(t,"y",0));var s=this.cornerRadius;s.tl=fd(gd(t,"tl",void 0),e,i),s.tr=fd(gd(t,"tr",void 0),e,i),s.bl=fd(gd(t,"bl",void 0),e,i),s.br=fd(gd(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){md(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){md(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){md(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){md(this.cornerRadius.br,t)}};var fd=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),yd(t),t},md=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=gd(e,"x",0),t.y=gd(e,"y",0)),yd(t)},yd=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const bd=Phaser.Math.DegToRad;var xd=function(t){return!t.hasOwnProperty("convex")||t.convex},Cd=function(t){return t.x>0&&t.y>0},wd=function(t,e,i,s,r,n,a,o,h){if(o&&a>n?a-=360:!o&&a=p?1:s/p,f=r>=g?1:r/g,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),o=m.tl,Cd(o)?(h=o.x*v,l=o.y*f,xd(o)?wd(t,h,l,h,l,180,270,!1,a):wd(t,0,0,h,l,90,0,!0,a),d=0,c=l):(t.lineTo(0,0),d=0,c=0),o=m.tr,Cd(o)?(h=o.x*v,l=o.y*f,xd(o)?wd(t,s-h,l,h,l,270,360,!1,a):wd(t,s,0,h,l,180,90,!0,a)):t.lineTo(s,0),o=m.br,Cd(o)?(h=o.x*v,l=o.y*f,xd(o)?wd(t,s-h,r-l,h,l,0,90,!1,a):wd(t,s,r,h,l,270,180,!0,a)):t.lineTo(s,r),o=m.bl,Cd(o)?(h=o.x*v,l=o.y*f,xd(o)?wd(t,h,r-l,h,l,90,180,!1,a):wd(t,0,r,h,l,360,270,!0,a)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,a,u),null!=o)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,o),p.addColorStop(1,d),o=p),e.fillStyle=o,e.fill());null!=h&&l>0&&(e.strokeStyle=h,e.lineWidth=l,e.stroke())},Od=function(t,e,i,s,r,n,a,o){if(null!=e||null!=i){var h=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;h=Math.max(1,h-s),l=Math.max(1,l-s),Sd(t.canvas,t.context,d,d,h,l,r,e,i,s,n,a,o)}};const kd=Phaser.Utils.Objects.GetValue;class Pd extends dd{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(kd(e,"color",null),kd(e,"color2",null),kd(e,"horizontalGradient",!0)),this.setStroke(kd(e,"stroke",null),kd(e,"strokeThickness",2)),this.setCornerRadius(kd(e,"cornerRadius",0),kd(e,"cornerIteration",null))}set color(t){t=ud(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=ud(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=ud(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,pd("color2",t,this),pd("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,pd("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,pd("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){Od(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Td=Phaser.Utils.Objects.GetValue;class _d extends dd{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(Td(e,"color",null),Td(e,"color2",null),Td(e,"horizontalGradient",!0)),this.setStroke(Td(e,"stroke",null),Td(e,"strokeThickness",2))}set color(t){t=ud(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=ud(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=ud(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,Td(t,"color2",null),Td(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Td(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,a=this.parent.height-i.top-i.bottom,o=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?o.createLinearGradient(0,0,n,0):o.createLinearGradient(0,0,0,a)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,o.fillStyle=t,o.fillRect(s,r,n,a));null!=this.stroke&&this.strokeThickness>0&&(o.strokeStyle=this.stroke,o.lineWidth=this.strokeThickness,o.strokeRect(s,r,n,a))}}const Md=Phaser.Utils.Objects.GetValue;let Ed=class t{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(Md(t,"bold",!1)),this.setItalic(Md(t,"italic",!1)),this.setFontSize(Md(t,"fontSize","16px")),this.setFontFamily(Md(t,"fontFamily","Courier")),this.setColor(Md(t,"color","#fff")),this.setStrokeStyle(Md(t,"stroke",null),Md(t,"strokeThickness",0)),this.setShadow(Md(t,"shadowColor",null),Md(t,"shadowOffsetX",0),Md(t,"shadowOffsetY",0),Md(t,"shadowBlur",0)),this.setOffset(Md(t,"offsetX",0),Md(t,"offsetY",0)),this.setSpace(Md(t,"leftSpace",0),Md(t,"rightSpace",0)),this.setAlign(Md(t,"align",void 0)),this.setBackgroundColor(Md(t,"backgroundColor",null)),this.setBackgroundHeight(Md(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Md(t,"backgroundBottomY",void 0)),this.setBackgroundLeftX(Md(t,"backgroundLeftX",0)),this.setBackgroundRightX(Md(t,"backgroundRightX",0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(pd("stroke",t,this),pd("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(pd("shadowOffsetX",t,this),pd("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),t.hasOwnProperty("backgroundLeftX")&&this.setBackgroundLeftX(t.backgroundLeftX),t.hasOwnProperty("backgroundRightX")&&this.setBackgroundRightX(t.backgroundRightX),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new t(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=ud(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=ud(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=ud(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=ud(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setBackgroundLeftX(t){return this.backgroundLeftX=t,this}setBackgroundRightX(t){return this.backgroundRightX=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}};const Rd=Phaser.Utils.Array.Remove,Ld=Phaser.Utils.Array.Remove,Dd="text",Ad="image",Bd="drawer",jd="space",Wd="command";var zd=function(t){return t.type===Dd&&"\n"===t.text},Yd=function(t){return t.type===Dd&&"\f"===t.text},Id=function(t){return t.type===Dd};class Xd extends dd{constructor(t,e,i){super(t,Dd),this.updateTextFlag=!1,this.style=new Ed(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX+e.backgroundLeftX,s=i,r=this.drawTRX+e.backgroundRightX-i+1;if(r>0){var n=e.backgroundBottomY;null==n&&(n=this.drawBLY);var a=e.backgroundHeight;null==a&&(a=n-this.drawTLY);var o=n-a;t.fillRect(s,o,r,a)}}var h=e.hasFill,l=e.hasStroke;(h||l)&&(e.syncFont(t).syncStyle(t),l&&(e.syncShadow(t),t.strokeText(this.text,0,0)),h&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var Fd=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const Vd=Phaser.Display.Canvas.CanvasPool;var Gd=function(t,e,i,s,r,n,a,o){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===o&&(o=!1),o&&(i=Math.round(i),s=Math.round(s));var h=e.getContext("2d",{willReadFrequently:!0});if(a){var l=Vd.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=a,d.fillRect(0,0,r,n),h.drawImage(l,0,0,r,n,i,s,r,n),Vd.remove(l)}else h.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)};Phaser.Display.Canvas.CanvasPool;class Hd extends dd{constructor(t,e,i){super(t,Ad),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){Gd(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class Ud extends dd{constructor(t,e,i,s){super(t,Bd),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class Nd extends dd{constructor(t,e){super(t,jd),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class $d extends Gl{constructor(t,e,i,s,r){super(t,Wd),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}var Kd=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const Zd={none:0,word:1,char:2,character:2,mix:3};var Jd=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,a=!r&&!n,o=t.length,h=e,l=s.word,d=0,c=!1;h0&&!o){var h=this.fixedHeight-s;i>0?n=h/i:(n=(l=ec.call(this)).height,a=l.ascent,i=Math.floor((h-a)/n))}else{var l;n=(l=ec.call(this)).height,a=l.ascent}}else this.fixedHeight>0?void 0===(i=sc(t,"maxLines"))&&(h=this.fixedHeight-s,i=Math.floor(h/n)):i=sc(t,"maxLines",0);void 0===a&&(a=n);var d=0===i,c=sc(t,"wrapMode");void 0===c&&(c=sc(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=Zd[c]);var u=sc(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=sc(t,"letterSpacing",0),g=sc(t,"hAlign",0),v=sc(t,"vAlign",0),f=sc(t,"justifyPercentage",.25),m=Kd({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:g,vAlign:v,justifyPercentage:f,ascent:a,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,b=0,x=y.length;b0&&(M.push({children:E,width:R}),L=Math.max(L,R)),m.start+=_.length,m.isLastPage=!D&&m.start===T,m.maxLineWidth=L,m.linesHeight=M.length*n;var I=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,X=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,a=t.vAlign,o=t.justifyPercentage,h=t.lines,l=0,d=h.length;l0?(a=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=ac(t,"maxLines",void 0))){var a=this.fixedWidth-r;i=Math.floor(a/n)+1}}else i=ac(t,"maxLines",0);var o=0===i,h=ac(t,"fixedCharacterHeight",void 0);if(void 0===h){var l=ac(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;h=Math.floor(d/l)}}var c=ac(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=ac(t,"letterSpacing",0),p=ac(t,"rtl",!0),g=ac(t,"hAlign",p?2:0),v=ac(t,"vAlign",0),f=Kd({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:g,vAlign:v,lineWidth:n,fixedCharacterHeight:h,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(_.push({children:M,height:E}),R=Math.max(R,E)),f.start+=T.length,f.isLastPage=f.start===P,f.maxLineHeight=R,f.linesWidth=_.length*n;var W=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,z=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,a=t.vAlign,o=t.rtl,h=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}o&&(s+=l);for(var c=0,u=h.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,a=i.bottom;return kn(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||a!=i.bottom,this},getPadding:function(t){return On(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),Rd(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return Ld(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(Dd);return null===i?i=new Xd(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),nd(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const Rc=Phaser.Utils.Objects.GetFastValue;var Lc={};class Dc{constructor(t){this.pools=Rc(t,"pools",Lc)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new Ec),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;ei&&(r=Math.floor(i));for(var n={},a=Xc(t,r,e,i,n),o=0;o<=zc&&0!==a;o++){if((r+=a)<0){r=0;break}a=Xc(t,r,e,i,n)}return o===zc&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),Fc(t,e,i),t},Ic=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},Xc=function(t,e,i,s,r){var n,a=Ic(t,e,r),o=Ic(t,e+1,r);if(void 0!==s)if(a.height<=s&&o.height>s)n=0;else{if(a.height>s)return-1;n=Math.floor(s-a.height)}if(a.width<=i&&o.width>i)return 0;if(a.width>i)return-1;var h=Math.floor(i-a.width);return void 0===n?h:Math.min(h,n)},Fc=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const Vc=Phaser.Utils.Objects.GetValue,Gc=Phaser.Utils.Objects.GetValue;class Hc extends rl{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=Gc(e,"background",void 0),r=Gc(e,"icon",void 0),n=Gc(e,"iconMask",void 0),a=Gc(e,"text",void 0),o=Gc(e,"action",void 0),h=Gc(e,"actionMask",void 0),l=Gc(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(a||o)&&(i={right:Gc(e,"space.icon",0),top:Gc(e,"space.iconTop",0),bottom:Gc(e,"space.iconBottom",0),left:Gc(e,"space.iconLeft",0)}):(a||o)&&(i={bottom:Gc(e,"space.icon",0),left:Gc(e,"space.iconLeft",0),right:Gc(e,"space.iconRight",0),top:Gc(e,"space.iconTop",0)});var d=Gc(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=gl.call(this,r,r,1)),!d){var c=Gc(e,"iconSize",void 0);this.setIconSize(Gc(e,"iconWidth",c),Gc(e,"iconHeight",c))}}if(a){var u=Gc(e,"wrapText",!1),p=Gc(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),function(t,e){switch(bl(t)){case 0:switch("string"==typeof e&&(e=Rl[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=wl;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Rl[e]||0),t.style.wrapMode=e}}(a,u),e.expandTextWidth=!0,Wc(a)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=Vc(e,"minWidth",0),s=Vc(e,"minHeight",0),r=Vc(e,"fitHeight",!1);t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return Yc(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),Yc(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t})}(a,{fitHeight:!0}));var g,v,f=Gc(e,"space.text",0),m=Gc(e,"expandTextWidth",!1),y=Gc(e,"expandTextHeight",!1);0===this.orientation?(g=m?1:0,o&&(i={right:f}),v=y):(g=y?1:0,o&&(i={bottom:f}),v=m),this.add(a,{proportion:g,expand:v,padding:i})}if(o&&(i=0===this.orientation?{top:Gc(e,"space.actionTop",0),bottom:Gc(e,"space.actionBottom",0),right:Gc(e,"space.actionRight",0)}:{left:Gc(e,"space.actionLeft",0),right:Gc(e,"space.actionRight",0),bottom:Gc(e,"space.actionBottom",0)},d=Gc(e,"squareFitAction",!1)?1:0,this.add(o,{proportion:0,padding:i,fitRatio:d}),h&&(h=gl.call(this,o,o,1)),!d)){var b=Gc(e,"actionSize");this.setActionSize(Gc(e,"actionWidth",b),Gc(e,"actionHeight",b))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",a),this.addChildrenMap("action",o),this.addChildrenMap("actionMask",h)}}var Uc=Phaser.Renderer.WebGL.Utils,Nc=function(t,e,i,s,r,n){for(var a=Uc.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),o=i.pathData,h=i.pathIndexes,l=0;l>>16,o=(65280&r)>>>8,h=255&r;t.fillStyle="rgba("+a+","+o+","+h+","+n+")"},qc=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,a=(16711680&r)>>>16,o=(65280&r)>>>8,h=255&r;t.strokeStyle="rgba("+a+","+o+","+h+","+n+")",t.lineWidth=e.lineWidth};const Qc=Phaser.Renderer.Canvas.SetTransform;var tu={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Zc(e,i,s),a=r.calcMatrix.copyFrom(n.calc),o=e._displayOriginX,h=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&Nc(r,a,e,l,o,h),e.isStroked&&Kc(r,e,l,o,h),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(Qc(t,r,e,i,s)){var n=e._displayOriginX,a=e._displayOriginY,o=e.pathData,h=o.length-1,l=o[0]-n,d=o[1]-a;r.beginPath(),r.moveTo(l,d),e.closePath||(h-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(iu.prototype,tu);var su=function(t){return t.x>0&&t.y>0},ru=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const nu=Phaser.Math.DegToRad;var au=function(t,e,i,s,r,n,a,o,h){a&&n>r?n-=360:!a&&n0,a=0,o=e.length;a0;this.dirty=this.dirty||this._radiusTL!==t||this._convexTL!==e,this._convexTL=e,this._radiusTL=Math.abs(t)}get radiusTR(){return this._radiusTR}set radiusTR(t){var e=t>0;this.dirty=this.dirty||this._radiusTR!==t||this._convexTR!==e,this._convexTR=e,this._radiusTR=Math.abs(t)}get radiusBL(){return this._radiusBL}set radiusBL(t){var e=t>0;this.dirty=this.dirty||this._radiusBL!==t||this._convexBL!==e,this._convexBL=e,this._radiusBL=Math.abs(t)}get radiusBR(){return this._radiusBR}set radiusBR(t){var e=t>0;this.dirty=this.dirty||this._radiusBR!==t||this._convexBR!==e,this._convexBR=e,this._radiusBR=Math.abs(t)}get radius(){return Math.max(this.radiusTL,this.radiusTR,this.radiusBL,this.radiusBR)}set radius(t){"number"==typeof t?(this.radiusTL=t,this.radiusTR=t,this.radiusBL=t,this.radiusBR=t):(this.radiusTL=ap(t,"tl",0),this.radiusTR=ap(t,"tr",0),this.radiusBL=ap(t,"bl",0),this.radiusBR=ap(t,"br",0))}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}get iterations(){return this._iterations}set iterations(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t}setIterations(t){return this.iterations=t,this}updateData(){var t=this.pathData;t.length=0;var e,i=this.width,s=this.height,r=this.iterations+1;return(e=this.radiusTL)>0?this._convexTL?au(e,e,e,e,180,270,!1,r,t):au(0,0,e,e,90,0,!0,r,t):ru(0,0,t),(e=this.radiusTR)>0?this._convexTR?au(i-e,e,e,e,270,360,!1,r,t):au(i,0,e,e,180,90,!0,r,t):ru(i,0,t),(e=this.radiusBR)>0?this._convexBR?au(i-e,s-e,e,e,0,90,!1,r,t):au(i,s,e,e,270,180,!0,r,t):ru(i,s,t),(e=this.radiusBL)>0?this._convexBL?au(e,s-e,e,e,90,180,!1,r,t):au(0,s,e,e,360,270,!0,r,t):ru(0,s,t),t.push(t[0],t[1]),Gu(this.x,this.y,t),super.updateData(),this}}Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlpha;var hp=function(t,e,i,s,r,n){var a=(e+s)/2;return n>=0?t.startAt(a+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(a+n,i):t.startAt(a,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(a,i),t.close(),t};const lp=Phaser.Utils.Objects.GetValue,dp=Phaser.Utils.Objects.IsPlainObject;class cp extends(Au(Pu)){constructor(t,e,i,s,r,n,a,o){dp(e)?(e=(o=e).x,i=o.y,s=o.width,r=o.height,n=o.barColor,a=o.value):dp(s)?(s=(o=s).width,r=o.height,n=o.barColor,a=o.value):dp(n)&&(n=(o=n).barColor,a=o.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===a&&(a=0),super(t,e,i,s,r,o),this.type="rexLineProgress",this.bootProgressBase(o),this.addShape((new np).setName("trackFill")).addShape((new np).setName("bar")).addShape((new np).setName("trackStroke")),this.setTrackColor(lp(o,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(lp(o,"trackStrokeThickness",2),lp(o,"trackStrokeColor",void 0)),this.setSkewX(lp(o,"skewX",0)),this.setRTL(lp(o,"rtl",!1)),this.setValue(a)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var up={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&hp(s,0,0,e,i,t);var r,n,a=this.getShape("bar");a.fillStyle(this.barColor),a.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),hp(a,r,0,n,i,t));var o=this.getShape("trackStroke");o.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),o.isStroked&&hp(o,0,0,e,i,t)}};Object.assign(cp.prototype,up);class pp extends cp{constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("value")||(e.value=0),e.hasOwnProperty("hover.bar")||(e["hover.bar"]=!0),e.hasOwnProperty("easeDuration")||(e.easeDuration=200),e.hasOwnProperty("ease")||(e.ease="Quad"),Xe(e,"easeValue.duration",e.easeDuration),Xe(e,"easeValue.ease",e.ease),super(t,e),this.type="rexStatesBarRectangleShape",this.barState=!1,e.style=this,e.propertiesMap=gp,this.addStyleManager(e),delete e.style,delete e.propertiesMap}get bar(){return this.barState}set bar(t){t=!!t,this.barState!==t&&(this.barState=t,this.easeValueTo(this.barState?1:0))}}const gp={color:"trackColor",strokeColor:"trackStrokeColor",strokeWidth:"trackStrokeThickness"};Object.assign(pp.prototype,yu);let vp=class extends l{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Js(t,e))return t[e];var i=t.parent;return Js(i,e)?i[e]:void 0}set(t,e,i){return Js(t,e)?t[e]=i:Js(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.texture.key}set key(t){this.key!==t&&this.parent.setTexture(t,this.frame)}get frame(){return this.parent.frame.name}set frame(t){this.frame!==t&&this.parent.setFrame(t)}};const fp=Phaser.GameObjects.NineSlice,mp=Phaser.Utils.Objects.GetValue;class yp extends fp{constructor(t,e){void 0===e&&(e={}),super(t,mp(e,"x",0),mp(e,"y",0),mp(e,"key",null),mp(e,"frame",null),mp(e,"width",0),mp(e,"height",0),mp(e,"leftWidth",0),mp(e,"rightWidth",0),mp(e,"topHeight",0),mp(e,"bottomHeight",0)),this.type="rexStatesNineSlice";var i=mp(e,"effects",!0);i&&ir(this,i),this.style=new vp(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(yp.prototype,yu);let bp=class extends l{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Js(t,e))return t[e];var i=t.parent;return Js(i,e)?i[e]:void 0}set(t,e,i){return Js(t,e)?t[e]=i:Js(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.texture.key}set key(t){this.parent.setTexture(t,this.frame)}get frame(){return this.parent.frame.name}set frame(t){this.parent.setFrame(t)}get scale(){return this.parent.scaleX}set scale(t){this.parent.setScale(t)}};const xp=Phaser.GameObjects.Image,Cp=Phaser.Utils.Objects.GetValue;class wp extends xp{constructor(t,e){void 0===e&&(e={}),super(t,Cp(e,"x",0),Cp(e,"y",0),Cp(e,"key",""),Cp(e,"frame",void 0)),this.type="rexStatesImage";var i=Cp(e,"effects",!0);i&&ir(this,i),this.style=new bp(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(wp.prototype,yu);var Sp=function(t,e,i){return"__BASE"===i?`${t},${e}`:`${i}:${t},${e}`};const Op=Phaser.Utils.Objects.IsPlainObject,kp=Phaser.Utils.Objects.GetValue;var Pp=function(t){return"string"==typeof t&&(t=Tp[t]),t};const Tp={scale:0,repeat:1};var _p=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},Mp={_beginDraw:Rr,_drawImage:Rr,_drawTileSprite:Rr,_endDraw:Rr,setGetFrameNameCallback:function(t){return void 0===t&&(t=Sp),this.getFrameNameCallback=t,this},setBaseTexture:function(t,e,i,s){Array.isArray(e)&&(s=i,i=e,e=void 0),null==e&&(e="__BASE"),"number"==typeof i&&arguments.length>=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=We(i),s=We(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),a=n.width,o=0,h=0,l=i.length;h0?a/o:0,c=n.height,u=0;for(h=0,l=s.length;h0?0:v,b=0,h=0;for(var S=i.length;h0?0:f),f>=1&&v>=1){var O=typeof(m=this.getFrameNameCallback(h,C,e));"string"!==O&&"number"!==O||r.add(m,0,b+n.cutX,x+n.cutY,f,v)}b+=f}x+=v}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,a,o,h=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-h,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/h,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var g=Math.min(u,p);if(u>g){var v=(u-g)*h;d>=0?d+=v:d=v,u=g}if(p>g){var f=(p-g)*l;c>=0?c+=f:c=f,p=g}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,x=this.rows.count;b0&&o>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(C,b)?0:1)?this._drawImage(this.textureKey,s,m,y,a,o):this._drawTileSprite(this.textureKey,s,m,y,a,o)),m+=a;y+=o}this._endDraw()},setStretchMode:function(t){return Op(t)?(this.stretchMode.edge=Pp(kp(t,"edge",0)),this.stretchMode.internal=Pp(kp(t,"internal",0))):(t=Pp(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return _p.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const Ep=Phaser.Utils.Objects.IsPlainObject,Rp=Phaser.Utils.Objects.GetValue,Lp=Phaser.GameObjects;var Dp=void 0,Ap=function(t,e){if(Dp||(Dp={},o(t).events.once("destroy",(function(){for(var t in Dp)Dp[t].destroy();Dp=void 0}))),!Dp.hasOwnProperty(e)){var i=o(t).scene.systemScene;(t=new Lp[e](i)).setOrigin(0),Dp[e]=t}return Dp[e]};const Bp=Phaser.GameObjects.RenderTexture;class jp extends(function(t,e){class i extends t{constructor(t,i,s,r,n,a,o,h,l,d){if(Ep(i)?(i=Rp(d=i,"x",0),s=Rp(d,"y",0),r=Rp(d,"width",1),n=Rp(d,"height",1),a=Rp(d,"key",void 0),o=Rp(d,"baseFrame",void 0),h=Rp(d,"columns",void 0),l=Rp(d,"rows",void 0)):Ep(r)?(r=Rp(d=r,"width",1),n=Rp(d,"height",1),a=Rp(d,"key",void 0),o=Rp(d,"baseFrame",void 0),h=Rp(d,"columns",void 0),l=Rp(d,"rows",void 0)):Ep(a)?(a=Rp(d=a,"key",void 0),o=Rp(d,"baseFrame",void 0),h=Rp(d,"columns",void 0),l=Rp(d,"rows",void 0)):Ep(o)?(o=Rp(d=o,"baseFrame",void 0),h=Rp(d,"columns",void 0),l=Rp(d,"rows",void 0)):Array.isArray(o)?(d=l,l=h,h=o,o=Rp(d,"baseFrame",void 0)):Ep(h)&&(h=Rp(d=h,"columns",void 0),l=Rp(d,"rows",void 0)),void 0===o&&(o=Rp(d,"frame",void 0)),void 0===h){var c=Rp(d,"leftWidth",void 0),u=Rp(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(h=[c,void 0,u])}if(void 0===l){var p=Rp(d,"topHeight",void 0),g=Rp(d,"bottomHeight",void 0);void 0!==p&&void 0!==g&&(l=[p,void 0,g])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(Rp(d,"getFrameNameCallback",void 0)),this.setStretchMode(Rp(d,"stretchMode",0)),this.setPreserveRatio(Rp(d,"preserveRatio",!0));var v=Rp(d,"maxFixedPartScale",1),f=Rp(d,"maxFixedPartScaleX",v),m=Rp(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(a,o,h,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,Mp),i}(Bp,"rexNinePatch")){}var Wp={_drawImage:function(t,e,i,s,r,n){var a=Ap(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(a,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var a=Ap(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(a,i,s)}};Object.assign(jp.prototype,Wp);let zp=class extends l{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Js(t,e))return t[e];var i=t.parent;return Js(i,e)?i[e]:void 0}set(t,e,i){return Js(t,e)?t[e]=i:Js(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}};const Yp=Phaser.Utils.Objects.GetValue;class Ip extends jp{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=Yp(e,"effects",!0);i&&ir(this,i),this.style=new zp(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Ip.prototype,yu);const Xp=["alpha","tint","flipX","flipY"];var Fp=function(t,e){if(!e)return t;for(var i=0,s=Xp.length;i0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=A,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===B&&this.onDragEnd(),this.pointer=void 0,this.tracerState=A,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=j,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&R(t,s,e,i)}}const A=0,B=1,j="IDLE";function W(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var z={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function s(){}function r(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function n(t,e,s,n,a){if("function"!=typeof s)throw new TypeError("The listener must be a function");var o=new r(s,n||t,a),h=i?i+e:e;return t._events[h]?t._events[h].fn?t._events[h]=[t._events[h],o]:t._events[h].push(o):(t._events[h]=o,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new s:delete t._events[e]}function o(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(i=!1)),o.prototype.eventNames=function(){var t,s,r=[];if(0===this._eventsCount)return r;for(s in t=this._events)e.call(t,s)&&r.push(i?s.slice(1):s);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(t)):r},o.prototype.listeners=function(t){var e=i?i+t:t,s=this._events[e];if(!s)return[];if(s.fn)return[s.fn];for(var r=0,n=s.length,a=new Array(n);rthis.tapOffset&&(this.state=Q,this.state=q);break;case Q:this.state=q}}onDragEnd(){this.state===q&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=Q))}onDrag(){this.state!==J&&this.pointer.getDistance()>this.dragThreshold&&(this.state=J)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===q){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=J):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=Q:this.state=J)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Q&&(this.state=J)}get isTapped(){return this.state===Q}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const J="IDLE",q="BEGIN",Q="RECOGNIZED",tt=Phaser.Utils.Objects.GetValue;class et extends D{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=it},eventEmitter:!1};this.setRecongizedStateObject(new N(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(tt(t,"threshold",9)),this.setHoldTime(tt(t,"time",251)),this}onDragStart(){this.state=st,0===this.holdTime&&(this.state=rt)}onDragEnd(){this.state=it}onDrag(){this.state!==it&&this.pointer.getDistance()>this.dragThreshold&&(this.state=it)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===st&&t-this.pointer.downTime>=this.holdTime&&(this.state=rt)}get isPressed(){return this.state===rt}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const it="IDLE",st="BEGIN",rt="RECOGNIZED",nt=Phaser.Utils.Objects.GetValue;class at extends D{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{},BEGIN:{enter:function(){var t=i.pointer;i.startX=t.x,i.startY=t.y,i.startWorldX=t.worldX,i.startWorldY=t.worldY}},RECOGNIZED:{enter:function(){i.emit("panstart",i,i.gameObject,i.lastPointer)},exit:function(){var t=i.lastPointer;i.endX=t.x,i.endY=t.y;var e=M(t,i.pointerCamera,!0);i.endWorldX=e.x,i.endWorldY=e.y,i.emit("panend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=ot},eventEmitter:!1};this.setRecongizedStateObject(new N(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(nt(t,"threshold",10)),this}onDragStart(){this.state=ht,0===this.dragThreshold&&(this.state=lt)}onDragEnd(){this.state=ot}onDrag(){switch(this.state){case ht:if(this.pointer.getDistance()>=this.dragThreshold){this.state=lt,this.dx=0,this.dy=0,this.dWorldX=0,this.dWorldY=0;var t=this.pointer;this.x=t.x,this.y=t.y,this.worldX=t.worldX,this.worldY=t.worldY}break;case lt:var e=this.pointerCamera,i=this.pointer.position,s=this.pointer.prevPosition;this.dx=i.x-s.x,this.dy=i.y-s.y,this.dWorldX=this.dx/e.zoom,this.dWorldY=this.dy/e.zoom,t=this.pointer,this.x=t.x,this.y=t.y;var r=M(t,e,!0);this.worldX=r.x,this.worldY=r.y,this.emit("pan",this,this.gameObject,this.lastPointer)}}get isPanned(){return this.state===lt}setDragThreshold(t){return this.dragThreshold=t,this}}const ot="IDLE",ht="BEGIN",lt="RECOGNIZED";var dt=function(t){return o(t).loop.delta};const ct=Phaser.Math.Distance.Between,ut=Phaser.Math.Angle.Between;var pt={getDt:function(){return dt(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return ct(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return ut(e.x,e.y,t.x,t.y)}},gt={"up&down":0,"left&right":1,"4dir":2,"8dir":3},vt={};const ft=Phaser.Utils.Objects.GetValue,mt=Phaser.Math.RadToDeg;class yt extends D{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=bt},eventEmitter:!1};this.setRecongizedStateObject(new N(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(ft(t,"threshold",10)),this.setVelocityThreshold(ft(t,"velocityThreshold",1e3)),this.setDirectionMode(ft(t,"dir","8dir")),this}onDragStart(){this.state=xt}onDragEnd(){this.state=bt}onDrag(){this.state===xt&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=Ct))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Ct&&(this.state=bt)}get isSwiped(){return this.state===Ct}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=gt[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=vt),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(mt(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(yt.prototype,pt);const bt="IDLE",xt="BEGIN",Ct="RECOGNIZED";var wt=function(t){if("object"!=typeof t||null===t)return t;if(Array.isArray(t))t.length=0;else for(var e in t)delete t[e];return t};const St=Phaser.Utils.Objects.GetValue,Ot=Phaser.Utils.Array.SpliceOne,kt=Phaser.Math.Distance.Between,Pt=Phaser.Math.Angle.Between;class Tt{constructor(t,e){var i=r(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(St(e,"inputConfig",void 0)),this.setEventEmitter(St(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(St(t,"enable",!0)),this.bounds=St(t,"bounds",void 0),this.tracerState=Mt,this.pointers.length=0,wt(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,wt(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case Mt:this.tracerState=Et,this.onDrag1Start();break;case Et:this.tracerState=Rt,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],Ot(this.pointers,e),this.tracerState){case Et:this.tracerState=Mt,this.onDrag1End();break;case Rt:this.tracerState=Et,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case Et:this.onDrag1();break;case Rt:this.onDrag2()}}}dragCancel(){return this.tracerState===Rt&&this.onDrag2End(),this.pointers.length=0,wt(this.movedState),this.tracerState=Mt,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Rt)return 0;var t=this.pointers[0],e=this.pointers[1];return kt(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Rt)return 0;var t=this.pointers[0],e=this.pointers[1];return Pt(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;_t.x=e.x-i.x,_t.y=e.y-i.y}else _t.x=0,_t.y=0;return _t}get centerX(){if(this.tracerState!==Rt)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Rt)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Rt)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Rt)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Lt,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&R(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&R(t,s,e,i)}}Object.assign(Tt.prototype,e);var _t={};const Mt=0,Et=1,Rt=2,Lt="IDLE",Dt=Phaser.Utils.Objects.GetValue;class At extends Tt{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.prevDistance=void 0,i.scaleFactor=1}},BEGIN:{},RECOGNIZED:{enter:function(){i.emit("pinchstart",i)},exit:function(){i.emit("pinchend",i)}}},init:function(){this.state=Bt},eventEmitter:!1};this.setRecongizedStateObject(new N(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Dt(t,"threshold",0)),this}onDrag2Start(){this.scaleFactor=1,this.prevDistance=this.distanceBetween,this.state=jt,0===this.dragThreshold&&(this.state=Wt)}onDrag2End(){this.state=Bt}onDrag2(){switch(this.state){case jt:if(this.pointers[0].getDistance()>=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=this.distanceBetween;this.scaleFactor=t/this.prevDistance,this.prevDistance=t,this.state=Wt}break;case Wt:t=this.distanceBetween,this.scaleFactor=t/this.prevDistance,this.emit("pinch",this),this.prevDistance=t}}get isPinched(){return this.state===Wt}setDragThreshold(t){return this.dragThreshold=t,this}}const Bt="IDLE",jt="BEGIN",Wt="RECOGNIZED",zt=Phaser.Math.RotateAround;var Yt=function(t,e,i,s){return zt(t,e,i,s),t.rotation+=s,t},It={};const Xt=Phaser.Utils.Objects.GetValue,Ft=Phaser.Math.Angle.WrapDegrees,Vt=Phaser.Math.Angle.ShortestBetween,Gt=Phaser.Math.RadToDeg,Ht=Phaser.Math.DegToRad;var Ut={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=It),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,a=r.y,o=this.rotation;if(Array.isArray(t))for(var h=t,l=0,d=h.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Ft(Gt(this.angleBetween));this.angle=Vt(this.prevAngle,t),this.prevAngle=t,this.state=Kt}break;case Kt:t=Ft(Gt(this.angleBetween)),this.angle=Vt(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Kt}get rotation(){return Ht(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Ut);const Nt="IDLE",$t="BEGIN",Kt="RECOGNIZED";var Zt=function(t,e){var i,s=t.cameras;if(void 0===e)i=s.main;else switch(typeof e){case"string":i=s.getCamera(e);break;case"number":i=s.cameras[e];break;default:i=e}return i};const Jt=Phaser.Utils.Objects.GetValue;class qt extends l{constructor(t,e){void 0===e&&(e={}),super(t,e),this.inputTarget=Jt(e,"inputTarget",t),this.pan=new at(this.inputTarget);var i=Zt(t,Jt(e,"camera"));this.setCamera(i).setEnable(Jt(e,"enable",!0)),this.boot()}boot(){this.pan.on("pan",(function(t){var e=this.camera;if(this.enable&&e){var i=e.zoom;e.scrollX-=t.dx/i,e.scrollY-=t.dy/i}}),this)}shutdown(t){this.isShutdown||(this.inputTarget=void 0,this.pan.destroy(),this.pan=void 0,super.shutdown(t))}setCamera(t){return this.camera=t,this}setEnable=function(t){return void 0===t&&(t=!0),this.enable=t,this}}var Qt=function(t,e,i,s){if(void 0!==i){var r=t.getWorldPoint(i,s);t.zoom=e,function(t){var e=t.width,i=t.height,s=t.zoomX,r=t.zoomY,n=t.matrix,a=t.scrollX,o=t.scrollY;t.useBounds&&(a=t.clampX(a),o=t.clampY(o)),t.scrollX=a,t.scrollY=o;var h=a+.5*e,l=o+.5*i;t.midPoint.set(h,l);var d=e/s,c=i/r;t.worldView.setTo(h-d/2,l-c/2,d,c);var u=e*t.originX,p=i*t.originY;n.applyITRS(t.x+u,t.y+p,t.rotation,s,r),n.translate(-u,-p)}(t);var n=t.getWorldPoint(i,s);t.scrollX-=n.x-r.x,t.scrollY-=n.y-r.y}else t.zoom=e};const te=Phaser.Utils.Objects.GetValue;Phaser.Math.Clamp;class ee extends l{constructor(t,e){void 0===e&&(e={}),super(t,e),this.inputTarget=te(e,"inputTarget",t),this.pinch=new At(this.inputTarget);var i=Zt(t,te(e,"camera"));this.setCamera(i).setEnable(te(e,"enable",!0)).setMinZoom(te(e,"minZoom",void 0)).setMaxZoom(te(e,"maxZoom",void 0)),this.boot()}boot(){this.pinch.on("pinch",(function(t){var e=this.camera;if(this.enable&&e){var i=e.zoom*t.scaleFactor;void 0!==this.minZoom&&ithis.maxZoom&&(i=this.maxZoom);var s=t.pointers[0],r=t.pointers[1],n=(s.x+r.x)/2,a=(s.y+r.y)/2;Qt(e,i,n,a)}}),this)}shutdown(t){this.isShutdown||(this.inputTarget=void 0,this.pinch.destroy(),this.pinch=void 0,super.shutdown(t))}setCamera(t){return this.camera=t,this}setEnable=function(t){return void 0===t&&(t=!0),this.enable=t,this};setMinZoom(t){return this.minZoom=t,this}setMaxZoom(t){return this.maxZoom=t,this}}const ie=Phaser.Input.Keyboard.Key,se=Phaser.Input.Keyboard.KeyCodes,re=["up","down","left","right"];class ne{constructor(t){this.scene=t,this.keys={},this.cursorKeys={},this.noKeyDown=!0;for(var e=0,i=re.length;e=s&&e<=s+o,l=e<=r&&e>=r-o,d=i>=n&&i<=n+o,c=i<=a&&i>=a-o;this.pointerOutBoundsReleaseEnable||(h|=er,d|=ia),this.setKeyState("left",h),this.setKeyState("right",l),this.setKeyState("up",d),this.setKeyState("down",c)}}get up(){return this.upKeyDown}get down(){return this.downKeyDown}get left(){return this.leftKeyDown}get right(){return this.rightKeyDown}get noKey(){return this.noKeyDown}}const pe=Phaser.Utils.Objects.GetValue;class ge extends l{constructor(t,e){void 0===e&&(e={}),super(t,e),this.cursorAtBounds=new ue(t);var i=this.cursorAtBounds.createCursorKeys();this.cameraController=new Phaser.Cameras.Controls.SmoothedKeyControl({left:i.left,right:i.right,up:i.up,down:i.down,acceleration:.06,drag:.003,maxSpeed:.3});var s=Zt(t,pe(e,"camera"));this.setCamera(s).setEnable(pe(e,"enable",!0)),this.boot()}boot(){this.scene.events.on("preupdate",this.updateCameraController,this)}shutdown(t){this.isShutdown||(this.scene.events.off("preupdate",this.updateCameraController,this),this.cursorAtBounds.destroy(),this.cameraController.destroy(),super.shutdown(t))}get camera(){return this.cameraController.camera}set camera(t){this.cameraController.setCamera(t),t?this.cameraController.start():this.cameraController.stop()}setCamera(t){return this.camera=t,this}get enable(){return this.cursorAtBounds.enable}set enable(t){this.cursorAtBounds.enable=t}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}updateCameraController(t,e){this.cameraController.update(e)}}const ve=Phaser.Utils.Objects.GetValue;class fe extends c{constructor(t,e){super(t,e);var i=this.scene?"update":"step";this.tickEventName=ve(e,"tickEventName",i),this.isSceneTicker=!me(this.tickEventName)}startTicking(){super.startTicking(),this.isSceneTicker?this.scene.sys.events.on(this.tickEventName,this.update,this):this.game.events.on(this.tickEventName,this.update,this)}stopTicking(){super.stopTicking(),this.isSceneTicker&&this.scene?this.scene.sys.events.off(this.tickEventName,this.update,this):this.game&&this.game.events.off(this.tickEventName,this.update,this)}}var me=function(t){return"step"===t||"poststep"===t};const ye=Phaser.Utils.Objects.GetValue,be=Phaser.Math.Clamp;class xe{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){this.state=ye(t,"state",Ce),this.timeScale=ye(t,"timeScale",1),this.delay=ye(t,"delay",0),this.repeat=ye(t,"repeat",0),this.repeatCounter=ye(t,"repeatCounter",0),this.repeatDelay=ye(t,"repeatDelay",0),this.duration=ye(t,"duration",0),this.nowTime=ye(t,"nowTime",0),this.justRestart=ye(t,"justRestart",!1)}toJSON(){return{state:this.state,timeScale:this.timeScale,delay:this.delay,repeat:this.repeat,repeatCounter:this.repeatCounter,repeatDelay:this.repeatDelay,duration:this.duration,nowTime:this.nowTime,justRestart:this.justRestart}}destroy(){}setTimeScale(t){return this.timeScale=t,this}setDelay(t){return void 0===t&&(t=0),this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatInfinity(){return this.repeat=-1,this}setRepeatDelay(t){return this.repeatDelay=t,this}start(){return this.nowTime=this.delay>0?-this.delay:0,this.state=this.nowTime>=0?Se:we,this.repeatCounter=0,this}stop(){return this.state=Ce,this}update(t,e){this.state!==Ce&&this.state!==ke&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=Oe)):(this.nowTime=this.duration,this.state=ke):this.nowTime>=0&&(this.state=Se))}get t(){var t;switch(this.state){case Ce:case we:case Oe:t=0;break;case Se:t=this.nowTime/this.duration;break;case ke:t=1}return be(t,0,1)}set t(t){(t=be(t,-1,1))<0?(this.state=we,this.nowTime=-this.delay*t):(this.state=Se,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===Ce}get isDelay(){return this.state===we}get isCountDown(){return this.state===Se}get isRunning(){return this.state===we||this.state===Se}get isDone(){return this.state===ke}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const Ce=0,we=1,Se=2,Oe=3,ke=-1;class Pe extends fe{constructor(t,e){super(t,e),this.timer=new xe}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const Te=Phaser.Utils.Objects.GetValue,_e=Phaser.Utils.Objects.GetAdvancedValue,Me=Phaser.Tweens.Builders.GetEaseFunction;class Ee extends Pe{resetFromJSON(t){return this.timer.resetFromJSON(Te(t,"timer")),this.setEnable(Te(t,"enable",!0)),this.setTarget(Te(t,"target",this.parent)),this.setDelay(_e(t,"delay",0)),this.setDuration(_e(t,"duration",1e3)),this.setEase(Te(t,"ease","Linear")),this.setRepeat(Te(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Me(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Re=Phaser.Math.Linear;class Le extends Ee{constructor(t,e){super(t,e),this.resetFromJSON(e)}start(t){return this.stop(),this.startZoomValue=this.target.zoom,this.endZoomValue=t,this.timer.setDuration(this.duration),super.start(),this}updateTarget(t,e){var i=this.parent,s=Re(this.startZoomValue,this.endZoomValue,e.t);Qt(t,s,i.focusLocalX,i.focusLocalY)}}const De=Phaser.Utils.Objects.GetValue;Phaser.Math.Clamp;class Ae extends l{constructor(t,e){void 0===e&&(e={}),super(t,e),this.easeZoom=new Le(this);var i=Zt(t,De(e,"camera"));this.setEnable(De(e,"enable",!0)).setMinZoom(De(e,"minZoom")).setMaxZoom(De(e,"maxZoom")).setZoomStep(De(e,"zoomStep",.1)).setEaseDuration(De(e,"easeDuration",200)).setCamera(i),this.boot()}boot(){this.scene.input.on("wheel",this.onWheel,this)}shutdown(t){this.isShutdown||(this.scene.input.off("wheel",this.onWheel,this),this.easeZoom.destroy(),this.easeZoom=void 0,this.inputTarget=void 0,super.shutdown(t))}setCamera(t){return this.camera=t,this.resetZoomLevel(),this.easeZoom.stop().setTarget(t||null),this}setEnable=function(t){return void 0===t&&(t=!0),this.enable=t,this};setMinZoom(t){return this.minZoom=t,this}setMaxZoom(t){return this.maxZoom=t,this}setZoomStep(t){return this.zoomStep=t,this}setEaseDuration(t){return this.easeDuration=t,this.easeZoom.setDuration(t),this}resetZoomLevel(){var t=this.camera;return t?(this.zoomLevel=Math.round(Be(t.zoom,this.zoomStep)),this.zoom=t.zoom,this):(this.zoomLevel=void 0,this)}onWheel(t,e,i,s,r,n){var a=this.camera;if(this.enable&&a){var o=void 0!==this.minZoom,h=void 0!==this.maxZoom;o&&this.zoom<=this.minZoom&&s>0||h&&this.zoom>=this.maxZoom&&s<0||(this.zoomLevel+=s<0?1:-1,this.zoom=je(this.zoomLevel,this.zoomStep),o&&this.zoomthis.maxZoom&&(this.zoom=this.maxZoom),this.focusLocalX=t.x,this.focusLocalY=t.y,this.easeZoom.start(this.zoom))}}}var Be=function(t,e){return t>=1?Math.log(t)/Math.log(1+e):-Math.log(t)/Math.log(1-e)},je=function(t,e){return t>=0?Math.pow(1+e,t):Math.pow(1-e,-t)};function We(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>We(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=We(t[i]));return e}const ze=Phaser.Utils.Objects.GetValue;class Ye extends l{constructor(t,e){super(t,e=void 0===e?{}:We(e)),this._enable=!0,this._camera=void 0;var i=ze(e,"enable",!0),s=ze(e,"minZoom"),r=ze(e,"maxZoom");ze(e,"panScroll",!0)&&(this.panScroll=new qt(t,{camera:ze(e,"camera"),inputTarget:ze(e,"inputTarget",t),enable:ze(e,"panScrollEnable",!0)})),ze(e,"pinchZoom",!0)&&(this.pinchZoom=new ee(t,{camera:ze(e,"camera"),inputTarget:ze(e,"inputTarget",t),enable:ze(e,"pinchZoomEnable",!0),minZoom:ze(e,"pinchZoomMin",s),maxZoom:ze(e,"pinchZoomMax",r)})),ze(e,"boundsScroll",!0)&&(this.boundsScroll=new ge(t,{camera:ze(e,"camera"),enable:ze(e,"boundsScrollEnable",!0)})),ze(e,"mouseWheelZoom",!0)&&(this.mouseWheelZoom=new Ae(t,{camera:ze(e,"camera"),enable:ze(e,"mouseWheelZoomEnable",!0),zoomStep:ze(e,"mouseWheelZoomStep",.1),minZoom:ze(e,"mouseWheelZoomMin",s),maxZoom:ze(e,"mouseWheelZoomMax",r)})),this.setEnable(i)}destroy(t){this.panScroll&&this.panScroll.destroy(t),this.pinchZoom&&this.pinchZoom.destroy(t),this.boundsScroll&&this.boundsScroll.destroy(t),this.mouseWheelZoom&&this.mouseWheelZoom.destroy(t),super.destroy(t)}set camera(t){this.panScroll&&this.panScroll.setCamera(t),this.pinchZoom&&this.pinchZoom.setCamera(t),this.boundsScroll&&this.boundsScroll.setCamera(t),this.mouseWheelZoom&&this.mouseWheelZoom.setCamera(t)}get camera(){return this.panScroll?this.panScroll.camera:this.pinchZoom?this.pinchZoom.camera:this.boundsScroll?this.boundsScroll.camera:this.mouseWheelZoom?this.mouseWheelZoom.camera:void 0}setCamera(t){return this.camera=t,this}set panScrollEnable(t){this.panScroll&&(this.panScroll.enable=t)}get panScrollEnable(){return!!this.panScroll&&this.panScroll.enable}setPanScrollEnable=function(t){return void 0===t&&(t=!0),this.panScrollEnable=t,this};set pinchZoomEnable(t){this.pinchZoom&&(this.pinchZoom.enable=t)}get pinchZoomEnable(){return!!this.pinchZoom&&this.pinchZoom.enable}setPinchZoomEnable=function(t){return void 0===t&&(t=!0),this.pinchZoomEnable=t,this};set boundsScrollEnable(t){this.boundsScroll&&(this.boundsScroll.enable=t)}get boundsScrollEnable(){return!!this.boundsScroll&&this.boundsScroll.enable}setBoundsScrollEnable=function(t){return void 0===t&&(t=!0),this.boundsScrollEnable=t,this};set mouseWheelZoomEnable(t){this.mouseWheelZoom&&(this.mouseWheelZoom.enable=t)}get mouseWheelZoomEnable(){if(this.mouseWheelZoom)return this.mouseWheelZoom.enable}setMouseWheelZoomEnable(t){return void 0===t&&(t=!0),this.mouseWheelZoom=t,this}set enable(t){t=!!t,this._enable!==t&&(t?(this.panScrollEnable=this.panScrollEnableSave,this.pinchZoomEnable=this.pinchZoomEnableSave,this.boundsScrollEnable=this.boundsScrollEnableSave,this.mouseWheelZoomEnable=this.mouseWheelZoomEnableSave):(this.panScrollEnableSave=this.panScrollEnable,this.pinchZoomEnableSave=this.pinchZoomEnable,this.boundsScrollEnableSave=this.boundsScrollEnable,this.mouseWheelZoomEnableSave=this.mouseWheelZoomEnable,this.panScrollEnable=!1,this.pinchZoomEnable=!1,this.boundsScrollEnable=!1,this.mouseWheelZoomEnable=!1),this._enable=t)}get enable(){return this._enable}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.enable=!this.enable,this}}var Ie=function(t){return null==t||""===t||0===t.length},Xe=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(Ie(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(Ie(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,a=e.length;n=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return He(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return Ue(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;iqe(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;eqe(t).x,getChildLocalY:t=>qe(t).y};const gi=Phaser.Math.DegToRad;var vi={updateChildRotation(t){var e=qe(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=qe(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return qe(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return qe(t).rotation=gi(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=qe(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>qe(t).rotation},fi={updateChildScale(t){var e=qe(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=qe(t),i=e.parent;return e.scaleX=ui(t.scaleX,i.scaleX),e.scaleY=ui(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=qe(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=qe(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>qe(t).scaleX,getChildLocalScaleY:t=>qe(t).scaleY},mi={updateChildVisible(t){var e=qe(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=qe(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),qe(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),qe(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=qe(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>qe(t).visible},yi={updateChildAlpha(t){var e=qe(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=qe(t),i=e.parent;return e.alpha=ui(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return qe(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=qe(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>qe(t).alpha},bi={updateChildActive(t){var e=qe(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return qe(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),qe(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=qe(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>qe(t).active},xi={updateChildScrollFactor(t){var e=qe(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},Ci={updateCameraFilter(t){var e=qe(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},wi={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(t){void 0===t&&(t=!1);var e=this;return this._mask=null,this.setChildMaskVisible(this),this.children.forEach((function(t){t.clearMask&&t.clearMask(!1),t.hasOwnProperty("isRexContainerLite")||e.setChildMaskVisible(t)})),t&&this.mask&&this.mask.destroy(),this}},Si=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},Pi=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const _i=Phaser.Utils.Array;var Mi={getChildren(t){if(t)for(var e=0,i=this.children.length;e0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,a=1/i.zoom,o=r/2,h=n/2,l=r*a,d=n*a;e.x===o&&e.y===h||e.setPosition(o,h),e.width===l&&e.height===d||e.setSize(l,d)}}}const Bs=Phaser.GameObjects.Rectangle;let js=class extends Bs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new As(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}};t.register("fullWindowRectangle",(function(t,e){var i=new js(this.scene,t,e);return this.scene.add.existing(i),i})),Xe(window,"RexPlugins.GameObjectShell.FullWindowRectangle",js);var Ws={hasProperty(t){var e=this.gameObject;return!!e.hasOwnProperty(t)||void 0!==e[t]},getProperty(t){return this.gameObject[t]},setProperty(t,e){return this.gameObject[t]=e,this},easeProperty(t){var e=t.property,i=t.value,s=t.duration,r=t.delay,n=t.ease,a=t.repeat,o=t.yoyo,h=t.from,l=t.complete,d=t.target;if(void 0===s&&(s=1e3),void 0===r&&(r=0),void 0===n&&(n="Linear"),void 0===a&&(a=0),void 0===o&&(o=!1),void 0===d&&(d=this.gameObject),h){var c=i;i=d[e],d[e]=c}return(t={targets:d,duration:s,delay:r,ease:n,repeat:a,yoyo:o,onComplete:l})[e]=i,this.addTweenTask(e,t),this},addTweenTask(t,e){var i=this.tweens,s=i[t];s&&s.remove();var r=e.onComplete;return e.onComplete=function(){i[t].remove(),i[t]=null,r&&r(e.targets,t)},(s=this.scene.tweens.add(e)).timeScale=this.timeScale,i[t]=s,this},getTweenTask(t){return this.tweens[t]},freeTweens(){var t,e=this.tweens;for(var i in e)(t=e[i])&&t.remove(),e[i]=null;return this}},zs={hasMethod(t){return"function"==typeof this.gameObject[t]},call(t,...e){if(!this.hasMethod(t))return console.warn(`[GameObjectManager] Game object '${this.name}' does not have method '${t}'`),this;var i=this.gameObject;return i[t].apply(i,e),this}},Ys={hasData(t){var e=this.gameObject;return!!e.data&&e.data.has(t)},getData(t){return this.gameObject.getData(t)},setData(t,e){return this.gameObject.setData(t,e),this}};class Is{constructor(t,e,i){this.GOManager=t,this.tweens={},this.effects={},this.setGO(e,i)}get scene(){return this.GOManager.scene}get timeScale(){return this.GOManager.timeScale}destroy(){this.freeGO(),this.GOManager=void 0}freeGO(){return this.freeTweens(),this.gameObject.bob=void 0,this.gameObject.destroy(),this.gameObject=void 0,this}setGO(t,e){return t.goName=e,t.goType=this.GOManager.name,t.bob=this,this.gameObject=t,this.name=e,this.freeTweens(),this}setTimeScale(t){var e=this.tweens;for(var i in e){var s=e[i];s&&(s.timeScale=t)}return this}}Object.assign(Is.prototype,Ws,zs,Ys);var Xs=function(t){for(var e in t)return!1;return!0},Fs=function(t){return t&&"!"!==t.charAt(0)},Vs={has(t){return this.bobs.hasOwnProperty(t)},exists(t){return this.bobs.hasOwnProperty(t)},get(t,e){if(Fs(t))return this.bobs[t];for(var i in void 0===e&&(e=[]),t&&(t=t.substring(1)),this.bobs)t&&i===t||e.push(this.bobs[i]);return e},getFitst(t){for(var e in t&&"!"===t.charAt(0)&&(t=t.substring(1)),this.bobs)if(!t||t!==e)return this.bobs[e];return null},getGO(t,e){var i=this.get(t);return i?Array.isArray(i)?(void 0===e&&(e=[]),i.forEach((function(t){e.push(t.gameObject)})),e):i.gameObject:null},forEachGO(t,e){for(var i in this.bobs){var s=this.bobs[i].gameObject;if(e?t.call(e,s,i,this):t(s,i,this))break}return this},getAllGO(t){for(var e in void 0===t&&(t=[]),this.bobs){var i=this.bobs[e].gameObject;t.push(i)}return t}},Gs=function(t){return t>>16&255},Hs=function(t){return t>>8&255},Us=function(t){return 255&t};const Ns=Phaser.Events.EventEmitter;var $s=function(t,e,i,s,r,n){return void 0===n?n={}:!0===n&&(n=Ks),"number"!=typeof i&&(i=0,s=0),n.x=r.x+r.width*t+i,n.y=r.y+r.height*e+s,n},Ks={},Zs=function(t,e,i,s,r,n,a){if(t.hasOwnProperty("vp"))return t;"function"==typeof i&&(a=i,i=void 0),"function"==typeof r&&(a=r,r=void 0),void 0===i&&(i=.5),void 0===s&&(s=.5),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=$s),function(t){if(t.events)return t;var e=new Ns,i=t.x;Object.defineProperty(t,"x",{get:function(){return i},set:function(s){i!==s&&(i=s,e.emit("update",t))}});var s=t.y;Object.defineProperty(t,"y",{get:function(){return s},set:function(i){s!==i&&(s=i,e.emit("update",t))}});var r=t.width;Object.defineProperty(t,"width",{get:function(){return r},set:function(i){r!==i&&(r=i,e.emit("update",t))}});var n=t.height;Object.defineProperty(t,"height",{get:function(){return n},set:function(i){n!==i&&(n=i,e.emit("update",t))}}),t.events=e}(e);var o=e.events;t.vp=e;var h=function(){a(i,s,r,n,e,t)};o.on("update",h),t.once("destroy",(function(){o.off("update",h),t.vp=void 0})),Object.defineProperty(t,"vpx",{get:function(){return i},set:function(t){i!==t&&(i=t,h())}}),Object.defineProperty(t,"vpy",{get:function(){return s},set:function(t){s!==t&&(s=t,h())}}),Object.defineProperty(t,"vpxOffset",{get:function(){return r},set:function(t){r!==t&&(r=t,h())}}),Object.defineProperty(t,"vpyOffset",{get:function(){return n},set:function(t){n!==t&&(n=t,h())}}),h()},Js=function(t,e){if(!t)return!1;if(t.hasOwnProperty(e))return!0;for(;t;){if(Object.getOwnPropertyDescriptor(t,e))return!0;t=t.__proto__}return!1},qs=function(t){return t.preFX?t.preFX:t.postFX?t.postFX:null},Qs=function(t,e){t._effectSwitchNames||(t._effectSwitchNames=[],t.clearAllEffects=function(){for(var e=t._effectSwitchNames,i=0,s=e.length;i0&&void 0!==t.setTint},useAlphaFadeEffect(t){return(void 0===this.fadeMode||1===this.fadeMode)&&this.fadeTime>0&&void 0!==t.setAlpha},useRevealEffect(t){return this.fadeMode>=2&&this.fadeMode<=5&&this.fadeTime>0&&(t.preFX||t.postFX)},fadeBob(t,e,i,s){var r=t.gameObject;if(this.useTintFadeEffect(r))void 0!==e&&t.setProperty("tintGray",255*e),t.easeProperty({property:"tintGray",value:Math.floor(255*i),duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s});else if(this.useAlphaFadeEffect(r))void 0!==e&&t.setProperty("alpha",e),t.easeProperty({property:"alpha",value:i,duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s});else if(this.useRevealEffect(r)){var n;switch(ir(r,"reveal"),this.fadeMode){case 2:n="revealUp";break;case 3:n="revealDown";break;case 4:n="revealLeft";break;case 5:n="revealRight"}void 0===e&&(e=0),r[n]=e,t.easeProperty({property:n,value:i,duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s}),t.getTweenTask(n).once("complete",(function(){r[n]=null}))}else s&&s(r);return this}},cr={setCamera(t,e){var i=this.get(t);if(!i)return this;var s=Zt(this.scene,e);return s?(i.gameObject.cameraFilter=4294967295^s.id,i.camera=s,this):this},getCamera(t){var e=this.get(t);return e?e.camera:null}},ur={drawGameObjectsBounds:function(t,e){return this.forEachGO((function(i){i.drawBounds?i.drawBounds(t,e):Ji(i,t,e)})),this}};Object.assign(ur,Vs,rr,nr,ar,or,hr,dr,cr);const pr=Phaser.Utils.Objects.GetValue;class gr{constructor(t,e){this.scene=t,this.BobClass=pr(e,"BobClass",Is),this.setCreateGameObjectCallback(pr(e,"createGameObject"),pr(e,"createGameObjectScope")),this.setEventEmitter(pr(e,"eventEmitter",void 0)),this.setGameObjectDepth(pr(e,"depth",void 0));var i=pr(e,"fade",500);"number"==typeof i?(this.setGOFadeMode(),this.setGOFadeTime(i)):(this.setGOFadeMode(pr(i,"mode")),this.setGOFadeTime(pr(i,"time",500)));var s=pr(e,"viewportCoordinate",!1);!1!==s?(this.setViewportCoordinateEnable(pr(e,"enable",!0)),this.setViewport(pr(s,"viewport"))):this.setViewportCoordinateEnable(!1);var r=pr(e,"effectProperties",!1);this.setEffectPropertiesConfig(r),this.setSymbols(pr(e,"symbols")),this.bobs={},this.removedGOs=[],this._timeScale=1,this.name=pr(e,"name")}destroy(t){this.clear(!t),this.createGameObjectCallback=void 0,this.viewport=void 0,this.scene=void 0}set timeScale(t){if(this._timeScale!==t){this._timeScale=t;var e=this.bobs;for(var i in e)e[i].setTimeScale(t)}}get timeScale(){return this._timeScale}setTimeScale(t){return this.timeScale=t,this}setCreateGameObjectCallback(t,e){return this.createGameObjectCallback=t,this.createGameObjectScope=e,this}setGameObjectDepth(t){return this.gameObjectDepth=t,this}setViewportCoordinateEnable(t){return void 0===t&&(t=!0),this.viewportCoordinateEnable=t,this}setEffectPropertiesConfig(t){return void 0===t&&(t=!0),this.effectPropertiesConfig=t,this}setViewport(t){return void 0===t&&(t=le(this.scene,this.scene.cameras.main)),this.viewport=t,this}setSymbols(t){return this.symbols=t,this}get isEmpty(){return Xs(this.bobs)&&0===this.removedGOs.length}}Object.assign(gr.prototype,e,ur);var vr={getLayer(t){return this.getGO(t)},getLayers(t){return void 0===t&&(t=[]),this.forEachGO((function(e){t.push(e)})),Si(t,!1),t},addToLayer(t,e){var i=this.getGO(t);if(i){Array.isArray(e)||(e=[e]);for(var s=0,r=e.length;s=0;e--)this.remove(this.backgroundChildren[e],t);return this}};const Sn=Phaser.Utils.Objects.GetValue;var On=function(t,e){return void 0===e?t:t[e]},kn=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Sn(e,"left",0),t.right=Sn(e,"right",0),t.top=Sn(e,"top",0),t.bottom=Sn(e,"bottom",0)),t},Pn={getInnerPadding(t){return On(this.space,t)},setInnerPadding(t,e){return kn(this.space,t,e),this},getOuterPadding(t){return On(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return kn(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),On(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),kn(this.getSizerConfig(t).padding,e,i),this}},Tn=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},_n=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Mn=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},En=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Rn=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},Ln=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Dn={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},An=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var Ga={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,n){var a=r(t);return a.time.delayedCall(e,(function(){a.game.events.once("poststep",(function(){i.call(s,n)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Ha={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=Rr),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=Rr),this.transitOutCallback=t,this}},Ua={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Na={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},$a={};Object.assign($a,Ga,Ha,Ua,Na);const Ka=Phaser.Utils.Objects.GetValue;class Za extends l{constructor(t,e){super(t,e),this.setTransitInTime(Ka(e,"duration.in",200)),this.setTransitOutTime(Ka(e,"duration.out",200)),this.setTransitInCallback(Ka(e,"transitIn")),this.setTransitOutCallback(Ka(e,"transitOut")),this.oneShotMode=Ka(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Va(this,{eventEmitter:!1,initState:Ka(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Za.prototype,$a);const Ja=Phaser.Utils.Objects.GetValue;class qa extends l{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Ja(t,"hitAreaMode",0)),this.setEnable(Ja(t,"enable",!0)),this.setStopMode(Ja(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Qa[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Qa={default:0,fullWindow:1};const to=Phaser.Utils.Objects.GetValue;class eo extends js{constructor(t,e){super(t,to(e,"color",0),to(e,"alpha",.8)),this.touchEventStop=new qa(this,{hitAreaMode:1})}}var io={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Kn(t,e)},scaleDown(t,e){Zn(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,ha(t,e)},fadeOut(t,e){la(t,e,!1)}},so=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,ha(t,e,t.alpha)},ro=function(t,e){la(t,e,!1)};const no=Phaser.Utils.Objects.GetValue;let ao=class extends Za{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=oo.popUp),null==e.transitOut&&(e.transitOut=oo.scaleDown),e.destroy=no(e,"destroy",!0),super(t,e);var i=no(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new eo(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(no(i,"transitIn",so)),this.setCoverTransitOutCallback(no(i,"transitOut",ro)));var s=no(e,"touchOutsideClose",!1),r=no(e,"duration.hold",-1),n=no(e,"timeOutClose",r>=0),a=no(e,"anyTouchClose",!1);no(e,"manualClose",!1)&&(s=!1,a=!1,n=!1),a&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),a?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),no(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&_(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=oo[t]),t){case oo.popUp:t=io.popUp;break;case oo.fadeIn:t=io.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=oo[t]),t){case oo.scaleDown:t=io.scaleDown;break;case oo.fadeOut:t=io.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const oo={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var ho={modal(t,e){return ws(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new ao(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},lo=function(t,e,i,s,r){ws(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},co={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return lo.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return lo.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return lo.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return lo.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return lo.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return lo.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return lo.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return lo.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return lo.call(this,"shutdown",t,e,i,s),this}},uo=function(t){return"[object Array]"===Object.prototype.toString.call(t)},po=function(t,e,i,s,r){return _(t,e,i,vo(s),r)},go=function(t){return!(t.rexSizer&&t.rexSizer.hidden)},vo=function(t){return t?function(e,i,s){return!!go(e)&&(t(e,i,s),!0)}:go},fo={},mo=function(t){var e,i;this.sizerEventsEnable&&(e=t,void 0===(i=this.getChildPrevState(t))?i={}:!0===i&&(i=fo),i.x=e.x,i.y=e.y,i.scaleX=e.scaleX,i.scaleY=e.scaleY,i.width=e.width,i.height=e.height,i.displayWidth=e.displayWidth,i.displayHeight=e.displayHeight,this.layoutedChildren.push(t))},yo=function(t,e,i,s,r,n,a,o){void 0===a&&(a=0),void 0===o&&(o=0),en(t,e,i,s,r,n),t.x+=a,t.y+=o,this.resetChildPositionState(t),this.sizerEventsEnable&&t.emit("sizer.postlayout",t,this)};const bo=Phaser.Display.Align.CENTER,xo=Phaser.Utils.Objects.IsPlainObject,Co=Phaser.Utils.Objects.GetValue;class wo extends l{constructor(t,e){super(t,e),this._enable=void 0,t.setInteractive(Co(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.isDown=!1,this.isOver=!1,this.setEnable(Co(t,"enable",!0)),this.setMode(Co(t,"mode",1)),this.setClickInterval(Co(t,"clickInterval",100)),this.setDragThreshold(Co(t,"threshold",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPress,this),t.on("pointerup",this.onRelease,this),t.on("pointerout",this.onPointOut,this),t.on("pointermove",this.onMove,this),t.on("pointerover",this.onOver,this),t.on("pointerout",this.onOut,this)}shutdown(t){this.isShutdown||(this.pointer=null,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=So[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}onPress(t,e,i,s){void 0===this.pointer&&(this.pointer=t,this.isDown=!0,this.emit("down",this,this.parent,t,s),0===this.mode&&this.click(t.downTime,t,s))}onRelease(t,e,i,s){this.pointer===t&&(this.isDown=!1,this.emit("up",this,this.parent,t,s),1===this.mode&&this.click(t.upTime,t,s),this.pointer=void 0)}onPointOut(t,e){this.pointer===t&&this.cancel()}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&t.getDistance()>=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const So={press:0,pointerdown:0,release:1,pointerup:1};var Oo={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new wo(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},ko=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!Po(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,a=n.pointersTotal,o=n.pointers,h=0;h0)return To.length=0,!0;return To.length=0,!1},To=[];const _o=Phaser.Utils.Objects.GetValue;class Mo extends l{constructor(t,e){super(t,e),this._enable=void 0;var i=_o(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(_o(t,"enable",!0)),this.setMode(_o(t,"mode",1)),this.setClickInterval(_o(t,"clickInterval",100)),this.setDragThreshold(_o(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Eo[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?ko:R)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Eo={press:0,pointerdown:0,release:1,pointerup:1};var Ro={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Mo(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Lo extends N{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Do=Phaser.Utils.Objects.GetValue;class Ao extends l{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Lo,this.parent.setInteractive(Do(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Do(t,"enable",!0)),this.setCooldown(Do(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Bo={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&R(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Ao(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Ao(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},jo={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Wo=function(t,e,i,s){if("parent"===t){for(var r,n=0,a=e.length;n(i=0===this.orientation?Math.abs(h.left-t):Math.abs(h.top-e))&&(n=i,r=a)}return h=s[s.length-1],n>(i=0===this.orientation?Math.abs(h.right-t):Math.abs(h.bottom-e))&&(n=i,r=a+1),r};const gh=Phaser.Utils.Objects.IsPlainObject,vh=Phaser.Utils.Objects.GetValue,fh=Phaser.Display.Align.CENTER,mh={min:0,full:-1};var yh=function(t,e,i,s,r,n,a,o,h,l){var d,c,u,v;un.call(this,t);var f=t.isRexSpace,m=typeof e;if(null===e)return this;if("number"===m);else if("string"===m)e=mh[e];else if(gh(e)){var y;e=vh(y=e,"proportion",void 0),i=vh(y,"align",fh),s=vh(y,"padding",0),r=vh(y,"expand",!1),n=vh(y,"key",void 0),a=vh(y,"index",void 0),t.isRexSizer||(o=vh(y,"minWidth",void 0),h=vh(y,"minHeight",void 0)),l=vh(y,"fitRatio",0),d=vh(y,"offsetX",0),c=vh(y,"offsetY",0),u=vh(y,"offsetOriginX",0),v=vh(y,"offsetOriginY",0)}return"string"==typeof i&&(i=Er[i]),void 0===e&&(e=f?1:0),void 0===i&&(i=fh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===o&&(f?o=0:t.isRexSizer||(o=t._minWidth)),void 0===h&&(f?h=0:t.isRexSizer||(h=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=p(t)/g(t)),void 0===d&&(d=0),void 0===c&&(c=0),void 0===u&&(u=0),void 0===v&&(v=0),(y=this.getSizerConfig(t)).proportion=e,y.align=i,y.padding=dn(s),y.expand=r,y.fitRatio=0===e?l:0,y.alignOffsetX=d,y.alignOffsetY=c,y.alignOffsetOriginX=u,y.alignOffsetOriginY=v,void 0===a||a>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(a,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===o?p(t):o:t.minHeight=void 0===h?g(t):h),r&&(0===this.orientation?t.minHeight=h:t.minWidth=o)),void 0!==n&&this.addChildrenMap(n,t),this},bh={add:yh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),yh.call(this,new uh(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,o){return gh(i)&&(i.index=t),yh.call(this,e,i,s,r,n,a,t,o),this},insertAtPosition(t,e,i,s,r,n,a,o,h){var l=ph.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,o,h),this}};const xh=ss.prototype.clear;var Ch=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),xh.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,Ch.call(this,t),this}},Oh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=Er[e]),this.getSizerConfig(t).align=e,this}},kh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},Ph={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},Th={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},_h={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,o=this.sizerChildren,h=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=o.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?h=!0:n=0)):n=0,h||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,a+=n)));else for(d=0,c=o.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?h=!0:n=0)):n=0,h||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,a+=n)))}return h?void 0:a+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,a=s.padding;i=n-(a.left+a.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,a=s.padding;i=n-(a.top+a.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Wn(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,An.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,o,h,l,d,c,u=this.sizerChildren,v=this.innerLeft,f=this.innerTop,m=this.innerWidth,y=this.innerHeight,b=v,x=f,C=this.startChildIndex,w=0,S=u.length;w0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=En.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||_n.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&dh.call(this,t,void 0),Mn.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Rn.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&dh.call(this,void 0,t),Ln.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],a=n&&n.isRexSpace;return"center"===t?a||this.insertSpace(r+1):a&&this.remove(n,!0),this}};Object.assign(_h,bh,Sh,Oh,kh,Ph,Th);var Mh=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},Eh={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},Rh=function(t){return"string"==typeof t&&(t=Eh[t]),t};const Lh=Phaser.Utils.Objects.IsPlainObject,Dh=Phaser.Utils.Objects.GetValue;class Ah extends oh{constructor(t,e,i,s,r,n,a){Lh(e)?(e=Dh(a=e,"x",0),i=Dh(a,"y",0),s=Dh(a,"width",void 0),r=Dh(a,"height",void 0),n=Dh(a,"orientation",0)):Lh(s)?(s=Dh(a=s,"width",void 0),r=Dh(a,"height",void 0),n=Dh(a,"orientation",0)):Lh(n)&&(n=Dh(a=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,a),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Dh(a,"space.item",0)),this.setStartChildIndex(Dh(a,"startChildIndex",0)),this.setRTL(Dh(a,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=Rh(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=Mh.call(this)),this._childrenProportion}}Object.assign(Ah.prototype,_h);var Bh=function(t,e,i,s){return e/t<=i?e/(s-1):0},jh=function(t){var e,i,s,r,n,a={lines:[],width:0,height:0},o=this.sizerChildren,h=0,l=a.lines,d=void 0;if(0===this.orientation){for(var c=0,u=o.length;co.height/2)){r>(h=Wh(o.left,o.centerY,t,e))&&(r=h,s=n);var h,l=i[n+1];l&&l.y===o.y||r>(h=Wh(o.right,o.centerY,t,e))&&(r=h,s=n+1)}}return s};const Yh=Phaser.Utils.Objects.IsPlainObject,Ih=Phaser.Utils.Objects.GetValue,Xh=Phaser.Display.Align.CENTER;var Fh=function(t,e,i,s){return"\n"===t?(this.addNewLine(),this):(un.call(this,t),Yh(e)&&(e=Ih(h=e,"padding",0),i=Ih(h,"key",void 0),s=Ih(h,"index",void 0),r=Ih(h,"offsetX",0),n=Ih(h,"offsetY",0),a=Ih(h,"offsetOriginX",0),o=Ih(h,"offsetOriginY",0)),void 0===e&&(e=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=0),void 0===o&&(o=0),(h=this.getSizerConfig(t)).align=Xh,h.padding=dn(e),h.alignOffsetX=r,h.alignOffsetY=n,h.alignOffsetOriginX=a,h.alignOffsetOriginY=o,void 0===s||s>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(s,0,t),void 0!==i&&this.addChildrenMap(i,t),this);var r,n,a,o,h},Vh={add(t,e,i){if(uo(t))for(var s=t,r=0,n=s.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,Ch.call(this,t),this}},Uh={getChildrenWidth:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=0===this.orientation&&t?this.maxChildWidth:this.rexSizer.resolved?this.wrapResult.width:void 0)?e+(this.space.left+this.space.right)*this.scaleX:void 0);var e},getChildrenHeight:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=1===this.orientation&&t?this.maxChildHeight:this.rexSizer.resolved?this.wrapResult.height:void 0)?e+(this.space.top+this.space.bottom)*this.scaleY:void 0);var e},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&r.push(h.join("")),r},Ol=0,kl=1,Pl=2,Tl=0,_l=1,Ml=2,El=/(?:\r\n|\r|\n)/;const Rl={none:Tl,word:_l,char:Ml,character:Ml,mix:3},Ll=Phaser.Renderer.WebGL.Utils;var Dl={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,a=r.height,o=Ll.getTintAppendFloatAlpha,h=t.pipelines.set(e.pipeline,e),l=h.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),h.batchTexture(e,r.glTexture,n,a,e.x,e.y,n/e.resolution,a/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,a,o(e.tintTopLeft,i.alpha*e._alphaTL),o(e.tintTopRight,i.alpha*e._alphaTR),o(e.tintBottomLeft,i.alpha*e._alphaBL),o(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const Al=Phaser.Display.Color;var Bl={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,a,o,h,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===a&&(a=0),void 0===o&&(o=0),void 0===h&&(h=c),void 0===l&&(l=u);var p=d.cutX+a,g=d.cutY+o;return this.context.drawImage(d.source.image,p,g,h,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new Al);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var a=i;i=a.red,s=a.green,r=a.blue,n=a.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var o=this.context.createImageData(1,1);return o.data[0]=i,o.data[1]=s,o.data[2]=r,o.data[3]=n,this.context.putImageData(o,t,e),this.dirty=!0,this}},jl=function(t,e,i,s,r,n,a){var o,h=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===a&&(a=e.height);var d=(o=h.exists(i)?h.get(i):h.createCanvas(i,n,a)).getSourceImage();d.width!==n&&(d.width=n),d.height!==a&&(d.height=a);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,a),c.drawImage(e,s,r,n,a),l.gl&&o&&l.canvasToTexture(d,o.source[0].glTexture,!0,0)},Wl={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,jl(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};Ve();const zl=Phaser.Display.Canvas.CanvasPool,Yl=Phaser.GameObjects.GameObject,Il=Phaser.Utils.String.UUID;let Xl=class extends Yl{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=zl.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=Il(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){zl.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}};const Fl=Phaser.GameObjects.Components;Phaser.Class.mixin(Xl,[Fl.Alpha,Fl.BlendMode,Fl.Crop,Fl.Depth,Fl.Flip,Fl.GetBounds,Fl.Mask,Fl.Origin,Fl.Pipeline,Fl.PostPipeline,Fl.ScrollFactor,Fl.Tint,Fl.Transform,Fl.Visible,Dl,Bl,Wl]);var Vl={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:F(this.data,t,e)},incData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)+e),this},mulData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)*e),this},clearData(){return this.data&&wt(this.data),this}};class Gl{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}}Object.assign(Gl.prototype,Vl);var Hl={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const Ul=Phaser.Math.RotateAround;var Nl;const $l=Phaser.Geom.Rectangle;var Kl,Zl=function(t){void 0===Kl&&(Kl=new $l);var e=t.drawTLX,i=t.drawTLY;return Kl.setTo(e,i,t.drawTRX-e,t.drawBLY-i),Kl};const Jl=Phaser.Math.RotateAround;var ql,Ql=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===ql&&(ql={}),s=ql),s.x=e,s.y=i,0!==t.rotation&&Jl(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const td=Phaser.GameObjects.Components.TransformMatrix;var ed,id,sd={},rd=function(t,e,i,s,r){var n=Ql(e,i,s,!0),a=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=sd);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===ed&&(ed=new td,id=new td),t.parentContainer?t.getWorldTransformMatrix(ed,id):ed.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),ed.transformPoint(r,n,s),s}(t,n.x,n.y,r);return a},nd=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,a=e.drawCenterY+s;return rd(t,e,n,a,r)},ad={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Nl&&(Nl={}),s=Nl),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&Ul(s,0,0,-i.rotation),s}(t,e,this,!0);return Zl(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return nd(this.parent,this,t,e,i)}};Object.assign(ad,Hl);const od=Phaser.Math.DegToRad,hd=Phaser.Math.RadToDeg,ld=Phaser.Utils.Objects.GetValue;class dd extends Gl{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return hd(this._rotation)}set angle(t){this.rotation=od(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=ld(t,"width",void 0),i=ld(t,"height",void 0),s=ld(t,"scaleX",void 0),r=ld(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(dd.prototype,ad);const cd=Phaser.Utils.String.Pad;var ud=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${cd(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},pd=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const gd=Phaser.Utils.Objects.GetValue;let vd=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=gd(t,"x",0),i=gd(t,"y",0));var s=this.cornerRadius;s.tl=fd(gd(t,"tl",void 0),e,i),s.tr=fd(gd(t,"tr",void 0),e,i),s.bl=fd(gd(t,"bl",void 0),e,i),s.br=fd(gd(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){md(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){md(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){md(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){md(this.cornerRadius.br,t)}};var fd=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),yd(t),t},md=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=gd(e,"x",0),t.y=gd(e,"y",0)),yd(t)},yd=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const bd=Phaser.Math.DegToRad;var xd=function(t){return!t.hasOwnProperty("convex")||t.convex},Cd=function(t){return t.x>0&&t.y>0},wd=function(t,e,i,s,r,n,a,o,h){if(o&&a>n?a-=360:!o&&a=p?1:s/p,f=r>=g?1:r/g,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),o=m.tl,Cd(o)?(h=o.x*v,l=o.y*f,xd(o)?wd(t,h,l,h,l,180,270,!1,a):wd(t,0,0,h,l,90,0,!0,a),d=0,c=l):(t.lineTo(0,0),d=0,c=0),o=m.tr,Cd(o)?(h=o.x*v,l=o.y*f,xd(o)?wd(t,s-h,l,h,l,270,360,!1,a):wd(t,s,0,h,l,180,90,!0,a)):t.lineTo(s,0),o=m.br,Cd(o)?(h=o.x*v,l=o.y*f,xd(o)?wd(t,s-h,r-l,h,l,0,90,!1,a):wd(t,s,r,h,l,270,180,!0,a)):t.lineTo(s,r),o=m.bl,Cd(o)?(h=o.x*v,l=o.y*f,xd(o)?wd(t,h,r-l,h,l,90,180,!1,a):wd(t,0,r,h,l,360,270,!0,a)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,a,u),null!=o)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,o),p.addColorStop(1,d),o=p),e.fillStyle=o,e.fill());null!=h&&l>0&&(e.strokeStyle=h,e.lineWidth=l,e.stroke())},Od=function(t,e,i,s,r,n,a,o){if(null!=e||null!=i){var h=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;h=Math.max(1,h-s),l=Math.max(1,l-s),Sd(t.canvas,t.context,d,d,h,l,r,e,i,s,n,a,o)}};const kd=Phaser.Utils.Objects.GetValue;class Pd extends dd{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(kd(e,"color",null),kd(e,"color2",null),kd(e,"horizontalGradient",!0)),this.setStroke(kd(e,"stroke",null),kd(e,"strokeThickness",2)),this.setCornerRadius(kd(e,"cornerRadius",0),kd(e,"cornerIteration",null))}set color(t){t=ud(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=ud(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=ud(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,pd("color2",t,this),pd("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,pd("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,pd("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){Od(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Td=Phaser.Utils.Objects.GetValue;class _d extends dd{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(Td(e,"color",null),Td(e,"color2",null),Td(e,"horizontalGradient",!0)),this.setStroke(Td(e,"stroke",null),Td(e,"strokeThickness",2))}set color(t){t=ud(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=ud(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=ud(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,Td(t,"color2",null),Td(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Td(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,a=this.parent.height-i.top-i.bottom,o=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?o.createLinearGradient(0,0,n,0):o.createLinearGradient(0,0,0,a)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,o.fillStyle=t,o.fillRect(s,r,n,a));null!=this.stroke&&this.strokeThickness>0&&(o.strokeStyle=this.stroke,o.lineWidth=this.strokeThickness,o.strokeRect(s,r,n,a))}}const Md=Phaser.Utils.Objects.GetValue;let Ed=class t{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(Md(t,"bold",!1)),this.setItalic(Md(t,"italic",!1)),this.setFontSize(Md(t,"fontSize","16px")),this.setFontFamily(Md(t,"fontFamily","Courier")),this.setColor(Md(t,"color","#fff")),this.setStrokeStyle(Md(t,"stroke",null),Md(t,"strokeThickness",0)),this.setShadow(Md(t,"shadowColor",null),Md(t,"shadowOffsetX",0),Md(t,"shadowOffsetY",0),Md(t,"shadowBlur",0)),this.setOffset(Md(t,"offsetX",0),Md(t,"offsetY",0)),this.setSpace(Md(t,"leftSpace",0),Md(t,"rightSpace",0)),this.setAlign(Md(t,"align",void 0)),this.setBackgroundColor(Md(t,"backgroundColor",null)),this.setBackgroundHeight(Md(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Md(t,"backgroundBottomY",void 0)),this.setBackgroundLeftX(Md(t,"backgroundLeftX",0)),this.setBackgroundRightX(Md(t,"backgroundRightX",0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(pd("stroke",t,this),pd("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(pd("shadowOffsetX",t,this),pd("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),t.hasOwnProperty("backgroundLeftX")&&this.setBackgroundLeftX(t.backgroundLeftX),t.hasOwnProperty("backgroundRightX")&&this.setBackgroundRightX(t.backgroundRightX),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new t(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=ud(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=ud(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=ud(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=ud(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setBackgroundLeftX(t){return this.backgroundLeftX=t,this}setBackgroundRightX(t){return this.backgroundRightX=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}};const Rd=Phaser.Utils.Array.Remove,Ld=Phaser.Utils.Array.Remove,Dd="text",Ad="image",Bd="drawer",jd="space",Wd="command";var zd=function(t){return t.type===Dd&&"\n"===t.text},Yd=function(t){return t.type===Dd&&"\f"===t.text},Id=function(t){return t.type===Dd};class Xd extends dd{constructor(t,e,i){super(t,Dd),this.updateTextFlag=!1,this.style=new Ed(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX+e.backgroundLeftX,s=i,r=this.drawTRX+e.backgroundRightX-i+1;if(r>0){var n=e.backgroundBottomY;null==n&&(n=this.drawBLY);var a=e.backgroundHeight;null==a&&(a=n-this.drawTLY);var o=n-a;t.fillRect(s,o,r,a)}}var h=e.hasFill,l=e.hasStroke;(h||l)&&(e.syncFont(t).syncStyle(t),l&&(e.syncShadow(t),t.strokeText(this.text,0,0)),h&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var Fd=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const Vd=Phaser.Display.Canvas.CanvasPool;var Gd=function(t,e,i,s,r,n,a,o){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===o&&(o=!1),o&&(i=Math.round(i),s=Math.round(s));var h=e.getContext("2d",{willReadFrequently:!0});if(a){var l=Vd.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=a,d.fillRect(0,0,r,n),h.drawImage(l,0,0,r,n,i,s,r,n),Vd.remove(l)}else h.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)};Phaser.Display.Canvas.CanvasPool;class Hd extends dd{constructor(t,e,i){super(t,Ad),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){Gd(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class Ud extends dd{constructor(t,e,i,s){super(t,Bd),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class Nd extends dd{constructor(t,e){super(t,jd),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class $d extends Gl{constructor(t,e,i,s,r){super(t,Wd),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}var Kd=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const Zd={none:0,word:1,char:2,character:2,mix:3};var Jd=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,a=!r&&!n,o=t.length,h=e,l=s.word,d=0,c=!1;h0&&!o){var h=this.fixedHeight-s;i>0?n=h/i:(n=(l=ec.call(this)).height,a=l.ascent,i=Math.floor((h-a)/n))}else{var l;n=(l=ec.call(this)).height,a=l.ascent}}else this.fixedHeight>0?void 0===(i=sc(t,"maxLines"))&&(h=this.fixedHeight-s,i=Math.floor(h/n)):i=sc(t,"maxLines",0);void 0===a&&(a=n);var d=0===i,c=sc(t,"wrapMode");void 0===c&&(c=sc(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=Zd[c]);var u=sc(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=sc(t,"letterSpacing",0),g=sc(t,"hAlign",0),v=sc(t,"vAlign",0),f=sc(t,"justifyPercentage",.25),m=Kd({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:g,vAlign:v,justifyPercentage:f,ascent:a,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,b=0,x=y.length;b0&&(M.push({children:E,width:R}),L=Math.max(L,R)),m.start+=_.length,m.isLastPage=!D&&m.start===T,m.maxLineWidth=L,m.linesHeight=M.length*n;var I=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,X=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,a=t.vAlign,o=t.justifyPercentage,h=t.lines,l=0,d=h.length;l0?(a=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=ac(t,"maxLines",void 0))){var a=this.fixedWidth-r;i=Math.floor(a/n)+1}}else i=ac(t,"maxLines",0);var o=0===i,h=ac(t,"fixedCharacterHeight",void 0);if(void 0===h){var l=ac(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;h=Math.floor(d/l)}}var c=ac(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=ac(t,"letterSpacing",0),p=ac(t,"rtl",!0),g=ac(t,"hAlign",p?2:0),v=ac(t,"vAlign",0),f=Kd({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:g,vAlign:v,lineWidth:n,fixedCharacterHeight:h,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(_.push({children:M,height:E}),R=Math.max(R,E)),f.start+=T.length,f.isLastPage=f.start===P,f.maxLineHeight=R,f.linesWidth=_.length*n;var W=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,z=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,a=t.vAlign,o=t.rtl,h=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}o&&(s+=l);for(var c=0,u=h.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,a=i.bottom;return kn(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||a!=i.bottom,this},getPadding:function(t){return On(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),Rd(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return Ld(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(Dd);return null===i?i=new Xd(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),nd(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const Rc=Phaser.Utils.Objects.GetFastValue;var Lc={};class Dc{constructor(t){this.pools=Rc(t,"pools",Lc)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new Ec),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;ei&&(r=Math.floor(i));for(var n={},a=Xc(t,r,e,i,n),o=0;o<=zc&&0!==a;o++){if((r+=a)<0){r=0;break}a=Xc(t,r,e,i,n)}return o===zc&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),Fc(t,e,i),t},Ic=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},Xc=function(t,e,i,s,r){var n,a=Ic(t,e,r),o=Ic(t,e+1,r);if(void 0!==s)if(a.height<=s&&o.height>s)n=0;else{if(a.height>s)return-1;n=Math.floor(s-a.height)}if(a.width<=i&&o.width>i)return 0;if(a.width>i)return-1;var h=Math.floor(i-a.width);return void 0===n?h:Math.min(h,n)},Fc=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const Vc=Phaser.Utils.Objects.GetValue,Gc=Phaser.Utils.Objects.GetValue;class Hc extends rl{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=Gc(e,"background",void 0),r=Gc(e,"icon",void 0),n=Gc(e,"iconMask",void 0),a=Gc(e,"text",void 0),o=Gc(e,"action",void 0),h=Gc(e,"actionMask",void 0),l=Gc(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(a||o)&&(i={right:Gc(e,"space.icon",0),top:Gc(e,"space.iconTop",0),bottom:Gc(e,"space.iconBottom",0),left:Gc(e,"space.iconLeft",0)}):(a||o)&&(i={bottom:Gc(e,"space.icon",0),left:Gc(e,"space.iconLeft",0),right:Gc(e,"space.iconRight",0),top:Gc(e,"space.iconTop",0)});var d=Gc(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=gl.call(this,r,r,1)),!d){var c=Gc(e,"iconSize",void 0);this.setIconSize(Gc(e,"iconWidth",c),Gc(e,"iconHeight",c))}}if(a){var u=Gc(e,"wrapText",!1),p=Gc(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),function(t,e){switch(bl(t)){case 0:switch("string"==typeof e&&(e=Rl[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=wl;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Rl[e]||0),t.style.wrapMode=e}}(a,u),e.expandTextWidth=!0,Wc(a)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=Vc(e,"minWidth",0),s=Vc(e,"minHeight",0),r=Vc(e,"fitHeight",!1);t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return Yc(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),Yc(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t})}(a,{fitHeight:!0}));var g,v,f=Gc(e,"space.text",0),m=Gc(e,"expandTextWidth",!1),y=Gc(e,"expandTextHeight",!1);0===this.orientation?(g=m?1:0,o&&(i={right:f}),v=y):(g=y?1:0,o&&(i={bottom:f}),v=m),this.add(a,{proportion:g,expand:v,padding:i})}if(o&&(i=0===this.orientation?{top:Gc(e,"space.actionTop",0),bottom:Gc(e,"space.actionBottom",0),right:Gc(e,"space.actionRight",0)}:{left:Gc(e,"space.actionLeft",0),right:Gc(e,"space.actionRight",0),bottom:Gc(e,"space.actionBottom",0)},d=Gc(e,"squareFitAction",!1)?1:0,this.add(o,{proportion:0,padding:i,fitRatio:d}),h&&(h=gl.call(this,o,o,1)),!d)){var b=Gc(e,"actionSize");this.setActionSize(Gc(e,"actionWidth",b),Gc(e,"actionHeight",b))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",a),this.addChildrenMap("action",o),this.addChildrenMap("actionMask",h)}}var Uc=Phaser.Renderer.WebGL.Utils,Nc=function(t,e,i,s,r,n){for(var a=Uc.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),o=i.pathData,h=i.pathIndexes,l=0;l>>16,o=(65280&r)>>>8,h=255&r;t.fillStyle="rgba("+a+","+o+","+h+","+n+")"},qc=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,a=(16711680&r)>>>16,o=(65280&r)>>>8,h=255&r;t.strokeStyle="rgba("+a+","+o+","+h+","+n+")",t.lineWidth=e.lineWidth};const Qc=Phaser.Renderer.Canvas.SetTransform;var tu={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Zc(e,i,s),a=r.calcMatrix.copyFrom(n.calc),o=e._displayOriginX,h=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&Nc(r,a,e,l,o,h),e.isStroked&&Kc(r,e,l,o,h),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(Qc(t,r,e,i,s)){var n=e._displayOriginX,a=e._displayOriginY,o=e.pathData,h=o.length-1,l=o[0]-n,d=o[1]-a;r.beginPath(),r.moveTo(l,d),e.closePath||(h-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(iu.prototype,tu);var su=function(t){return t.x>0&&t.y>0},ru=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const nu=Phaser.Math.DegToRad;var au=function(t,e,i,s,r,n,a,o,h){a&&n>r?n-=360:!a&&n0,a=0,o=e.length;a0;this.dirty=this.dirty||this._radiusTL!==t||this._convexTL!==e,this._convexTL=e,this._radiusTL=Math.abs(t)}get radiusTR(){return this._radiusTR}set radiusTR(t){var e=t>0;this.dirty=this.dirty||this._radiusTR!==t||this._convexTR!==e,this._convexTR=e,this._radiusTR=Math.abs(t)}get radiusBL(){return this._radiusBL}set radiusBL(t){var e=t>0;this.dirty=this.dirty||this._radiusBL!==t||this._convexBL!==e,this._convexBL=e,this._radiusBL=Math.abs(t)}get radiusBR(){return this._radiusBR}set radiusBR(t){var e=t>0;this.dirty=this.dirty||this._radiusBR!==t||this._convexBR!==e,this._convexBR=e,this._radiusBR=Math.abs(t)}get radius(){return Math.max(this.radiusTL,this.radiusTR,this.radiusBL,this.radiusBR)}set radius(t){"number"==typeof t?(this.radiusTL=t,this.radiusTR=t,this.radiusBL=t,this.radiusBR=t):(this.radiusTL=op(t,"tl",0),this.radiusTR=op(t,"tr",0),this.radiusBL=op(t,"bl",0),this.radiusBR=op(t,"br",0))}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}get iterations(){return this._iterations}set iterations(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t}setIterations(t){return this.iterations=t,this}updateData(){var t=this.pathData;t.length=0;var e,i=this.width,s=this.height,r=this.iterations+1;return(e=this.radiusTL)>0?this._convexTL?au(e,e,e,e,180,270,!1,r,t):au(0,0,e,e,90,0,!0,r,t):ru(0,0,t),(e=this.radiusTR)>0?this._convexTR?au(i-e,e,e,e,270,360,!1,r,t):au(i,0,e,e,180,90,!0,r,t):ru(i,0,t),(e=this.radiusBR)>0?this._convexBR?au(i-e,s-e,e,e,0,90,!1,r,t):au(i,s,e,e,270,180,!0,r,t):ru(i,s,t),(e=this.radiusBL)>0?this._convexBL?au(e,s-e,e,e,90,180,!1,r,t):au(0,s,e,e,360,270,!0,r,t):ru(0,s,t),t.push(t[0],t[1]),Hu(this.x,this.y,t),super.updateData(),this}}Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlpha;var lp=function(t,e,i,s,r,n){var a=(e+s)/2;return n>=0?t.startAt(a+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(a+n,i):t.startAt(a,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(a,i),t.close(),t};const dp=Phaser.Utils.Objects.GetValue,cp=Phaser.Utils.Objects.IsPlainObject;class up extends(Au(Pu)){constructor(t,e,i,s,r,n,a,o){cp(e)?(e=(o=e).x,i=o.y,s=o.width,r=o.height,n=o.barColor,a=o.value):cp(s)?(s=(o=s).width,r=o.height,n=o.barColor,a=o.value):cp(n)&&(n=(o=n).barColor,a=o.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===a&&(a=0),super(t,e,i,s,r,o),this.type="rexLineProgress",this.bootProgressBase(o),this.addShape((new ap).setName("trackFill")).addShape((new ap).setName("bar")).addShape((new ap).setName("trackStroke")),this.setTrackColor(dp(o,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(dp(o,"trackStrokeThickness",2),dp(o,"trackStrokeColor",void 0)),this.setSkewX(dp(o,"skewX",0)),this.setRTL(dp(o,"rtl",!1)),this.setValue(a)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var pp={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&lp(s,0,0,e,i,t);var r,n,a=this.getShape("bar");a.fillStyle(this.barColor),a.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),lp(a,r,0,n,i,t));var o=this.getShape("trackStroke");o.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),o.isStroked&&lp(o,0,0,e,i,t)}};Object.assign(up.prototype,pp);class gp extends up{constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("value")||(e.value=0),e.hasOwnProperty("hover.bar")||(e["hover.bar"]=!0),e.hasOwnProperty("easeDuration")||(e.easeDuration=200),e.hasOwnProperty("ease")||(e.ease="Quad"),Xe(e,"easeValue.duration",e.easeDuration),Xe(e,"easeValue.ease",e.ease),super(t,e),this.type="rexStatesBarRectangleShape",this.barState=!1,e.style=this,e.propertiesMap=vp,this.addStyleManager(e),delete e.style,delete e.propertiesMap}get bar(){return this.barState}set bar(t){t=!!t,this.barState!==t&&(this.barState=t,this.easeValueTo(this.barState?1:0))}}const vp={color:"trackColor",strokeColor:"trackStrokeColor",strokeWidth:"trackStrokeThickness"};Object.assign(gp.prototype,yu);let fp=class extends l{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Js(t,e))return t[e];var i=t.parent;return Js(i,e)?i[e]:void 0}set(t,e,i){return Js(t,e)?t[e]=i:Js(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.texture.key}set key(t){this.key!==t&&this.parent.setTexture(t,this.frame)}get frame(){return this.parent.frame.name}set frame(t){this.frame!==t&&this.parent.setFrame(t)}};const mp=Phaser.GameObjects.NineSlice,yp=Phaser.Utils.Objects.GetValue;class bp extends mp{constructor(t,e){void 0===e&&(e={}),super(t,yp(e,"x",0),yp(e,"y",0),yp(e,"key",null),yp(e,"frame",null),yp(e,"width",0),yp(e,"height",0),yp(e,"leftWidth",0),yp(e,"rightWidth",0),yp(e,"topHeight",0),yp(e,"bottomHeight",0)),this.type="rexStatesNineSlice";var i=yp(e,"effects",!0);i&&ir(this,i),this.style=new fp(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(bp.prototype,yu);let xp=class extends l{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Js(t,e))return t[e];var i=t.parent;return Js(i,e)?i[e]:void 0}set(t,e,i){return Js(t,e)?t[e]=i:Js(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.texture.key}set key(t){this.parent.setTexture(t,this.frame)}get frame(){return this.parent.frame.name}set frame(t){this.parent.setFrame(t)}get scale(){return this.parent.scaleX}set scale(t){this.parent.setScale(t)}};const Cp=Phaser.GameObjects.Image,wp=Phaser.Utils.Objects.GetValue;class Sp extends Cp{constructor(t,e){void 0===e&&(e={}),super(t,wp(e,"x",0),wp(e,"y",0),wp(e,"key",""),wp(e,"frame",void 0)),this.type="rexStatesImage";var i=wp(e,"effects",!0);i&&ir(this,i),this.style=new xp(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Sp.prototype,yu);var Op=function(t,e,i){return"__BASE"===i?`${t},${e}`:`${i}:${t},${e}`};const kp=Phaser.Utils.Objects.IsPlainObject,Pp=Phaser.Utils.Objects.GetValue;var Tp=function(t){return"string"==typeof t&&(t=_p[t]),t};const _p={scale:0,repeat:1};var Mp=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},Ep={_beginDraw:Rr,_drawImage:Rr,_drawTileSprite:Rr,_endDraw:Rr,setGetFrameNameCallback:function(t){return void 0===t&&(t=Op),this.getFrameNameCallback=t,this},setBaseTexture:function(t,e,i,s){Array.isArray(e)&&(s=i,i=e,e=void 0),null==e&&(e="__BASE"),"number"==typeof i&&arguments.length>=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=We(i),s=We(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),a=n.width,o=0,h=0,l=i.length;h0?a/o:0,c=n.height,u=0;for(h=0,l=s.length;h0?0:v,b=0,h=0;for(var S=i.length;h0?0:f),f>=1&&v>=1){var O=typeof(m=this.getFrameNameCallback(h,C,e));"string"!==O&&"number"!==O||r.add(m,0,b+n.cutX,x+n.cutY,f,v)}b+=f}x+=v}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,a,o,h=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-h,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/h,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var g=Math.min(u,p);if(u>g){var v=(u-g)*h;d>=0?d+=v:d=v,u=g}if(p>g){var f=(p-g)*l;c>=0?c+=f:c=f,p=g}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,x=this.rows.count;b0&&o>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(C,b)?0:1)?this._drawImage(this.textureKey,s,m,y,a,o):this._drawTileSprite(this.textureKey,s,m,y,a,o)),m+=a;y+=o}this._endDraw()},setStretchMode:function(t){return kp(t)?(this.stretchMode.edge=Tp(Pp(t,"edge",0)),this.stretchMode.internal=Tp(Pp(t,"internal",0))):(t=Tp(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Mp.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const Rp=Phaser.Utils.Objects.IsPlainObject,Lp=Phaser.Utils.Objects.GetValue,Dp=Phaser.GameObjects;var Ap=void 0,Bp=function(t,e){if(Ap||(Ap={},o(t).events.once("destroy",(function(){for(var t in Ap)Ap[t].destroy();Ap=void 0}))),!Ap.hasOwnProperty(e)){var i=o(t).scene.systemScene;(t=new Dp[e](i)).setOrigin(0),Ap[e]=t}return Ap[e]};const jp=Phaser.GameObjects.RenderTexture;class Wp extends(function(t,e){class i extends t{constructor(t,i,s,r,n,a,o,h,l,d){if(Rp(i)?(i=Lp(d=i,"x",0),s=Lp(d,"y",0),r=Lp(d,"width",1),n=Lp(d,"height",1),a=Lp(d,"key",void 0),o=Lp(d,"baseFrame",void 0),h=Lp(d,"columns",void 0),l=Lp(d,"rows",void 0)):Rp(r)?(r=Lp(d=r,"width",1),n=Lp(d,"height",1),a=Lp(d,"key",void 0),o=Lp(d,"baseFrame",void 0),h=Lp(d,"columns",void 0),l=Lp(d,"rows",void 0)):Rp(a)?(a=Lp(d=a,"key",void 0),o=Lp(d,"baseFrame",void 0),h=Lp(d,"columns",void 0),l=Lp(d,"rows",void 0)):Rp(o)?(o=Lp(d=o,"baseFrame",void 0),h=Lp(d,"columns",void 0),l=Lp(d,"rows",void 0)):Array.isArray(o)?(d=l,l=h,h=o,o=Lp(d,"baseFrame",void 0)):Rp(h)&&(h=Lp(d=h,"columns",void 0),l=Lp(d,"rows",void 0)),void 0===o&&(o=Lp(d,"frame",void 0)),void 0===h){var c=Lp(d,"leftWidth",void 0),u=Lp(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(h=[c,void 0,u])}if(void 0===l){var p=Lp(d,"topHeight",void 0),g=Lp(d,"bottomHeight",void 0);void 0!==p&&void 0!==g&&(l=[p,void 0,g])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(Lp(d,"getFrameNameCallback",void 0)),this.setStretchMode(Lp(d,"stretchMode",0)),this.setPreserveRatio(Lp(d,"preserveRatio",!0));var v=Lp(d,"maxFixedPartScale",1),f=Lp(d,"maxFixedPartScaleX",v),m=Lp(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(a,o,h,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,Ep),i}(jp,"rexNinePatch")){}var zp={_drawImage:function(t,e,i,s,r,n){var a=Bp(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(a,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var a=Bp(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(a,i,s)}};Object.assign(Wp.prototype,zp);let Yp=class extends l{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Js(t,e))return t[e];var i=t.parent;return Js(i,e)?i[e]:void 0}set(t,e,i){return Js(t,e)?t[e]=i:Js(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}};const Ip=Phaser.Utils.Objects.GetValue;class Xp extends Wp{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=Ip(e,"effects",!0);i&&ir(this,i),this.style=new Yp(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Xp.prototype,yu);const Fp=["alpha","tint","flipX","flipY"];var Vp=function(t,e){if(!e)return t;for(var i=0,s=Fp.length;i * @copyright 2018 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */const tg=Phaser.Display.Canvas.CanvasPool;var eg=function(t){var e=tg.create(this),i=e.getContext("2d",{willReadFrequently:!0});t.syncFont(e,i);var s=i.measureText(t.testString);if("actualBoundingBoxAscent"in s){var r=s.actualBoundingBoxAscent,n=s.actualBoundingBoxDescent,a={ascent:r,descent:n,fontSize:r+n};return tg.remove(e),a}var o=Math.ceil(s.width*t.baselineX),h=o,l=2*h;if(h=h*t.baselineY|0,e.width=o,e.height=l,i.fillStyle="#f00",i.fillRect(0,0,o,l),i.font=t._font,i.textBaseline="alphabetic",i.fillStyle="#000",i.fillText(t.testString,0,h),a={ascent:0,descent:0,fontSize:0},!i.getImageData(0,0,o,l))return a.ascent=h,a.descent=h+6,a.fontSize=a.ascent+a.descent,tg.remove(e),a;var d,c,u=i.getImageData(0,0,o,l).data,p=u.length,g=4*o,v=0,f=!1;for(d=0;dh;d--){for(c=0;c0&&this.wrapMode!==Tl&&0===this.wrapWidth}setStyle(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wordWrap")){var s=t.wordWrap;s.hasOwnProperty("width")&&(t.wrap={mode:"word",width:s.width})}if(t&&t.hasOwnProperty("wrap")){var r=t.wrap;if(r.hasOwnProperty("mode")){var n=r.mode;"string"==typeof n&&(r.mode=Rl[n])}else r.hasOwnProperty("width")&&(r.mode=1)}t&&t.rtl&&i&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var a=this.propertyMap;for(var o in a){var h=a[o],l=h[0],d=i?h[1]:this[o],c=h[2];if("wrapCallback"===o||"wrapCallbackScope"===o)this[o]=sg(t,l,d);else{var u=ig(t,l,d);c&&(u=c(u)),this[o]=u}}var p=sg(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var g=sg(t,"fill",null);null!==g&&(this.color=ud(g));var v=sg(t,"metrics",!1);return v?this.metrics={ascent:sg(v,"ascent",0),descent:sg(v,"descent",0),fontSize:sg(v,"fontSize",0)}:!e&&this.metrics||(this.metrics=eg(this)),e?this.parent.updateText():this.parent}syncFont(t,e){e.font=this._font}syncStyle(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"}syncShadow(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)}update(t){return t&&(this._font=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim(),this.metrics=eg(this)),this.parent.updateText(t)}buildFont(){var t=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim();return t!==this._font&&(this._font=t),this}setFont(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=sg(t,"fontFamily","Courier"),this.fontSize=sg(t,"fontSize","16px"),this.fontStyle=sg(t,"fontStyle","")),this.update(!0)}setFontFamily(t){return this.fontFamily=t,this.update(!0)}setFontStyle(t){return this.fontStyle=t,this.update(!0)}setFontSize(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}setTestString(t){return this.testString=t,this.update(!0)}setFixedSize(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}setResolution(t){return this.resolution=t,this.update(!1)}setXOffset(t){return this.xOffset=t,this.update(!1)}setBackgroundColor(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=ud(t,this.parent.canvas,this.parent.context),this.backgroundColor2=ud(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=ud(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}setBackgroundCornerRadius(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}setFill(t){return this.color=ud(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=ud(t,this.parent.canvas,this.parent.context),this.update(!1)}setStroke(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=ud(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}setShadow(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===n&&(n=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=ud(i,this.parent.canvas,this.parent.context),this.shadowBlur=s,this.shadowStroke=r,this.shadowFill=n,this.update(!1)}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}setShadowColor(t){return void 0===t&&(t="#000"),this.shadowColor=ud(t,this.parent.canvas,this.parent.context),this.update(!1)}setShadowBlur(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}setShadowStroke(t){return this.shadowStroke=t,this.update(!1)}setShadowFill(t){return this.shadowFill=t,this.update(!1)}setUnderline(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=ud(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}setUnderlineColor(t){return void 0===t&&(t="#000"),this.underlineColor=ud(t,this.parent.canvas,this.parent.context),this.update(!1)}setUnderlineThickness(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}setUnderlineOffset(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}setStrikethrough(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=ud(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}setStrikethroughColor(t){return void 0===t&&(t="#000"),this.strikethroughColor=ud(t,this.parent.canvas,this.parent.context),this.update(!1)}setStrikethroughThickness(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}setStrikethroughOffset(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}setWrapMode(t){return"string"==typeof t&&(t=Rl[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}setWrapWidth(t){return this.wrapWidth=t,this.update(!1)}setAlign(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}setHAlign(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}setVAlign(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}setMaxLines(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}getTextMetrics(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}setTextMetrics(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=sg(e,"fontFamily",this.fontFamily),this.fontSize=sg(e,"fontSize",this.fontSize),this.fontStyle=sg(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}get lineHeight(){return this.metrics.fontSize+this.parent.lineSpacing}toJSON(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}destroy(){this.parent=void 0}}var ng={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var a=this.defaultStyle;this.clear(),Od(this,a.backgroundColor,a.backgroundStrokeColor,a.backgroundStrokeLineWidth,a.backgroundCornerRadius,a.backgroundColor2,a.backgroundHorizontalGradient,a.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var o,h,l,d,c,u,p=a.halign,g=a.valign,v=a.lineHeight,f=r.lines,m=f.length,y=a.maxLines;y>0&&m>y?(h=y,l="center"===g?Math.floor((m-h)/2):"bottom"===g?m-h:0):(h=m,l=0),d=l+h;var b=this.rtl,x=b?this.parent.width:void 0;u="center"===g?Math.max((s-h*v)/2,0):"bottom"===g?Math.max(s-h*v-2,0):0,u+=e;for(var C=l;C0){var o=this.defaultStyle.metrics,h=i-o.ascent,l=o.fontSize;this.drawRectangle(e,h,t.width,l,a.bgcolor,a)}if(a.underlineThickness>0&&t.width>0){var d=i+a.underlineOffset-a.underlineThickness/2;this.drawLine(e,d,t.width,a.underlineThickness,a.underlineColor,a)}if(t.isTextPen&&(a.buildFont(),a.syncFont(r,n),a.syncStyle(r,n),this.drawText(e,i,t.text,a)),t.isImagePen&&this.drawImage(e,i,t.prop.img,t.prop.color,a),a.strikethroughThickness>0&&t.width>0&&(d=i+a.strikethroughOffset-a.strikethroughThickness/2,this.drawLine(e,d,t.width,a.strikethroughThickness,a.strikethroughColor,a)),n.restore(),t.hasAreaMarker&&t.width>0){var c,u=t.prop.area;if(u)c={key:u};else{var p=t.prop.url;c={key:`url:${p}`,url:p}}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,c)}},clear(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawRectangle(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;a.fillStyle=r,a.fillRect(t,e,i,s)},drawLine(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;n.syncShadow(a,n.shadowStroke);var o=a.lineCap;a.lineCap="butt",a.strokeStyle=r,a.lineWidth=s,a.beginPath(),a.moveTo(t,e),a.lineTo(t+i,e),a.stroke(),a.lineCap=o},drawText(t,e,i,s){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;s.stroke&&"none"!==s.stroke&&s.strokeThickness>0&&(s.syncShadow(r,s.shadowStroke),r.strokeText(i,t,e)),s.color&&"none"!==s.color&&(s.syncShadow(r,s.shadowFill),r.fillText(i,t,e))},drawImage(t,e,i,s,r){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,s,this.autoRound)}};const ag=Phaser.Utils.Objects.GetValue,og=Ol,hg=kl;class lg{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=ag(t,"text",""),this.x=ag(t,"x",0),this.y=ag(t,"y",0),this.width=ag(t,"width",0);var e=ag(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=ag(t,"newLineMode",0),this.startIndex=ag(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===hg&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==og&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===hg&&(t+=1),t}get endIndex(){return this.startIndex+this.rawTextLength}get lastX(){return this.x+this.width}get isTextPen(){return""!==this.text}get isImagePen(){return!!this.prop.img}get hasAreaMarker(){return!!this.prop.area||!!this.prop.url}}const dg=Phaser.Utils.Objects.GetFastValue,cg=Ol,ug=Pl;class pg{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=dg(t,"tagToText",Rr),this.tagToTextScope=dg(t,"tagToTextScope",void 0)}destroy(){this.clear(),this.tagToText=void 0,this.tagToTextScope=void 0}clear(){for(var t=0,e=this.lines.length;t=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}getLineEndIndex(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,s=!1;for(e=t;e>=0&&!(s=null!=(i=this.lines[e])&&i.length>0);e--);return s?i[i.length-1].endIndex:0}getLineWidth(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}getMaxLineWidth(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,s=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}getLineWidths(){for(var t=[],e=0,i=this.lines.length;e=t&&h<=e||(a=a.substring(t-o,e-o)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,a,l,d):c+=this.tagToText(a,l,d),d=l,!(h>=e)));u++);return c}get length(){return this.lines.length}set length(t){this.clear()}}var gg={};const vg=Phaser.Geom.Rectangle;var fg=new Ec;class mg{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&Rg(v)){""!==b?a.push(n.getLine(b,x,Og)):0===C&&r>0&&a.push(n.getLine("",0,Og)),a.push(...Mg(v,e,Tg,s,0,n));var S=a.pop();b=S.text,x=S.width,n.freeLine(S)," "===b&&(b="",x=0)}else(m=x+f)>h?(a.push(n.getLine(b,x,Og)),b=v,x=f,h=s):(b+=v,x=m),C===w-1&&a.push(n.getLine(b,x,l))}return a},Eg=function(t,e){var i;switch(e){case Pg:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==Dg&&i0&&t>e&&(t=e),t}get linesWidth(){return Math.ceil(this.penManager.getMaxLineWidth())}get linesHeight(){var t=this.displayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}get imageManager(){return this.parent.imageManager}get rtl(){return this.parent.style.rtl}newPenManager(){return new pg({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}get tmpPenManager(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}getPlainText(t,e,i){var s;if(null==t)s=this.penManager.plainText;else{var r=this.parser.splitText(t,1);s="";for(var n=0,a=r.length;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return Fv(this.sizerChildren,null),Ch.call(this,t),this}},Gv={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)Fv(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},$v={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,o=this.sizerChildren,h=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=En.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,Fv(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Fv(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},Zv=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const Jv=Phaser.Utils.Objects.IsPlainObject,qv=Phaser.Utils.Objects.GetValue;class Qv extends oh{constructor(t,e,i,s,r,n,a,o,h,l){Jv(e)?(e=qv(l=e,"x",0),i=qv(l,"y",0),s=qv(l,"width",void 0),r=qv(l,"height",void 0),n=qv(l,"column",l.col||0),a=qv(l,"row",0),o=qv(l,"columnProportions",0),h=qv(l,"rowProportions",0)):Jv(s)?(s=qv(l=s,"width",void 0),r=qv(l,"height",void 0),n=qv(l,"column",l.col||0),a=qv(l,"row",0),o=qv(l,"columnProportions",0),h=qv(l,"rowProportions",0)):Jv(n)?(n=qv(l=n,"column",l.col||0),a=qv(l,"row",0),o=qv(l,"columnProportions",0),h=qv(l,"rowProportions",0)):Jv(o)&&(o=qv(l=o,"columnProportions",0),h=qv(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(qv(l,"createCellContainerCallback")),this.setIndentLeft(qv(l,"space.indentLeftOdd",0),qv(l,"space.indentLeftEven",0)),this.setIndentTop(qv(l,"space.indentTopOdd",0),qv(l,"space.indentTopEven",0)),this.resetGrid(n,a,o,h,qv(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=Kv.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=Zv.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(Qv.prototype,$v);const tf=Phaser.Utils.Objects.GetValue,ef=Phaser.Math.Percent;var sf=function(t,e,i){var s;return t.y===e.y?s=ef(i.x,t.x,e.x):t.x===e.x&&(s=ef(i.y,t.y,e.y)),s},rf=function(t,e,i){var s,r;this.enable&&(nf.x=e,nf.y=i,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint()),this.value=sf(s,r,nf))},nf={},af=function(t,e,i){if(this.enable&&t.isDown){var s,r;of.x=t.worldX,of.y=t.worldY,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint());var n=sf(s,r,of);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-n)<.1?this.value=n:this.easeValueTo(n)}},of={},hf=function(t,e){void 0===e&&(e=lf);var i=this.childrenMap.thumb,s=i.x,r=i.y;return en(i,this.innerLeft,this.innerTop,this.innerWidth,this.innerHeight,t),e.x=i.x,e.y=i.y,i.x=s,i.y=r,e},lf={};const df=Phaser.Display.Align.LEFT_CENTER,cf=Phaser.Display.Align.TOP_CENTER;var uf={};const pf=Phaser.Display.Align.RIGHT_CENTER,gf=Phaser.Display.Align.BOTTOM_CENTER;var vf={};const ff=Phaser.Math.Linear;var mf={};const yf=Phaser.Display.Align.LEFT_CENTER,bf=Phaser.Display.Align.TOP_CENTER,xf=Phaser.Display.Align.RIGHT_CENTER,Cf=Phaser.Display.Align.BOTTOM_CENTER,wf=Phaser.Utils.Objects.GetValue,Sf=Phaser.Utils.Objects.IsPlainObject,Of=Phaser.Math.Clamp,kf=Phaser.Math.Snap.To;class Pf extends(Au(Ah)){constructor(t,e){super(t,e),this.type="rexSlider",this.bootProgressBase(e),this.reverseAxis=wf(e,"reverseAxis",!1);var i=wf(e,"background",void 0),s=wf(e,"track",void 0),r=wf(e,"indicator",void 0),n=wf(e,"thumb",void 0);if(i&&(Sf(i)&&(i=Vp(t,i)),this.addBackground(i)),s&&(Sf(s)&&(s=Vp(t,s)),this.add(s,{proportion:1,expand:!0,minWidth:0===this.orientation?0:void 0,minHeight:1===this.orientation?0:void 0})),r&&(Sf(r)&&(r=Vp(t,r)),this.pin(r)),n){Sf(n)&&(n=Vp(t,n)),this.pin(n);var a=wf(e,"thumbOffsetX",0),o=wf(e,"thumbOffsetY",0);this.setThumbOffset(a,o)}var h=wf(e,"input",0);switch("string"==typeof h&&(h=Tf[h]),h){case 0:n&&(n.setInteractive(),this.scene.input.setDraggable(n),n.on("drag",rf,this).on("dragstart",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("dragend",(function(t){this.eventEmitter.emit("inputend",t)}),this));break;case 1:this.on("pointerdown",af,this).on("pointermove",af,this).on("pointerdown",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("pointerup",(function(t){this.eventEmitter.emit("inputend",t)}),this).on("pointerover",(function(t){t.isDown&&this.eventEmitter.emit("inputstart",t)}),this).on("pointerout",(function(t){t.isDown&&this.eventEmitter.emit("inputend",t)}),this).setInteractive()}this.addChildrenMap("background",i),this.addChildrenMap("track",s),this.addChildrenMap("indicator",r),this.addChildrenMap("thumb",n),this.setEnable(wf(e,"enable",void 0));var l=wf(e,"tick",void 0);void 0===l&&(l=wf(e,"gap",void 0)),this.setGap(l),this.setValue(wf(e,"value",0),wf(e,"min",void 0),wf(e,"max",void 0))}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setGap(t,e,i){return t&&void 0!==e&&(t/=i-e),this.gap=t,this}setTick(t,e,i){return this.setGap(t,e,i),this}get tick(){return this.gap}set tick(t){this.gap=t}setThumbOffset(t,e){return this.thumbOffsetX=t,this.thumbOffsetY=e,this}get value(){return this._value}set value(t){void 0!==this.gap&&(t=kf(t,this.gap));var e=this._value;this._value=Of(t,0,1),e!==this._value&&(this.updateThumb(this._value),this.updateIndicator(this._value),this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter))}postLayout(t,e,i){return this.updateThumb(),this.updateIndicator(),super.postLayout(t,e,i),this}}const Tf={pan:0,drag:0,click:1,none:-1};var _f={getStartPoint:function(t){if(void 0===t&&(t=uf),this.childrenMap.thumb){var e=0===this.orientation?df:cf;hf.call(this,e,t)}else 0===this.orientation?(t.x=this.innerLeft+1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerTop+1);return t},getEndPoint:function(t){if(void 0===t&&(t=vf),this.childrenMap.thumb){var e=0===this.orientation?pf:gf;hf.call(this,e,t)}else 0===this.orientation?(t.x=this.innerRight-1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerBottom-1);return t},updateThumb:function(t){var e,i,s=this.childrenMap.thumb;return void 0===s||(void 0===t&&(t=this.value),this.reverseAxis?(e=this.getEndPoint(),i=this.getStartPoint()):(e=this.getStartPoint(),i=this.getEndPoint()),function(t,e,i,s){void 0===s&&(s=mf),s.x=ff(e.x,i.x,t),s.y=ff(e.y,i.y,t)}(t,e,i,s),s.x+=this.thumbOffsetX,s.y+=this.thumbOffsetY,this.resetChildPositionState(s)),this},updateIndicator:function(t){var e=this.childrenMap.indicator;if(void 0===e)return this;void 0===t&&(t=this.value);var i,s,r,n=this.reverseAxis,a=this.childrenMap.thumb;if(a)if(0===this.orientation){var o,h=p(a);if(n)o=a.x-h*a.originX,i=this.right-o;else i=(o=a.x-h*a.originX)+h-this.left}else{var l,d=g(a);if(n)l=a.y-d*a.originY,s=this.bottom-l;else s=(l=a.y-d*a.originY)+d-this.top}else 0===this.orientation?i=this.width*t:s=this.height*t;Wn(e,i,s),r=n?0===this.orientation?xf:Cf:0===this.orientation?yf:bf,tn(e,this,r),this.resetChildPositionState(e)}};Object.assign(Pf.prototype,_f);const Mf=Phaser.Utils.Objects.GetValue;class Ef extends Ah{constructor(t,e){super(t,e),this.type="rexScrollBar";var i,s,r=Mf(e,"background",void 0),n=Mf(e,"buttons",void 0),a=Mf(n,"top",Mf(n,"left",void 0)),o=Mf(n,"bottom",Mf(n,"right",void 0)),h=Mf(e,"slider",void 0);(r&&this.addBackground(r),a&&(this.add(a),new Ao(a).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?this.scrollStep:-this.scrollStep;this.value+=t}}),this)),h)&&(h.orientation=this.orientation,h.eventEmitter=this,h.value=null,s=0===this.orientation?void 0===Mf(h,"width",void 0)?1:0:void 0===Mf(h,"height",void 0)?1:0,i=new Pf(t,h),t.add.existing(i),this.add(i,{proportion:s}));o&&(this.add(o),new Ao(o).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?-this.scrollStep:this.scrollStep;this.value+=t}}),this));var l=[a,o];this.addChildrenMap("background",r),this.addChildrenMap("slider",i),this.addChildrenMap("buttons",l);var d=Mf(e,"valuechangeCallback",null);if(null!==d){var c=Mf(e,"valuechangeCallbackScope",void 0);this.on("valuechange",d,c)}this.setEnable(Mf(e,"enable",void 0)),this.setValue(Mf(e,"value",0)),this.setScrollStep(Mf(n,"step",.01))}setScrollStep(t){return this.scrollStep=t,this}get enable(){return!!this.childrenMap.slider&&this.childrenMap.slider.enable}set enable(t){this.childrenMap.slider&&this.childrenMap.slider.setEnable(t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get value(){return this.childrenMap.slider?this.childrenMap.slider.value:0}set value(t){this.childrenMap.slider&&(this.childrenMap.slider.value=t)}setValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setValue(t,e,i),this}addValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.addValue(t,e,i),this}getValue(t,e){return this.childrenMap.slider?this.childrenMap.slider.getValue(t,e):0}easeValueTo(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.easeValueTo(t,e,i),this}stopEaseValue(){return this.childrenMap.slider&&this.childrenMap.slider.stopEaseValue(),this}setEaseValueDuration(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueDuration(t),this}setEaseValueFunction(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueFunction(t),this}setGap(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setGap(t,e,i),this}get gap(){if(this.childrenMap.slider)return this.childrenMap.slider.gap}set gap(t){this.childrenMap.slider&&(this.childrenMap.slider.gap=t)}setTick(t,e,i){return this.setGap(t,e,i),this}get tick(){if(this.childrenMap.slider)return this.childrenMap.slider.tick}set tick(t){this.childrenMap.slider&&(this.childrenMap.slider.tick=t)}}class Rf extends N{constructor(t,e){super(e),this.parent=t,this.init()}init(){this.start("IDLE")}next_IDLE(){var t,e=this.parent;return e.dragState.isDown&&(t=0===e.dragThreshold?"DRAG":"DRAGBEGIN"),t}update_IDLE(t,e){this.next()}next_DRAGBEGIN(){var t=this.parent,e=t.dragState;return e.isDown?e.pointer.getDistance()>=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const Lf=Phaser.Utils.Objects.GetValue,Df=Phaser.Math.Distance.Between;class Af extends l{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=Lf(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(Lf(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(Lf(t,"enable",!0)),this.holdThreshold=Lf(t,"holdThreshold",50),this.pointerOutReleaseEnable=Lf(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return dt(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:Df(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!R(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!R(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const Bf=Phaser.Utils.Objects.GetValue;class jf{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(Bf(t,"value",0)),this.setSpeed(Bf(t,"speed",0)),this.setAcceleration(Bf(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class Wf{constructor(){this.value,this.dir,this.movement=new jf}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const Xf={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},Ff=Phaser.Utils.Objects.GetValue;class Vf extends l{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=Ff(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(Ff(e,"speed",.1)),this.setEnable(Ff(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(Ff(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||R(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const Gf=Phaser.Utils.Objects.GetValue;var Hf=function(t,e,i,s){var r,n,a="Y"===(i=i.toUpperCase()),o=2===t.scrollMode,h=t.childrenMap.child,l=`slider${i}`;if(r=o||s.hasOwnProperty(l)?Gf(s,l,void 0):Gf(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=a?1:0,n=function(t,e){void 0===e&&(e={});var i=Gi(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new Ef(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r),n.tickLength=Gf(r,"tickLength",void 0);var p=Gf(r,"position",0);"string"==typeof p&&(p=Uf[p]);var g,v,f=Gf(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=Gf(s,"space.slider",void 0))&&(o?f=0:g=Gf(s,"space.child",0)),v=void 0===g?"number"==typeof f:"number"==typeof g,a?0===p?(d=2,c=1,u=void 0===g?v?{left:f}:f:{left:Gf(g,"right",g)}):(d=0,c=1,u=void 0===g?v?{right:f}:f:{right:Gf(g,"left",g)}):0===p?(d=1,c=2,u=void 0===g?v?{top:f}:f:{top:Gf(g,"bottom",g)}):(d=1,c=0,u=void 0===g?v?{bottom:f}:f:{bottom:Gf(g,"top",g)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=Gf(r,"hideUnscrollableSlider",!1),t[`disableUnscrollableDrag${i}`]=Gf(r,"disableUnscrollableDrag",!1),t[`adaptThumb${i}SizeMode`]=Gf(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=Gf(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`disableUnscrollableDrag${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=Gf(s,"scrollDetectionMode");"string"==typeof b&&(b=Nf[b]);var x=`scroller${i}`;(m=o||s.hasOwnProperty(x)?Gf(s,x,!0):Gf(s,"scroller",!0))&&h&&(!0===m&&(m={}),m.orientation=a?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new If(h,m),h.isRexContainerLite&&h.sendChildToBack(h));var C,w,S,O,k,P=Gf(s,o?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);P&&h&&(void 0!==b&&(P.focus=1===b?2:0),C=new Vf(h,P)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,C),o&&!a||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.disableUnscrollableDrag=t[`disableUnscrollableDrag${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",C)),n&&(o?(w=a?"t":"s",O=`scroll${i}`):(w="t",O="scroll"),n.on("valuechange",(function(e){t[w]=e,t.emit(O,t)}))),y&&(o?(S=`childO${i}`,O=`scroll${i}`):(S="childOY",O="scroll"),y.on("valuechange",(function(e){t[S]=e,t.emit(O,t)}))),C&&(k=o?`addChildO${i}`:"addChildOY",C.on("scroll",(function(e){t[k](-e,!0)})))};const Uf={right:0,left:1,bottom:0,top:1},Nf={gameObject:0,rectBounds:1},$f=Phaser.Utils.Objects.GetValue;var Kf=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=$f(e,"width"),a=$f(e,"height");n||$f(e,"child.expandWidth",!0)||(s[1]=0),a||$f(e,"child.expandHeight",!0)||(r[1]=0);var o=new Qv(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=tf(i,"child"),r=tf(s,"gameObject",void 0);if(r){var n=tf(i,"space.child",0);t.childMargin={};var a=t.childMargin,o={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:a.top=0,a.bottom=0,a.left=0,a.right=0;break;default:a.top=n,a.bottom=n,a.left=n,a.right=n}else switch(t.scrollMode){case 0:a.top=tf(n,"top",0),a.bottom=tf(n,"bottom",0),o.left=tf(n,"left",0),o.right=tf(n,"right",0);break;case 1:a.top=tf(n,"left",0),a.bottom=tf(n,"right",0),o.top=tf(n,"top",0),o.bottom=tf(n,"bottom",0);break;default:a.top=tf(n,"top",0),a.bottom=tf(n,"bottom",0),a.left=tf(n,"left",0),a.right=tf(n,"right",0)}e.add(r,{column:1,row:1,align:tf(s,"align","center"),padding:o,expand:{width:tf(s,"expandWidth",!0),height:tf(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,o,e),t.scrollMode){case 0:Hf(t,o,"y",e);break;case 1:Hf(t,o,"x",e);break;default:Hf(t,o,"y",e),Hf(t,o,"x",e)}return o},Zf=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}i*="Y"===t?this.scaleY:this.scaleX,s&&s.setBounds(e,i),r&&(r.setEnable(e!==i),r.tickLength&&r.setTick(r.tickLength,e,i))},Jf=function(t){switch(this.scrollMode){case 0:case 1:(i=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(i,this.isOverflow),(r=this.childrenMap.scroller)&&this.disableUnscrollableDrag&&r.setEnable(this.isOverflow);break;default:var e=this[`isOverflow${t=t.toUpperCase()}`],i=this.childrenMap[`slider${t}`],s=this[`hideUnscrollableSlider${t}`];i&&s&&this.setChildVisible(i,e);var r=this.childrenMap.scroller,n=this[`disableUnscrollableDrag${t}`];r&&n&&r.setEnable(e)}},qf=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(o=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=o.childrenMap.track,s=o.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&n0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n")}return i}(this.textObject,this.text,this.lines),this.linesCount=this.lines.length,this._textHeight=void 0,this._textVisibleHeight=void 0,this.updateTextObject(),this},updateTextObject:function(){var t=Math.max(Math.floor(rm.call(this,-this.textOY)),0),e=nm.call(this,t)+this.textOY,i=am.call(this,t);return function(t,e){switch(bl(t)){case 0:var i=(r=t.style).wordWrapWidth,s=r.wordWrapCallback;r.wordWrapWidth=0,r.wordWrapCallback=void 0,t.setText(e),r.wordWrapWidth=i,r.wordWrapCallback=s;break;case 1:var r,n=(r=t.style).wrapMode;r.wrapMode=0,t.setText(e),r.wrapMode=n;break;case 2:var a=t._maxWidth;t._maxWidth=0,t.setText(e),t._maxWidth=a}}(this.textObject,i),this.textObject.rexSizer.offsetY=e,om.call(this),this},preLayout:function(){return this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,An.call(this),this},layoutChildren:function(){var t,e,i,s,r,n,a,o=this.left,h=this.top;(t=this.textObject).rexSizer.hidden||(s=o+(i=(e=t.rexSizer).padding).left*this.scaleX,r=h+i.top*this.scaleY,n=this.width*this.scaleX-(i.left+i.right)*this.scaleX,a=this.height*this.scaleY-(i.top+i.bottom)*this.scaleY,lm.call(this,t,n,a),en(t,s,r,n,a,e.align),e.preOffsetY=0,om.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const cm=Phaser.Utils.Objects.IsPlainObject,um=Phaser.Utils.Objects.GetValue,pm=Phaser.Display.Align.TOP_LEFT;class gm extends oh{constructor(t,e,i,s,r,n){cm(e)?(e=um(n=e,"x",0),i=um(n,"y",0),s=um(n,"width",void 0),r=um(n,"height",void 0)):cm(s)&&(s=um(n=s,"width",void 0),r=um(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexTextBlock",this.textObject=void 0,this.linesCount=0,this.textMask=void 0,this.textObjectType=void 0,this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,this._textObjectRealHeight=0,this.lines=void 0,this.text=um(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode(um(n,"clampTextOY",!0)),this.alwaysScrollable=um(n,"alwaysScrollable",!1);var a=um(n,"background",void 0),o=um(n,"text",void 0);void 0===o&&(o=vm(t)),this.textCropEnable=um(n,"textCrop",!!o.setCrop);var h=um(n,"textMask",!this.textCropEnable);a&&this.addBackground(a),this.add(o),this.sizerChildren=[o];var l=this.getSizerConfig(o);l.align=pm,l.padding=dn(0),l.expand=!0,this.textObject=o,this.textObjectType=bl(o),l.preOffsetY=0,l.offsetY=0,h&&(this.textMask=gl.call(this,this.textObject,this)),this.addChildrenMap("background",a),this.addChildrenMap("text",o)}destroy(t){if(this.scene&&!this.ignoreDestroy){if(this.textObject=void 0,this.textMask=void 0,this.lines){switch(this.textObjectType){case 0:case 2:this.lines.length=0;break;case 1:this.lines.destroy()}this.lines=void 0}super.destroy(t)}}setClampMode(t){return void 0===t&&(t=!0),this.clampTextOY=t,this}get textLineHeight(){if(void 0===this._textLineHeight){var t;switch(this.textObjectType){case 0:case 1:var e=this.textObject.style;t=e.metrics.fontSize+e.strokeThickness;break;case 2:var i=this.textObject.fontSize/this.textObject.fontData.size;t=this.textObject.fontData.lineHeight*i}this._textLineHeight=t}return this._textLineHeight}get textLineSpacing(){if(void 0===this._textLineSpacing){var t;switch(this.textObjectType){case 0:case 1:t=this.textObject.lineSpacing;break;case 2:t=0}this._textLineSpacing=t}return this._textLineSpacing}get visibleLinesCount(){return void 0===this._visibleLinesCount&&(this._visibleLinesCount=Math.floor(rm.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=nm.call(this,this.linesCount)),this._textHeight}get textObjectHeight(){return this._textObjectRealHeight-(this.textLineHeight+this.textLineSpacing)}get textVisibleHeight(){if(void 0===this._textVisibleHeight){var t=this.textHeight-this.textObjectHeight;!this.alwaysScrollable&&t<0&&(t=0),this._textVisibleHeight=t}return this._textVisibleHeight}textOYExceedTop(t){return void 0===t&&(t=this.textOY),t>this.topTextOY}textOYExeceedBottom(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:s?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}setTextOY(t){return this.textOY=t,this}set t(t){this.textOY=-this.textVisibleHeight*t}get t(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t}setTextOYByPercentage(t){return this.t=t,this}}var vm=function(t){return t.add.text(0,0,"")};Object.assign(gm.prototype,dm);var fm={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},mm={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const ym=Phaser.Utils.Objects.GetValue;class bm extends im{constructor(t,e){void 0===e&&(e={});var i=ym(e,"text",void 0),s=ym(e,"textWidth",void 0),r=ym(e,"textHeight",void 0),n=ym(e,"textCrop",!!i.setCrop),a=ym(e,"textMask",!n),o=ym(e,"content",""),h=new gm(t,{width:s,height:r,text:i,textMask:a,textCrop:n&&!a,content:o,clampTextOY:ym(e,"clampChildOY",!1),alwaysScrollable:ym(e,"alwaysScrollable",!1)});t.add.existing(h),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textObjectHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.textHeight}})}(h),e.scrollMode=0,e.type="rexTextArea",e.child={gameObject:h,expandWidth:void 0===s,expandHeight:void 0===r};var l=ym(e,"space",void 0);l&&(l.child=ym(l,"text",0)),super(t,e),this.addChildrenMap("text",i)}get text(){return this.childrenMap.child.text}get lineHeight(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.textHeight}}Object.assign(bm.prototype,fm,mm);const xm=Phaser.Utils.Objects.GetValue;var Cm=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("key")&&(i="bitmaptext",e.font=e.key)),i){case"bitmaptext":case"bitmap":s=new Mv(t,e);break;case"bbcodetext":case"bbcode":s=new kv(t,0,0,"",e);break;case"label":s=new Ev(t,e);break;case"textarea":s=function(t,e,i){e=e?We(e):{};var s=xm(i,"background",Vp),r=xm(i,"text",Cm),n=xm(i,"track",Vp),a=xm(i,"thumb",Vp);s?e.background=s(t,e.background):delete e.background,r?e.text=r(t,e.text):delete e.text;var o=e.slider;!1!==o&&null!==o&&(void 0===o&&(o={}),n?o.track=n(t,o.track):delete o.track,a?o.thumb=a(t,o.thumb):delete o.thumb,e.slider=o);var h=new bm(t,e);return t.add.existing(h),h}(t,e);break;default:s=new Up(t,e)}return Fp(s,e),t.add.existing(s),s},wm=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("leftWidth")?i="nineSlice":(e.hasOwnProperty("color")||e.hasOwnProperty("strokeColor"))&&(i="roundRectangle")),i){case"nineSlice":s=e.hasOwnProperty("stretchMode")?new Ip(t,e):new yp(t,e);break;case"roundRectangle":s=new bu(t,e);break;default:s=new wp(t,e)}return Fp(s,e),t.add.existing(s),s};const Sm=Phaser.Utils.Objects.GetValue;var Om=function(t,e,i){e=e?We(e):{};var s=Sm(i,"background",Vp),r=Sm(i,"text",Cm),n=Sm(i,"icon",wm),a=Sm(i,"action",wm);return null!==e.background&&s?e.background=s(t,e.background):delete e.background,null!==e.text&&r?e.text=r(t,e.text):delete e.text,null!==e.icon&&n?e.icon=n(t,e.icon):delete e.icon,null!==e.action&&a?e.action=a(t,e.action):delete e.action,e};class km extends Hc{constructor(t,e){super(t,e=Om(t,e)),this.type="rexTweaker.Title"}setTitle(t){return(t=t?We(t):{}).hasOwnProperty("text")||(t.hasOwnProperty("title")?t.text=t.title:t.text=""),this.resetDisplayContent(t),this}}Phaser.Math.Wrap;const Pm=Phaser.Math.Linear;var Tm=function(){var t,e,i,s,r,n,a=this.getShape("triangle"),o=this.padding,h=this.width-o.right,l=0+o.left,d=this.height-o.bottom,c=0+o.top,u=(l+h)/2,p=(c+d)/2,g={0:{a:{x:l,y:c},b:{x:h,y:p},c:{x:l,y:d}},1:{a:{x:l,y:c},b:{x:u,y:d},c:{x:h,y:c}},2:{a:{x:h,y:c},b:{x:l,y:p},c:{x:h,y:d}},3:{a:{x:l,y:d},b:{x:u,y:c},c:{x:h,y:d}}};if(void 0===this.previousDirection){var v=g[this.direction],f=v.a,m=v.b,y=v.c;t=f.x,e=f.y,i=m.x,s=m.y,r=y.x,n=y.y}else{var b=g[this.previousDirection],x=g[this.direction],C=this.easeDirectionProgress;t=Pm(b.a.x,x.a.x,C),e=Pm(b.a.y,x.a.y,C),i=Pm(b.b.x,x.b.x,C),s=Pm(b.b.y,x.b.y,C),r=Pm(b.c.x,x.c.x,C),n=Pm(b.c.y,x.c.y,C)}a.startAt(t,e).lineTo(i,s).lineTo(r,n),this.arrowOnly?a.end():a.close()};const _m=(0,Phaser.Math.DegToRad)(120);var Mm=function(t){t=this.getShape("triangle");var e=this.width/2,i=this.height/2,s=Math.min(e,i)*this.radius,r=this.verticeRotation;t.startAt(e+s*Math.cos(r+_m),i+s*Math.sin(r+_m)).lineTo(e+s*Math.cos(r),i+s*Math.sin(r)).lineTo(e+s*Math.cos(r-_m),i+s*Math.sin(r-_m)),this.arrowOnly?t.end():t.close()},Em={buildShapes(){this.addShape((new np).setName("triangle"))},updateShapes(){var t=this.getShape("triangle");this.arrowOnly?t.fillStyle().lineStyle(this.lineWidth,this.strokeColor,this.strokeAlpha):t.fillStyle(this.fillColor,this.fillAlpha).lineStyle(this.lineWidth,this.strokeColor,this.strokeAlpha),0===this.shapeMode?Tm.call(this):Mm.call(this)}},Rm={setEaseDuration(t){return void 0===t&&(t=0),this.easeDuration=t,this},playEaseDirectionation(){return void 0===this.easeDirectionProgressTask&&(this.easeDirectionProgressTask=new La(this,{eventEmitter:null})),this.easeDirectionProgressTask.restart({key:"easeDirectionProgress",from:0,to:1,duration:this.easeDuration}),this},stopEaseDirection(){return void 0===this.easeDirectionProgressTask||this.easeDirectionProgressTask.stop(),this}};const Lm=Phaser.Utils.Objects.GetValue,Dm=Phaser.Utils.Objects.IsPlainObject,Am=Phaser.Math.DegToRad,Bm=Phaser.Math.RadToDeg;class jm extends Pu{constructor(t,e,i,s,r,n,a){var o,h,l,d,c,u,p,g;if(Dm(e)){var v=e;e=v.x,i=v.y,s=v.width,r=v.height,n=v.color,a=v.alpha,o=v.strokeColor,h=v.strokeAlpha,l=v.strokeWidth,d=v.arrowOnly,c=v.direction,u=v.easeDuration,p=v.padding,g=v.radius}void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=s),void 0===d&&(d=!1),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),void 0===g&&(g=void 0),super(t,e,i,s,r),this.type="rexTriangle",this.setFillStyle(n,a),void 0!==o&&void 0===l&&(l=2),this.setStrokeStyle(l,o,h),this.setArrowOnly(d),this.setDirection(c,u),this.setPadding(p),this.setRadius(g),this.buildShapes()}get arrowOnly(){return this._arrowOnly}set arrowOnly(t){this.dirty=this.dirty||this._arrowOnly!=t,this._arrowOnly=t}setArrowOnly(t){return void 0===t&&(t=!0),this.arrowOnly=t,this}get direction(){return this._direction}set direction(t){t=zm(t),this._direction!==t&&(this.easeDuration>0&&void 0!==this._direction?this.previousDirection=this._direction:this.previousDirection=void 0,this._direction=t,this.verticeAngle=90*t,this.dirty=!0,void 0!==this.previousDirection?this.playEaseDirectionation():this.stopEaseDirection())}setDirection(t,e){return void 0!==e&&this.setEaseDuration(e),this.direction=t,this}toggleDirection(t){return this.setDirection(this.direction+2,t),this}get easeDirectionProgress(){return this._easeDirectionProgress}set easeDirectionProgress(t){this._easeDirectionProgress!==t&&(this._easeDirectionProgress=t,this.dirty=!0)}setPadding(t,e,i,s){if("object"==typeof t){var r=t,n=Lm(r,"x",null);null!==n?(t=n,i=n):(t=Lm(r,"left",0),i=Lm(r,"right",t));var a=Lm(r,"y",null);null!==a?(e=a,s=a):(e=Lm(r,"top",0),s=Lm(r,"bottom",e))}else void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=t),void 0===s&&(s=e);return void 0===this.padding&&(this.padding={}),this.dirty=this.dirty||this.padding.left!=t||this.padding.top!=e||this.padding.right!=i||this.padding.bottom!=s,this.padding.left=t,this.padding.top=e,this.padding.right=i,this.padding.bottom=s,this.setRadius(),this}get radius(){return this._radius}set radius(t){this.dirty=this.dirty||this._radius!=t,this._radius=t}setRadius(t){return this.radius=t,this.shapeMode=null==t?0:1,this}get verticeRotation(){return this._verticeRotation}set verticeRotation(t){this.dirty=this.dirty||this._verticeRotation!=t,this._verticeRotation=t}setVerticeRotation(t){return this.verticeRotation=t,this}get verticeAngle(){return Bm(this.verticeRotation)}set verticeAngle(t){this.verticeRotation=Am(t)}setVerticeAngle(t){return this.verticeAngle=t,this}}const Wm={right:0,down:1,left:2,up:3};var zm=function(t){return"string"==typeof t&&(t=Wm[t]),t%=4};Object.assign(jm.prototype,Em,Rm);class Ym extends km{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexTweaker.FolderTitle";var i=new jm(t,e.expandedIcon);t.add.existing(i),this.addSpace().add(i,{proportion:0,expand:!1,padding:1,fitRatio:1}),this.addChildrenMap("expandedIcon",i)}setExpandedState(t){void 0===t&&(t=!0);var e=t?"down":"right";return this.childrenMap.expandedIcon.setDirection(e),this}} + */const eg=Phaser.Display.Canvas.CanvasPool;var ig=function(t){var e=eg.create(this),i=e.getContext("2d",{willReadFrequently:!0});t.syncFont(e,i);var s=i.measureText(t.testString);if("actualBoundingBoxAscent"in s){var r=s.actualBoundingBoxAscent,n=s.actualBoundingBoxDescent,a={ascent:r,descent:n,fontSize:r+n};return eg.remove(e),a}var o=Math.ceil(s.width*t.baselineX),h=o,l=2*h;if(h=h*t.baselineY|0,e.width=o,e.height=l,i.fillStyle="#f00",i.fillRect(0,0,o,l),i.font=t._font,i.textBaseline="alphabetic",i.fillStyle="#000",i.fillText(t.testString,0,h),a={ascent:0,descent:0,fontSize:0},!i.getImageData(0,0,o,l))return a.ascent=h,a.descent=h+6,a.fontSize=a.ascent+a.descent,eg.remove(e),a;var d,c,u=i.getImageData(0,0,o,l).data,p=u.length,g=4*o,v=0,f=!1;for(d=0;dh;d--){for(c=0;c0&&this.wrapMode!==Tl&&0===this.wrapWidth}setStyle(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wordWrap")){var s=t.wordWrap;s.hasOwnProperty("width")&&(t.wrap={mode:"word",width:s.width})}if(t&&t.hasOwnProperty("wrap")){var r=t.wrap;if(r.hasOwnProperty("mode")){var n=r.mode;"string"==typeof n&&(r.mode=Rl[n])}else r.hasOwnProperty("width")&&(r.mode=1)}t&&t.rtl&&i&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var a=this.propertyMap;for(var o in a){var h=a[o],l=h[0],d=i?h[1]:this[o],c=h[2];if("wrapCallback"===o||"wrapCallbackScope"===o)this[o]=rg(t,l,d);else{var u=sg(t,l,d);c&&(u=c(u)),this[o]=u}}var p=rg(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var g=rg(t,"fill",null);null!==g&&(this.color=ud(g));var v=rg(t,"metrics",!1);return v?this.metrics={ascent:rg(v,"ascent",0),descent:rg(v,"descent",0),fontSize:rg(v,"fontSize",0)}:!e&&this.metrics||(this.metrics=ig(this)),e?this.parent.updateText():this.parent}syncFont(t,e){e.font=this._font}syncStyle(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"}syncShadow(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)}update(t){return t&&(this._font=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim(),this.metrics=ig(this)),this.parent.updateText(t)}buildFont(){var t=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim();return t!==this._font&&(this._font=t),this}setFont(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=rg(t,"fontFamily","Courier"),this.fontSize=rg(t,"fontSize","16px"),this.fontStyle=rg(t,"fontStyle","")),this.update(!0)}setFontFamily(t){return this.fontFamily=t,this.update(!0)}setFontStyle(t){return this.fontStyle=t,this.update(!0)}setFontSize(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}setTestString(t){return this.testString=t,this.update(!0)}setFixedSize(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}setResolution(t){return this.resolution=t,this.update(!1)}setXOffset(t){return this.xOffset=t,this.update(!1)}setBackgroundColor(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=ud(t,this.parent.canvas,this.parent.context),this.backgroundColor2=ud(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=ud(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}setBackgroundCornerRadius(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}setFill(t){return this.color=ud(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=ud(t,this.parent.canvas,this.parent.context),this.update(!1)}setStroke(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=ud(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}setShadow(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===n&&(n=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=ud(i,this.parent.canvas,this.parent.context),this.shadowBlur=s,this.shadowStroke=r,this.shadowFill=n,this.update(!1)}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}setShadowColor(t){return void 0===t&&(t="#000"),this.shadowColor=ud(t,this.parent.canvas,this.parent.context),this.update(!1)}setShadowBlur(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}setShadowStroke(t){return this.shadowStroke=t,this.update(!1)}setShadowFill(t){return this.shadowFill=t,this.update(!1)}setUnderline(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=ud(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}setUnderlineColor(t){return void 0===t&&(t="#000"),this.underlineColor=ud(t,this.parent.canvas,this.parent.context),this.update(!1)}setUnderlineThickness(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}setUnderlineOffset(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}setStrikethrough(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=ud(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}setStrikethroughColor(t){return void 0===t&&(t="#000"),this.strikethroughColor=ud(t,this.parent.canvas,this.parent.context),this.update(!1)}setStrikethroughThickness(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}setStrikethroughOffset(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}setWrapMode(t){return"string"==typeof t&&(t=Rl[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}setWrapWidth(t){return this.wrapWidth=t,this.update(!1)}setAlign(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}setHAlign(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}setVAlign(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}setMaxLines(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}getTextMetrics(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}setTextMetrics(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=rg(e,"fontFamily",this.fontFamily),this.fontSize=rg(e,"fontSize",this.fontSize),this.fontStyle=rg(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}get lineHeight(){return this.metrics.fontSize+this.parent.lineSpacing}toJSON(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}destroy(){this.parent=void 0}}var ag={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var a=this.defaultStyle;this.clear(),Od(this,a.backgroundColor,a.backgroundStrokeColor,a.backgroundStrokeLineWidth,a.backgroundCornerRadius,a.backgroundColor2,a.backgroundHorizontalGradient,a.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var o,h,l,d,c,u,p=a.halign,g=a.valign,v=a.lineHeight,f=r.lines,m=f.length,y=a.maxLines;y>0&&m>y?(h=y,l="center"===g?Math.floor((m-h)/2):"bottom"===g?m-h:0):(h=m,l=0),d=l+h;var b=this.rtl,x=b?this.parent.width:void 0;u="center"===g?Math.max((s-h*v)/2,0):"bottom"===g?Math.max(s-h*v-2,0):0,u+=e;for(var C=l;C0){var o=this.defaultStyle.metrics,h=i-o.ascent,l=o.fontSize;this.drawRectangle(e,h,t.width,l,a.bgcolor,a)}if(a.underlineThickness>0&&t.width>0){var d=i+a.underlineOffset-a.underlineThickness/2;this.drawLine(e,d,t.width,a.underlineThickness,a.underlineColor,a)}if(t.isTextPen&&(a.buildFont(),a.syncFont(r,n),a.syncStyle(r,n),this.drawText(e,i,t.text,a)),t.isImagePen&&this.drawImage(e,i,t.prop.img,t.prop.color,a),a.strikethroughThickness>0&&t.width>0&&(d=i+a.strikethroughOffset-a.strikethroughThickness/2,this.drawLine(e,d,t.width,a.strikethroughThickness,a.strikethroughColor,a)),n.restore(),t.hasAreaMarker&&t.width>0){var c,u=t.prop.area;if(u)c={key:u};else{var p=t.prop.url;c={key:`url:${p}`,url:p}}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,c)}},clear(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawRectangle(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;a.fillStyle=r,a.fillRect(t,e,i,s)},drawLine(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;n.syncShadow(a,n.shadowStroke);var o=a.lineCap;a.lineCap="butt",a.strokeStyle=r,a.lineWidth=s,a.beginPath(),a.moveTo(t,e),a.lineTo(t+i,e),a.stroke(),a.lineCap=o},drawText(t,e,i,s){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;s.stroke&&"none"!==s.stroke&&s.strokeThickness>0&&(s.syncShadow(r,s.shadowStroke),r.strokeText(i,t,e)),s.color&&"none"!==s.color&&(s.syncShadow(r,s.shadowFill),r.fillText(i,t,e))},drawImage(t,e,i,s,r){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,s,this.autoRound)}};const og=Phaser.Utils.Objects.GetValue,hg=Ol,lg=kl;class dg{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=og(t,"text",""),this.x=og(t,"x",0),this.y=og(t,"y",0),this.width=og(t,"width",0);var e=og(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=og(t,"newLineMode",0),this.startIndex=og(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===lg&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==hg&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===lg&&(t+=1),t}get endIndex(){return this.startIndex+this.rawTextLength}get lastX(){return this.x+this.width}get isTextPen(){return""!==this.text}get isImagePen(){return!!this.prop.img}get hasAreaMarker(){return!!this.prop.area||!!this.prop.url}}const cg=Phaser.Utils.Objects.GetFastValue,ug=Ol,pg=Pl;class gg{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=cg(t,"tagToText",Rr),this.tagToTextScope=cg(t,"tagToTextScope",void 0)}destroy(){this.clear(),this.tagToText=void 0,this.tagToTextScope=void 0}clear(){for(var t=0,e=this.lines.length;t=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}getLineEndIndex(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,s=!1;for(e=t;e>=0&&!(s=null!=(i=this.lines[e])&&i.length>0);e--);return s?i[i.length-1].endIndex:0}getLineWidth(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}getMaxLineWidth(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,s=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}getLineWidths(){for(var t=[],e=0,i=this.lines.length;e=t&&h<=e||(a=a.substring(t-o,e-o)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,a,l,d):c+=this.tagToText(a,l,d),d=l,!(h>=e)));u++);return c}get length(){return this.lines.length}set length(t){this.clear()}}var vg={};const fg=Phaser.Geom.Rectangle;var mg=new Ec;class yg{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&Lg(v)){""!==b?a.push(n.getLine(b,x,kg)):0===C&&r>0&&a.push(n.getLine("",0,kg)),a.push(...Eg(v,e,_g,s,0,n));var S=a.pop();b=S.text,x=S.width,n.freeLine(S)," "===b&&(b="",x=0)}else(m=x+f)>h?(a.push(n.getLine(b,x,kg)),b=v,x=f,h=s):(b+=v,x=m),C===w-1&&a.push(n.getLine(b,x,l))}return a},Rg=function(t,e){var i;switch(e){case Tg:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==Ag&&i0&&t>e&&(t=e),t}get linesWidth(){return Math.ceil(this.penManager.getMaxLineWidth())}get linesHeight(){var t=this.displayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}get imageManager(){return this.parent.imageManager}get rtl(){return this.parent.style.rtl}newPenManager(){return new gg({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}get tmpPenManager(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}getPlainText(t,e,i){var s;if(null==t)s=this.penManager.plainText;else{var r=this.parser.splitText(t,1);s="";for(var n=0,a=r.length;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return Vv(this.sizerChildren,null),Ch.call(this,t),this}},Hv={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)Vv(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},Kv={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,o=this.sizerChildren,h=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=En.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,Vv(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Vv(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},Jv=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const qv=Phaser.Utils.Objects.IsPlainObject,Qv=Phaser.Utils.Objects.GetValue;class tf extends oh{constructor(t,e,i,s,r,n,a,o,h,l){qv(e)?(e=Qv(l=e,"x",0),i=Qv(l,"y",0),s=Qv(l,"width",void 0),r=Qv(l,"height",void 0),n=Qv(l,"column",l.col||0),a=Qv(l,"row",0),o=Qv(l,"columnProportions",0),h=Qv(l,"rowProportions",0)):qv(s)?(s=Qv(l=s,"width",void 0),r=Qv(l,"height",void 0),n=Qv(l,"column",l.col||0),a=Qv(l,"row",0),o=Qv(l,"columnProportions",0),h=Qv(l,"rowProportions",0)):qv(n)?(n=Qv(l=n,"column",l.col||0),a=Qv(l,"row",0),o=Qv(l,"columnProportions",0),h=Qv(l,"rowProportions",0)):qv(o)&&(o=Qv(l=o,"columnProportions",0),h=Qv(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(Qv(l,"createCellContainerCallback")),this.setIndentLeft(Qv(l,"space.indentLeftOdd",0),Qv(l,"space.indentLeftEven",0)),this.setIndentTop(Qv(l,"space.indentTopOdd",0),Qv(l,"space.indentTopEven",0)),this.resetGrid(n,a,o,h,Qv(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=Zv.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=Jv.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(tf.prototype,Kv);const ef=Phaser.Utils.Objects.GetValue,sf=Phaser.Math.Percent;var rf=function(t,e,i){var s;return t.y===e.y?s=sf(i.x,t.x,e.x):t.x===e.x&&(s=sf(i.y,t.y,e.y)),s},nf=function(t,e,i){var s,r;this.enable&&(af.x=e,af.y=i,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint()),this.value=rf(s,r,af))},af={},of=function(t,e,i){if(this.enable&&t.isDown){var s,r;hf.x=t.worldX,hf.y=t.worldY,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint());var n=rf(s,r,hf);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-n)<.1?this.value=n:this.easeValueTo(n)}},hf={},lf=function(t,e){void 0===e&&(e=df);var i=this.childrenMap.thumb,s=i.x,r=i.y;return en(i,this.innerLeft,this.innerTop,this.innerWidth,this.innerHeight,t),e.x=i.x,e.y=i.y,i.x=s,i.y=r,e},df={};const cf=Phaser.Display.Align.LEFT_CENTER,uf=Phaser.Display.Align.TOP_CENTER;var pf={};const gf=Phaser.Display.Align.RIGHT_CENTER,vf=Phaser.Display.Align.BOTTOM_CENTER;var ff={};const mf=Phaser.Math.Linear;var yf={};const bf=Phaser.Display.Align.LEFT_CENTER,xf=Phaser.Display.Align.TOP_CENTER,Cf=Phaser.Display.Align.RIGHT_CENTER,wf=Phaser.Display.Align.BOTTOM_CENTER,Sf=Phaser.Utils.Objects.GetValue,Of=Phaser.Utils.Objects.IsPlainObject,kf=Phaser.Math.Clamp,Pf=Phaser.Math.Snap.To;class Tf extends(Au(Ah)){constructor(t,e){super(t,e),this.type="rexSlider",this.bootProgressBase(e),this.reverseAxis=Sf(e,"reverseAxis",!1);var i=Sf(e,"background",void 0),s=Sf(e,"track",void 0),r=Sf(e,"indicator",void 0),n=Sf(e,"thumb",void 0);if(i&&(Of(i)&&(i=Gp(t,i)),this.addBackground(i)),s&&(Of(s)&&(s=Gp(t,s)),this.add(s,{proportion:1,expand:!0,minWidth:0===this.orientation?0:void 0,minHeight:1===this.orientation?0:void 0})),r&&(Of(r)&&(r=Gp(t,r)),this.pin(r)),n){Of(n)&&(n=Gp(t,n)),this.pin(n);var a=Sf(e,"thumbOffsetX",0),o=Sf(e,"thumbOffsetY",0);this.setThumbOffset(a,o)}var h=Sf(e,"input",0);switch("string"==typeof h&&(h=_f[h]),h){case 0:n&&(n.setInteractive(),this.scene.input.setDraggable(n),n.on("drag",nf,this).on("dragstart",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("dragend",(function(t){this.eventEmitter.emit("inputend",t)}),this));break;case 1:this.on("pointerdown",of,this).on("pointermove",of,this).on("pointerdown",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("pointerup",(function(t){this.eventEmitter.emit("inputend",t)}),this).on("pointerover",(function(t){t.isDown&&this.eventEmitter.emit("inputstart",t)}),this).on("pointerout",(function(t){t.isDown&&this.eventEmitter.emit("inputend",t)}),this).setInteractive()}this.addChildrenMap("background",i),this.addChildrenMap("track",s),this.addChildrenMap("indicator",r),this.addChildrenMap("thumb",n),this.setEnable(Sf(e,"enable",void 0));var l=Sf(e,"tick",void 0);void 0===l&&(l=Sf(e,"gap",void 0)),this.setGap(l),this.setValue(Sf(e,"value",0),Sf(e,"min",void 0),Sf(e,"max",void 0))}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setGap(t,e,i){return t&&void 0!==e&&(t/=i-e),this.gap=t,this}setTick(t,e,i){return this.setGap(t,e,i),this}get tick(){return this.gap}set tick(t){this.gap=t}setThumbOffset(t,e){return this.thumbOffsetX=t,this.thumbOffsetY=e,this}get value(){return this._value}set value(t){void 0!==this.gap&&(t=Pf(t,this.gap));var e=this._value;this._value=kf(t,0,1),e!==this._value&&(this.updateThumb(this._value),this.updateIndicator(this._value),this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter))}postLayout(t,e,i){return this.updateThumb(),this.updateIndicator(),super.postLayout(t,e,i),this}}const _f={pan:0,drag:0,click:1,none:-1};var Mf={getStartPoint:function(t){if(void 0===t&&(t=pf),this.childrenMap.thumb){var e=0===this.orientation?cf:uf;lf.call(this,e,t)}else 0===this.orientation?(t.x=this.innerLeft+1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerTop+1);return t},getEndPoint:function(t){if(void 0===t&&(t=ff),this.childrenMap.thumb){var e=0===this.orientation?gf:vf;lf.call(this,e,t)}else 0===this.orientation?(t.x=this.innerRight-1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerBottom-1);return t},updateThumb:function(t){var e,i,s=this.childrenMap.thumb;return void 0===s||(void 0===t&&(t=this.value),this.reverseAxis?(e=this.getEndPoint(),i=this.getStartPoint()):(e=this.getStartPoint(),i=this.getEndPoint()),function(t,e,i,s){void 0===s&&(s=yf),s.x=mf(e.x,i.x,t),s.y=mf(e.y,i.y,t)}(t,e,i,s),s.x+=this.thumbOffsetX,s.y+=this.thumbOffsetY,this.resetChildPositionState(s)),this},updateIndicator:function(t){var e=this.childrenMap.indicator;if(void 0===e)return this;void 0===t&&(t=this.value);var i,s,r,n=this.reverseAxis,a=this.childrenMap.thumb;if(a)if(0===this.orientation){var o,h=p(a);if(n)o=a.x-h*a.originX,i=this.right-o;else i=(o=a.x-h*a.originX)+h-this.left}else{var l,d=g(a);if(n)l=a.y-d*a.originY,s=this.bottom-l;else s=(l=a.y-d*a.originY)+d-this.top}else 0===this.orientation?i=this.width*t:s=this.height*t;Wn(e,i,s),r=n?0===this.orientation?Cf:wf:0===this.orientation?bf:xf,tn(e,this,r),this.resetChildPositionState(e)}};Object.assign(Tf.prototype,Mf);const Ef=Phaser.Utils.Objects.GetValue;class Rf extends Ah{constructor(t,e){super(t,e),this.type="rexScrollBar";var i,s,r=Ef(e,"background",void 0),n=Ef(e,"buttons",void 0),a=Ef(n,"top",Ef(n,"left",void 0)),o=Ef(n,"bottom",Ef(n,"right",void 0)),h=Ef(e,"slider",void 0);(r&&this.addBackground(r),a&&(this.add(a),new Ao(a).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?this.scrollStep:-this.scrollStep;this.value+=t}}),this)),h)&&(h.orientation=this.orientation,h.eventEmitter=this,h.value=null,s=0===this.orientation?void 0===Ef(h,"width",void 0)?1:0:void 0===Ef(h,"height",void 0)?1:0,i=new Tf(t,h),t.add.existing(i),this.add(i,{proportion:s}));o&&(this.add(o),new Ao(o).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?-this.scrollStep:this.scrollStep;this.value+=t}}),this));var l=[a,o];this.addChildrenMap("background",r),this.addChildrenMap("slider",i),this.addChildrenMap("buttons",l);var d=Ef(e,"valuechangeCallback",null);if(null!==d){var c=Ef(e,"valuechangeCallbackScope",void 0);this.on("valuechange",d,c)}this.setEnable(Ef(e,"enable",void 0)),this.setValue(Ef(e,"value",0)),this.setScrollStep(Ef(n,"step",.01))}setScrollStep(t){return this.scrollStep=t,this}get enable(){return!!this.childrenMap.slider&&this.childrenMap.slider.enable}set enable(t){this.childrenMap.slider&&this.childrenMap.slider.setEnable(t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get value(){return this.childrenMap.slider?this.childrenMap.slider.value:0}set value(t){this.childrenMap.slider&&(this.childrenMap.slider.value=t)}setValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setValue(t,e,i),this}addValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.addValue(t,e,i),this}getValue(t,e){return this.childrenMap.slider?this.childrenMap.slider.getValue(t,e):0}easeValueTo(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.easeValueTo(t,e,i),this}stopEaseValue(){return this.childrenMap.slider&&this.childrenMap.slider.stopEaseValue(),this}setEaseValueDuration(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueDuration(t),this}setEaseValueFunction(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueFunction(t),this}setGap(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setGap(t,e,i),this}get gap(){if(this.childrenMap.slider)return this.childrenMap.slider.gap}set gap(t){this.childrenMap.slider&&(this.childrenMap.slider.gap=t)}setTick(t,e,i){return this.setGap(t,e,i),this}get tick(){if(this.childrenMap.slider)return this.childrenMap.slider.tick}set tick(t){this.childrenMap.slider&&(this.childrenMap.slider.tick=t)}}class Lf extends N{constructor(t,e){super(e),this.parent=t,this.init()}init(){this.start("IDLE")}next_IDLE(){var t,e=this.parent;return e.dragState.isDown&&(t=0===e.dragThreshold?"DRAG":"DRAGBEGIN"),t}update_IDLE(t,e){this.next()}next_DRAGBEGIN(){var t=this.parent,e=t.dragState;return e.isDown?e.pointer.getDistance()>=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const Df=Phaser.Utils.Objects.GetValue,Af=Phaser.Math.Distance.Between;class Bf extends l{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=Df(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(Df(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(Df(t,"enable",!0)),this.holdThreshold=Df(t,"holdThreshold",50),this.pointerOutReleaseEnable=Df(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return dt(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:Af(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!R(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!R(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const jf=Phaser.Utils.Objects.GetValue;class Wf{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(jf(t,"value",0)),this.setSpeed(jf(t,"speed",0)),this.setAcceleration(jf(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class zf{constructor(){this.value,this.dir,this.movement=new Wf}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const Ff={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},Vf=Phaser.Utils.Objects.GetValue;class Gf extends l{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=Vf(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(Vf(e,"speed",.1)),this.setEnable(Vf(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(Vf(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||R(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const Hf=Phaser.Utils.Objects.GetValue;var Uf=function(t,e,i,s){var r,n,a="Y"===(i=i.toUpperCase()),o=2===t.scrollMode,h=t.childrenMap.child,l=`slider${i}`;if(r=o||s.hasOwnProperty(l)?Hf(s,l,void 0):Hf(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=a?1:0,n=function(t,e){void 0===e&&(e={});var i=Gi(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new Rf(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r),n.tickLength=Hf(r,"tickLength",void 0);var p=Hf(r,"position",0);"string"==typeof p&&(p=Nf[p]);var g,v,f=Hf(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=Hf(s,"space.slider",void 0))&&(o?f=0:g=Hf(s,"space.child",0)),v=void 0===g?"number"==typeof f:"number"==typeof g,a?0===p?(d=2,c=1,u=void 0===g?v?{left:f}:f:{left:Hf(g,"right",g)}):(d=0,c=1,u=void 0===g?v?{right:f}:f:{right:Hf(g,"left",g)}):0===p?(d=1,c=2,u=void 0===g?v?{top:f}:f:{top:Hf(g,"bottom",g)}):(d=1,c=0,u=void 0===g?v?{bottom:f}:f:{bottom:Hf(g,"top",g)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=Hf(r,"hideUnscrollableSlider",!1),t[`disableUnscrollableDrag${i}`]=Hf(r,"disableUnscrollableDrag",!1),t[`adaptThumb${i}SizeMode`]=Hf(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=Hf(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`disableUnscrollableDrag${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=Hf(s,"scrollDetectionMode");"string"==typeof b&&(b=$f[b]);var x=`scroller${i}`;(m=o||s.hasOwnProperty(x)?Hf(s,x,!0):Hf(s,"scroller",!0))&&h&&(!0===m&&(m={}),m.orientation=a?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new Xf(h,m),h.isRexContainerLite&&h.sendChildToBack(h));var C,w,S,O,k,P=Hf(s,o?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);P&&h&&(void 0!==b&&(P.focus=1===b?2:0),C=new Gf(h,P)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,C),o&&!a||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.disableUnscrollableDrag=t[`disableUnscrollableDrag${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",C)),n&&(o?(w=a?"t":"s",O=`scroll${i}`):(w="t",O="scroll"),n.on("valuechange",(function(e){t[w]=e,t.emit(O,t)}))),y&&(o?(S=`childO${i}`,O=`scroll${i}`):(S="childOY",O="scroll"),y.on("valuechange",(function(e){t[S]=e,t.emit(O,t)}))),C&&(k=o?`addChildO${i}`:"addChildOY",C.on("scroll",(function(e){t[k](-e,!0)})))};const Nf={right:0,left:1,bottom:0,top:1},$f={gameObject:0,rectBounds:1},Kf=Phaser.Utils.Objects.GetValue;var Zf=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=Kf(e,"width"),a=Kf(e,"height");n||Kf(e,"child.expandWidth",!0)||(s[1]=0),a||Kf(e,"child.expandHeight",!0)||(r[1]=0);var o=new tf(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=ef(i,"child"),r=ef(s,"gameObject",void 0);if(r){var n=ef(i,"space.child",0);t.childMargin={};var a=t.childMargin,o={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:a.top=0,a.bottom=0,a.left=0,a.right=0;break;default:a.top=n,a.bottom=n,a.left=n,a.right=n}else switch(t.scrollMode){case 0:a.top=ef(n,"top",0),a.bottom=ef(n,"bottom",0),o.left=ef(n,"left",0),o.right=ef(n,"right",0);break;case 1:a.top=ef(n,"left",0),a.bottom=ef(n,"right",0),o.top=ef(n,"top",0),o.bottom=ef(n,"bottom",0);break;default:a.top=ef(n,"top",0),a.bottom=ef(n,"bottom",0),a.left=ef(n,"left",0),a.right=ef(n,"right",0)}e.add(r,{column:1,row:1,align:ef(s,"align","center"),padding:o,expand:{width:ef(s,"expandWidth",!0),height:ef(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,o,e),t.scrollMode){case 0:Uf(t,o,"y",e);break;case 1:Uf(t,o,"x",e);break;default:Uf(t,o,"y",e),Uf(t,o,"x",e)}return o},Jf=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}i*="Y"===t?this.scaleY:this.scaleX,s&&s.setBounds(e,i),r&&(r.setEnable(e!==i),r.tickLength&&r.setTick(r.tickLength,e,i))},qf=function(t){switch(this.scrollMode){case 0:case 1:(i=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(i,this.isOverflow),(r=this.childrenMap.scroller)&&this.disableUnscrollableDrag&&r.setEnable(this.isOverflow);break;default:var e=this[`isOverflow${t=t.toUpperCase()}`],i=this.childrenMap[`slider${t}`],s=this[`hideUnscrollableSlider${t}`];i&&s&&this.setChildVisible(i,e);var r=this.childrenMap.scroller,n=this[`disableUnscrollableDrag${t}`];r&&n&&r.setEnable(e)}},Qf=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(o=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=o.childrenMap.track,s=o.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&n0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n")}return i}(this.textObject,this.text,this.lines),this.linesCount=this.lines.length,this._textHeight=void 0,this._textVisibleHeight=void 0,this.updateTextObject(),this},updateTextObject:function(){var t=Math.max(Math.floor(nm.call(this,-this.textOY)),0),e=am.call(this,t)+this.textOY,i=om.call(this,t);return function(t,e){switch(bl(t)){case 0:var i=(r=t.style).wordWrapWidth,s=r.wordWrapCallback;r.wordWrapWidth=0,r.wordWrapCallback=void 0,t.setText(e),r.wordWrapWidth=i,r.wordWrapCallback=s;break;case 1:var r,n=(r=t.style).wrapMode;r.wrapMode=0,t.setText(e),r.wrapMode=n;break;case 2:var a=t._maxWidth;t._maxWidth=0,t.setText(e),t._maxWidth=a}}(this.textObject,i),this.textObject.rexSizer.offsetY=e,hm.call(this),this},preLayout:function(){return this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,An.call(this),this},layoutChildren:function(){var t,e,i,s,r,n,a,o=this.left,h=this.top;(t=this.textObject).rexSizer.hidden||(s=o+(i=(e=t.rexSizer).padding).left*this.scaleX,r=h+i.top*this.scaleY,n=this.width*this.scaleX-(i.left+i.right)*this.scaleX,a=this.height*this.scaleY-(i.top+i.bottom)*this.scaleY,dm.call(this,t,n,a),en(t,s,r,n,a,e.align),e.preOffsetY=0,hm.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const um=Phaser.Utils.Objects.IsPlainObject,pm=Phaser.Utils.Objects.GetValue,gm=Phaser.Display.Align.TOP_LEFT;class vm extends oh{constructor(t,e,i,s,r,n){um(e)?(e=pm(n=e,"x",0),i=pm(n,"y",0),s=pm(n,"width",void 0),r=pm(n,"height",void 0)):um(s)&&(s=pm(n=s,"width",void 0),r=pm(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexTextBlock",this.textObject=void 0,this.linesCount=0,this.textMask=void 0,this.textObjectType=void 0,this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,this._textObjectRealHeight=0,this.lines=void 0,this.text=pm(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode(pm(n,"clampTextOY",!0)),this.alwaysScrollable=pm(n,"alwaysScrollable",!1);var a=pm(n,"background",void 0),o=pm(n,"text",void 0);void 0===o&&(o=fm(t)),this.textCropEnable=pm(n,"textCrop",!!o.setCrop);var h=pm(n,"textMask",!this.textCropEnable);a&&this.addBackground(a),this.add(o),this.sizerChildren=[o];var l=this.getSizerConfig(o);l.align=gm,l.padding=dn(0),l.expand=!0,this.textObject=o,this.textObjectType=bl(o),l.preOffsetY=0,l.offsetY=0,h&&(this.textMask=gl.call(this,this.textObject,this)),this.addChildrenMap("background",a),this.addChildrenMap("text",o)}destroy(t){if(this.scene&&!this.ignoreDestroy){if(this.textObject=void 0,this.textMask=void 0,this.lines){switch(this.textObjectType){case 0:case 2:this.lines.length=0;break;case 1:this.lines.destroy()}this.lines=void 0}super.destroy(t)}}setClampMode(t){return void 0===t&&(t=!0),this.clampTextOY=t,this}get textLineHeight(){if(void 0===this._textLineHeight){var t;switch(this.textObjectType){case 0:case 1:var e=this.textObject.style;t=e.metrics.fontSize+e.strokeThickness;break;case 2:var i=this.textObject.fontSize/this.textObject.fontData.size;t=this.textObject.fontData.lineHeight*i}this._textLineHeight=t}return this._textLineHeight}get textLineSpacing(){if(void 0===this._textLineSpacing){var t;switch(this.textObjectType){case 0:case 1:t=this.textObject.lineSpacing;break;case 2:t=0}this._textLineSpacing=t}return this._textLineSpacing}get visibleLinesCount(){return void 0===this._visibleLinesCount&&(this._visibleLinesCount=Math.floor(nm.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=am.call(this,this.linesCount)),this._textHeight}get textObjectHeight(){return this._textObjectRealHeight-(this.textLineHeight+this.textLineSpacing)}get textVisibleHeight(){if(void 0===this._textVisibleHeight){var t=this.textHeight-this.textObjectHeight;!this.alwaysScrollable&&t<0&&(t=0),this._textVisibleHeight=t}return this._textVisibleHeight}textOYExceedTop(t){return void 0===t&&(t=this.textOY),t>this.topTextOY}textOYExeceedBottom(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:s?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}setTextOY(t){return this.textOY=t,this}set t(t){this.textOY=-this.textVisibleHeight*t}get t(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t}setTextOYByPercentage(t){return this.t=t,this}}var fm=function(t){return t.add.text(0,0,"")};Object.assign(vm.prototype,cm);var mm={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},ym={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const bm=Phaser.Utils.Objects.GetValue;class xm extends sm{constructor(t,e){void 0===e&&(e={});var i=bm(e,"text",void 0),s=bm(e,"textWidth",void 0),r=bm(e,"textHeight",void 0),n=bm(e,"textCrop",!!i.setCrop),a=bm(e,"textMask",!n),o=bm(e,"content",""),h=new vm(t,{width:s,height:r,text:i,textMask:a,textCrop:n&&!a,content:o,clampTextOY:bm(e,"clampChildOY",!1),alwaysScrollable:bm(e,"alwaysScrollable",!1)});t.add.existing(h),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textObjectHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.textHeight}})}(h),e.scrollMode=0,e.type="rexTextArea",e.child={gameObject:h,expandWidth:void 0===s,expandHeight:void 0===r};var l=bm(e,"space",void 0);l&&(l.child=bm(l,"text",0)),super(t,e),this.addChildrenMap("text",i)}get text(){return this.childrenMap.child.text}get lineHeight(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.textHeight}}Object.assign(xm.prototype,mm,ym);const Cm=Phaser.Utils.Objects.GetValue;var wm=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("key")&&(i="bitmaptext",e.font=e.key)),i){case"bitmaptext":case"bitmap":s=new Ev(t,e);break;case"bbcodetext":case"bbcode":s=new Pv(t,0,0,"",e);break;case"label":s=new Rv(t,e);break;case"textarea":s=function(t,e,i){e=e?We(e):{};var s=Cm(i,"background",Gp),r=Cm(i,"text",wm),n=Cm(i,"track",Gp),a=Cm(i,"thumb",Gp);s?e.background=s(t,e.background):delete e.background,r?e.text=r(t,e.text):delete e.text;var o=e.slider;!1!==o&&null!==o&&(void 0===o&&(o={}),n?o.track=n(t,o.track):delete o.track,a?o.thumb=a(t,o.thumb):delete o.thumb,e.slider=o);var h=new xm(t,e);return t.add.existing(h),h}(t,e);break;default:s=new Np(t,e)}return Vp(s,e),t.add.existing(s),s},Sm=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("leftWidth")?i="nineSlice":(e.hasOwnProperty("color")||e.hasOwnProperty("strokeColor"))&&(i="roundRectangle")),i){case"nineSlice":s=e.hasOwnProperty("stretchMode")?new Xp(t,e):new bp(t,e);break;case"roundRectangle":s=new bu(t,e);break;default:s=new Sp(t,e)}return Vp(s,e),t.add.existing(s),s};const Om=Phaser.Utils.Objects.GetValue;var km=function(t,e,i){e=e?We(e):{};var s=Om(i,"background",Gp),r=Om(i,"text",wm),n=Om(i,"icon",Sm),a=Om(i,"action",Sm);return null!==e.background&&s?e.background=s(t,e.background):delete e.background,null!==e.text&&r?e.text=r(t,e.text):delete e.text,null!==e.icon&&n?e.icon=n(t,e.icon):delete e.icon,null!==e.action&&a?e.action=a(t,e.action):delete e.action,e};class Pm extends Hc{constructor(t,e){super(t,e=km(t,e)),this.type="rexTweaker.Title"}setTitle(t){return(t=t?We(t):{}).hasOwnProperty("text")||(t.hasOwnProperty("title")?t.text=t.title:t.text=""),this.resetDisplayContent(t),this}}Phaser.Math.Wrap;const Tm=Phaser.Math.Linear;var _m=function(){var t,e,i,s,r,n,a=this.getShape("triangle"),o=this.padding,h=this.width-o.right,l=0+o.left,d=this.height-o.bottom,c=0+o.top,u=(l+h)/2,p=(c+d)/2,g={0:{a:{x:l,y:c},b:{x:h,y:p},c:{x:l,y:d}},1:{a:{x:l,y:c},b:{x:u,y:d},c:{x:h,y:c}},2:{a:{x:h,y:c},b:{x:l,y:p},c:{x:h,y:d}},3:{a:{x:l,y:d},b:{x:u,y:c},c:{x:h,y:d}}};if(void 0===this.previousDirection){var v=g[this.direction],f=v.a,m=v.b,y=v.c;t=f.x,e=f.y,i=m.x,s=m.y,r=y.x,n=y.y}else{var b=g[this.previousDirection],x=g[this.direction],C=this.easeDirectionProgress;t=Tm(b.a.x,x.a.x,C),e=Tm(b.a.y,x.a.y,C),i=Tm(b.b.x,x.b.x,C),s=Tm(b.b.y,x.b.y,C),r=Tm(b.c.x,x.c.x,C),n=Tm(b.c.y,x.c.y,C)}a.startAt(t,e).lineTo(i,s).lineTo(r,n),this.arrowOnly?a.end():a.close()};const Mm=(0,Phaser.Math.DegToRad)(120);var Em=function(t){t=this.getShape("triangle");var e=this.width/2,i=this.height/2,s=Math.min(e,i)*this.radius,r=this.verticeRotation;t.startAt(e+s*Math.cos(r+Mm),i+s*Math.sin(r+Mm)).lineTo(e+s*Math.cos(r),i+s*Math.sin(r)).lineTo(e+s*Math.cos(r-Mm),i+s*Math.sin(r-Mm)),this.arrowOnly?t.end():t.close()},Rm={buildShapes(){this.addShape((new ap).setName("triangle"))},updateShapes(){var t=this.getShape("triangle");this.arrowOnly?t.fillStyle().lineStyle(this.lineWidth,this.strokeColor,this.strokeAlpha):t.fillStyle(this.fillColor,this.fillAlpha).lineStyle(this.lineWidth,this.strokeColor,this.strokeAlpha),0===this.shapeMode?_m.call(this):Em.call(this)}},Lm={setEaseDuration(t){return void 0===t&&(t=0),this.easeDuration=t,this},playEaseDirectionation(){return void 0===this.easeDirectionProgressTask&&(this.easeDirectionProgressTask=new La(this,{eventEmitter:null})),this.easeDirectionProgressTask.restart({key:"easeDirectionProgress",from:0,to:1,duration:this.easeDuration}),this},stopEaseDirection(){return void 0===this.easeDirectionProgressTask||this.easeDirectionProgressTask.stop(),this}};const Dm=Phaser.Utils.Objects.GetValue,Am=Phaser.Utils.Objects.IsPlainObject,Bm=Phaser.Math.DegToRad,jm=Phaser.Math.RadToDeg;class Wm extends Pu{constructor(t,e,i,s,r,n,a){var o,h,l,d,c,u,p,g;if(Am(e)){var v=e;e=v.x,i=v.y,s=v.width,r=v.height,n=v.color,a=v.alpha,o=v.strokeColor,h=v.strokeAlpha,l=v.strokeWidth,d=v.arrowOnly,c=v.direction,u=v.easeDuration,p=v.padding,g=v.radius}void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=s),void 0===d&&(d=!1),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),void 0===g&&(g=void 0),super(t,e,i,s,r),this.type="rexTriangle",this.setFillStyle(n,a),void 0!==o&&void 0===l&&(l=2),this.setStrokeStyle(l,o,h),this.setArrowOnly(d),this.setDirection(c,u),this.setPadding(p),this.setRadius(g),this.buildShapes()}get arrowOnly(){return this._arrowOnly}set arrowOnly(t){this.dirty=this.dirty||this._arrowOnly!=t,this._arrowOnly=t}setArrowOnly(t){return void 0===t&&(t=!0),this.arrowOnly=t,this}get direction(){return this._direction}set direction(t){t=Ym(t),this._direction!==t&&(this.easeDuration>0&&void 0!==this._direction?this.previousDirection=this._direction:this.previousDirection=void 0,this._direction=t,this.verticeAngle=90*t,this.dirty=!0,void 0!==this.previousDirection?this.playEaseDirectionation():this.stopEaseDirection())}setDirection(t,e){return void 0!==e&&this.setEaseDuration(e),this.direction=t,this}toggleDirection(t){return this.setDirection(this.direction+2,t),this}get easeDirectionProgress(){return this._easeDirectionProgress}set easeDirectionProgress(t){this._easeDirectionProgress!==t&&(this._easeDirectionProgress=t,this.dirty=!0)}setPadding(t,e,i,s){if("object"==typeof t){var r=t,n=Dm(r,"x",null);null!==n?(t=n,i=n):(t=Dm(r,"left",0),i=Dm(r,"right",t));var a=Dm(r,"y",null);null!==a?(e=a,s=a):(e=Dm(r,"top",0),s=Dm(r,"bottom",e))}else void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=t),void 0===s&&(s=e);return void 0===this.padding&&(this.padding={}),this.dirty=this.dirty||this.padding.left!=t||this.padding.top!=e||this.padding.right!=i||this.padding.bottom!=s,this.padding.left=t,this.padding.top=e,this.padding.right=i,this.padding.bottom=s,this.setRadius(),this}get radius(){return this._radius}set radius(t){this.dirty=this.dirty||this._radius!=t,this._radius=t}setRadius(t){return this.radius=t,this.shapeMode=null==t?0:1,this}get verticeRotation(){return this._verticeRotation}set verticeRotation(t){this.dirty=this.dirty||this._verticeRotation!=t,this._verticeRotation=t}setVerticeRotation(t){return this.verticeRotation=t,this}get verticeAngle(){return jm(this.verticeRotation)}set verticeAngle(t){this.verticeRotation=Bm(t)}setVerticeAngle(t){return this.verticeAngle=t,this}}const zm={right:0,down:1,left:2,up:3};var Ym=function(t){return"string"==typeof t&&(t=zm[t]),t%=4};Object.assign(Wm.prototype,Rm,Lm);class Im extends Pm{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexTweaker.FolderTitle";var i=new Wm(t,e.expandedIcon);t.add.existing(i),this.addSpace().add(i,{proportion:0,expand:!1,padding:1,fitRatio:1}),this.addChildrenMap("expandedIcon",i)}setExpandedState(t){void 0===t&&(t=!0);var e=t?"down":"right";return this.childrenMap.expandedIcon.setDirection(e),this}} /** * @author Richard Davey * @copyright 2019 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */var Im=function(t,e){var i=Gi(t);for(var s in e)i.hasOwnProperty(s)||(i[s]=e[s]);return i},Xm=function(t,e,i){return Vp(t,Im(e,i))};class Fm extends Za{constructor(t,e){void 0===e&&(e={}),e.destroy=!1,super(t,e)}onOpen(){this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.parent,this),super.onClose()}}var Vm={expand(t){if(!0===this.expanded)return this;void 0===t&&(t=this.transitionDuration),this.expanded=!0;var e=this.childrenMap.title,i=this.childrenMap.child;return this.show(i),this.reLayoutEnable&&(this.reLayoutTarget?this.reLayoutTarget:this.getTopmostSizer()).layout(),e.emit("folder.expand",t,this),i.emit("folder.expand",t,this),this.emit("expand.start",this),this.childTransition.once("open",(function(){this.emit("expand.complete",this)}),this).requestOpen(null,t),this},collapse(t){if(!1===this.expanded)return this;void 0===t&&(t=this.transitionDuration),this.expanded=!1;var e=this.childrenMap.title,i=this.childrenMap.child;return e.emit("folder.collapse",t,this),i.emit("folder.collapse",t,this),this.emit("collapse.start",this),this.childTransition.once("close",(function(){this.setChildScale(i,1,1).hide(i),this.reLayoutEnable&&(this.reLayoutTarget?this.reLayoutTarget:this.getTopmostSizer()).layout(),this.emit("collapse.complete",this)}),this).requestClose(null,t),this},toggle(t){return this.expanded?this.collapse(t):this.expand(t),this},setExpandedState(t){return this.reLayoutEnable=!1,void 0===t?this.expanded=void 0:t?this.expand(0):this.collapse(0),this.reLayoutEnable=!0,this}},Gm=function(t,e){ea.popUp.call(t,e,this.expandDirection)},Hm=function(t,e){ea.scaleDown.call(t,e,this.expandDirection)},Um={setTransitionDuration(t){return this.transitionDuration=t,this.childTransition.setTransitInTime(t).setTransitOutTime(t),this},setExpandCallback(t){return void 0===t&&(t=Gm.bind(this)),this.childTransition.setTransitInCallback(t),this},setCollapseCallback(t){return void 0===t&&(t=Hm.bind(this)),this.childTransition.setTransitOutCallback(t),this}};const Nm=Phaser.Utils.Objects.GetValue;let $m=class extends Ah{constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("orientation")||(e.orientation=1),super(t,e),this.type="rexFolder",this.reLayoutEnable=!0,this.expanded=void 0,this.expandDirection=1===this.orientation?"y":"x";var i=e.background,s=e.title,r=e.child;i&&this.addBackground(i);var n=Nm(e,"space"),a=1===this.orientation?"left":"top",o=Nm(e,"align.title",a),h=Nm(e,"expand.title",!0);this.add(s,{proportion:0,align:o,expand:h,padding:{left:Nm(n,"titleLeft",0),right:Nm(n,"titleRight",0),top:Nm(n,"titleTop",0),bottom:Nm(n,"titleBottom",0)}});var l=Nm(e,"toggleByTarget",void 0),d=Nm(e,"toggleClickConfig");if(void 0===l&&(l=s),l&&Oo.onClick.call(l,(function(){this.toggle()}),this,d),this.childTransition=new Fm(r),!Nm(e,"customChildOrigin",!1)){var c=this.rtl?1:0;r.setOrigin(c)}o=Nm(e,"align.child","left");var u=(h=Nm(e,"expand.child",!0))?1:0;this.add(r,{proportion:u,align:o,expand:h,padding:{left:Nm(n,"childLeft",0),right:Nm(n,"childRight",0),top:Nm(n,"childTop",0),bottom:Nm(n,"childBottom",0)}}),this.addChildrenMap("title",s),this.addChildrenMap("child",r),this.addChildrenMap("background",i);var p=e.transition;this.setTransitionDuration(Nm(p,"duration",200)),this.setExpandCallback(Nm(p,"expandCallback",void 0)),this.setCollapseCallback(Nm(p,"collapseCallback",void 0)),this.reLayoutTarget=Nm(e,"reLayoutTarget",void 0);var g=e.onExpandStart;g&&this.on("expand.start",g);var v=e.onExpandComplete;v&&this.on("expand.complete",v);var f=e.onCollapseStart;f&&this.on("collapse.start",f);var m=e.onCollapseComplete;m&&this.on("collapse.complete",m);var y=Nm(e,"expanded",void 0);void 0!==y&&this.setExpandedState(y)}};Object.assign($m.prototype,Vm,Um);var Km={setBindingTarget(t){return this.childrenMap.child.setBindingTarget(t),this}},Zm={getMaxInputRowTitleWidth(){return this.childrenMap.child.getMaxInputRowTitleWidth()+this.getInnerPadding("left")},setInputRowTitleWidth(t){return t-=this.getInnerPadding("left"),this.childrenMap.child.setInputRowTitleWidth(t),this}};class Jm extends $m{constructor(t,e){void 0===e&&(e={}),e.orientation=1,super(t,e),this.type="rexTweaker.Folder"}setTitle(t){return this.childrenMap.title.setTitle(t),this}}Object.assign(Jm.prototype,Km,Zm);const qm=Phaser.Utils.Objects.GetValue,Qm=Phaser.Utils.Objects.GetValue,ty=Ah.prototype.add,ey=Ah.prototype.addSpace;var iy=function(t){var e=!t.isRexSpace,i=!e||this.buttonsExpand?1:0;if(0===this.sizerChildren.length)if(e){!this.buttonsExpand&&("right"===this.buttonsAlign||"center"===this.buttonsAlign||"bottom"===this.buttonsAlign)&&ey.call(this),ty.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&ey.call(this),this.hasTailSpace=s}else ty.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;ty.call(this,t,{index:r,proportion:i,expand:!0})}else ty.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},sy={addButton(t){if(uo(t))for(var e=t,i=0,s=e.length;i=0;i--)ay.call(this,e[i],t);return this}},hy=function(t,e,i){if(t){var s=this.setValueCallback,r=this.setValueCallbackScope;s&&(r?s.call(r,t,e,i):s(t,e,i)),this.fireEvent("button.statechange",t,e,i)}},ly=function(t){var e=this;t._selected=void 0,Object.defineProperty(t,"selected",{get:function(){return t._selected},set:function(i){if(t._selected!==i){var s=t._selected;t._selected=i,hy.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},dy={add(t){return this.buttons.push(t),t._click||(t._click=new wo(t,this.clickConfig),t._click.on("click",(function(t,e,i,s){this.fireEvent("button.click",e,i,s)}),this).on("enable",(function(t,e){this.fireEvent("button.enable",e)}),this).on("disable",(function(t,e){this.fireEvent("button.disable",e)}),this).on("over",(function(t,e,i,s){this.fireEvent("button.over",e,i,s)}),this).on("out",(function(t,e,i,s){this.fireEvent("button.out",e,i,s)}),this).on("down",(function(t,e,i,s){this.fireEvent("button.down",e,i,s)}),this).on("up",(function(t,e,i,s){this.fireEvent("button.up",e,i,s)}),this),t.isRexContainerLite&&t.sendChildToBack(t)),this.buttonsType&&(void 0===t.name&&console.error(`${this.parent.constructor.name}: Option button miss value`),ly.call(this,t)),this},addMultiple(t){for(var e=0,i=t.length;e0},setButtonEnable(t,e){var i=this.buttons;if(void 0===t||"boolean"==typeof t){e=t;for(var s=0,r=i.length;sr&&wy.addNewLine(this)}else for(n=0,a=t.length;n=0;i--)Ty.call(this,e[i],t);return this}};const My=Phaser.Utils.Objects.GetValue;class Ey extends Jh{constructor(t,e){void 0===e&&(e={});var i=e.space;"number"==typeof i&&(e.space={item:i,line:i}),super(t,e),this.type="rexFixWidthButtons",this.buttonGroup=new my({parent:this,eventEmitter:My(e,"eventEmitter",this),groupName:My(e,"groupName",void 0),clickConfig:My(e,"click",void 0)}).setButtonsType(e);var s=My(e,"background",void 0),r=My(e,"buttons",void 0);this.buttonsAlign=My(e,"align",void 0),s&&this.addBackground(s),r&&this.addButtons(r),this.addChildrenMap("background",s),this.addChildrenMap("buttons",this.buttonGroup.buttons)}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.buttonGroup.destroy(),this.buttonGroup=void 0)}get buttons(){return this.buttonGroup.buttons}get groupName(){return this.buttonGroup.groupName}set groupName(t){this.buttonGroup.groupName=t}get eventEmitter(){return this.buttonGroup.eventEmitter}}Object.assign(Ey.prototype,Oy,_y,fy,by);var Ry=function(t,e,i,s){if(void 0===i)i=0;else{var r=typeof i;"boolean"===r?(s=i,i=0):"string"===r&&(i=Ly[i])}void 0===s?s={}:!0===s&&(s=Dy);var n=e.width/t.width,a=e.height/t.height,o=i?Math.max(n,a):Math.min(n,a);return s.width=t.width*o,s.height=t.height*o,s};const Ly={fit:0,FIT:0,envelop:1,ENVELOP:1};var Dy={},Ay={},By={};const jy=Phaser.Utils.Objects.IsPlainObject,Wy=Phaser.Utils.Objects.GetValue,zy=Phaser.Display.Align.CENTER,Yy=Phaser.Utils.String.UUID;var Iy={add:function(t,e,i,s,r,n,a,o,h,l){var d,c;un.call(this,t),jy(e)&&(e=Wy(u=e,"key",void 0),i=Wy(u,"align",zy),s=Wy(u,"padding",0),r=Wy(u,"expand",!0),t.isRexSizer||(n=Wy(u,"minWidth",t._minWidth),a=Wy(u,"minHeight",t._minHeighted)),o=Wy(u,"offsetX",0),h=Wy(u,"offsetY",0),d=Wy(u,"offsetOriginX",0),c=Wy(u,"offsetOriginY",0),l=Wy(u,"aspectRatio",0));var u,v=void 0!==e;return v||(e=Yy()),"string"==typeof i&&(i=Er[i]),void 0===i&&(i=zy),void 0===s&&(s=0),void 0===r&&(r=!0),t.isRexSizer||(void 0===n&&(n=t._minWidth),void 0===a&&(a=t._minHeight)),void 0===o&&(o=0),void 0===h&&(h=0),void 0===d&&(d=0),void 0===c&&(c=0),void 0===l?l=0:!0===l&&(l=p(t)/g(t)),l>0&&(r=!0,void 0===n&&(n=0),void 0===a&&(a=0)),(u=this.getSizerConfig(t)).align=i,u.padding=dn(s),jy(r)?(u.expandWidth=Wy(r,"width",!1),u.expandHeight=Wy(r,"height",!1)):(u.expandWidth=r,u.expandHeight=r),t.isRexSizer||(u.expandWidth&&(t.minWidth=void 0===n?p(t):n),u.expandHeight&&(t.minHeight=void 0===a?g(t):a)),u.alignOffsetX=o,u.alignOffsetY=h,u.alignOffsetOriginX=d,u.alignOffsetOriginY=c,u.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,v&&this.addChildrenMap(e,t),this}},Xy={remove(t,e){var i;if("string"==typeof t){if(i=t,!(t=this.sizerChildren[i]))return this}else{if(this.getParentSizer(t)!==this)return this;i=this.childToKey(t)}return i&&(delete this.sizerChildren[i],this.childrenMap.hasOwnProperty(i)&&delete this.childrenMap[i]),bn.call(this,t,e),this},removeAll(t){for(var e in this.sizerChildren)this.remove(e,t);return this},clear(t){for(var e in this.sizerChildren)delete this.sizerChildren[e],this.childrenMap.hasOwnProperty(e)&&delete this.childrenMap[e];return Ch.call(this,t),this}},Fy={getChildrenWidth:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var a in r)t=r[a],void 0===(i=this.getChildWidth(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).left+e.right)*this.scaleX,s=Math.max(i,s));return n?void 0:s+(this.space.left+this.space.right)*this.scaleX},getChildrenHeight:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var a in r)t=r[a],void 0===(i=this.getChildHeight(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).top+e.bottom)*this.scaleY,s=Math.max(i,s));return n?void 0:s+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(s.expandWidth){var r=e-(this.space.left+this.space.right)*this.scaleX,n=s.padding;i=r-(n.left+n.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(s.expandHeight){var r=e-(this.space.top+this.space.bottom)*this.scaleY,n=s.padding;i=r-(n.top+n.bottom)*this.scaleY}return i},getChildrenSizers:function(t){void 0===t&&(t=[]);var e,i=this.sizerChildren;for(var s in i)(e=i[s]).isRexSizer&&t.push(e);return t},layoutChildren:function(){var t,e,i,s,r,n,a,o,h,l,d,c,u=this.innerLeft,v=this.innerTop,f=this.innerWidth,m=this.innerHeight,y=this.sizerChildren;for(var b in y)(t=y[b]).rexSizer.hidden||(i=(e=t.rexSizer).padding,mo.call(this,t),l=this.getExpandedChildWidth(t),d=this.getExpandedChildHeight(t),e.aspectRatio>0&&(Ay.width=e.aspectRatio,Ay.height=1,By.width=l,By.height=d,l=(c=Ry(Ay,By,"FIT",!0)).width,d=c.height),t.isRexSizer?(t.runLayout(this,l,d),hh(t,this)):Wn(t,l,d),s=u+i.left*this.scaleX,n=f-(i.left+i.right)*this.scaleX,r=v+i.top*this.scaleY,a=m-(i.top+i.bottom)*this.scaleY,void 0===l&&(l=p(t)),void 0===d&&(d=g(t)),o=(e.alignOffsetX+e.alignOffsetOriginX*l)*this.scaleX,h=(e.alignOffsetY+e.alignOffsetOriginY*d)*this.scaleY,yo.call(this,t,s,r,n,a,e.align,o,h))}};Object.assign(Fy,Iy,Xy);const Vy=Phaser.Utils.Objects.IsPlainObject,Gy=Phaser.Utils.Objects.GetValue;class Hy extends oh{constructor(t,e,i,s,r,n){Vy(e)?(e=Gy(n=e,"x",0),i=Gy(n,"y",0),s=Gy(n,"width",void 0),r=Gy(n,"height",void 0)):Vy(s)&&(s=Gy(n=s,"width",void 0),r=Gy(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexOverlapSizer",this.sizerChildren={},this.addChildrenMap("items",this.sizerChildren)}childToKey(t){if("string"!=typeof t)return function(t,e){if(Array.isArray(t))return t.indexOf(e);for(var i in t)if(t[i]===e)return i;return null}(this.sizerChildren,t);var e=t;return this.sizerChildren.hasOwnPropery(e)?e:null}}Object.assign(Hy.prototype,Fy);const Uy=Hy.prototype.add;var Ny=function(t,e,i,s,r,n,a,o,h){return t.setVisible(!1),Uy.call(this,t,e,i,s,r,n,a,o,h),this},$y={add:Ny,addPage:Ny};const Ky=ss.prototype.setChildVisible;var Zy={getPage:function(t){return void 0===t?null:this.sizerChildren.hasOwnProperty(t)?this.sizerChildren[t]:null},swapPage:function(t,e){this._previousKey=this._currentKey;var i=this.previousPage;i&&(0===this.swapMode?(Ky.call(this,i,!1),this.emit("pageinvisible",i,this._previousKey,this)):i.destroy()),t&&!this.sizerChildren.hasOwnProperty(t)&&this.emit("createpage",t,this),this._currentKey=t;var s=this.currentPage;return s&&(Ky.call(this,s,!0),this.emit("pagevisible",s,this._currentKey,this),void 0===e&&(e=this.fadeInDuration),e>0&&s.setAlpha(0).fadeIn(e,1)),this},hasPage:function(t){return this.sizerChildren.hasOwnProperty(t)}};Object.assign(Zy,$y);const Jy=Phaser.Utils.Objects.GetValue;class qy extends Hy{constructor(t,e){super(t,e),this.type="rexPages",this.childrenMap=this.sizerChildren,this._previousKey=void 0,this._currentKey=void 0,this.setSwapMode(Jy(e,"swapMode",0)),this.setFadeInDuration(Jy(e,"fadeIn",0))}setSwapMode(t){return"string"==typeof t&&(t=Qy[t]),this.swapMode=t,this}setFadeInDuration(t){return this.fadeInDuration=t,this}get previousKey(){return this._previousKey}get currentKey(){return this._currentKey}set currentKey(t){this.swapPage(t)}get currentPage(){return this.getPage(this.currentKey)}get previousPage(){return this.getPage(this.previousKey)}get keys(){return Object.keys(this.sizerChildren)}}Object.assign(qy.prototype,Zy);const Qy={invisible:0,destroy:1},tb=Phaser.Utils.Objects.IsPlainObject,eb=Phaser.Utils.Objects.GetValue,ib=Phaser.Utils.String.UUID;var sb={swapPage:function(t,e){var i,s;return null!=(i="number"==typeof t?t:this.getPageIndex(t))&&(void 0!==e&&(s=this.childrenMap.pages.fadeInDuration,this.childrenMap.pages.fadeInDuration=e),this.childrenMap.tabs.emitButtonClick(i),void 0!==s&&(this.childrenMap.pages.fadeInDuration=s)),this},swapFirstPage:function(t){return this.swapPage(0,t),this},swapLastPage:function(t){var e=this.getElement("tabs.buttons").length-1;return this.swapPage(e,t),this}},rb={removePage(t,e){"number"==typeof t&&(t=this.getPageKey(t));var i=this.childrenMap.tabs,s=i.getByName(t),r=this.childrenMap.pages,n=r.getElement(t);return s&&n?(r.removeChildrenMap(t),i.removeButton(s,e),r.remove(n,e),this):this},removeAllPages(t){for(var e=this.getElement("tabs.buttons"),i=e.length-1;i>=0;i--)this.removePage(e[i].name,t);return this}},nb={top:1,left:3,right:5,bottom:7},ab={top:"bottom",left:"right",right:"left",bottom:"top"},ob={setTabsPadding(t,e){return this.childrenMap.tabs.setOuterPadding(t,e),this},getTabsPadding(t){return this.childrenMap.tabs.getOuterPadding(t)}},hb={getPageKey:function(t){var e=this.getElement("tabs.buttons");if(!(t>=e.length))return e[t].name},getPageIndex:function(t){for(var e=this.getElement("tabs.buttons"),i=0,s=e.length;i0,setInputRowTitleWidth(t){return this}};const Pb=Phaser.Utils.Objects.GetValue;class Tb extends Ah{constructor(t,e){void 0===e&&(e={}),e.orientation="y",super(t,e),this.type="rexTweaker.Wrap";var i=Pb(e,"background",void 0),s=Pb(e,"title",void 0);i&&this.addBackground(i),s&&this.add(s,{expand:!0,space:{bottom:Pb(e,"space.title",0)}});var r=Pb(e,"child",void 0);this.add(r,{expand:!0}),this.addChildrenMap("title",s),this.addChildrenMap("child",r)}setTitle(t){var e=this.childrenMap.title;return t.title||t.icon?e.show().setTitle(t):e.hide(),this}}Object.assign(Tb.prototype,Ob,kb);const _b=Phaser.Utils.Objects.GetValue,Mb=Phaser.Utils.Objects.GetValue;var Eb=function(t){return t.hasOwnProperty("geometryMask")?t.geometryMask:t.bitmapMask};const Rb=Phaser.Geom.Intersects.RectangleToRectangle,Lb=Phaser.Geom.Rectangle.Overlaps;var Db=function(t){if(!t.displayList)return!1;for(;;){var e=t.rexContainer;if(e){if(e.visible){var i=e.parent;if(i){t=i;continue}return!0}return!1}return t.visible}},Ab=function(t,e){var i=e.top,s=e.bottom,r=e.left,n=e.right,a=0;return a+=t.contains(r,i)?1:0,a+=t.contains(r,s)?1:0,a+=t.contains(n,i)?1:0,a+=t.contains(n,s)?1:0},Bb=function(t,e,i){e.hasOwnProperty("isRexContainerLite")?(e.syncChildrenEnable=!1,t.setChildMaskVisible(e,!0),e.syncChildrenEnable=!0):(e.clearMask&&e.clearMask(),t.setChildMaskVisible(e,!0))},jb=function(t,e,i){e.hasOwnProperty("isRexContainerLite")?(e.syncChildrenEnable=!1,t.setChildMaskVisible(e,!0),e.syncChildrenEnable=!0):(e.setMask&&e.setMask(i),t.setChildMaskVisible(e,!0))},Wb=function(t,e,i){e.hasOwnProperty("isRexContainerLite")?(e.syncChildrenEnable=!1,t.setChildMaskVisible(e,!1),e.syncChildrenEnable=!0):(e.clearMask&&e.clearMask(),t.setChildMaskVisible(e,!1))};const zb=Phaser.Utils.Objects.GetValue,Yb={update:0,everyTick:1};var Ib={setupChildrenMask(t){return!1===t||(this.setMaskUpdateMode(zb(t,"updateMode",0)),this.enableChildrenMask(zb(t,"padding",0)),this.setMaskLayer(zb(t,"layer",void 0)),this.onMaskGameObjectVisible=zb(t,"onVisible"),this.onMaskGameObjectInvisible=zb(t,"onInvisible"),this.maskGameObjectCallbackScope=zb(t,"scope"),this.startMaskUpdate()),this},destroyChildrenMask(){return this.childrenMask?(this.stopMaskUpdate(),this.childrenMask.destroy(),this.childrenMask=void 0,this.onMaskGameObjectVisible=null,this.onMaskGameObjectInvisible=null,this.maskGameObjectCallbackScope=null,this):this},setMaskUpdateMode(t){return"string"==typeof t&&(t=Yb[t]),this.maskUpdateMode=t,this},startMaskUpdate(){this.scene.game.events.on("poststep",this.maskChildren,this)},stopMaskUpdate(){this.scene.game.events.off("poststep",this.maskChildren,this)},enableChildrenMask(t){var e=gl.call(this,null,this,0,t);return this.childrenMask=e.createGeometryMask(),this},setMaskChildrenFlag(t){return void 0===t&&(t=!0),this.maskChildrenFlag=t,this},setMaskLayer(t){return this.maskLayer=t,this},maskChildren(){return this.childrenMask&&this.maskChildrenFlag&&0!==this.alpha&&this.visible?(this.privateRenderLayer?this.privateRenderLayer.setMask(this.childrenMask):this.maskLayer?(this.addToLayer(this.maskLayer),this.maskLayer.setMask(this.childrenMask)):function({parent:t,mask:e,children:i,onVisible:s,onInvisible:r,scope:n}){if(e){void 0===i&&(i=t.getAllChildren());for(var a,o,h,l=!!s||!!r,d=t.getBounds(),c=Eb(e),u=0,p=i.length;uthis.topChildOY}childOYExeceedBottom(t){return void 0===t&&(t=this.childOY),tthis.leftChildOX}childOXExeceedRight(t){return void 0===t&&(t=this.childOX),tthis.childHeight?t=0:s?t=e:r&&(t=i)),this._childOY!==t&&(this._childOY=t,this.resetChildPosition()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}get childOX(){return this._childOX}set childOX(t){var e=this.leftChildOX,i=this.rightChildOX,s=this.childOXExceedLeft(t),r=this.childOXExeceedRight(t);this.clampChildOX&&(this.childVisibleWidth>this.childWidth?t=0:s?t=e:r&&(t=i)),this._childOX!==t&&(this._childOX=t,this.resetChildPosition()),s&&(this.execeedLeftState||this.emit("execeedleft",this,t,e)),this.execeedLeftState=s,r&&(this.execeedRightState||this.emit("execeedright",this,t,i)),this.execeedRightState=r}setChildOY(t){return this.childOY=t,this}setChildOX(t){return this.childOX=t,this}set t(t){this.childOY=-this.visibleHeight*t}get t(){var t=this.visibleHeight;return 0===t?0:this.childOY/-t}set s(t){this.childOX=-this.visibleWidth*t}get s(){var t=this.visibleWidth;return 0===t?0:this.childOX/-t}setChildOYByPercentage(t){return this.t=t,this}setChildOXByPercentage(t){return this.s=t,this}}Object.assign(Hb.prototype,Xb);const Ub=["top","bottom","centerY","center"],Nb=["left","right","centerX","center"];var $b=function(t,e,i){var s,r="Y"===(e=e.toUpperCase()),n=this.childrenMap.child;if(r){if(i)for(var a=0,o=Ub.length;a=0?0:Math.abs(l)<=Math.abs(d)?l:d}}else{if(i)for(a=0,o=Nb.length;a=0?0:Math.abs(c)<=Math.abs(u)?c:u}}switch(this.scrollMode){case 0:case 1:this.childOY+=s;break;default:this[`childO${e}`]+=s}};const Kb=Phaser.Utils.Objects.GetValue;class Zb extends im{constructor(t,e){void 0===e&&(e={});var i=Dv(e),s=Kb(e,"panel",void 0);void 0===s&&(s={}),s.scrollMode=i,s.clampChildOY=Kb(e,"clampChildOY",!1),s.clampChildOX=Kb(e,"clampChildOX",!1);var r,n,a=new Hb(t,s);switch(t.add.existing(a),i){case 0:r=Kb(e,"expand.panel",!0),n=!0;break;case 1:r=!0,n=Kb(e,"expand.panel",!0);break;default:r=!0,n=!0}e.type="rexScrollablePanel",e.child={gameObject:a,expandWidth:r,expandHeight:n,align:Kb(e,"align.panel","center")};var o=Kb(e,"space",void 0);o&&(o.child=Kb(o,"panel",0)),super(t,e),this.addChildrenMap("panel",a.child),this.addChildrenMap("panelLayer",a.maskLayer),this.addChildrenMap("mask",a.maskGameObject),this.addChildrenMap("scrollableBlock",a)}setChildrenInteractive(t){return void 0===t&&(t={}),t.hasOwnProperty("eventEmitter")||(t.eventEmitter=this),t.hasOwnProperty("targets")||(t.targets=[this.childrenMap.panel]),rh(this.childrenMap.child,t),this}}var Jb={scrollToChild:function(t,e){if(!this.hasChild(t))return this;switch(this.scrollMode){case 0:$b.call(this,t,"y",e);break;case 1:$b.call(this,t,"x",e);break;default:$b.call(this,t,"y",e),$b.call(this,t,"x",e)}return this}};Object.assign(Zb.prototype,Jb);var qb={setBindingTarget(t){return this.childrenMap.panel.setBindingTarget(t),this}},Qb={getMaxInputRowTitleWidth(){return this.childrenMap.panel.getMaxInputRowTitleWidth()+this.getInnerPadding("left")},setInputRowTitleWidth(t){return t-=this.getInnerPadding("left"),this.childrenMap.panel.setInputRowTitleWidth(t),this}};class tx extends Zb{constructor(t,e){super(t,e),this.type="rexTweaker.Scrollable"}setTitle(t){var e=this.childrenMap.header;return t.title||t.icon?e.show().setTitle(t):e.hide(),this}}Object.assign(tx.prototype,qb,Qb);const ex=Phaser.Utils.Objects.GetValue,ix=Phaser.Utils.Objects.GetValue,sx=Phaser.Utils.Objects.GetValue;var rx={setupBinding(){return this.childrenMap.inputField.on("valuechange",(function(t){this.autoUpdateEnable&&this.setTargetValue(t)}),this),this},setAutoUpdateEnable(t){return void 0===t&&(t=!0),this.autoUpdateEnable=t,this},setBindingTarget(t,e){this.bindingTarget=t,void 0!==e&&this.setBindingTargetKey(e),this.syncTargetValue();var i=this.childrenMap.inputField;return i.onBindTarget&&i.onBindTarget(t,e),this},setBindingTargetKey(t){return this.bindTargetKey=t,this},setValueCallbacks(t){return this.onGetValue=sx(t,"onGetValue"),this.onSetValue=sx(t,"onSetValue"),this},getTargetValue(){if(this.bindingTarget)return null!=this.bindTargetKey?this.bindingTarget[this.bindTargetKey]:this.onGetValue?this.onGetValue(this.bindingTarget):void 0},setTargetValue(t){return this.bindingTarget?null!=this.bindTargetKey?(this.bindingTarget[this.bindTargetKey]=t,this):(this.onSetValue&&this.onSetValue(this.bindingTarget,t),this):this},syncTargetValue(){if(!this.bindingTarget)return this;var t=this.childrenMap.inputField;return t.syncValue&&t.syncValue(this.getTargetValue()),this}},nx={startMonitorTarget(){return this.isMonitoring||(this.isMonitoring=!0,this.scene.events.on("postupdate",this.onMonitorTarget,this)),this},stopMonitorTarget(){return this.isMonitoring?(this.isMonitoring=!1,this.scene.events.off("postupdate",this.onMonitorTarget,this),this):this},onMonitorTarget(){if(this.bindingTarget){var t=this.getTargetValue(),e=this.childrenMap.inputField;e.value!==t&&e.syncValue(t)}}},ax={getMinTitleWidth(){var t=this.childrenMap.title;if(!t||0!==t.orientation)return 0;var e=t.rexSizer.padding;return this.getChildWidth(this.childrenMap.title)+(e.left+e.right)*t.scaleX+this.getInnerPadding("left")},setMinTitleWidth(t){var e=this.childrenMap.title;if(!e||0!==e.orientation)return this;var i=e.rexSizer.padding;return t-=(i.left+i.right)*e.scaleX,e.minWidth=t,this}};const ox=Phaser.Utils.Objects.GetValue;class hx extends Ah{constructor(t,e){super(t,e),this.type="rexTweaker.InputRow",this.bindingTarget=void 0,this.bindTargetKey=void 0,this.autoUpdateEnable=!0;var i,s=e.inputTitle,r=e.inputField,n=e.background,a=ox(e,"proportion.title",0),o=ox(e,"space.title",0);i=0===this.orientation?{right:o}:{bottom:o},this.add(s,{proportion:a,expand:!0,padding:i});var h=r.defaultProportion;void 0===h&&(h=e.defaultExpandWidth?1:0),a=ox(e,"proportion.inputField",h),this.add(r,{proportion:a,expand:!0}),n&&this.addBackground(n),this.addChildrenMap("title",s),this.addChildrenMap("inputField",r),this.addChildrenMap("background",n),this.setupBinding()}destroy(t){this.scene&&!this.ignoreDestroy&&(this.stopMonitorTarget(),super.destroy(t))}setTitle(t){return this.childrenMap.title.setTitle(t),this}preLayout(){var t=this.childrenMap.title;t&&(t.minWidth=0),super.preLayout()}}Object.assign(hx.prototype,rx,nx,ax);var lx=function(t,e,i){var s=new km(t,i);return t.add.existing(s),s},dx=function(t){return void 0===t&&(t=Ah),class extends t{get bindingTarget(){return this.getParentSizer().bindingTarget}get bindingKey(){return this.getParentSizer().bindTargetKey}get value(){return this._value}get root(){return this.getParentSizer().getParentSizer().root}onBindTarget(t,e){this.onBindTargetCallback&&this.onBindTargetCallback(this,t,e)}validate(t){return!(!this.syncValueFlag&&this.validateCallback)||this.validateCallback(t,this._value,this.bindingTarget,this.bindingKey)}getFotmatText(t){return t=this.textFormatCallback?this.textFormatCallback(t):t.toString()}set value(t){if(this._value!==t&&(this.validate(t)||(t=this._value),this.filterValueCallback&&(t=this.filterValueCallback(this,t)),this.displayValueCallback&&this.displayValueCallback(this,t),this._value!==t)){var e=this._value;if(this._value=t,!this.syncValueFlag){var i=this.bindingTarget,s=this.bindingKey;this.emit("valuechange",t,e,i,s),this.root.emit("valuechange",t,e,i,s)}}}getValue(){return this.value}setValue(t){return this.value=t,this}syncValue(t){return this.syncValueFlag=!0,this.value=t,this.syncValueFlag=!1,this}setup(t,e){return void 0===e&&(e=!1),(e||t.hasOwnProperty("format"))&&this.setTextFormatCallback(t.format),(e||t.hasOwnProperty("onValidate"))&&this.setValidateCallback(t.onValidate),this.setupCallback&&this.setupCallback(this,t,e),this}setSetupCallback(t){return this.setupCallback=t,this}setFilterValueCallback(t){return this.filterValueCallback=t,this}setDisplayValueCallback(t){return this.displayValueCallback=t,this}setOnBindTargetCallback(t){return this.onBindTargetCallback=t,this}setTextFormatCallback(t){return this.textFormatCallback=t,this}setValidateCallback(t){return this.validateCallback=t,this}}},cx=function(t,e,i){for(var s,r=this.inputHandlers,n=0,a=r.length;n0?0:1,0===n.minWidth&&n.setMinWidth(this.itemWidth)),0===n.minHeight&&n.setMinHeight(this.itemHeight),this.add(n,{proportion:r,expand:!0})),i.onValueChange&&n.childrenMap.inputField.on("valuechange",i.onValueChange),n.setAutoUpdateEnable(i.autoUpdate),n.setBindingTarget(t,e),i.monitor&&n.startMonitorTarget(),i.key&&this.root.addChildrenMap(i.key,n),this):(console.error(`[Tweaker] Can't add Input\n title: ${i.title}\n view: ${i.view}\n`),this)},addButtons:function(t){void 0===t&&(t={});var e=this.scene,i=t.bindingTarget;delete t.bindingTarget;var s=mx(this.styles,"inputRow")||{},r=fx(e,t,s);return this.add(r,{expand:!0}),i&&r.setBindingTarget(i),t.key&&this.root.addChildrenMap(t.key,r),this},addButton:function(t){return void 0===t&&(t={}),t.buttons=[{label:t.label,callback:t.callback}],delete t.label,delete t.callback,this.addButtons(t),this},addSeparator:function(t){void 0===t&&(t={});var e=function(t,e,i){return Vp(t,Im(e,i))}(this.scene,t,yx(this.styles,"separator"));return this.add(e,{expand:!0}),this},addRows:function(t,e,i){return"boolean"==typeof e&&(i=e,e=void 0),void 0===i&&(i=!0),bx(this,We(t),e,i),this},setBindingTarget:function(t){for(var e=this.sizerChildren,i=0,s=e.length;i=r&&h=i&&hi.length&&(t.prevCursorPosition=null),null!==t.prevCursorPosition&&(s=e.getCharChild(t.prevCursorPosition))&&("\n"===s.text&&s.clearTextSize(),e.emit("cursorout",s,t.prevCursorPosition,e)),null!=r&&(s=e.getCharChild(r))&&("\n"===s.text&&s.copyTextSize(e.lastInsertCursor),function(t){var e,i,s=t.parent,r=s.width,n=s.height,a=t.drawX,o=t.drawY,h=a+t.drawTLX,l=a+t.drawTRX,d=o+t.drawTLY,c=o+t.drawBLY;e=h<0?0-h:l>r?r-l:0,i=d<0?0-d:c>n?n-c:0,s._textOX+=e,s._textOY+=i}(s),e.emit("cursorin",s,r,e)),e.emit("movecursor",r,t.prevCursorPosition,e),t.prevCursorPosition=r)}(this)):(Yx(this),Ix(this)),this}setNumberInput(){return this.onUpdateCallback=zx,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}}const Vx=Phaser.Utils.Objects.GetValue,Gx=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var Hx=function(t,e){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return!0;if(-1!==e.indexOf(".")){for(var i=e.split("."),s=t,r=0;rt.length?i:t})),a.value=t.join(e)}else a.value=t.join(i.slice(o,o+a.count));o+=a.count,a.added||(h+=a.count)}}let l=e[a-1];return a>1&&"string"==typeof l.value&&(l.added||l.removed)&&t.equals("",l.value)&&(e[a-2].value+=l.value,e.pop()),e}qx.prototype={diff(t,e,i={}){let s=i.callback;"function"==typeof i&&(s=i,i={}),this.options=i;let r=this;function n(t){return s?(setTimeout((function(){s(void 0,t)}),0),!0):t}t=this.castInput(t),e=this.castInput(e),t=this.removeEmpty(this.tokenize(t));let a=(e=this.removeEmpty(this.tokenize(e))).length,o=t.length,h=1,l=a+o;i.maxEditLength&&(l=Math.min(l,i.maxEditLength));let d=[{newPos:-1,components:[]}],c=this.extractCommon(d[0],e,t,0);if(d[0].newPos+1>=a&&c+1>=o)return n([{value:this.join(e),count:e.length}]);function u(){for(let s=-1*h;s<=h;s+=2){let h,l=d[s-1],c=d[s+1],u=(c?c.newPos:0)-s;l&&(d[s-1]=void 0);let p=l&&l.newPos+1=a&&u+1>=o)return n(Qx(r,h.components,e,t,r.useLongestToken));d[s]=h}else d[s]=void 0}var i;h++}if(s)!function t(){setTimeout((function(){if(h>l)return s();u()||t()}),0)}();else for(;h<=l;){let t=u();if(t)return t}},pushComponent(t,e,i){let s=t[t.length-1];s&&s.added===e&&s.removed===i?t[t.length-1]={count:s.count+1,added:e,removed:i}:t.push({count:1,added:e,removed:i})},extractCommon(t,e,i,s){let r=e.length,n=i.length,a=t.newPos,o=a-s,h=0;for(;a+1t,tokenize:t=>t.split(""),join:t=>t.join("")};const tC=new qx,eC=/^[a-zA-Z\u{C0}-\u{FF}\u{D8}-\u{F6}\u{F8}-\u{2C6}\u{2C8}-\u{2D7}\u{2DE}-\u{2FF}\u{1E00}-\u{1EFF}]+$/u,iC=/\S/,sC=new qx;sC.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!iC.test(t)&&!iC.test(e)},sC.tokenize=function(t){let e=t.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/);for(let t=0;tvoid 0===i?e:i}=this.options;return"string"==typeof t?t:JSON.stringify(oC(t,null,null,i),i," ")},aC.equals=function(t,e){return qx.prototype.equals.call(aC,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const hC=new qx;hC.tokenize=function(t){return t.slice()},hC.join=hC.removeEmpty=function(t){return t};const lC=Phaser.Utils.Array.Remove;var dC=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),lC(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(h=i,l=e,tC.diff(h,l,d)),r=0,n=0,a=s.length;nr)i+=a;else{if(s!==r)break;i+=Math.min(e.position,a)}}return i},vC={cursorMoveLeft(){if(!this.isOpened)return this;var t=uC(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=uC(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=pC(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=uC(gC(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=pC(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=uC(gC(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const fC=Phaser.Utils.Objects.IsPlainObject;class mC extends jc{constructor(t,e,i,s,r,n){fC(e)?n=e:fC(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(Hx(e,"wrap.vAlign")||Xe(e,"wrap.vAlign",s=i?"center":"top"),Hx(e,"wrap.wrapMode")||Xe(e,"wrap.wrapMode","char"),Hx(e,"wrap.maxLines")||Xe(e,"wrap.maxLines",s=i?1:void 0),i&&Xe(e,"wrap.wrapWidth",1/0),Hx(e,"wrap.useDefaultTextHeight")||Xe(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!Hx(e.edit,"inputType")){var s=i?"text":"textarea";Xe(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new Nx(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var a=n.text;a&&delete n.text;var o=uu(n.background,"focus"),h=uu(n.style,"cursor"),l=uu(n.style,"range");super(t,e,i,s,r,n),this.type="rexCanvasInput",this.contentWidth=void 0,this.contentHeight=void 0,this.lineHeight=void 0,this.linesCount=void 0,this.characterCountOfLines=[],this._text,this.textEdit=function(t,e){var i=Vx(e,"edit");return void 0===i&&(i={}),kx(e,i,Gx),new Fx(t,i)}(this,n),$x.call(this),n.focusStyle&&Object.assign(o,n.focusStyle),Jx.call(this,o),n.cursorStyle&&Object.assign(h,n.cursorStyle),Kx.call(this,h),n.rangeStyle&&Object.assign(l,n.rangeStyle),Xs(l)&&Object.assign(l,h),Zx.call(this,l);var d=n.onAddChar;d&&this.on("addchar",d);var c=n.onCursorIn;c&&this.on("cursorin",c);var u=n.onCursorOut;u&&this.on("cursorout",u);var p=!n.onRangeIn&&!n.onRangeOut,g=p?n.onCursorIn:n.onRangeIn;g&&this.on("rangein",g);var v=p?n.onCursorOut:n.onRangeOut;v&&this.on("rangeout",v);var f,m=n.onMoveCursor;m&&this.on("movecursor",m),this.setParseTextCallback(n.parseTextCallback),this.lastInsertCursor=((f=this.createCharChild("|")).text="",f),a||(a=""),this.setText(a)}addChild(t,e){if(super.addChild(t,e),Array.isArray(t))for(var i=t,s=0,r=i.length;st.hasOwnProperty("view")?"string"===t.view:"string"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.TextInput";var s=e.inputText,r=bC(i,s);t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))}},CC={setText(t){return this.childrenMap.child.setText(t),this},appendText(t){return this.setText(this.text+t),this}},wC={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const SC=Phaser.Utils.Objects.GetValue;class OC extends im{constructor(t,e){void 0===e&&(e={});var i,s=SC(e,"text");Ui(s)?i=s:(void 0===s&&(s={}),s.textArea=!0,i=new mC(t,s),t.add.existing(i)),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textVisibleHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.contentHeight}})}(i);var r=void 0===s.width,n=void 0===s.height;r&&(i.minWidth=0),n&&(i.minHeight=0),e.scrollMode=0,e.type="rexTextAreaInput",e.child={gameObject:i,expandWidth:r,expandHeight:n};var a,o,h=SC(e,"space",void 0);h&&(h.child=SC(h,"text",0)),e.scroller=!1,super(t,e),this.addChildrenMap("text",i),i.on("cursorin",(function(){var t=i.textOY,e=i.contentHeight,s=a!==t,r=o!==e;a=t,o=e,r&&this.resizeController(),(s||r)&&(this.t=i.t)}),this),i.on("textchange",(function(t){this.emit("textchange",t,this)}),this).on("close",(function(){this.emit("close",this.text,this)}),this);var l=SC(e,"content",void 0);l&&this.setText(l)}get text(){return this.childrenMap.child.text}set text(t){t=null==t?"":t.toString(),this.childrenMap.child.text!==t&&this.setText(t)}get lineHeight(){return this.childrenMap.child.lineHeight}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.contentHeight}get readOnly(){return this.childrenMap.child.readOnly}set readOnly(t){this.childrenMap.child.readOnly=t}setReadOnly(t){return this.childrenMap.child.setReadOnly(t),this}get value(){return this.text}set value(t){this.text=t}}Object.assign(OC.prototype,CC,wC);var kC={name:"TextAreaInput",accept:t=>!!t.hasOwnProperty("view")&&"textarea"===t.view,build(t,e){var i=t.scene;this.type="rexTweaker.TextAreaInput";var s=e.inputTextArea;void 0===s&&(s={}),s.hasOwnProperty("text")||(s.text=e.inputText),s.hasOwnProperty("slider")||(s.slider=e.slider);var r=function(t,e,i){void 0===i&&(i=!0),i?e=e?We(e):{}:e||(e={});var s=new OC(t,e);return t.add.existing(s),s}(i,s);t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))},onBindTarget(t){t.childrenMap.inputText.scrollToTop()}},PC={name:"NumberInput",accept:t=>t.hasOwnProperty("view")?"number"===t.view:"number"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.NumberInput";var s=e.inputNumber||e.inputText,r=bC(i,s).setNumberInput();t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly),t.isFloatType=!e.int},filterValue:(t,e)=>t.isFloatType?e:Math.floor(e),displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))}};const TC=Phaser.Utils.Objects.GetValue,_C=Phaser.Math.Linear,MC=Phaser.Math.Snap.Floor;var EC={name:"RangeInput",accept:t=>t.hasOwnProperty("view")?"range"===t.view:"number"==typeof t.value&&t.hasOwnProperty("min")&&t.hasOwnProperty("max"),build(t,e){var i=t.scene;t.type="rexTweaker.RangeInput";var s=e.slider,r=0===t.orientation?"track.height":"track.width",n=TC(s,r),a=function(t,e){var i=new Pf(t,e);return t.add.existing(i),i}(i,s),o=e.defaultExpandWidth?2:0,h=TC(e,"proportion.range.slider",o),l=void 0===n;t.add(a,{proportion:h,expand:l,key:"slider"});var d=e.inputNumber||e.inputText,c=bC(i,d).setNumberInput();o=e.defaultExpandWidth?1:0,h=TC(e,"proportion.range.inputText",o),t.add(c,{proportion:h,expand:!0,key:"inputText"}),c.on("close",(function(){t.setValue(c.value)})),a.on("valuechange",(function(){var e=_C(t.minValue,t.maxValue,a.value);t.step&&(e=MC(e,t.step,t.minValue)),t.setValue(e)}))},setup(t,e,i){(i||e.hasOwnProperty("max"))&&function(t,e,i,s){t.minValue=e,t.maxValue=i,t.step=s,t.childrenMap.slider.setGap(s,e,i)}(t,e.min,e.max,e.step),(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.slider.setValue(e,t.minValue,t.maxValue),t.childrenMap.inputText.setText("").setText(t.getFotmatText(e))}},RC=function(t,e){var i=new Cy(t,e);return t.add.existing(i),i};const LC=Phaser.Utils.Objects.GetValue;var DC={name:"RangeInput",accept:t=>!!t.hasOwnProperty("view")&&"incdec"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.IncDecInput";var s=LC(e,"incDec")||{},r={text:null,action:null},n=RC(i,{expand:!1}),a=e.defaultExpandWidth?1:0;t.add(n,{proportion:a,expand:!0});var o=e.inputNumber||e.inputText,h=bC(i,o).setNumberInput();h.on("close",(function(){t.setValue(h.value)}));var l=Object.assign(We(r),s.incButton||{}),d=vb(i,l),c=Object.assign(We(r),s.decButton||{}),u=vb(i,c);n.addButton(d),n.addButton(u);var p=s.inputTextIndex||0;n.insert(p,h,{proportion:1,expand:!0}),t.step=1,t.minValue=void 0,t.maxValue=void 0,n.on("button.click",(function(e,i,s,r){var n=t.value;0===i?n+=t.step:n-=t.step,void 0!==t.maxValue&&n>t.maxValue&&(n=t.maxValue),void 0!==t.minValue&&n0&&{height:this.colorComponentsHeight,formatLabel:this.colorComponentsFormatLabelConfig,inputText:this.colorComponentsInputTextConfig,space:this.colorComponentsSpace};var a=new Pw(t,{width:s,height:n,background:e,space:this.colorPickerSpace,hPalette:{position:this.colorPickerHPalettePosition},colorComponents:r,value:this.value});return t.add.existing(a),a};const _w=Phaser.Utils.Objects.GetValue;var Mw=function(t,e){var i=_w(e,"expandDirection",void 0);"string"==typeof i&&(i=Ew[i]);var s,r,n,a,o,h,l,d=(n="alignTargetX",Hx(s=e,r="alignTarget")?F(s,r):n&&Hx(s,n)?F(s,n):a&&Hx(s,a)?F(s,a):o),c=_w(e,"alignTargetY",d),u=_w(e,"alignOffsetX",0),p=_w(e,"alignOffsetY",0),g=_w(e,"alignSide","").includes("right"),v=_w(e,"bounds"),f=0===i,m=!(f||1===i),y=g?1:0,b=f||m?0:1;t.setOrigin(y,b),h=g?d.getTopRight().x:d.getTopLeft().x,l=c.getBottomLeft().y,t.setPosition(h+u,l+p);var x=v;x||(x=le(t.scene)),m&&t.getBottomLeft().y>x.bottom&&(l=c.getTopLeft().y,t.setOrigin(0,1).setPosition(h+u,l+p))};const Ew={down:0,up:1},Rw=Phaser.Utils.Objects.GetValue;class Lw extends Za{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=function(t,e){Kn(t,e,"y","Cubic")}),null==e.transitOut&&(e.transitOut=function(t,e){!function(t,e,i,s,r){void 0===s&&(s="Linear");var n={mode:0};switch(i){case 0:case"x":n.end={x:0};break;case 1:case"y":n.end={y:0};break;default:n.end=0}n.duration=e,n.ease=s,void 0===r?r=new Nn(t,n):r.resetFromJSON(n),r.restart()}(t,e,"y","Linear")}),e.manualClose=!0,e.clickOutsideClose=!0,e.destroy=!0,super(t,e),Mw(t,e),t.isRexSizer&&t.layout();var i=Rw(e,"touchOutsideClose",!1),s=Rw(e,"anyTouchClose",!1);s&&(i=!1),s?this.once("open",this.anyTouchClose,this):i&&this.once("open",this.touchOutsideClose,this),this.requestOpen()}shutdown(t){this.isShutdown||(this.scene.input.off("pointerup",this.touchCloseCallback,this),super.shutdown(t))}touchOutsideClose(){return this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&_(this.parent,t.worldX,t.worldY)||this.requestClose()}onOpen(){this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.parent,this),super.onClose()}}var Dw={openColorPicker:function(){if(!this.colorPicker){var t=Tw.call(this).layout(),e=new Lw(t,{duration:{in:this.colorPickerEaseInDuration,out:this.colorPickerEaseOutDuration},transitIn:this.colorPickerTransitInCallback,transitOut:this.colorPickerTransitOutCallback,expandDirection:this.colorPickerExpandDirection,alignTargetX:this,alignTargetY:this,bounds:this.colorPickerBounds,touchOutsideClose:!0}).on("open",(function(){t.on("valuechange",(function(t){this.setValue(t)}),this)}),this).on("close",(function(){this.colorPicker=void 0,this.dropDownBehavior=void 0}),this);return this.colorPicker=t,this.dropDownBehavior=e,this.pin(t),this}}};Object.assign(Dw,NC);const Aw=Phaser.Utils.Objects.GetValue;class Bw extends UC{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexColorInput",e.hasOwnProperty("colorPicker")||(e.colorPicker={background:{color:0}});var i=e.colorPicker,s=!1!==i&&null!==i;if(s){var r;this.setColorPickerSize(Aw(i,"width",160),Aw(i,"height",170));var n=Aw(i,"background");r=n?function(t){return Vp(t,n)}:Aw(i,"createBackgroundCallback"),this.setCreateColorPickerBackgroundCallback(r),this.setColorPickerHPalettePosition(Aw(i,"hPalettePosition",0)),this.setColorPickerExpandDirection(Aw(i,"expandDirection")),this.setColorPickerEaseInDuration(Aw(i,"easeIn",200)),this.setColorPickerEaseOutDuration(Aw(i,"easeOut",200)),this.setColorPickerTransitInCallback(Aw(i,"transitIn")),this.setColorPickerTransitOutCallback(Aw(i,"transitOut")),this.setColorPickerBounds(Aw(i,"bounds"));var a=Aw(i,"space");void 0===a&&(a={left:10,right:10,top:10,bottom:10,item:8}),this.setColorPickerSpace(a)}var o=e.colorComponents;if(s&&!1!==o&&null!==o){this.setColorComponentsHeight(Aw(o,"height",30)),this.setColorComponentsFormatLabelConfig(Aw(o,"formatLabel"));var h=Aw(o,"inputText");h||(h=Aw(e,"inputText")),this.setColorComponentsInputTextConfig(h);var l=Aw(o,"space");void 0===l&&(l={item:8}),this.setColorComponentsSpace(l)}var d=this.childrenMap.swatch;d&&s&&this.onClick(d,this.openColorPicker,this)}}Object.assign(Bw.prototype,Dw);var jw={name:"ColorInput",accept:t=>!!t.hasOwnProperty("view")&&"color"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.ColorInput";var s=e.colorInput;void 0===s&&(s={}),s.hasOwnProperty("inputText")||(s.inputText=e.inputText);var r=function(t,e,i){void 0===i&&(i=!0),i?e=e?We(e):{}:e||(e={});var s=new Bw(t,e);return t.add.existing(s),s}(i,s);t.add(r,{proportion:1,expand:!0,key:"colorInput"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.colorInput.setValue(e)}},Ww={setBoxFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.boxFillColor!==t||this.boxFillAlpha!==e,this.boxFillColor=t,this.boxFillAlpha=e,this},setUncheckedBoxFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.uncheckedBoxFillColor!==t||this.uncheckedBoxFillAlpha!==e,this.uncheckedBoxFillColor=t,this.uncheckedBoxFillAlpha=e,this},setBoxStrokeStyle(t,e,i){return void 0===i&&(i=1),this.dirty=this.dirty||this.boxLineWidth!==t||this.boxStrokeColor!==e||this.boxStrokeAlpha!==i,this.boxLineWidth=t,this.boxStrokeColor=e,this.boxStrokeAlpha=i,this},setUncheckedBoxStrokeStyle(t,e,i){return void 0===i&&(i=1),this.dirty=this.dirty||this.uncheckedBoxLineWidth!==t||this.uncheckedBoxStrokeColor!==e||this.uncheckedBoxStrokeAlpha!==i,this.uncheckedBoxLineWidth=t,this.uncheckedBoxStrokeColor=e,this.uncheckedBoxStrokeAlpha=i,this},setCheckerStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.checkerColor!==t||this.checkAlpha!==e,this.checkerColor=t,this.checkAlpha=e,this},setBoxShape(t){return void 0===t&&(t=!1),this.isCircleShape===t||(this.isCircleShape=t,this.isSizeChanged=!0,this.dirty=!0),this}},zw={setBoxSize(t){return this.dirty=this.dirty||this.boxSize!==t,this.boxSize=t,this},setCheckerSize(t){return this.dirty=this.dirty||this.checkerSize!==t,this.checkerSize=t,this}},Yw={buildShapes(){this.addShape((new op).setName("box")).addShape((new np).setName("checker"))},updateShapes(){var t=this.width/2,e=this.height/2,i=Math.min(t,e),s=2*i,r=t-i,n=e-i,a=this.boxLineWidth,o=Math.max(s/10,2),h=this.getShape("box"),l=this.getShape("checker");if(this.isSizeChanged){var d=s*(1-this.boxSize)/2,c=a/2,u=s*this.boxSize-a;h.setTopLeftPosition(r+c+d,n+c+d).setSize(u,u),this.isCircleShape?h.setRadius(u/2):h.setRadius(0),d=s*(1-this.checkerSize)/2;var p=s*this.checkerSize/4,g=1*p,v=2*p,f=3*p;l.startAt(g,v).lineTo(v,f).lineTo(f,g).offset(r+d,n+d).end()}this.checked?(h.fillStyle(this.boxFillColor,this.boxFillAlpha).lineStyle(a,this.boxStrokeColor,this.boxStrokeAlpha),l.lineStyle(o,this.checkerColor)):(h.fillStyle(this.uncheckedBoxFillColor,this.uncheckedBoxFillAlpha).lineStyle(a,this.uncheckedBoxStrokeColor,this.uncheckedBoxStrokeAlpha),l.lineStyle()),this.checked&&l.setDisplayPathSegment(this.checkerAnimProgress)}},Iw={setCheckerAnimationDuration(t){return void 0===t&&(t=0),this.checkerAnimDuration=t,this},playCheckerAnimation(){return void 0===this.checkerAnimProgressTask&&(this.checkerAnimProgressTask=new La(this,{eventEmitter:null})),this.checkerAnimProgressTask.restart({key:"checkerAnimProgress",from:0,to:1,duration:this.checkerAnimDuration}),this},stopCheckerAnimation(){return void 0===this.checkerAnimProgressTask||this.checkerAnimProgressTask.stop(),this}},Xw={};Object.assign(Xw,Ww,zw,Yw,Iw);const Fw=23730,Vw=Phaser.Utils.Objects.GetValue,Gw=Phaser.Utils.Objects.IsPlainObject;class Hw extends Pu{constructor(t,e,i,s,r,n,a){Gw(e)?(e=Vw(a=e,"x",0),i=Vw(a,"y",0),s=Vw(a,"width",2),r=Vw(a,"height",2),n=Vw(a,"color",Fw)):Gw(n)&&(n=Vw(a=n,"color",Fw)),super(t,e,i,s,r),this.type="rexCheckbox",void 0===n&&(n=Fw),this.setBoxShape(Vw(a,"circleBox",!1)),this.setBoxFillStyle(n,Vw(a,"boxFillAlpha",1)),this.setUncheckedBoxFillStyle(Vw(a,"uncheckedColor",null),Vw(a,"uncheckedBoxFillAlpha",1)),this.setBoxStrokeStyle(Vw(a,"boxLineWidth",4),Vw(a,"boxStrokeColor",n),Vw(a,"boxStrokeAlpha",1)),this.setUncheckedBoxStrokeStyle(this.boxLineWidth,Vw(a,"uncheckedBoxStrokeColor",this.boxStrokeColor),Vw(a,"uncheckedBoxStrokeAlpha",this.boxStrokeAlpha)),this.setCheckerStyle(Vw(a,"checkerColor",16777215),Vw(a,"checkerAlpha",1)),this.setBoxSize(Vw(a,"boxSize",1)),this.setCheckerSize(Vw(a,"checkerSize",1)),this.setCheckerAnimationDuration(Vw(a,"animationDuration",150)),this.buildShapes();var o=Vw(a,"checked");void 0===o&&(o=Vw(a,"value",!1)),this.setValue(o)}get value(){return this._value}set value(t){t=!!t,this._value!==t&&(this.dirty=!0,this._value=t,t?this.playCheckerAnimation():this.stopCheckerAnimation(),this.emit("valuechange",t))}setValue(t){return this.value=t,this}toggleValue(){return this.setValue(!this.value),this}get checked(){return this.value}set checked(t){this.value=t}setChecked(t){return void 0===t&&(t=!0),this.setValue(t),this}toggleChecked(){return this.toggleValue(),this}get checkerAnimProgress(){return this._checkerAnimProgress}set checkerAnimProgress(t){this._checkerAnimProgress!==t&&(this._checkerAnimProgress=t,this.dirty=!0)}}Object.assign(Hw.prototype,Xw);const Uw=Phaser.Utils.Objects.GetValue,Nw=Phaser.Utils.Objects.IsPlainObject;class $w extends Hw{constructor(t,e,i,s,r,n,a){Nw(e)?(e=Uw(a=e,"x",0),i=Uw(a,"y",0),s=Uw(a,"width",2),r=Uw(a,"height",2),n=Uw(a,"color",Fw)):Nw(n)&&(n=Uw(a=n,"color",Fw)),super(t,e,i,s,r,n,a),this._click=new wo(this,Uw(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(Uw(a,"readOnly",!1))}get readOnly(){return!this._click.enable}set readOnly(t){this._click.enable=!t}setReadOnly(t){return void 0===t&&(t=!0),this.readOnly=t,this}}var Kw={name:"CheckboxInput",accept:t=>t.hasOwnProperty("view")?"boolean"===t.view:"boolean"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.CheckboxInput";var s=e.checkbox,r=function(t,e){var i=new $w(t,e);return t.add.existing(i),i}(i,s),n=s.size;void 0!==n&&r.setSize(n,n);var a=void 0!==n?0:1;t.add(r,{proportion:0,expand:!1,fitRatio:a,key:"checkbox"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.checkbox.setValue(e)}},Zw={setTrackFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.trackFillColor!==t||this.trackFillAlpha!==e,this.trackFillColor=t,this.trackFillAlpha=e,this},setFalseValueTrackFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.falseValueTrackColor!==t||this.uncheckedTrackFillAlpha!==e,this.falseValueTrackColor=t,this.falseValueTrackFillAlpha=e,this},setThumbStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.thumbColor!==t||this.checkAlpha!==e,this.thumbColor=t,this.thumbAlpha=e,this}},Jw={setTrackSize(t,e){return this.dirty=this.dirty||this.trackWidth!==t||this.trackHeight!==e,this.trackWidth=t,this.trackHeight=e,this},setTrackRadius(t){return this.dirty=this.dirty||this.trackRadius!==t,this.trackRadius=t,this},setThumbSize(t,e){return void 0===e&&(e=t),this.dirty=this.dirty||this.thumbWidth!==t||this.thumbHeight!==e,this.thumbWidth=t,this.thumbHeight=e,this},setThumbRadius(t){return this.dirty=this.dirty||this.thumbRadius!==t,this.thumbRadius=t,this}},qw={setThumbPosition(t,e){return void 0===e&&(e=1-t),this.thumbLeftX=t,this.thumbRightX=e,this},setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}},Qw=function(t,e,i){return(e-t)*i+t};const tS=Phaser.Math.Linear;var eS={buildShapes(){this.addShape((new op).setName("track")).addShape((new op).setName("thumb"))},updateShapes(){var t=this.width,e=this.height,i=this.value?this.toggleAnimProgress:1-this.toggleAnimProgress,s=this.getShape("track");if(this.isSizeChanged){var r=t*this.trackWidth,n=e*this.trackHeight,a=(t-r)/2,o=(e-n)/2,h=e*this.trackRadius;s.setTopLeftPosition(a,o).setSize(r,n).setRadius(h)}var l,d,c,u=(l=this.falseValueTrackColor,d=this.trackFillColor,c=i,(255&Qw(Gs(l),Gs(d),c))<<16|(255&Qw(Hs(l),Hs(d),c))<<8|255&Qw(Us(l),Us(d),c)),p=tS(this.falseValueTrackFillAlpha,this.trackFillAlpha,i);s.fillStyle(u,p);var g=this.getShape("thumb");if(this.isSizeChanged){var v=t*this.thumbWidth,f=e*this.thumbHeight,m=e*this.thumbRadius;g.setSize(v,f).setRadius(m)}var y=tS(this.thumbLeftX,this.thumbRightX,i)*t;this.rtl&&(y=t-y);var b=e/2;g.setCenterPosition(y,b),g.fillStyle(this.thumbColor,this.thumbAlpha)}},iS={setToggleAnimationDuration(t){return void 0===t&&(t=0),this.toggleAnimDuration=t,this},playToggleAnimation(){return void 0===this.toggleAnimProgressTask&&(this.toggleAnimProgressTask=new La(this,{eventEmitter:null})),this.toggleAnimProgressTask.restart({key:"toggleAnimProgress",from:0,to:1,duration:this.toggleAnimDuration}),this},stopToggleAnimation(){return void 0===this.toggleAnimProgressTask||this.toggleAnimProgressTask.stop(),this}},sS={};Object.assign(sS,Zw,Jw,qw,eS,iS);const rS=Phaser.Utils.Objects.GetValue,nS=Phaser.Utils.Objects.IsPlainObject,aS=23730;class oS extends Pu{constructor(t,e,i,s,r,n,a){nS(e)?(e=rS(a=e,"x",0),i=rS(a,"y",0),s=rS(a,"width",2),r=rS(a,"height",2),n=rS(a,"color",aS)):nS(n)&&(n=rS(a=n,"color",aS)),super(t,e,i,s,r),this.type="rexToggleSwitch",void 0===n&&(n=aS),this.setTrackFillStyle(n,rS(a,"trackFillAlpha",1)),this.setFalseValueTrackFillStyle(rS(a,"falseValueTrackColor",function(t){var e=.3*Gs(t)+.59*Hs(t)+.11*Us(t);return(255&e)<<16|(255&e)<<8|255&e}(n)),rS(a,"falseValueTrackFillAlpha",1)),this.setThumbStyle(rS(a,"thumbColor",16777215),rS(a,"thumbAlpha",1)),this.setTrackSize(rS(a,"trackWidth",.9),rS(a,"trackHeight",.5)),this.setTrackRadius(rS(a,"trackRadius",.5*this.trackHeight));var o=rS(a,"thumbHeight",void 0),h=rS(a,"thumbWidth",o);void 0===h&&(h=.9*this.trackHeight),this.setThumbSize(h,o),this.setThumbRadius(rS(a,"thumbRadius",.5*this.thumbHeight)),this.setThumbPosition(rS(a,"thumbLeft",.3),rS(a,"thumbRight",void 0)),this.setRTL(rS(a,"rtl",!1)),this.setToggleAnimationDuration(rS(a,"animationDuration",150)),this.buildShapes(),this.setValue(rS(a,"value",!1),0)}get value(){return this._value}set value(t){t=!!t,this._value!==t&&(this.dirty=!0,this._value=t,this.playToggleAnimation(),this.emit("valuechange",t))}setValue(t,e){void 0===e&&(e=this.toggleAnimDuration);var i=this.toggleAnimDuration;return this.toggleAnimDuration=e,this.value=t,this.toggleAnimDuration=i,this}toggleValue(t){return this.setValue(!this.value,t),this}get toggleAnimProgress(){return this._toggleAnimProgress}set toggleAnimProgress(t){this._toggleAnimProgress!==t&&(this._toggleAnimProgress=t,this.dirty=!0)}}Object.assign(oS.prototype,sS);const hS=Phaser.Utils.Objects.GetValue;class lS extends oS{constructor(t,e,i,s,r,n,a){super(t,e,i,s,r,n,a),this._click=new wo(this,hS(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(hS(a,"readOnly",!1))}get readOnly(){return!this._click.enable}set readOnly(t){this._click.enable=!t}setReadOnly(t){return void 0===t&&(t=!0),this.readOnly=t,this}}var dS={name:"ToggleSwitchInput",accept:t=>!!t.hasOwnProperty("view")&&"toggleSwitch"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.ToggleSwitchInput";var s=e.toggleSwitch,r=function(t,e){var i=new lS(t,e);return t.add.existing(i),i}(i,s),n=s.size;void 0!==n&&r.setSize(n,n);var a=void 0!==n?0:1;t.addSpace().add(r,{proportion:0,expand:!1,fitRatio:a,key:"toggleSwitch"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.toggleSwitch.setValue(e)}},cS={setWrapEnable(t){return void 0===t&&(t=!0),this.listWrapEnable=t,this},setCreateButtonCallback(t){return this.listCreateButtonCallback=t,this},setCreateListBackgroundCallback(t){return this.listCreateBackgroundCallback=t,this},setCreateListSliderTrackCallback(t){return this.listCreateSliderTrackCallback=t,this},setCreateListSliderThumbCallback(t){return this.listCreateSliderThumbCallback=t,this},setListSliderAdaptThumbSizeEnable(t){return void 0===t&&(t=!0),this.listSliderAdaptThumbSizeEnable=t,this},setListScrollerConfig(t){return void 0===t&&(t={}),this.listScrollerConfig=t,this},setListMouseWheelScrollerConfig(t){return this.listMouseWheelScrollerConfig=t,this},setButtonClickCallback(t){return this.listOnButtonClick=t,this},setButtonOverCallback(t){return this.listOnButtonOver=t,this},setButtonOutCallback(t){return this.listOnButtonOut=t,this},setListExpandDirection(t){return"string"==typeof t&&(t=uS[t]),this.listExpandDirection=t,this},setListEaseInDuration(t){return void 0===t&&(t=0),this.listEaseInDuration=t,this},setListEaseOutDuration(t){return void 0===t&&(t=0),this.listEaseOutDuration=t,this},setListTransitInCallback(t){return this.listTransitInCallback=t,this},settListTransitOutCallback(t){return this.listTransitOutCallback=t,this},setListBounds(t){return this.listBounds=t,this},setListWidth(t){return this.listWidth=t,this},setListHeight(t){return this.listHeight=t,this},setListSize(t,e){return this.setListWidth(t).setListHeight(e),this},setListMaxHeight(t){return this.listMaxHeight=t,this},setListAlignmentMode(t){return this.listAlignMode=t,this},setListAlignmentSide(t){return void 0===t&&(t=""),this.listAlignSide=t,this},setListSpace(t){return void 0===t&&(t={}),this.listSpace=t,this},setListDraggable(t){return void 0===t&&(t=!0),this.listDraggable=t,this}};const uS={down:0,up:1},pS=Phaser.Utils.Objects.GetValue;var gS=function(){var t,e=this.scene,i=this.listCreateBackgroundCallback;i&&(t=i.call(this,e),e.add.existing(t));var s=[],r=this.listCreateButtonCallback;if(r)for(var n=this.options,a=0,o=n.length;a0||this.listMaxHeight>0)){if(s=vS(e,u,this.listWrapEnable),this.listMaxHeight>0&&(s.layout(),s.height<=this.listMaxHeight&&(d=s)),!d){0===c&&(c=this.listMaxHeight);var p=fS(e,this.listCreateSliderTrackCallback),g=fS(e,this.listCreateSliderThumbCallback);d=new Zb(e,{height:c,scrollMode:0,panel:{child:s,mask:{padding:1}},slider:{track:p,thumb:g,adaptThumbSize:this.listSliderAdaptThumbSizeEnable},scrollDetectionMode:1,scroller:this.listScrollerConfig,mouseWheelScroller:this.listMouseWheelScrollerConfig,space:{panel:pS(this.listSpace,"panel",0)}}),e.add.existing(d)}}else u.height=c,s=vS(e,u,this.listWrapEnable),d=s;return t&&d.addBackground(t,"background"),this.listDraggable&&d.setDraggable(!0),d!==s&&s.on("button.over",(function(t,e,i,s){d.emit("button.over",t,e,i,s)})).on("button.out",(function(t,e,i,s){d.emit("button.out",t,e,i,s)})).on("button.click",(function(t,e,i,s){d.emit("button.click",t,e,i,s)})),d},vS=function(t,e,i){var s;return i?(e.orientation="x",s=new Ey(t,e)):(e.orientation="y",s=new Cy(t,e)),t.add.existing(s),s},fS=function(t,e,i){var s;return e&&(s=e.call(i,t),t.add.existing(s)),s},mS={focusNextButton(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;return t=void 0===e?0:(e+1)%this.listPanel.getButtons().length,this.emitButtonOver(t),this},focusPrevButton(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;if(void 0===e)t=0;else{var i=this.listPanel.getButtons().length;t=(e-1+i)%i}return this.emitButtonOver(t),this}},yS={openListPanel:function(){if(this.listPanel)return this;if(0===this.options.length)return this;var t,e=gS.call(this);e.on("button.over",(function(t,i,s,r){this.currentOverIndex=i,this.listOnButtonOver&&this.listOnButtonOver.call(this,t,i,s,r),this.emit("button.over",this,e,t,i,s,r)}),this).on("button.out",(function(t,i,s,r){this.currentOverIndex===i&&(this.currentOverIndex=void 0),this.listOnButtonOut&&this.listOnButtonOut.call(this,t,i,s,r),this.emit("button.out",this,e,t,i,s,r)}),this),t=this.listAlignMode&&"label"!==this.listAlignMode?this.getElement(this.listAlignMode):this;var i=new Lw(e,{duration:{in:this.listEaseInDuration,out:this.listEaseOutDuration},transitIn:this.listTransitInCallback,transitOut:this.listTransitOutCallback,expandDirection:this.listExpandDirection,alignTargetX:t,alignTargetY:this,alignSide:this.listAlignSide,bounds:this.listBounds}).on("open",(function(){e.on("button.click",(function(t,i,s,r){this.listOnButtonClick&&this.listOnButtonClick.call(this,t,i,s,r),this.emit("button.click",this,e,t,i,s,r),this.dropDownBehavior.requestClose()}),this),this.emit("list.open",this,e)}),this).on("close",(function(){this.listPanel=void 0,this.dropDownBehavior=void 0,this.emit("list.close",this)}),this);return e.onClickOutside((function(){i.requestClose()})),this.listPanel=e,this.dropDownBehavior=i,this.pin(e),this},closeListPanel:function(){return this.dropDownBehavior?(this.dropDownBehavior.requestClose(),this.currentOverIndex=void 0,this):this},toggleListPanel:function(){return this.listPanel?this.closeListPanel():this.openListPanel(),this},emitButtonClick:function(t){if(void 0===t&&(t=this.currentOverIndex),void 0===t)return this;var e=this.listPanel,i=e?e.getButton(t):this.options[t];return this.listOnButtonClick&&this.listOnButtonClick.call(this,i,t),this.emit("button.click",this,e,i,t),this},emitButtonOver:function(t){var e=this.listPanel;return e?(e.emitButtonOver(t),this):this}};Object.assign(yS,cS,mS);const bS=Phaser.Utils.Objects.GetValue;class xS extends Hc{constructor(t,e){super(t,e),this.type="rexDropDownList",this.timer=void 0,this.listPanel=void 0,this.currentOverIndex=void 0,this.setOptions(bS(e,"options"));var i=bS(e,"list");this.setWrapEnable(bS(i,"wrap",!1)),this.setCreateButtonCallback(bS(i,"createButtonCallback")),this.setCreateListBackgroundCallback(bS(i,"createBackgroundCallback")),this.setCreateListSliderTrackCallback(bS(i,"createTrackCallback")),this.setCreateListSliderThumbCallback(bS(i,"createThumbCallback")),this.setListSliderAdaptThumbSizeEnable(bS(i,"sliderAdaptThumbSize",!1)),this.setListScrollerConfig(bS(i,"scroller")),this.setListMouseWheelScrollerConfig(bS(i,"mouseWheelScroller")),this.setButtonClickCallback(bS(i,"onButtonClick")),this.setButtonOverCallback(bS(i,"onButtonOver")),this.setButtonOutCallback(bS(i,"onButtonOut")),this.setListExpandDirection(bS(i,"expandDirection")),this.setListEaseInDuration(bS(i,"easeIn",500)),this.setListEaseOutDuration(bS(i,"easeOut",100)),this.setListTransitInCallback(bS(i,"transitIn")),this.settListTransitOutCallback(bS(i,"transitOut")),this.setListMaxHeight(bS(i,"maxHeight",0)),this.setListSize(bS(i,"width"),bS(i,"height",0)),this.setListAlignmentMode(bS(i,"alignParent","text")),this.setListAlignmentSide(bS(i,"alignSide","")),this.setListBounds(bS(i,"bounds")),this.setListSpace(bS(i,"space")),this.setListDraggable(bS(i,"draggable",!1)),this.setValueChangeCallback(bS(e,"setValueCallback"),bS(e,"setValueCallbackScope")),this.setValue(bS(e,"value")),this.onClick(this.toggleListPanel,this)}destroy(t){this.scene&&!this.ignoreDestroy&&(this.listPanel&&(this.listPanel.destroy(t),this.listPanel=void 0),super.destroy(t))}get isOpened(){return!!this.listPanel}setOptions(t){return void 0===t&&(t=[]),this.options=t,this}setValueChangeCallback(t,e){return this.valueChangeCallback=t,this.valueChangeCallbackScope=e,this}setValue(t){return this.value=t,this}get value(){return this._value}set value(t){if(this._value!==t){var e=this._value;this._value=t;var i=this.valueChangeCallback,s=this.valueChangeCallbackScope;i&&(s?i.call(s,this,t,e):i(this,t,e)),this.emit("valuechange",this,t,e)}}}Object.assign(xS.prototype,yS);var CS=function(t,e){e=function(t,e,i){void 0===i&&(i={});var s=(e=e?We(e):{}).label||e.button,r=e.button||e.label;delete e.label,delete e.button;var n=i.label||i.button||i,a=i.button||i.label||i,o=Om(t,s,n);o.list=e.list||{},o.list.createButtonCallback=function(t,e){var i=vb(t,r,a).resetDisplayContent(e);return e.hasOwnProperty("value")&&(i.value=e.value),i};var h=e.track;h&&(o.list.createTrackCallback=function(t){return Vp(t,h)},delete e.track);var l=e.thumb;return l&&(o.list.createThumbCallback=function(t){return Vp(t,l)},delete e.thumb),o.list.onButtonOver=function(t,e,i,s){t.setHoverState&&t.setHoverState(!0)},o.list.onButtonOut=function(t,e,i,s){t.setHoverState&&t.setHoverState(!1)},o}(t,e);var i=new xS(t,e);return t.add.existing(i),i},wS=function(t,e){for(var i=0,s=t.length;it.hasOwnProperty("view")?"list"===t.view:t.hasOwnProperty("options"),build(t,e){var i=t.scene;t.type="rexTweaker.ListInput";var s=CS(i,e.list);t.add(s,{proportion:1,expand:!0,key:"list"}),s.on("button.click",(function(e,i,s,r,n,a){t.setValue(s.value)}))},setup(t,e,i){(i||e.hasOwnProperty("options"))&&function(t,e){t.childrenMap.list.setOptions(e)}(t,e.options)},displayValue(t,e){var i=t.childrenMap.list,s=function(t,e){var i=wS(t,e);if(null!=i)return t[i]}(i.options,e);i.resetDisplayContent(s).setMinSize(i.width,i.height).layout().setMinSize(0,0)}};const OS=Phaser.Utils.Objects.GetValue;var kS={name:"ButtonsInput",accept:t=>!!t.hasOwnProperty("view")&&"buttons"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.ButtonsInput";var s=e.button?We(e.button):{},r=OS(s,"expand",!0);r&&(s.align="center"),delete s.expand;var n=RC(i,{expand:r});n.buttonConfig=s,t.add(n,{proportion:1,expand:!0,key:"list"}),n.on("button.click",(function(e,i,s,r){var a=n.options[i];a&&(t._selectedIndex=i,t.setValue(a.value),t._selectedIndex=void 0)}))},setup(t,e,i){(i||e.hasOwnProperty("options"))&&function(t,e){var i=t.childrenMap.list;i.options=e;var s=t.scene,r=i.buttonConfig;i.clearButtons(!0);for(var n=0,a=e.length;n=0;i--)oy.call(this,e[i],t);return this}},ly=function(t,e,i){if(t){var s=this.setValueCallback,r=this.setValueCallbackScope;s&&(r?s.call(r,t,e,i):s(t,e,i)),this.fireEvent("button.statechange",t,e,i)}},dy=function(t){var e=this;t._selected=void 0,Object.defineProperty(t,"selected",{get:function(){return t._selected},set:function(i){if(t._selected!==i){var s=t._selected;t._selected=i,ly.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},cy={add(t){return this.buttons.push(t),t._click||(t._click=new wo(t,this.clickConfig),t._click.on("click",(function(t,e,i,s){this.fireEvent("button.click",e,i,s)}),this).on("enable",(function(t,e){this.fireEvent("button.enable",e)}),this).on("disable",(function(t,e){this.fireEvent("button.disable",e)}),this).on("over",(function(t,e,i,s){this.fireEvent("button.over",e,i,s)}),this).on("out",(function(t,e,i,s){this.fireEvent("button.out",e,i,s)}),this).on("down",(function(t,e,i,s){this.fireEvent("button.down",e,i,s)}),this).on("up",(function(t,e,i,s){this.fireEvent("button.up",e,i,s)}),this),t.isRexContainerLite&&t.sendChildToBack(t)),this.buttonsType&&(void 0===t.name&&console.error(`${this.parent.constructor.name}: Option button miss value`),dy.call(this,t)),this},addMultiple(t){for(var e=0,i=t.length;e0},setButtonEnable(t,e){var i=this.buttons;if(void 0===t||"boolean"==typeof t){e=t;for(var s=0,r=i.length;sr&&Sy.addNewLine(this)}else for(n=0,a=t.length;n=0;i--)_y.call(this,e[i],t);return this}};const Ey=Phaser.Utils.Objects.GetValue;class Ry extends Jh{constructor(t,e){void 0===e&&(e={});var i=e.space;"number"==typeof i&&(e.space={item:i,line:i}),super(t,e),this.type="rexFixWidthButtons",this.buttonGroup=new yy({parent:this,eventEmitter:Ey(e,"eventEmitter",this),groupName:Ey(e,"groupName",void 0),clickConfig:Ey(e,"click",void 0)}).setButtonsType(e);var s=Ey(e,"background",void 0),r=Ey(e,"buttons",void 0);this.buttonsAlign=Ey(e,"align",void 0),s&&this.addBackground(s),r&&this.addButtons(r),this.addChildrenMap("background",s),this.addChildrenMap("buttons",this.buttonGroup.buttons)}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.buttonGroup.destroy(),this.buttonGroup=void 0)}get buttons(){return this.buttonGroup.buttons}get groupName(){return this.buttonGroup.groupName}set groupName(t){this.buttonGroup.groupName=t}get eventEmitter(){return this.buttonGroup.eventEmitter}}Object.assign(Ry.prototype,ky,My,my,xy);var Ly=function(t,e,i,s){if(void 0===i)i=0;else{var r=typeof i;"boolean"===r?(s=i,i=0):"string"===r&&(i=Dy[i])}void 0===s?s={}:!0===s&&(s=Ay);var n=e.width/t.width,a=e.height/t.height,o=i?Math.max(n,a):Math.min(n,a);return s.width=t.width*o,s.height=t.height*o,s};const Dy={fit:0,FIT:0,envelop:1,ENVELOP:1};var Ay={},By={},jy={};const Wy=Phaser.Utils.Objects.IsPlainObject,zy=Phaser.Utils.Objects.GetValue,Yy=Phaser.Display.Align.CENTER,Iy=Phaser.Utils.String.UUID;var Xy={add:function(t,e,i,s,r,n,a,o,h,l){var d,c;un.call(this,t),Wy(e)&&(e=zy(u=e,"key",void 0),i=zy(u,"align",Yy),s=zy(u,"padding",0),r=zy(u,"expand",!0),t.isRexSizer||(n=zy(u,"minWidth",t._minWidth),a=zy(u,"minHeight",t._minHeighted)),o=zy(u,"offsetX",0),h=zy(u,"offsetY",0),d=zy(u,"offsetOriginX",0),c=zy(u,"offsetOriginY",0),l=zy(u,"aspectRatio",0));var u,v=void 0!==e;return v||(e=Iy()),"string"==typeof i&&(i=Er[i]),void 0===i&&(i=Yy),void 0===s&&(s=0),void 0===r&&(r=!0),t.isRexSizer||(void 0===n&&(n=t._minWidth),void 0===a&&(a=t._minHeight)),void 0===o&&(o=0),void 0===h&&(h=0),void 0===d&&(d=0),void 0===c&&(c=0),void 0===l?l=0:!0===l&&(l=p(t)/g(t)),l>0&&(r=!0,void 0===n&&(n=0),void 0===a&&(a=0)),(u=this.getSizerConfig(t)).align=i,u.padding=dn(s),Wy(r)?(u.expandWidth=zy(r,"width",!1),u.expandHeight=zy(r,"height",!1)):(u.expandWidth=r,u.expandHeight=r),t.isRexSizer||(u.expandWidth&&(t.minWidth=void 0===n?p(t):n),u.expandHeight&&(t.minHeight=void 0===a?g(t):a)),u.alignOffsetX=o,u.alignOffsetY=h,u.alignOffsetOriginX=d,u.alignOffsetOriginY=c,u.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,v&&this.addChildrenMap(e,t),this}},Fy={remove(t,e){var i;if("string"==typeof t){if(i=t,!(t=this.sizerChildren[i]))return this}else{if(this.getParentSizer(t)!==this)return this;i=this.childToKey(t)}return i&&(delete this.sizerChildren[i],this.childrenMap.hasOwnProperty(i)&&delete this.childrenMap[i]),bn.call(this,t,e),this},removeAll(t){for(var e in this.sizerChildren)this.remove(e,t);return this},clear(t){for(var e in this.sizerChildren)delete this.sizerChildren[e],this.childrenMap.hasOwnProperty(e)&&delete this.childrenMap[e];return Ch.call(this,t),this}},Vy={getChildrenWidth:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var a in r)t=r[a],void 0===(i=this.getChildWidth(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).left+e.right)*this.scaleX,s=Math.max(i,s));return n?void 0:s+(this.space.left+this.space.right)*this.scaleX},getChildrenHeight:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var a in r)t=r[a],void 0===(i=this.getChildHeight(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).top+e.bottom)*this.scaleY,s=Math.max(i,s));return n?void 0:s+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(s.expandWidth){var r=e-(this.space.left+this.space.right)*this.scaleX,n=s.padding;i=r-(n.left+n.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(s.expandHeight){var r=e-(this.space.top+this.space.bottom)*this.scaleY,n=s.padding;i=r-(n.top+n.bottom)*this.scaleY}return i},getChildrenSizers:function(t){void 0===t&&(t=[]);var e,i=this.sizerChildren;for(var s in i)(e=i[s]).isRexSizer&&t.push(e);return t},layoutChildren:function(){var t,e,i,s,r,n,a,o,h,l,d,c,u=this.innerLeft,v=this.innerTop,f=this.innerWidth,m=this.innerHeight,y=this.sizerChildren;for(var b in y)(t=y[b]).rexSizer.hidden||(i=(e=t.rexSizer).padding,mo.call(this,t),l=this.getExpandedChildWidth(t),d=this.getExpandedChildHeight(t),e.aspectRatio>0&&(By.width=e.aspectRatio,By.height=1,jy.width=l,jy.height=d,l=(c=Ly(By,jy,"FIT",!0)).width,d=c.height),t.isRexSizer?(t.runLayout(this,l,d),hh(t,this)):Wn(t,l,d),s=u+i.left*this.scaleX,n=f-(i.left+i.right)*this.scaleX,r=v+i.top*this.scaleY,a=m-(i.top+i.bottom)*this.scaleY,void 0===l&&(l=p(t)),void 0===d&&(d=g(t)),o=(e.alignOffsetX+e.alignOffsetOriginX*l)*this.scaleX,h=(e.alignOffsetY+e.alignOffsetOriginY*d)*this.scaleY,yo.call(this,t,s,r,n,a,e.align,o,h))}};Object.assign(Vy,Xy,Fy);const Gy=Phaser.Utils.Objects.IsPlainObject,Hy=Phaser.Utils.Objects.GetValue;class Uy extends oh{constructor(t,e,i,s,r,n){Gy(e)?(e=Hy(n=e,"x",0),i=Hy(n,"y",0),s=Hy(n,"width",void 0),r=Hy(n,"height",void 0)):Gy(s)&&(s=Hy(n=s,"width",void 0),r=Hy(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexOverlapSizer",this.sizerChildren={},this.addChildrenMap("items",this.sizerChildren)}childToKey(t){if("string"!=typeof t)return function(t,e){if(Array.isArray(t))return t.indexOf(e);for(var i in t)if(t[i]===e)return i;return null}(this.sizerChildren,t);var e=t;return this.sizerChildren.hasOwnPropery(e)?e:null}}Object.assign(Uy.prototype,Vy);const Ny=Uy.prototype.add;var $y=function(t,e,i,s,r,n,a,o,h){return t.setVisible(!1),Ny.call(this,t,e,i,s,r,n,a,o,h),this},Ky={add:$y,addPage:$y};const Zy=ss.prototype.setChildVisible;var Jy={getPage:function(t){return void 0===t?null:this.sizerChildren.hasOwnProperty(t)?this.sizerChildren[t]:null},swapPage:function(t,e){this._previousKey=this._currentKey;var i=this.previousPage;i&&(0===this.swapMode?(Zy.call(this,i,!1),this.emit("pageinvisible",i,this._previousKey,this)):i.destroy()),t&&!this.sizerChildren.hasOwnProperty(t)&&this.emit("createpage",t,this),this._currentKey=t;var s=this.currentPage;return s&&(Zy.call(this,s,!0),this.emit("pagevisible",s,this._currentKey,this),void 0===e&&(e=this.fadeInDuration),e>0&&s.setAlpha(0).fadeIn(e,1)),this},hasPage:function(t){return this.sizerChildren.hasOwnProperty(t)}};Object.assign(Jy,Ky);const qy=Phaser.Utils.Objects.GetValue;class Qy extends Uy{constructor(t,e){super(t,e),this.type="rexPages",this.childrenMap=this.sizerChildren,this._previousKey=void 0,this._currentKey=void 0,this.setSwapMode(qy(e,"swapMode",0)),this.setFadeInDuration(qy(e,"fadeIn",0))}setSwapMode(t){return"string"==typeof t&&(t=tb[t]),this.swapMode=t,this}setFadeInDuration(t){return this.fadeInDuration=t,this}get previousKey(){return this._previousKey}get currentKey(){return this._currentKey}set currentKey(t){this.swapPage(t)}get currentPage(){return this.getPage(this.currentKey)}get previousPage(){return this.getPage(this.previousKey)}get keys(){return Object.keys(this.sizerChildren)}}Object.assign(Qy.prototype,Jy);const tb={invisible:0,destroy:1},eb=Phaser.Utils.Objects.IsPlainObject,ib=Phaser.Utils.Objects.GetValue,sb=Phaser.Utils.String.UUID;var rb={swapPage:function(t,e){var i,s;return null!=(i="number"==typeof t?t:this.getPageIndex(t))&&(void 0!==e&&(s=this.childrenMap.pages.fadeInDuration,this.childrenMap.pages.fadeInDuration=e),this.childrenMap.tabs.emitButtonClick(i),void 0!==s&&(this.childrenMap.pages.fadeInDuration=s)),this},swapFirstPage:function(t){return this.swapPage(0,t),this},swapLastPage:function(t){var e=this.getElement("tabs.buttons").length-1;return this.swapPage(e,t),this}},nb={removePage(t,e){"number"==typeof t&&(t=this.getPageKey(t));var i=this.childrenMap.tabs,s=i.getByName(t),r=this.childrenMap.pages,n=r.getElement(t);return s&&n?(r.removeChildrenMap(t),i.removeButton(s,e),r.remove(n,e),this):this},removeAllPages(t){for(var e=this.getElement("tabs.buttons"),i=e.length-1;i>=0;i--)this.removePage(e[i].name,t);return this}},ab={top:1,left:3,right:5,bottom:7},ob={top:"bottom",left:"right",right:"left",bottom:"top"},hb={setTabsPadding(t,e){return this.childrenMap.tabs.setOuterPadding(t,e),this},getTabsPadding(t){return this.childrenMap.tabs.getOuterPadding(t)}},lb={getPageKey:function(t){var e=this.getElement("tabs.buttons");if(!(t>=e.length))return e[t].name},getPageIndex:function(t){for(var e=this.getElement("tabs.buttons"),i=0,s=e.length;i0,setInputRowTitleWidth(t){return this}};const Tb=Phaser.Utils.Objects.GetValue;class _b extends Ah{constructor(t,e){void 0===e&&(e={}),e.orientation="y",super(t,e),this.type="rexTweaker.Wrap";var i=Tb(e,"background",void 0),s=Tb(e,"title",void 0);i&&this.addBackground(i),s&&this.add(s,{expand:!0,space:{bottom:Tb(e,"space.title",0)}});var r=Tb(e,"child",void 0);this.add(r,{expand:!0}),this.addChildrenMap("title",s),this.addChildrenMap("child",r)}setTitle(t){var e=this.childrenMap.title;return t.title||t.icon?e.show().setTitle(t):e.hide(),this}}Object.assign(_b.prototype,kb,Pb);const Mb=Phaser.Utils.Objects.GetValue,Eb=Phaser.Utils.Objects.GetValue;var Rb=function(t){return t.hasOwnProperty("geometryMask")?t.geometryMask:t.bitmapMask};const Lb=Phaser.Geom.Intersects.RectangleToRectangle,Db=Phaser.Geom.Rectangle.Overlaps;var Ab=function(t){if(!t.displayList)return!1;for(;;){var e=t.rexContainer;if(e){if(e.visible){var i=e.parent;if(i){t=i;continue}return!0}return!1}return t.visible}},Bb=function(t,e){var i=e.top,s=e.bottom,r=e.left,n=e.right,a=0;return a+=t.contains(r,i)?1:0,a+=t.contains(r,s)?1:0,a+=t.contains(n,i)?1:0,a+=t.contains(n,s)?1:0},jb=function(t,e,i){e.hasOwnProperty("isRexContainerLite")?(e.syncChildrenEnable=!1,t.setChildMaskVisible(e,!0),e.syncChildrenEnable=!0):(e.clearMask&&e.clearMask(),t.setChildMaskVisible(e,!0))},Wb=function(t,e,i){e.hasOwnProperty("isRexContainerLite")?(e.syncChildrenEnable=!1,t.setChildMaskVisible(e,!0),e.syncChildrenEnable=!0):(e.setMask&&e.setMask(i),t.setChildMaskVisible(e,!0))},zb=function(t,e,i){e.hasOwnProperty("isRexContainerLite")?(e.syncChildrenEnable=!1,t.setChildMaskVisible(e,!1),e.syncChildrenEnable=!0):(e.clearMask&&e.clearMask(),t.setChildMaskVisible(e,!1))};const Yb=Phaser.Utils.Objects.GetValue,Ib={update:0,everyTick:1};var Xb={setupChildrenMask(t){return!1===t||(this.setMaskUpdateMode(Yb(t,"updateMode",0)),this.enableChildrenMask(Yb(t,"padding",0)),this.setMaskLayer(Yb(t,"layer",void 0)),this.onMaskGameObjectVisible=Yb(t,"onVisible"),this.onMaskGameObjectInvisible=Yb(t,"onInvisible"),this.maskGameObjectCallbackScope=Yb(t,"scope"),this.startMaskUpdate()),this},destroyChildrenMask(){return this.childrenMask?(this.stopMaskUpdate(),this.childrenMask.destroy(),this.childrenMask=void 0,this.onMaskGameObjectVisible=null,this.onMaskGameObjectInvisible=null,this.maskGameObjectCallbackScope=null,this):this},setMaskUpdateMode(t){return"string"==typeof t&&(t=Ib[t]),this.maskUpdateMode=t,this},startMaskUpdate(){this.scene.game.events.on("poststep",this.maskChildren,this)},stopMaskUpdate(){this.scene.game.events.off("poststep",this.maskChildren,this)},enableChildrenMask(t){var e=gl.call(this,null,this,0,t);return this.childrenMask=e.createGeometryMask(),this},setMaskChildrenFlag(t){return void 0===t&&(t=!0),this.maskChildrenFlag=t,this},setMaskLayer(t){return this.maskLayer=t,this},maskChildren(){return this.childrenMask&&this.maskChildrenFlag&&0!==this.alpha&&this.visible?(this.privateRenderLayer?this.privateRenderLayer.setMask(this.childrenMask):this.maskLayer?(this.addToLayer(this.maskLayer),this.maskLayer.setMask(this.childrenMask)):function({parent:t,mask:e,children:i,onVisible:s,onInvisible:r,scope:n}){if(e){void 0===i&&(i=t.getAllChildren());for(var a,o,h,l=!!s||!!r,d=t.getBounds(),c=Rb(e),u=0,p=i.length;uthis.topChildOY}childOYExeceedBottom(t){return void 0===t&&(t=this.childOY),tthis.leftChildOX}childOXExeceedRight(t){return void 0===t&&(t=this.childOX),tthis.childHeight?t=0:s?t=e:r&&(t=i)),this._childOY!==t&&(this._childOY=t,this.resetChildPosition()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}get childOX(){return this._childOX}set childOX(t){var e=this.leftChildOX,i=this.rightChildOX,s=this.childOXExceedLeft(t),r=this.childOXExeceedRight(t);this.clampChildOX&&(this.childVisibleWidth>this.childWidth?t=0:s?t=e:r&&(t=i)),this._childOX!==t&&(this._childOX=t,this.resetChildPosition()),s&&(this.execeedLeftState||this.emit("execeedleft",this,t,e)),this.execeedLeftState=s,r&&(this.execeedRightState||this.emit("execeedright",this,t,i)),this.execeedRightState=r}setChildOY(t){return this.childOY=t,this}setChildOX(t){return this.childOX=t,this}set t(t){this.childOY=-this.visibleHeight*t}get t(){var t=this.visibleHeight;return 0===t?0:this.childOY/-t}set s(t){this.childOX=-this.visibleWidth*t}get s(){var t=this.visibleWidth;return 0===t?0:this.childOX/-t}setChildOYByPercentage(t){return this.t=t,this}setChildOXByPercentage(t){return this.s=t,this}}Object.assign(Ub.prototype,Fb);const Nb=["top","bottom","centerY","center"],$b=["left","right","centerX","center"];var Kb=function(t,e,i){var s,r="Y"===(e=e.toUpperCase()),n=this.childrenMap.child;if(r){if(i)for(var a=0,o=Nb.length;a=0?0:Math.abs(l)<=Math.abs(d)?l:d}}else{if(i)for(a=0,o=$b.length;a=0?0:Math.abs(c)<=Math.abs(u)?c:u}}switch(this.scrollMode){case 0:case 1:this.childOY+=s;break;default:this[`childO${e}`]+=s}};const Zb=Phaser.Utils.Objects.GetValue;class Jb extends sm{constructor(t,e){void 0===e&&(e={});var i=Av(e),s=Zb(e,"panel",void 0);void 0===s&&(s={}),s.scrollMode=i,s.clampChildOY=Zb(e,"clampChildOY",!1),s.clampChildOX=Zb(e,"clampChildOX",!1);var r,n,a=new Ub(t,s);switch(t.add.existing(a),i){case 0:r=Zb(e,"expand.panel",!0),n=!0;break;case 1:r=!0,n=Zb(e,"expand.panel",!0);break;default:r=!0,n=!0}e.type="rexScrollablePanel",e.child={gameObject:a,expandWidth:r,expandHeight:n,align:Zb(e,"align.panel","center")};var o=Zb(e,"space",void 0);o&&(o.child=Zb(o,"panel",0)),super(t,e),this.addChildrenMap("panel",a.child),this.addChildrenMap("panelLayer",a.maskLayer),this.addChildrenMap("mask",a.maskGameObject),this.addChildrenMap("scrollableBlock",a)}setChildrenInteractive(t){return void 0===t&&(t={}),t.hasOwnProperty("eventEmitter")||(t.eventEmitter=this),t.hasOwnProperty("targets")||(t.targets=[this.childrenMap.panel]),rh(this.childrenMap.child,t),this}}var qb={scrollToChild:function(t,e){if(!this.hasChild(t))return this;switch(this.scrollMode){case 0:Kb.call(this,t,"y",e);break;case 1:Kb.call(this,t,"x",e);break;default:Kb.call(this,t,"y",e),Kb.call(this,t,"x",e)}return this}};Object.assign(Jb.prototype,qb);var Qb={setBindingTarget(t){return this.childrenMap.panel.setBindingTarget(t),this}},tx={getMaxInputRowTitleWidth(){return this.childrenMap.panel.getMaxInputRowTitleWidth()+this.getInnerPadding("left")},setInputRowTitleWidth(t){return t-=this.getInnerPadding("left"),this.childrenMap.panel.setInputRowTitleWidth(t),this}};class ex extends Jb{constructor(t,e){super(t,e),this.type="rexTweaker.Scrollable"}setTitle(t){var e=this.childrenMap.header;return t.title||t.icon?e.show().setTitle(t):e.hide(),this}}Object.assign(ex.prototype,Qb,tx);const ix=Phaser.Utils.Objects.GetValue,sx=Phaser.Utils.Objects.GetValue,rx=Phaser.Utils.Objects.GetValue;var nx={setupBinding(){return this.childrenMap.inputField.on("valuechange",(function(t){this.autoUpdateEnable&&this.setTargetValue(t)}),this),this},setAutoUpdateEnable(t){return void 0===t&&(t=!0),this.autoUpdateEnable=t,this},setBindingTarget(t,e){this.bindingTarget=t,void 0!==e&&this.setBindingTargetKey(e),this.syncTargetValue();var i=this.childrenMap.inputField;return i.onBindTarget&&i.onBindTarget(t,e),this},setBindingTargetKey(t){return this.bindTargetKey=t,this},setValueCallbacks(t){return this.onGetValue=rx(t,"onGetValue"),this.onSetValue=rx(t,"onSetValue"),this},getTargetValue(){if(this.bindingTarget)return null!=this.bindTargetKey?this.bindingTarget[this.bindTargetKey]:this.onGetValue?this.onGetValue(this.bindingTarget):void 0},setTargetValue(t){return this.bindingTarget?null!=this.bindTargetKey?(this.bindingTarget[this.bindTargetKey]=t,this):(this.onSetValue&&this.onSetValue(this.bindingTarget,t),this):this},syncTargetValue(){if(!this.bindingTarget)return this;var t=this.childrenMap.inputField;return t.syncValue&&t.syncValue(this.getTargetValue()),this}},ax={startMonitorTarget(){return this.isMonitoring||(this.isMonitoring=!0,this.scene.events.on("postupdate",this.onMonitorTarget,this)),this},stopMonitorTarget(){return this.isMonitoring?(this.isMonitoring=!1,this.scene.events.off("postupdate",this.onMonitorTarget,this),this):this},onMonitorTarget(){if(this.bindingTarget){var t=this.getTargetValue(),e=this.childrenMap.inputField;e.value!==t&&e.syncValue(t)}}},ox={getMinTitleWidth(){var t=this.childrenMap.title;if(!t||0!==t.orientation)return 0;var e=t.rexSizer.padding;return this.getChildWidth(this.childrenMap.title)+(e.left+e.right)*t.scaleX+this.getInnerPadding("left")},setMinTitleWidth(t){var e=this.childrenMap.title;if(!e||0!==e.orientation)return this;var i=e.rexSizer.padding;return t-=(i.left+i.right)*e.scaleX,e.minWidth=t,this}};const hx=Phaser.Utils.Objects.GetValue;class lx extends Ah{constructor(t,e){super(t,e),this.type="rexTweaker.InputRow",this.bindingTarget=void 0,this.bindTargetKey=void 0,this.autoUpdateEnable=!0;var i,s=e.inputTitle,r=e.inputField,n=e.background,a=hx(e,"proportion.title",0),o=hx(e,"space.title",0);i=0===this.orientation?{right:o}:{bottom:o},this.add(s,{proportion:a,expand:!0,padding:i});var h=r.defaultProportion;void 0===h&&(h=e.defaultExpandWidth?1:0),a=hx(e,"proportion.inputField",h),this.add(r,{proportion:a,expand:!0}),n&&this.addBackground(n),this.addChildrenMap("title",s),this.addChildrenMap("inputField",r),this.addChildrenMap("background",n),this.setupBinding()}destroy(t){this.scene&&!this.ignoreDestroy&&(this.stopMonitorTarget(),super.destroy(t))}setTitle(t){return this.childrenMap.title.setTitle(t),this}preLayout(){var t=this.childrenMap.title;t&&(t.minWidth=0),super.preLayout()}}Object.assign(lx.prototype,nx,ax,ox);var dx=function(t,e,i){var s=new Pm(t,i);return t.add.existing(s),s},cx=function(t){return void 0===t&&(t=Ah),class extends t{get bindingTarget(){return this.getParentSizer().bindingTarget}get bindingKey(){return this.getParentSizer().bindTargetKey}get value(){return this._value}get root(){return this.getParentSizer().getParentSizer().root}onBindTarget(t,e){this.onBindTargetCallback&&this.onBindTargetCallback(this,t,e)}validate(t){return!(!this.syncValueFlag&&this.validateCallback)||this.validateCallback(t,this._value,this.bindingTarget,this.bindingKey)}getFotmatText(t){return t=this.textFormatCallback?this.textFormatCallback(t):t.toString()}set value(t){if(this._value!==t&&(this.validate(t)||(t=this._value),this.filterValueCallback&&(t=this.filterValueCallback(this,t)),this.displayValueCallback&&this.displayValueCallback(this,t),this._value!==t)){var e=this._value;if(this._value=t,!this.syncValueFlag){var i=this.bindingTarget,s=this.bindingKey;this.emit("valuechange",t,e,i,s),this.root.emit("valuechange",t,e,i,s)}}}getValue(){return this.value}setValue(t){return this.value=t,this}syncValue(t){return this.syncValueFlag=!0,this.value=t,this.syncValueFlag=!1,this}setup(t,e){return void 0===e&&(e=!1),(e||t.hasOwnProperty("format"))&&this.setTextFormatCallback(t.format),(e||t.hasOwnProperty("onValidate"))&&this.setValidateCallback(t.onValidate),this.setupCallback&&this.setupCallback(this,t,e),this}setSetupCallback(t){return this.setupCallback=t,this}setFilterValueCallback(t){return this.filterValueCallback=t,this}setDisplayValueCallback(t){return this.displayValueCallback=t,this}setOnBindTargetCallback(t){return this.onBindTargetCallback=t,this}setTextFormatCallback(t){return this.textFormatCallback=t,this}setValidateCallback(t){return this.validateCallback=t,this}}},ux=function(t,e,i){for(var s,r=this.inputHandlers,n=0,a=r.length;n0?0:1,0===n.minWidth&&n.setMinWidth(this.itemWidth)),0===n.minHeight&&n.setMinHeight(this.itemHeight),this.add(n,{proportion:r,expand:!0})),i.onValueChange&&n.childrenMap.inputField.on("valuechange",i.onValueChange),n.setAutoUpdateEnable(i.autoUpdate),n.setBindingTarget(t,e),i.monitor&&n.startMonitorTarget(),i.key&&this.root.addChildrenMap(i.key,n),this):(console.error(`[Tweaker] Can't add Input\n title: ${i.title}\n view: ${i.view}\n`),this)},addButtons:function(t){void 0===t&&(t={});var e=this.scene,i=t.bindingTarget;delete t.bindingTarget;var s=yx(this.styles,"inputRow")||{},r=mx(e,t,s);return this.add(r,{expand:!0}),i&&r.setBindingTarget(i),t.key&&this.root.addChildrenMap(t.key,r),this},addButton:function(t){return void 0===t&&(t={}),t.buttons=[{label:t.label,callback:t.callback}],delete t.label,delete t.callback,this.addButtons(t),this},addSeparator:function(t){void 0===t&&(t={});var e=function(t,e,i){return Gp(t,Xm(e,i))}(this.scene,t,bx(this.styles,"separator"));return this.add(e,{expand:!0}),this},addRows:function(t,e,i){return"boolean"==typeof e&&(i=e,e=void 0),void 0===i&&(i=!0),xx(this,We(t),e,i),this},setBindingTarget:function(t){for(var e=this.sizerChildren,i=0,s=e.length;i=r&&h=i&&hi.length&&(t.prevCursorPosition=null),null!==t.prevCursorPosition&&(s=e.getCharChild(t.prevCursorPosition))&&("\n"===s.text&&s.clearTextSize(),e.emit("cursorout",s,t.prevCursorPosition,e)),null!=r&&(s=e.getCharChild(r))&&("\n"===s.text&&s.copyTextSize(e.lastInsertCursor),function(t){var e,i,s=t.parent,r=s.width,n=s.height,a=t.drawX,o=t.drawY,h=a+t.drawTLX,l=a+t.drawTRX,d=o+t.drawTLY,c=o+t.drawBLY;e=h<0?0-h:l>r?r-l:0,i=d<0?0-d:c>n?n-c:0,s._textOX+=e,s._textOY+=i}(s),e.emit("cursorin",s,r,e)),e.emit("movecursor",r,t.prevCursorPosition,e),t.prevCursorPosition=r)}(this)):(Ix(this),Xx(this)),this}setNumberInput(){return this.onUpdateCallback=Yx,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}}const Gx=Phaser.Utils.Objects.GetValue,Hx=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var Ux=function(t,e){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return!0;if(-1!==e.indexOf(".")){for(var i=e.split("."),s=t,r=0;rt.length?i:t})),a.value=t.join(e)}else a.value=t.join(i.slice(o,o+a.count));o+=a.count,a.added||(h+=a.count)}}let l=e[a-1];return a>1&&"string"==typeof l.value&&(l.added||l.removed)&&t.equals("",l.value)&&(e[a-2].value+=l.value,e.pop()),e}Qx.prototype={diff(t,e,i={}){let s=i.callback;"function"==typeof i&&(s=i,i={}),this.options=i;let r=this;function n(t){return s?(setTimeout((function(){s(void 0,t)}),0),!0):t}t=this.castInput(t),e=this.castInput(e),t=this.removeEmpty(this.tokenize(t));let a=(e=this.removeEmpty(this.tokenize(e))).length,o=t.length,h=1,l=a+o;i.maxEditLength&&(l=Math.min(l,i.maxEditLength));let d=[{newPos:-1,components:[]}],c=this.extractCommon(d[0],e,t,0);if(d[0].newPos+1>=a&&c+1>=o)return n([{value:this.join(e),count:e.length}]);function u(){for(let s=-1*h;s<=h;s+=2){let h,l=d[s-1],c=d[s+1],u=(c?c.newPos:0)-s;l&&(d[s-1]=void 0);let p=l&&l.newPos+1=a&&u+1>=o)return n(tC(r,h.components,e,t,r.useLongestToken));d[s]=h}else d[s]=void 0}var i;h++}if(s)!function t(){setTimeout((function(){if(h>l)return s();u()||t()}),0)}();else for(;h<=l;){let t=u();if(t)return t}},pushComponent(t,e,i){let s=t[t.length-1];s&&s.added===e&&s.removed===i?t[t.length-1]={count:s.count+1,added:e,removed:i}:t.push({count:1,added:e,removed:i})},extractCommon(t,e,i,s){let r=e.length,n=i.length,a=t.newPos,o=a-s,h=0;for(;a+1t,tokenize:t=>t.split(""),join:t=>t.join("")};const eC=new Qx,iC=/^[a-zA-Z\u{C0}-\u{FF}\u{D8}-\u{F6}\u{F8}-\u{2C6}\u{2C8}-\u{2D7}\u{2DE}-\u{2FF}\u{1E00}-\u{1EFF}]+$/u,sC=/\S/,rC=new Qx;rC.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!sC.test(t)&&!sC.test(e)},rC.tokenize=function(t){let e=t.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/);for(let t=0;tvoid 0===i?e:i}=this.options;return"string"==typeof t?t:JSON.stringify(hC(t,null,null,i),i," ")},oC.equals=function(t,e){return Qx.prototype.equals.call(oC,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const lC=new Qx;lC.tokenize=function(t){return t.slice()},lC.join=lC.removeEmpty=function(t){return t};const dC=Phaser.Utils.Array.Remove;var cC=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),dC(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(h=i,l=e,eC.diff(h,l,d)),r=0,n=0,a=s.length;nr)i+=a;else{if(s!==r)break;i+=Math.min(e.position,a)}}return i},fC={cursorMoveLeft(){if(!this.isOpened)return this;var t=pC(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=pC(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=gC(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=pC(vC(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=gC(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=pC(vC(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const mC=Phaser.Utils.Objects.IsPlainObject;class yC extends jc{constructor(t,e,i,s,r,n){mC(e)?n=e:mC(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(Ux(e,"wrap.vAlign")||Xe(e,"wrap.vAlign",s=i?"center":"top"),Ux(e,"wrap.wrapMode")||Xe(e,"wrap.wrapMode","char"),Ux(e,"wrap.maxLines")||Xe(e,"wrap.maxLines",s=i?1:void 0),i&&Xe(e,"wrap.wrapWidth",1/0),Ux(e,"wrap.useDefaultTextHeight")||Xe(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!Ux(e.edit,"inputType")){var s=i?"text":"textarea";Xe(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new $x(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var a=n.text;a&&delete n.text;var o=uu(n.background,"focus"),h=uu(n.style,"cursor"),l=uu(n.style,"range");super(t,e,i,s,r,n),this.type="rexCanvasInput",this.contentWidth=void 0,this.contentHeight=void 0,this.lineHeight=void 0,this.linesCount=void 0,this.characterCountOfLines=[],this._text,this.textEdit=function(t,e){var i=Gx(e,"edit");return void 0===i&&(i={}),Px(e,i,Hx),new Vx(t,i)}(this,n),Kx.call(this),n.focusStyle&&Object.assign(o,n.focusStyle),qx.call(this,o),n.cursorStyle&&Object.assign(h,n.cursorStyle),Zx.call(this,h),n.rangeStyle&&Object.assign(l,n.rangeStyle),Xs(l)&&Object.assign(l,h),Jx.call(this,l);var d=n.onAddChar;d&&this.on("addchar",d);var c=n.onCursorIn;c&&this.on("cursorin",c);var u=n.onCursorOut;u&&this.on("cursorout",u);var p=!n.onRangeIn&&!n.onRangeOut,g=p?n.onCursorIn:n.onRangeIn;g&&this.on("rangein",g);var v=p?n.onCursorOut:n.onRangeOut;v&&this.on("rangeout",v);var f,m=n.onMoveCursor;m&&this.on("movecursor",m),this.setParseTextCallback(n.parseTextCallback),this.lastInsertCursor=((f=this.createCharChild("|")).text="",f),a||(a=""),this.setText(a)}addChild(t,e){if(super.addChild(t,e),Array.isArray(t))for(var i=t,s=0,r=i.length;st.hasOwnProperty("view")?"string"===t.view:"string"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.TextInput";var s=e.inputText,r=xC(i,s);t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))}},wC={setText(t){return this.childrenMap.child.setText(t),this},appendText(t){return this.setText(this.text+t),this}},SC={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const OC=Phaser.Utils.Objects.GetValue;class kC extends sm{constructor(t,e){void 0===e&&(e={});var i,s=OC(e,"text");Ui(s)?i=s:(void 0===s&&(s={}),s.textArea=!0,i=new yC(t,s),t.add.existing(i)),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textVisibleHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.contentHeight}})}(i);var r=void 0===s.width,n=void 0===s.height;r&&(i.minWidth=0),n&&(i.minHeight=0),e.scrollMode=0,e.type="rexTextAreaInput",e.child={gameObject:i,expandWidth:r,expandHeight:n};var a,o,h=OC(e,"space",void 0);h&&(h.child=OC(h,"text",0)),e.scroller=!1,super(t,e),this.addChildrenMap("text",i),i.on("cursorin",(function(){var t=i.textOY,e=i.contentHeight,s=a!==t,r=o!==e;a=t,o=e,r&&this.resizeController(),(s||r)&&(this.t=i.t)}),this),i.on("textchange",(function(t){this.emit("textchange",t,this)}),this).on("close",(function(){this.emit("close",this.text,this)}),this);var l=OC(e,"content",void 0);l&&this.setText(l)}get text(){return this.childrenMap.child.text}set text(t){t=null==t?"":t.toString(),this.childrenMap.child.text!==t&&this.setText(t)}get lineHeight(){return this.childrenMap.child.lineHeight}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.contentHeight}get readOnly(){return this.childrenMap.child.readOnly}set readOnly(t){this.childrenMap.child.readOnly=t}setReadOnly(t){return this.childrenMap.child.setReadOnly(t),this}get value(){return this.text}set value(t){this.text=t}}Object.assign(kC.prototype,wC,SC);var PC={name:"TextAreaInput",accept:t=>!!t.hasOwnProperty("view")&&"textarea"===t.view,build(t,e){var i=t.scene;this.type="rexTweaker.TextAreaInput";var s=e.inputTextArea;void 0===s&&(s={}),s.hasOwnProperty("text")||(s.text=e.inputText),s.hasOwnProperty("slider")||(s.slider=e.slider);var r=function(t,e,i){void 0===i&&(i=!0),i?e=e?We(e):{}:e||(e={});var s=new kC(t,e);return t.add.existing(s),s}(i,s);t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))},onBindTarget(t){t.childrenMap.inputText.scrollToTop()}},TC={name:"NumberInput",accept:t=>t.hasOwnProperty("view")?"number"===t.view:"number"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.NumberInput";var s=e.inputNumber||e.inputText,r=xC(i,s).setNumberInput();t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly),t.isFloatType=!e.int},filterValue:(t,e)=>t.isFloatType?e:Math.floor(e),displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))}};const _C=Phaser.Utils.Objects.GetValue,MC=Phaser.Math.Linear,EC=Phaser.Math.Snap.Floor;var RC={name:"RangeInput",accept:t=>t.hasOwnProperty("view")?"range"===t.view:"number"==typeof t.value&&t.hasOwnProperty("min")&&t.hasOwnProperty("max"),build(t,e){var i=t.scene;t.type="rexTweaker.RangeInput";var s=e.slider,r=0===t.orientation?"track.height":"track.width",n=_C(s,r),a=function(t,e){var i=new Tf(t,e);return t.add.existing(i),i}(i,s),o=e.defaultExpandWidth?2:0,h=_C(e,"proportion.range.slider",o),l=void 0===n;t.add(a,{proportion:h,expand:l,key:"slider"});var d=e.inputNumber||e.inputText,c=xC(i,d).setNumberInput();o=e.defaultExpandWidth?1:0,h=_C(e,"proportion.range.inputText",o),t.add(c,{proportion:h,expand:!0,key:"inputText"}),c.on("close",(function(){t.setValue(c.value)})),a.on("valuechange",(function(){var e=MC(t.minValue,t.maxValue,a.value);t.step&&(e=EC(e,t.step,t.minValue)),t.setValue(e)}))},setup(t,e,i){(i||e.hasOwnProperty("max"))&&function(t,e,i,s){t.minValue=e,t.maxValue=i,t.step=s,t.childrenMap.slider.setGap(s,e,i)}(t,e.min,e.max,e.step),(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.slider.setValue(e,t.minValue,t.maxValue),t.childrenMap.inputText.setText("").setText(t.getFotmatText(e))}},LC=function(t,e){var i=new wy(t,e);return t.add.existing(i),i};const DC=Phaser.Utils.Objects.GetValue;var AC={name:"RangeInput",accept:t=>!!t.hasOwnProperty("view")&&"incdec"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.IncDecInput";var s=DC(e,"incDec")||{},r={text:null,action:null},n=LC(i,{expand:!1}),a=e.defaultExpandWidth?1:0;t.add(n,{proportion:a,expand:!0});var o=e.inputNumber||e.inputText,h=xC(i,o).setNumberInput();h.on("close",(function(){t.setValue(h.value)}));var l=Object.assign(We(r),s.incButton||{}),d=fb(i,l),c=Object.assign(We(r),s.decButton||{}),u=fb(i,c);n.addButton(d),n.addButton(u);var p=s.inputTextIndex||0;n.insert(p,h,{proportion:1,expand:!0}),t.step=1,t.minValue=void 0,t.maxValue=void 0,n.on("button.click",(function(e,i,s,r){var n=t.value;0===i?n+=t.step:n-=t.step,void 0!==t.maxValue&&n>t.maxValue&&(n=t.maxValue),void 0!==t.minValue&&n0&&{height:this.colorComponentsHeight,formatLabel:this.colorComponentsFormatLabelConfig,inputText:this.colorComponentsInputTextConfig,space:this.colorComponentsSpace};var a=new Tw(t,{width:s,height:n,background:e,space:this.colorPickerSpace,hPalette:{position:this.colorPickerHPalettePosition},colorComponents:r,value:this.value});return t.add.existing(a),a};const Mw=Phaser.Utils.Objects.GetValue;var Ew=function(t,e){var i=Mw(e,"expandDirection",void 0);"string"==typeof i&&(i=Rw[i]);var s,r,n,a,o,h,l,d=(n="alignTargetX",Ux(s=e,r="alignTarget")?F(s,r):n&&Ux(s,n)?F(s,n):a&&Ux(s,a)?F(s,a):o),c=Mw(e,"alignTargetY",d),u=Mw(e,"alignOffsetX",0),p=Mw(e,"alignOffsetY",0),g=Mw(e,"alignSide","").includes("right"),v=Mw(e,"bounds"),f=0===i,m=!(f||1===i),y=g?1:0,b=f||m?0:1;t.setOrigin(y,b),h=g?d.getTopRight().x:d.getTopLeft().x,l=c.getBottomLeft().y,t.setPosition(h+u,l+p);var x=v;x||(x=le(t.scene)),m&&t.getBottomLeft().y>x.bottom&&(l=c.getTopLeft().y,t.setOrigin(0,1).setPosition(h+u,l+p))};const Rw={down:0,up:1},Lw=Phaser.Utils.Objects.GetValue;class Dw extends Za{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=function(t,e){Kn(t,e,"y","Cubic")}),null==e.transitOut&&(e.transitOut=function(t,e){!function(t,e,i,s,r){void 0===s&&(s="Linear");var n={mode:0};switch(i){case 0:case"x":n.end={x:0};break;case 1:case"y":n.end={y:0};break;default:n.end=0}n.duration=e,n.ease=s,void 0===r?r=new Nn(t,n):r.resetFromJSON(n),r.restart()}(t,e,"y","Linear")}),e.manualClose=!0,e.clickOutsideClose=!0,e.destroy=!0,super(t,e),Ew(t,e),t.isRexSizer&&t.layout();var i=Lw(e,"touchOutsideClose",!1),s=Lw(e,"anyTouchClose",!1);s&&(i=!1),s?this.once("open",this.anyTouchClose,this):i&&this.once("open",this.touchOutsideClose,this),this.requestOpen()}shutdown(t){this.isShutdown||(this.scene.input.off("pointerup",this.touchCloseCallback,this),super.shutdown(t))}touchOutsideClose(){return this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&_(this.parent,t.worldX,t.worldY)||this.requestClose()}onOpen(){this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.parent,this),super.onClose()}}var Aw={openColorPicker:function(){if(!this.colorPicker){var t=_w.call(this).layout(),e=new Dw(t,{duration:{in:this.colorPickerEaseInDuration,out:this.colorPickerEaseOutDuration},transitIn:this.colorPickerTransitInCallback,transitOut:this.colorPickerTransitOutCallback,expandDirection:this.colorPickerExpandDirection,alignTargetX:this,alignTargetY:this,bounds:this.colorPickerBounds,touchOutsideClose:!0}).on("open",(function(){t.on("valuechange",(function(t){this.setValue(t)}),this)}),this).on("close",(function(){this.colorPicker=void 0,this.dropDownBehavior=void 0}),this);return this.colorPicker=t,this.dropDownBehavior=e,this.pin(t),this}}};Object.assign(Aw,$C);const Bw=Phaser.Utils.Objects.GetValue;class jw extends NC{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexColorInput",e.hasOwnProperty("colorPicker")||(e.colorPicker={background:{color:0}});var i=e.colorPicker,s=!1!==i&&null!==i;if(s){var r;this.setColorPickerSize(Bw(i,"width",160),Bw(i,"height",170));var n=Bw(i,"background");r=n?function(t){return Gp(t,n)}:Bw(i,"createBackgroundCallback"),this.setCreateColorPickerBackgroundCallback(r),this.setColorPickerHPalettePosition(Bw(i,"hPalettePosition",0)),this.setColorPickerExpandDirection(Bw(i,"expandDirection")),this.setColorPickerEaseInDuration(Bw(i,"easeIn",200)),this.setColorPickerEaseOutDuration(Bw(i,"easeOut",200)),this.setColorPickerTransitInCallback(Bw(i,"transitIn")),this.setColorPickerTransitOutCallback(Bw(i,"transitOut")),this.setColorPickerBounds(Bw(i,"bounds"));var a=Bw(i,"space");void 0===a&&(a={left:10,right:10,top:10,bottom:10,item:8}),this.setColorPickerSpace(a)}var o=e.colorComponents;if(s&&!1!==o&&null!==o){this.setColorComponentsHeight(Bw(o,"height",30)),this.setColorComponentsFormatLabelConfig(Bw(o,"formatLabel"));var h=Bw(o,"inputText");h||(h=Bw(e,"inputText")),this.setColorComponentsInputTextConfig(h);var l=Bw(o,"space");void 0===l&&(l={item:8}),this.setColorComponentsSpace(l)}var d=this.childrenMap.swatch;d&&s&&this.onClick(d,this.openColorPicker,this)}}Object.assign(jw.prototype,Aw);var Ww={name:"ColorInput",accept:t=>!!t.hasOwnProperty("view")&&"color"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.ColorInput";var s=e.colorInput;void 0===s&&(s={}),s.hasOwnProperty("inputText")||(s.inputText=e.inputText);var r=function(t,e,i){void 0===i&&(i=!0),i?e=e?We(e):{}:e||(e={});var s=new jw(t,e);return t.add.existing(s),s}(i,s);t.add(r,{proportion:1,expand:!0,key:"colorInput"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.colorInput.setValue(e)}},zw={setBoxFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.boxFillColor!==t||this.boxFillAlpha!==e,this.boxFillColor=t,this.boxFillAlpha=e,this},setUncheckedBoxFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.uncheckedBoxFillColor!==t||this.uncheckedBoxFillAlpha!==e,this.uncheckedBoxFillColor=t,this.uncheckedBoxFillAlpha=e,this},setBoxStrokeStyle(t,e,i){return void 0===i&&(i=1),this.dirty=this.dirty||this.boxLineWidth!==t||this.boxStrokeColor!==e||this.boxStrokeAlpha!==i,this.boxLineWidth=t,this.boxStrokeColor=e,this.boxStrokeAlpha=i,this},setUncheckedBoxStrokeStyle(t,e,i){return void 0===i&&(i=1),this.dirty=this.dirty||this.uncheckedBoxLineWidth!==t||this.uncheckedBoxStrokeColor!==e||this.uncheckedBoxStrokeAlpha!==i,this.uncheckedBoxLineWidth=t,this.uncheckedBoxStrokeColor=e,this.uncheckedBoxStrokeAlpha=i,this},setCheckerStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.checkerColor!==t||this.checkAlpha!==e,this.checkerColor=t,this.checkAlpha=e,this},setBoxShape(t){return void 0===t&&(t=!1),this.isCircleShape===t||(this.isCircleShape=t,this.isSizeChanged=!0,this.dirty=!0),this}},Yw={setBoxSize(t){return this.dirty=this.dirty||this.boxSize!==t,this.boxSize=t,this},setCheckerSize(t){return this.dirty=this.dirty||this.checkerSize!==t,this.checkerSize=t,this}},Iw={buildShapes(){this.addShape((new hp).setName("box")).addShape((new ap).setName("checker"))},updateShapes(){var t=this.width/2,e=this.height/2,i=Math.min(t,e),s=2*i,r=t-i,n=e-i,a=this.boxLineWidth,o=Math.max(s/10,2),h=this.getShape("box"),l=this.getShape("checker");if(this.isSizeChanged){var d=s*(1-this.boxSize)/2,c=a/2,u=s*this.boxSize-a;h.setTopLeftPosition(r+c+d,n+c+d).setSize(u,u),this.isCircleShape?h.setRadius(u/2):h.setRadius(0),d=s*(1-this.checkerSize)/2;var p=s*this.checkerSize/4,g=1*p,v=2*p,f=3*p;l.startAt(g,v).lineTo(v,f).lineTo(f,g).offset(r+d,n+d).end()}this.checked?(h.fillStyle(this.boxFillColor,this.boxFillAlpha).lineStyle(a,this.boxStrokeColor,this.boxStrokeAlpha),l.lineStyle(o,this.checkerColor)):(h.fillStyle(this.uncheckedBoxFillColor,this.uncheckedBoxFillAlpha).lineStyle(a,this.uncheckedBoxStrokeColor,this.uncheckedBoxStrokeAlpha),l.lineStyle()),this.checked&&l.setDisplayPathSegment(this.checkerAnimProgress)}},Xw={setCheckerAnimationDuration(t){return void 0===t&&(t=0),this.checkerAnimDuration=t,this},playCheckerAnimation(){return void 0===this.checkerAnimProgressTask&&(this.checkerAnimProgressTask=new La(this,{eventEmitter:null})),this.checkerAnimProgressTask.restart({key:"checkerAnimProgress",from:0,to:1,duration:this.checkerAnimDuration}),this},stopCheckerAnimation(){return void 0===this.checkerAnimProgressTask||this.checkerAnimProgressTask.stop(),this}},Fw={};Object.assign(Fw,zw,Yw,Iw,Xw);const Vw=23730,Gw=Phaser.Utils.Objects.GetValue,Hw=Phaser.Utils.Objects.IsPlainObject;class Uw extends Pu{constructor(t,e,i,s,r,n,a){Hw(e)?(e=Gw(a=e,"x",0),i=Gw(a,"y",0),s=Gw(a,"width",2),r=Gw(a,"height",2),n=Gw(a,"color",Vw)):Hw(n)&&(n=Gw(a=n,"color",Vw)),super(t,e,i,s,r),this.type="rexCheckbox",void 0===n&&(n=Vw),this.setBoxShape(Gw(a,"circleBox",!1)),this.setBoxFillStyle(n,Gw(a,"boxFillAlpha",1)),this.setUncheckedBoxFillStyle(Gw(a,"uncheckedColor",null),Gw(a,"uncheckedBoxFillAlpha",1)),this.setBoxStrokeStyle(Gw(a,"boxLineWidth",4),Gw(a,"boxStrokeColor",n),Gw(a,"boxStrokeAlpha",1)),this.setUncheckedBoxStrokeStyle(this.boxLineWidth,Gw(a,"uncheckedBoxStrokeColor",this.boxStrokeColor),Gw(a,"uncheckedBoxStrokeAlpha",this.boxStrokeAlpha)),this.setCheckerStyle(Gw(a,"checkerColor",16777215),Gw(a,"checkerAlpha",1)),this.setBoxSize(Gw(a,"boxSize",1)),this.setCheckerSize(Gw(a,"checkerSize",1)),this.setCheckerAnimationDuration(Gw(a,"animationDuration",150)),this.buildShapes();var o=Gw(a,"checked");void 0===o&&(o=Gw(a,"value",!1)),this.setValue(o)}get value(){return this._value}set value(t){t=!!t,this._value!==t&&(this.dirty=!0,this._value=t,t?this.playCheckerAnimation():this.stopCheckerAnimation(),this.emit("valuechange",t))}setValue(t){return this.value=t,this}toggleValue(){return this.setValue(!this.value),this}get checked(){return this.value}set checked(t){this.value=t}setChecked(t){return void 0===t&&(t=!0),this.setValue(t),this}toggleChecked(){return this.toggleValue(),this}get checkerAnimProgress(){return this._checkerAnimProgress}set checkerAnimProgress(t){this._checkerAnimProgress!==t&&(this._checkerAnimProgress=t,this.dirty=!0)}}Object.assign(Uw.prototype,Fw);const Nw=Phaser.Utils.Objects.GetValue,$w=Phaser.Utils.Objects.IsPlainObject;class Kw extends Uw{constructor(t,e,i,s,r,n,a){$w(e)?(e=Nw(a=e,"x",0),i=Nw(a,"y",0),s=Nw(a,"width",2),r=Nw(a,"height",2),n=Nw(a,"color",Vw)):$w(n)&&(n=Nw(a=n,"color",Vw)),super(t,e,i,s,r,n,a),this._click=new wo(this,Nw(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(Nw(a,"readOnly",!1))}get readOnly(){return!this._click.enable}set readOnly(t){this._click.enable=!t}setReadOnly(t){return void 0===t&&(t=!0),this.readOnly=t,this}}var Zw={name:"CheckboxInput",accept:t=>t.hasOwnProperty("view")?"boolean"===t.view:"boolean"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.CheckboxInput";var s=e.checkbox,r=function(t,e){var i=new Kw(t,e);return t.add.existing(i),i}(i,s),n=s.size;void 0!==n&&r.setSize(n,n);var a=void 0!==n?0:1;t.add(r,{proportion:0,expand:!1,fitRatio:a,key:"checkbox"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.checkbox.setValue(e)}},Jw={setTrackFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.trackFillColor!==t||this.trackFillAlpha!==e,this.trackFillColor=t,this.trackFillAlpha=e,this},setFalseValueTrackFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.falseValueTrackColor!==t||this.uncheckedTrackFillAlpha!==e,this.falseValueTrackColor=t,this.falseValueTrackFillAlpha=e,this},setThumbStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.thumbColor!==t||this.checkAlpha!==e,this.thumbColor=t,this.thumbAlpha=e,this}},qw={setTrackSize(t,e){return this.dirty=this.dirty||this.trackWidth!==t||this.trackHeight!==e,this.trackWidth=t,this.trackHeight=e,this},setTrackRadius(t){return this.dirty=this.dirty||this.trackRadius!==t,this.trackRadius=t,this},setThumbSize(t,e){return void 0===e&&(e=t),this.dirty=this.dirty||this.thumbWidth!==t||this.thumbHeight!==e,this.thumbWidth=t,this.thumbHeight=e,this},setThumbRadius(t){return this.dirty=this.dirty||this.thumbRadius!==t,this.thumbRadius=t,this}},Qw={setThumbPosition(t,e){return void 0===e&&(e=1-t),this.thumbLeftX=t,this.thumbRightX=e,this},setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}},tS=function(t,e,i){return(e-t)*i+t};const eS=Phaser.Math.Linear;var iS={buildShapes(){this.addShape((new hp).setName("track")).addShape((new hp).setName("thumb"))},updateShapes(){var t=this.width,e=this.height,i=this.value?this.toggleAnimProgress:1-this.toggleAnimProgress,s=this.getShape("track");if(this.isSizeChanged){var r=t*this.trackWidth,n=e*this.trackHeight,a=(t-r)/2,o=(e-n)/2,h=e*this.trackRadius;s.setTopLeftPosition(a,o).setSize(r,n).setRadius(h)}var l,d,c,u=(l=this.falseValueTrackColor,d=this.trackFillColor,c=i,(255&tS(Gs(l),Gs(d),c))<<16|(255&tS(Hs(l),Hs(d),c))<<8|255&tS(Us(l),Us(d),c)),p=eS(this.falseValueTrackFillAlpha,this.trackFillAlpha,i);s.fillStyle(u,p);var g=this.getShape("thumb");if(this.isSizeChanged){var v=t*this.thumbWidth,f=e*this.thumbHeight,m=e*this.thumbRadius;g.setSize(v,f).setRadius(m)}var y=eS(this.thumbLeftX,this.thumbRightX,i)*t;this.rtl&&(y=t-y);var b=e/2;g.setCenterPosition(y,b),g.fillStyle(this.thumbColor,this.thumbAlpha)}},sS={setToggleAnimationDuration(t){return void 0===t&&(t=0),this.toggleAnimDuration=t,this},playToggleAnimation(){return void 0===this.toggleAnimProgressTask&&(this.toggleAnimProgressTask=new La(this,{eventEmitter:null})),this.toggleAnimProgressTask.restart({key:"toggleAnimProgress",from:0,to:1,duration:this.toggleAnimDuration}),this},stopToggleAnimation(){return void 0===this.toggleAnimProgressTask||this.toggleAnimProgressTask.stop(),this}},rS={};Object.assign(rS,Jw,qw,Qw,iS,sS);const nS=Phaser.Utils.Objects.GetValue,aS=Phaser.Utils.Objects.IsPlainObject,oS=23730;class hS extends Pu{constructor(t,e,i,s,r,n,a){aS(e)?(e=nS(a=e,"x",0),i=nS(a,"y",0),s=nS(a,"width",2),r=nS(a,"height",2),n=nS(a,"color",oS)):aS(n)&&(n=nS(a=n,"color",oS)),super(t,e,i,s,r),this.type="rexToggleSwitch",void 0===n&&(n=oS),this.setTrackFillStyle(n,nS(a,"trackFillAlpha",1)),this.setFalseValueTrackFillStyle(nS(a,"falseValueTrackColor",function(t){var e=.3*Gs(t)+.59*Hs(t)+.11*Us(t);return(255&e)<<16|(255&e)<<8|255&e}(n)),nS(a,"falseValueTrackFillAlpha",1)),this.setThumbStyle(nS(a,"thumbColor",16777215),nS(a,"thumbAlpha",1)),this.setTrackSize(nS(a,"trackWidth",.9),nS(a,"trackHeight",.5)),this.setTrackRadius(nS(a,"trackRadius",.5*this.trackHeight));var o=nS(a,"thumbHeight",void 0),h=nS(a,"thumbWidth",o);void 0===h&&(h=.9*this.trackHeight),this.setThumbSize(h,o),this.setThumbRadius(nS(a,"thumbRadius",.5*this.thumbHeight)),this.setThumbPosition(nS(a,"thumbLeft",.3),nS(a,"thumbRight",void 0)),this.setRTL(nS(a,"rtl",!1)),this.setToggleAnimationDuration(nS(a,"animationDuration",150)),this.buildShapes(),this.setValue(nS(a,"value",!1),0)}get value(){return this._value}set value(t){t=!!t,this._value!==t&&(this.dirty=!0,this._value=t,this.playToggleAnimation(),this.emit("valuechange",t))}setValue(t,e){void 0===e&&(e=this.toggleAnimDuration);var i=this.toggleAnimDuration;return this.toggleAnimDuration=e,this.value=t,this.toggleAnimDuration=i,this}toggleValue(t){return this.setValue(!this.value,t),this}get toggleAnimProgress(){return this._toggleAnimProgress}set toggleAnimProgress(t){this._toggleAnimProgress!==t&&(this._toggleAnimProgress=t,this.dirty=!0)}}Object.assign(hS.prototype,rS);const lS=Phaser.Utils.Objects.GetValue;class dS extends hS{constructor(t,e,i,s,r,n,a){super(t,e,i,s,r,n,a),this._click=new wo(this,lS(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(lS(a,"readOnly",!1))}get readOnly(){return!this._click.enable}set readOnly(t){this._click.enable=!t}setReadOnly(t){return void 0===t&&(t=!0),this.readOnly=t,this}}var cS={name:"ToggleSwitchInput",accept:t=>!!t.hasOwnProperty("view")&&"toggleSwitch"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.ToggleSwitchInput";var s=e.toggleSwitch,r=function(t,e){var i=new dS(t,e);return t.add.existing(i),i}(i,s),n=s.size;void 0!==n&&r.setSize(n,n);var a=void 0!==n?0:1;t.addSpace().add(r,{proportion:0,expand:!1,fitRatio:a,key:"toggleSwitch"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.toggleSwitch.setValue(e)}},uS={setWrapEnable(t){return void 0===t&&(t=!0),this.listWrapEnable=t,this},setCreateButtonCallback(t){return this.listCreateButtonCallback=t,this},setCreateListBackgroundCallback(t){return this.listCreateBackgroundCallback=t,this},setCreateListSliderTrackCallback(t){return this.listCreateSliderTrackCallback=t,this},setCreateListSliderThumbCallback(t){return this.listCreateSliderThumbCallback=t,this},setListSliderAdaptThumbSizeEnable(t){return void 0===t&&(t=!0),this.listSliderAdaptThumbSizeEnable=t,this},setListScrollerConfig(t){return void 0===t&&(t={}),this.listScrollerConfig=t,this},setListMouseWheelScrollerConfig(t){return this.listMouseWheelScrollerConfig=t,this},setButtonClickCallback(t){return this.listOnButtonClick=t,this},setButtonOverCallback(t){return this.listOnButtonOver=t,this},setButtonOutCallback(t){return this.listOnButtonOut=t,this},setListExpandDirection(t){return"string"==typeof t&&(t=pS[t]),this.listExpandDirection=t,this},setListEaseInDuration(t){return void 0===t&&(t=0),this.listEaseInDuration=t,this},setListEaseOutDuration(t){return void 0===t&&(t=0),this.listEaseOutDuration=t,this},setListTransitInCallback(t){return this.listTransitInCallback=t,this},settListTransitOutCallback(t){return this.listTransitOutCallback=t,this},setListBounds(t){return this.listBounds=t,this},setListWidth(t){return this.listWidth=t,this},setListHeight(t){return this.listHeight=t,this},setListSize(t,e){return this.setListWidth(t).setListHeight(e),this},setListMaxHeight(t){return this.listMaxHeight=t,this},setListAlignmentMode(t){return this.listAlignMode=t,this},setListAlignmentSide(t){return void 0===t&&(t=""),this.listAlignSide=t,this},setListSpace(t){return void 0===t&&(t={}),this.listSpace=t,this},setListDraggable(t){return void 0===t&&(t=!0),this.listDraggable=t,this}};const pS={down:0,up:1},gS=Phaser.Utils.Objects.GetValue;var vS=function(){var t,e=this.scene,i=this.listCreateBackgroundCallback;i&&(t=i.call(this,e),e.add.existing(t));var s=[],r=this.listCreateButtonCallback;if(r)for(var n=this.options,a=0,o=n.length;a0||this.listMaxHeight>0)){if(s=fS(e,u,this.listWrapEnable),this.listMaxHeight>0&&(s.layout(),s.height<=this.listMaxHeight&&(d=s)),!d){0===c&&(c=this.listMaxHeight);var p=mS(e,this.listCreateSliderTrackCallback),g=mS(e,this.listCreateSliderThumbCallback);d=new Jb(e,{height:c,scrollMode:0,panel:{child:s,mask:{padding:1}},slider:{track:p,thumb:g,adaptThumbSize:this.listSliderAdaptThumbSizeEnable},scrollDetectionMode:1,scroller:this.listScrollerConfig,mouseWheelScroller:this.listMouseWheelScrollerConfig,space:{panel:gS(this.listSpace,"panel",0)}}),e.add.existing(d)}}else u.height=c,s=fS(e,u,this.listWrapEnable),d=s;return t&&d.addBackground(t,"background"),this.listDraggable&&d.setDraggable(!0),d!==s&&s.on("button.over",(function(t,e,i,s){d.emit("button.over",t,e,i,s)})).on("button.out",(function(t,e,i,s){d.emit("button.out",t,e,i,s)})).on("button.click",(function(t,e,i,s){d.emit("button.click",t,e,i,s)})),d},fS=function(t,e,i){var s;return i?(e.orientation="x",s=new Ry(t,e)):(e.orientation="y",s=new wy(t,e)),t.add.existing(s),s},mS=function(t,e,i){var s;return e&&(s=e.call(i,t),t.add.existing(s)),s},yS={focusNextButton(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;return t=void 0===e?0:(e+1)%this.listPanel.getButtons().length,this.emitButtonOver(t),this},focusPrevButton(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;if(void 0===e)t=0;else{var i=this.listPanel.getButtons().length;t=(e-1+i)%i}return this.emitButtonOver(t),this}},bS={openListPanel:function(){if(this.listPanel)return this;if(0===this.options.length)return this;var t,e=vS.call(this);e.on("button.over",(function(t,i,s,r){this.currentOverIndex=i,this.listOnButtonOver&&this.listOnButtonOver.call(this,t,i,s,r),this.emit("button.over",this,e,t,i,s,r)}),this).on("button.out",(function(t,i,s,r){this.currentOverIndex===i&&(this.currentOverIndex=void 0),this.listOnButtonOut&&this.listOnButtonOut.call(this,t,i,s,r),this.emit("button.out",this,e,t,i,s,r)}),this),t=this.listAlignMode&&"label"!==this.listAlignMode?this.getElement(this.listAlignMode):this;var i=new Dw(e,{duration:{in:this.listEaseInDuration,out:this.listEaseOutDuration},transitIn:this.listTransitInCallback,transitOut:this.listTransitOutCallback,expandDirection:this.listExpandDirection,alignTargetX:t,alignTargetY:this,alignSide:this.listAlignSide,bounds:this.listBounds}).on("open",(function(){e.on("button.click",(function(t,i,s,r){this.listOnButtonClick&&this.listOnButtonClick.call(this,t,i,s,r),this.emit("button.click",this,e,t,i,s,r),this.dropDownBehavior.requestClose()}),this),this.emit("list.open",this,e)}),this).on("close",(function(){this.listPanel=void 0,this.dropDownBehavior=void 0,this.emit("list.close",this)}),this);return e.onClickOutside((function(){i.requestClose()})),this.listPanel=e,this.dropDownBehavior=i,this.pin(e),this},closeListPanel:function(){return this.dropDownBehavior?(this.dropDownBehavior.requestClose(),this.currentOverIndex=void 0,this):this},toggleListPanel:function(){return this.listPanel?this.closeListPanel():this.openListPanel(),this},emitButtonClick:function(t){if(void 0===t&&(t=this.currentOverIndex),void 0===t)return this;var e=this.listPanel,i=e?e.getButton(t):this.options[t];return this.listOnButtonClick&&this.listOnButtonClick.call(this,i,t),this.emit("button.click",this,e,i,t),this},emitButtonOver:function(t){var e=this.listPanel;return e?(e.emitButtonOver(t),this):this}};Object.assign(bS,uS,yS);const xS=Phaser.Utils.Objects.GetValue;class CS extends Hc{constructor(t,e){super(t,e),this.type="rexDropDownList",this.timer=void 0,this.listPanel=void 0,this.currentOverIndex=void 0,this.setOptions(xS(e,"options"));var i=xS(e,"list");this.setWrapEnable(xS(i,"wrap",!1)),this.setCreateButtonCallback(xS(i,"createButtonCallback")),this.setCreateListBackgroundCallback(xS(i,"createBackgroundCallback")),this.setCreateListSliderTrackCallback(xS(i,"createTrackCallback")),this.setCreateListSliderThumbCallback(xS(i,"createThumbCallback")),this.setListSliderAdaptThumbSizeEnable(xS(i,"sliderAdaptThumbSize",!1)),this.setListScrollerConfig(xS(i,"scroller")),this.setListMouseWheelScrollerConfig(xS(i,"mouseWheelScroller")),this.setButtonClickCallback(xS(i,"onButtonClick")),this.setButtonOverCallback(xS(i,"onButtonOver")),this.setButtonOutCallback(xS(i,"onButtonOut")),this.setListExpandDirection(xS(i,"expandDirection")),this.setListEaseInDuration(xS(i,"easeIn",500)),this.setListEaseOutDuration(xS(i,"easeOut",100)),this.setListTransitInCallback(xS(i,"transitIn")),this.settListTransitOutCallback(xS(i,"transitOut")),this.setListMaxHeight(xS(i,"maxHeight",0)),this.setListSize(xS(i,"width"),xS(i,"height",0)),this.setListAlignmentMode(xS(i,"alignParent","text")),this.setListAlignmentSide(xS(i,"alignSide","")),this.setListBounds(xS(i,"bounds")),this.setListSpace(xS(i,"space")),this.setListDraggable(xS(i,"draggable",!1)),this.setValueChangeCallback(xS(e,"setValueCallback"),xS(e,"setValueCallbackScope")),this.setValue(xS(e,"value")),this.onClick(this.toggleListPanel,this)}destroy(t){this.scene&&!this.ignoreDestroy&&(this.listPanel&&(this.listPanel.destroy(t),this.listPanel=void 0),super.destroy(t))}get isOpened(){return!!this.listPanel}setOptions(t){return void 0===t&&(t=[]),this.options=t,this}setValueChangeCallback(t,e){return this.valueChangeCallback=t,this.valueChangeCallbackScope=e,this}setValue(t){return this.value=t,this}get value(){return this._value}set value(t){if(this._value!==t){var e=this._value;this._value=t;var i=this.valueChangeCallback,s=this.valueChangeCallbackScope;i&&(s?i.call(s,this,t,e):i(this,t,e)),this.emit("valuechange",this,t,e)}}}Object.assign(CS.prototype,bS);var wS=function(t,e){e=function(t,e,i){void 0===i&&(i={});var s=(e=e?We(e):{}).label||e.button,r=e.button||e.label;delete e.label,delete e.button;var n=i.label||i.button||i,a=i.button||i.label||i,o=km(t,s,n);o.list=e.list||{},o.list.createButtonCallback=function(t,e){var i=fb(t,r,a).resetDisplayContent(e);return e.hasOwnProperty("value")&&(i.value=e.value),i};var h=e.track;h&&(o.list.createTrackCallback=function(t){return Gp(t,h)},delete e.track);var l=e.thumb;return l&&(o.list.createThumbCallback=function(t){return Gp(t,l)},delete e.thumb),o.list.onButtonOver=function(t,e,i,s){t.setHoverState&&t.setHoverState(!0)},o.list.onButtonOut=function(t,e,i,s){t.setHoverState&&t.setHoverState(!1)},o}(t,e);var i=new CS(t,e);return t.add.existing(i),i},SS=function(t,e){for(var i=0,s=t.length;it.hasOwnProperty("view")?"list"===t.view:t.hasOwnProperty("options"),build(t,e){var i=t.scene;t.type="rexTweaker.ListInput";var s=wS(i,e.list);t.add(s,{proportion:1,expand:!0,key:"list"}),s.on("button.click",(function(e,i,s,r,n,a){t.setValue(s.value)}))},setup(t,e,i){(i||e.hasOwnProperty("options"))&&function(t,e){t.childrenMap.list.setOptions(e)}(t,e.options)},displayValue(t,e){var i=t.childrenMap.list,s=function(t,e){var i=SS(t,e);if(null!=i)return t[i]}(i.options,e);i.resetDisplayContent(s).setMinSize(i.width,i.height).layout().setMinSize(0,0)}};const kS=Phaser.Utils.Objects.GetValue;var PS={name:"ButtonsInput",accept:t=>!!t.hasOwnProperty("view")&&"buttons"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.ButtonsInput";var s=e.button?We(e.button):{},r=kS(s,"expand",!0);r&&(s.align="center"),delete s.expand;var n=LC(i,{expand:r});n.buttonConfig=s,t.add(n,{proportion:1,expand:!0,key:"list"}),n.on("button.click",(function(e,i,s,r){var a=n.options[i];a&&(t._selectedIndex=i,t.setValue(a.value),t._selectedIndex=void 0)}))},setup(t,e,i){(i||e.hasOwnProperty("options"))&&function(t,e){var i=t.childrenMap.list;i.options=e;var s=t.scene,r=i.buttonConfig;i.clearButtons(!0);for(var n=0,a=e.length;n=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const _=Phaser.Math.DegToRad;var T={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=_(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},E={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=x(t.scaleX,i.scaleX),e.scaleY=x(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},k={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=x(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},D={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},R={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},X={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},L={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(t){void 0===t&&(t=!1);var e=this;return this._mask=null,this.setChildMaskVisible(this),this.children.forEach((function(t){t.clearMask&&t.clearMask(!1),t.hasOwnProperty("isRexContainerLite")||e.setChildMaskVisible(t)})),t&&this.mask&&this.mask.destroy(),this}},Y=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},I=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const W=Phaser.Utils.Array;var V={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Ee=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const ke=/(\S+)\[(\d+)\]/i,Me=Phaser.Utils.Objects.GetValue;var De=function(t,e){return void 0===e?t:t[e]},Re=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Me(e,"left",0),t.right=Me(e,"right",0),t.top=Me(e,"top",0),t.bottom=Me(e,"bottom",0)),t},Xe={getInnerPadding(t){return De(this.space,t)},setInnerPadding(t,e){return Re(this.space,t,e),this},getOuterPadding(t){return De(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Re(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),De(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Re(this.getSizerConfig(t).padding,e,i),this}},Le=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Ye=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},ze=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Ae=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Ie=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},je=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},We={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Ve=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?mi:fi,this.repeatCounter=0,this}stop(){return this.state=gi,this}update(t,e){this.state!==gi&&this.state!==yi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=bi)):(this.nowTime=this.duration,this.state=yi):this.nowTime>=0&&(this.state=mi))}get t(){var t;switch(this.state){case gi:case fi:case bi:t=0;break;case mi:t=this.nowTime/this.duration;break;case yi:t=1}return pi(t,0,1)}set t(t){(t=pi(t,-1,1))<0?(this.state=fi,this.nowTime=-this.delay*t):(this.state=mi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===gi}get isDelay(){return this.state===fi}get isCountDown(){return this.state===mi}get isRunning(){return this.state===fi||this.state===mi}get isDone(){return this.state===yi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const gi=0,fi=1,mi=2,bi=3,yi=-1;class Ci extends di{constructor(t,e){super(t,e),this.timer=new vi}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const Si=Phaser.Utils.Objects.GetValue,wi=Phaser.Utils.Objects.GetAdvancedValue,Pi=Phaser.Tweens.Builders.GetEaseFunction;class xi extends Ci{resetFromJSON(t){return this.timer.resetFromJSON(Si(t,"timer")),this.setEnable(Si(t,"enable",!0)),this.setTarget(Si(t,"target",this.parent)),this.setDelay(wi(t,"delay",0)),this.setDuration(wi(t,"duration",1e3)),this.setEase(Si(t,"ease","Linear")),this.setRepeat(Si(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Pi(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Oi=Phaser.Utils.Objects.GetValue,_i=Phaser.Utils.Objects.GetAdvancedValue,Ti=Phaser.Math.Linear;let Ei=class extends xi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Oi(t,"mode",0)),this.setScaleRange(_i(t,"start",void 0),_i(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=ki[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=_i(t,"x",this.parent.scaleX),this.startY=_i(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=_i(e,"x",void 0),this.endY=_i(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Ti(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Ti(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const ki={stop:0,destroy:1,yoyo:2};var Mi=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new Ei(t,a):r.resetFromJSON(a),r.restart(),r},Di=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Ei&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new Ei(t,h):n.resetFromJSON(h),n.restart(),n},Ri=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Xi=function(t){return Ri(t,"complete")};const Li=Phaser.Utils.Objects.IsPlainObject;var Yi={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Li(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Mi(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Xi(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Li(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Di(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Xi(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Xi(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Li(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new Ei(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Xi(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},zi={};Object.assign(zi,Yi),zi.onInitScale=function(){Yi.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=Ce.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Ai=Phaser.Utils.Objects.GetValue,Ii=Phaser.Utils.Objects.GetAdvancedValue,ji=Phaser.Math.Linear;class Wi extends xi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Ai(t,"mode",0)),this.setAlphaRange(Ii(t,"start",this.parent.alpha),Ii(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Vi[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=ji(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Vi={stop:0,destroy:1,yoyo:2},Fi=Phaser.Utils.Objects.IsPlainObject;var Hi=function(t,e,i,s){var r,n;Fi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Wi(t,h):s.resetFromJSON(h),s.restart(),s},Bi=function(t,e,i,s){i instanceof Wi&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Wi(t,r):s.resetFromJSON(r),s.restart(),s};const Ni=Phaser.Utils.Objects.IsPlainObject;var Gi={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Ni(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Hi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Xi(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Ni(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Bi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Xi(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Xi(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Ui={};Object.assign(Ui,Gi),Ui.onInitFade=function(){Gi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=Ce.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const $i=Phaser.Utils.Objects.GetValue,Ji=Phaser.Utils.Objects.GetAdvancedValue,qi=Phaser.Math.Linear;class Ki extends xi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode($i(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ji(t,"x",void 0),i=Ji(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Zi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Ji(i,"startX",void 0),this.startY=Ji(i,"startY",void 0),this.endX=Ji(i,"endX",void 0),this.endY=Ji(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=qi(this.startX,this.endX,i)),this.hasMoveY&&(t.y=qi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Zi={stop:0,destroy:1,yoyo:2};var Qi=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const ts=Phaser.Utils.Objects.IsPlainObject,es=Phaser.Math.Distance.Between;var is={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(ts(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*es(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Ki&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=Qi(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=Qi(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Ki(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Xi(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Xi(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(ts(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*es(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Ki&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=Qi(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=Qi(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Ki(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Xi(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Xi(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},ss={};Object.assign(ss,is),ss.onInitEaseMove=function(){is.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=Ce.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const rs=Phaser.Utils.Objects.GetValue;class ns extends ai{constructor(t,e){super(t,e),this.timer=new vi,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(rs(t,"timer")),this.setEnable(rs(t,"enable",!0)),this.setMode(rs(t,"mode",1)),this.isRunning=rs(t,"isRunning",!1),this.setMagnitudeMode(rs(t,"magnitudeMode",1)),this.setAxisMode(rs(t,"axis",0)),this.setDuration(rs(t,"duration",500)),this.setMagnitude(rs(t,"magnitude",10)),this.ox=rs(t,"ox",void 0),this.oy=rs(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=hs[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=os[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=as[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=rs(i,"magnitude",void 0),t=rs(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const hs={effect:0,behavior:1},as={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},os={constant:0,decay:1},ls=Phaser.Utils.Objects.IsPlainObject;var ds={shake(t,e,i){if(ls(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new ns(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Xi(this._shake)}};const cs=Phaser.Utils.Objects.GetValue,us=Phaser.Math.Linear;class ps extends xi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=cs(t,"key","value");var i=e[this.propertyKey];return this.fromValue=cs(t,"from",i),this.toValue=cs(t,"to",i),this.setEase(cs(t,"ease",this.ease)),this.setDuration(cs(t,"duration",this.duration)),this.setRepeat(cs(t,"repeat",0)),this.setDelay(cs(t,"delay",0)),this.setRepeatDelay(cs(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=us(this.fromValue,this.toValue,i)}}const vs=Phaser.Utils.Objects.IsPlainObject;class gs extends ii{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new ps(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(vs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(vs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var fs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new gs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Ri(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},ms=Phaser.Utils.Array.Remove,bs={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var Xs={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Ke(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Ls={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=At),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=At),this.transitOutCallback=t,this}},Ys={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},zs={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},As={};Object.assign(As,Xs,Ls,Ys,zs);const Is=Phaser.Utils.Objects.GetValue;class js extends ii{constructor(t,e){super(t,e),this.setTransitInTime(Is(e,"duration.in",200)),this.setTransitOutTime(Is(e,"duration.out",200)),this.setTransitInCallback(Is(e,"transitIn")),this.setTransitOutCallback(Is(e,"transitOut")),this.oneShotMode=Is(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Rs(this,{eventEmitter:!1,initState:Is(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(js.prototype,As);var Ws=function(t){if(t.parentContainer)return Ws(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?Ws(e):t};class Vs extends ii{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Ws(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Fs=Phaser.GameObjects.Rectangle;class Hs extends Fs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Vs(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Bs=Phaser.Utils.Objects.GetValue;class Ns extends ii{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Bs(t,"hitAreaMode",0)),this.setEnable(Bs(t,"enable",!0)),this.setStopMode(Bs(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Gs[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Gs={default:0,fullWindow:1};const Us=Phaser.Utils.Objects.GetValue;class $s extends Hs{constructor(t,e){super(t,Us(e,"color",0),Us(e,"alpha",.8)),this.touchEventStop=new Ns(this,{hitAreaMode:1})}}var Js={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Mi(t,e)},scaleDown(t,e){Di(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Hi(t,e)},fadeOut(t,e){Bi(t,e,!1)}},qs=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Hi(t,e,t.alpha)},Ks=function(t,e){Bi(t,e,!1)},Zs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!nt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Qs=Phaser.Utils.Objects.GetValue;let tr=class extends js{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=er.popUp),null==e.transitOut&&(e.transitOut=er.scaleDown),e.destroy=Qs(e,"destroy",!0),super(t,e);var i=Qs(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new $s(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Qs(i,"transitIn",qs)),this.setCoverTransitOutCallback(Qs(i,"transitOut",Ks)));var s=Qs(e,"touchOutsideClose",!1),r=Qs(e,"duration.hold",-1),n=Qs(e,"timeOutClose",r>=0),h=Qs(e,"anyTouchClose",!1);Qs(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Qs(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Zs(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=er[t]),t){case er.popUp:t=Js.popUp;break;case er.fadeIn:t=Js.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=er[t]),t){case er.scaleDown:t=Js.scaleDown;break;case er.fadeOut:t=Js.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const er={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var ir=function(t){return t&&"function"==typeof t},sr={modal(t,e){return ir(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new tr(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},rr=function(t,e,i,s,r){ir(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},nr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return rr.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return rr.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return rr.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return rr.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return rr.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return rr.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return rr.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return rr.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return rr.call(this,"shutdown",t,e,i,s),this}},hr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=ar),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},ar={},or=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?Zs(t,e.x,e.y,i,s):!!(r=hr(e,n,!0))&&Zs(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const yr={press:0,pointerdown:0,release:1,pointerup:1};var Cr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new br(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},Sr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!wr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return Pr.length=0,!0;return Pr.length=0,!1},Pr=[];const xr=Phaser.Utils.Objects.GetValue;class Or extends ii{constructor(t,e){super(t,e),this._enable=void 0;var i=xr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(xr(t,"enable",!0)),this.setMode(xr(t,"mode",1)),this.setClickInterval(xr(t,"clickInterval",100)),this.setDragThreshold(xr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=_r[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?Sr:or)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const _r={press:0,pointerdown:0,release:1,pointerup:1};var Tr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Or(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Er extends Ds{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const kr=Phaser.Utils.Objects.GetValue;class Mr extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Er,this.parent.setInteractive(kr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(kr(t,"enable",!0)),this.setCooldown(kr(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Dr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&or(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Mr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Mr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Rr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Xr=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Jr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===qr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Jr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Kr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&or(t,s,e,i)}}const Jr=0,qr=1,Kr="IDLE",Zr=Phaser.Utils.Objects.GetValue,Qr=Phaser.Math.Distance.Between;class tn extends $r{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=en},eventEmitter:!1};this.setRecongizedStateObject(new Ds(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Zr(t,"time",250)),this.setTapInterval(Zr(t,"tapInterval",200)),this.setDragThreshold(Zr(t,"threshold",9)),this.setTapOffset(Zr(t,"tapOffset",10));var e=Zr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Zr(t,"maxTaps",void 0)),this.setMinTaps(Zr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case en:this.state=sn;break;case sn:var t=this.lastPointer;Qr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=rn,this.state=sn);break;case rn:this.state=sn}}onDragEnd(){this.state===sn&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=rn))}onDrag(){this.state!==en&&this.pointer.getDistance()>this.dragThreshold&&(this.state=en)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===sn){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=en):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=rn:this.state=en)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===rn&&(this.state=en)}get isTapped(){return this.state===rn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const en="IDLE",sn="BEGIN",rn="RECOGNIZED",nn=Phaser.Utils.Objects.GetValue;class hn extends $r{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=an},eventEmitter:!1};this.setRecongizedStateObject(new Ds(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(nn(t,"threshold",9)),this.setHoldTime(nn(t,"time",251)),this}onDragStart(){this.state=on,0===this.holdTime&&(this.state=ln)}onDragEnd(){this.state=an}onDrag(){this.state!==an&&this.pointer.getDistance()>this.dragThreshold&&(this.state=an)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===on&&t-this.pointer.downTime>=this.holdTime&&(this.state=ln)}get isPressed(){return this.state===ln}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const an="IDLE",on="BEGIN",ln="RECOGNIZED";Phaser.Utils.Objects.GetValue;var dn=function(t){return ti(t).loop.delta};const cn=Phaser.Math.Distance.Between,un=Phaser.Math.Angle.Between;var pn={getDt:function(){return dn(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return cn(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return un(e.x,e.y,t.x,t.y)}},vn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},gn={};const fn=Phaser.Utils.Objects.GetValue,mn=Phaser.Math.RadToDeg;class bn extends $r{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=yn},eventEmitter:!1};this.setRecongizedStateObject(new Ds(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(fn(t,"threshold",10)),this.setVelocityThreshold(fn(t,"velocityThreshold",1e3)),this.setDirectionMode(fn(t,"dir","8dir")),this}onDragStart(){this.state=Cn}onDragEnd(){this.state=yn}onDrag(){this.state===Cn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=Sn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Sn&&(this.state=yn)}get isSwiped(){return this.state===Sn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=vn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=gn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(mn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(bn.prototype,pn);const yn="IDLE",Cn="BEGIN",Sn="RECOGNIZED",wn=Phaser.Utils.Objects.GetValue,Pn=Phaser.Utils.Array.SpliceOne,xn=Phaser.Math.Distance.Between,On=Phaser.Math.Angle.Between;class _n{constructor(t,e){var i=Ke(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(wn(e,"inputConfig",void 0)),this.setEventEmitter(wn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(wn(t,"enable",!0)),this.bounds=wn(t,"bounds",void 0),this.tracerState=En,this.pointers.length=0,ft(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,ft(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case En:this.tracerState=kn,this.onDrag1Start();break;case kn:this.tracerState=Mn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],Pn(this.pointers,e),this.tracerState){case kn:this.tracerState=En,this.onDrag1End();break;case Mn:this.tracerState=kn,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case kn:this.onDrag1();break;case Mn:this.onDrag2()}}}dragCancel(){return this.tracerState===Mn&&this.onDrag2End(),this.pointers.length=0,ft(this.movedState),this.tracerState=En,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0],e=this.pointers[1];return xn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0],e=this.pointers[1];return On(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Tn.x=e.x-i.x,Tn.y=e.y-i.y}else Tn.x=0,Tn.y=0;return Tn}get centerX(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Mn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Mn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Dn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&or(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&or(t,s,e,i)}}Object.assign(_n.prototype,$e);var Tn={};const En=0,kn=1,Mn=2,Dn="IDLE";Phaser.Utils.Objects.GetValue;const Rn=Phaser.Math.RotateAround;var Xn=function(t,e,i,s){return Rn(t,e,i,s),t.rotation+=s,t},Ln={};const Yn=Phaser.Utils.Objects.GetValue,zn=Phaser.Math.Angle.WrapDegrees,An=Phaser.Math.Angle.ShortestBetween,In=Phaser.Math.RadToDeg,jn=Phaser.Math.DegToRad;var Wn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Ln),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=zn(In(this.angleBetween));this.angle=An(this.prevAngle,t),this.prevAngle=t,this.state=Hn}break;case Hn:t=zn(In(this.angleBetween)),this.angle=An(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Hn}get rotation(){return jn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Wn);const Vn="IDLE",Fn="BEGIN",Hn="RECOGNIZED",Bn=Phaser.Utils.Objects.GetValue;var Nn=function(t){var e=Bn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new tn(this,e),this._tap.on("tap",(function(t,e,s){Lr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Lr(i.eventEmitter,`${i.eventNamePrefix}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Gn=Phaser.Utils.Objects.GetValue;var Un=function(t){var e=Gn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new hn(this,e),this._press.on("pressstart",(function(t,e,s){Lr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this).on("pressend",(function(t,e,s){Lr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const $n=Phaser.Utils.Objects.GetValue;var Jn=function(t){var e=$n(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new bn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Lr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Lr(i.eventEmitter,`${i.eventNamePrefix}swipe`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const qn=Phaser.Utils.Objects.GetValue;var Kn=function(t,e){return t.setInteractive(),qn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:qn(e,"targets",[t]),targetMode:qn(e,"targetMode","parent"),eventEmitter:qn(e,"eventEmitter",t),eventNamePrefix:qn(e,"inputEventPrefix","child.")},zr.call(t,e),jr.call(t,e),Fr.call(t,e),Gr.call(t,e),Nn.call(t,e),Un.call(t,e),Jn.call(t,e),t},Zn={getSizerConfig:function(t){return void 0===t&&(t=this),Mt(t)},getChildPrevState:function(t){var e=Mt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Xt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=oe(e,"color"),s=oe(e,"lineWidth");var o=oe(e,"name",!1);o&&(r=oe(o,"createTextCallback",ce),n=oe(o,"createTextCallbackScope",void 0),"string"==typeof(h=oe(o,"align","left-top"))&&(h=zt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new le(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}var d,c,u=this.getAllShownChildren([this]);ue(u,u);for(var p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const ah=Phaser.Utils.Objects.IsPlainObject,oh=Phaser.Utils.Objects.GetValue,lh=Phaser.Display.Align.CENTER,dh={min:0,full:-1};var ch=function(t,e,i,s,r,n,h,a,o,l){var d,c,u,p;me.call(this,t);var v=t.isRexSpace,g=typeof e;if(null===e)return this;if("number"===g);else if("string"===g)e=dh[e];else if(ah(e)){var f;e=oh(f=e,"proportion",void 0),i=oh(f,"align",lh),s=oh(f,"padding",0),r=oh(f,"expand",!1),n=oh(f,"key",void 0),h=oh(f,"index",void 0),t.isRexSizer||(a=oh(f,"minWidth",void 0),o=oh(f,"minHeight",void 0)),l=oh(f,"fitRatio",0),d=oh(f,"offsetX",0),c=oh(f,"offsetY",0),u=oh(f,"offsetOriginX",0),p=oh(f,"offsetOriginY",0)}return"string"==typeof i&&(i=zt[i]),void 0===e&&(e=v?1:0),void 0===i&&(i=lh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(v?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(v?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),(f=this.getSizerConfig(t)).proportion=e,f.align=i,f.padding=ge(s),f.expand=r,f.fitRatio=0===e?l:0,f.alignOffsetX=d,f.alignOffsetY=c,f.alignOffsetOriginX=u,f.alignOffsetOriginY=p,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},uh={add:ch,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),ch.call(this,new nh(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return ah(i)&&(i.index=t),ch.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=hh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const ph=kt.prototype.clear;var vh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),ph.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,vh.call(this,t),this}},mh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=zt[e]),this.getSizerConfig(t).align=e,this}},bh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},yh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},Ch={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},Sh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Be(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Ve.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d,c,u=this.sizerChildren,p=this.innerLeft,v=this.innerTop,g=this.innerWidth,f=this.innerHeight,m=p,b=v,y=this.startChildIndex,C=0,S=u.length;C0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Ae.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Ye.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&sh.call(this,t,void 0),ze.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Ie.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&sh.call(this,void 0,t),je.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(Sh,uh,fh,mh,bh,yh,Ch);var wh=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},Ph={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const xh=Phaser.Utils.Objects.IsPlainObject,Oh=Phaser.Utils.Objects.GetValue;class _h extends th{constructor(t,e,i,s,r,n,h){xh(e)?(e=Oh(h=e,"x",0),i=Oh(h,"y",0),s=Oh(h,"width",void 0),r=Oh(h,"height",void 0),n=Oh(h,"orientation",0)):xh(s)?(s=Oh(h=s,"width",void 0),r=Oh(h,"height",void 0),n=Oh(h,"orientation",0)):xh(n)&&(n=Oh(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Oh(h,"space.item",0)),this.setStartChildIndex(Oh(h,"startChildIndex",0)),this.setRTL(Oh(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=Ph[t]),t}(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=wh.call(this)),this._childrenProportion}}Object.assign(_h.prototype,Sh);var Th={v:0,vertical:0,y:0,h:1,horizontal:1,x:1,xy:2,vh:2},Eh=function(t,e){void 0===e&&(e="scrollMode"),t.hasOwnProperty(e)||(t[e]=kh(t));var i=t[e];return"string"==typeof i&&(i=Th[i]),i},kh=function(t){var e=!!t.sliderY||!!t.scrollerY,i=!!t.sliderX||!!t.scrollerX;return e&&i?2:e?0:i?1:0},Mh=function(){return Array.prototype.reduce.call(arguments,Dh,0)},Dh=function(t,e){return t+e};const Rh=Phaser.Utils.Objects.IsPlainObject,Xh=Phaser.Utils.Objects.GetValue,Lh=Phaser.Display.Align.CENTER;var Yh=function(t,e,i,s,r){if("number"==typeof t||"number"==typeof e){if(void 0===t){for(var n=0;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return Ah(this.sizerChildren,null),vh.call(this,t),this}},jh={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)Ah(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},Hh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Ae.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,Ah(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Ah(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},Nh=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const Gh=Phaser.Utils.Objects.IsPlainObject,Uh=Phaser.Utils.Objects.GetValue;class $h extends th{constructor(t,e,i,s,r,n,h,a,o,l){Gh(e)?(e=Uh(l=e,"x",0),i=Uh(l,"y",0),s=Uh(l,"width",void 0),r=Uh(l,"height",void 0),n=Uh(l,"column",l.col||0),h=Uh(l,"row",0),a=Uh(l,"columnProportions",0),o=Uh(l,"rowProportions",0)):Gh(s)?(s=Uh(l=s,"width",void 0),r=Uh(l,"height",void 0),n=Uh(l,"column",l.col||0),h=Uh(l,"row",0),a=Uh(l,"columnProportions",0),o=Uh(l,"rowProportions",0)):Gh(n)?(n=Uh(l=n,"column",l.col||0),h=Uh(l,"row",0),a=Uh(l,"columnProportions",0),o=Uh(l,"rowProportions",0)):Gh(a)&&(a=Uh(l=a,"columnProportions",0),o=Uh(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(Uh(l,"createCellContainerCallback")),this.setIndentLeft(Uh(l,"space.indentLeftOdd",0),Uh(l,"space.indentLeftEven",0)),this.setIndentTop(Uh(l,"space.indentTopOdd",0),Uh(l,"space.indentTopEven",0)),this.resetGrid(n,h,a,o,Uh(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=Bh.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=Nh.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign($h.prototype,Hh);const Jh=Phaser.Utils.Objects.GetValue;var qh=Phaser.Renderer.WebGL.Utils,Kh=function(t,e,i,s,r,n){for(var h=qh.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),a=i.pathData,o=i.pathIndexes,l=0;l>>16,a=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+h+","+a+","+o+","+n+")"},ia=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,h=(16711680&r)>>>16,a=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+h+","+a+","+o+","+n+")",t.lineWidth=e.lineWidth};const sa=Phaser.Renderer.Canvas.SetTransform;var ra={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=ta(e,i,s),h=r.calcMatrix.copyFrom(n.calc),a=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&Kh(r,h,e,l,a,o),e.isStroked&&Qh(r,e,l,a,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(sa(t,r,e,i,s)){var n=e._displayOriginX,h=e._displayOriginY,a=e.pathData,o=a.length-1,l=a[0]-n,d=a[1]-h;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(ha.prototype,ra);const aa=Phaser.Utils.Objects.GetValue;let oa=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=aa(t,"x",0),i=aa(t,"y",0));var s=this.cornerRadius;s.tl=la(aa(t,"tl",void 0),e,i),s.tr=la(aa(t,"tr",void 0),e,i),s.bl=la(aa(t,"bl",void 0),e,i),s.br=la(aa(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){da(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){da(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){da(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){da(this.cornerRadius.br,t)}};var la=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),ca(t),t},da=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=aa(e,"x",0),t.y=aa(e,"y",0)),ca(t)},ca=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},ua=function(t){return t.x>0&&t.y>0},pa=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const va=Phaser.Math.DegToRad;var ga=function(t,e,i,s,r,n,h,a,o){h&&n>r?n-=360:!h&&n0,h=0,a=e.length;h=0?t.startAt(h+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(h+n,i):t.startAt(h,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(h,i),t.close(),t};const fo=Phaser.Utils.Objects.GetValue,mo=Phaser.Utils.Objects.IsPlainObject;class bo extends(Fa(La)){constructor(t,e,i,s,r,n,h,a){mo(e)?(e=(a=e).x,i=a.y,s=a.width,r=a.height,n=a.barColor,h=a.value):mo(s)?(s=(a=s).width,r=a.height,n=a.barColor,h=a.value):mo(n)&&(n=(a=n).barColor,h=a.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===h&&(h=0),super(t,e,i,s,r,a),this.type="rexLineProgress",this.bootProgressBase(a),this.addShape((new vo).setName("trackFill")).addShape((new vo).setName("bar")).addShape((new vo).setName("trackStroke")),this.setTrackColor(fo(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(fo(a,"trackStrokeThickness",2),fo(a,"trackStrokeColor",void 0)),this.setSkewX(fo(a,"skewX",0)),this.setRTL(fo(a,"rtl",!1)),this.setValue(h)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var yo={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&go(s,0,0,e,i,t);var r,n,h=this.getShape("bar");h.fillStyle(this.barColor),h.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),go(h,r,0,n,i,t));var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&go(a,0,0,e,i,t)}};Object.assign(bo.prototype,yo);var Co=function(t){return null==t||""===t||0===t.length},So=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(Co(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(Co(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,h=e.length;njo(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=jo(t[i]));return e}const Wo=Phaser.Utils.Objects.IsPlainObject,Vo=Phaser.Utils.Objects.GetValue;var Fo=function(t){return"string"==typeof t&&(t=Ho[t]),t};const Ho={scale:0,repeat:1};var Bo=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},No={_beginDraw:At,_drawImage:At,_drawTileSprite:At,_endDraw:At,setGetFrameNameCallback:function(t){return void 0===t&&(t=Io),this.getFrameNameCallback=t,this},setBaseTexture:function(t,e,i,s){Array.isArray(e)&&(s=i,i=e,e=void 0),null==e&&(e="__BASE"),"number"==typeof i&&arguments.length>=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=jo(i),s=jo(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),h=n.width,a=0,o=0,l=i.length;o0?h/a:0,c=n.height,u=0;for(o=0,l=s.length;o0?0:g,y=0,o=0;for(var P=i.length;o0?0:f),f>=1&&g>=1){var x=typeof(m=this.getFrameNameCallback(o,S,e));"string"!==x&&"number"!==x||r.add(m,0,y+n.cutX,C+n.cutY,f,g)}y+=f}C+=g}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,h,a,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/o,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(u,p);if(u>v){var g=(u-v)*o;d>=0?d+=g:d=g,u=v}if(p>v){var f=(p-v)*l;c>=0?c+=f:c=f,p=v}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,b=0;this._beginDraw();for(var y=0,C=this.rows.count;y0&&a>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(S,y)?0:1)?this._drawImage(this.textureKey,s,m,b,h,a):this._drawTileSprite(this.textureKey,s,m,b,h,a)),m+=h;b+=a}this._endDraw()},setStretchMode:function(t){return Wo(t)?(this.stretchMode.edge=Fo(Vo(t,"edge",0)),this.stretchMode.internal=Fo(Vo(t,"internal",0))):(t=Fo(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Bo.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const Go=Phaser.Utils.Objects.IsPlainObject,Uo=Phaser.Utils.Objects.GetValue,$o=Phaser.GameObjects;var Jo=void 0,qo=function(t,e){if(Jo||(Jo={},ti(t).events.once("destroy",(function(){for(var t in Jo)Jo[t].destroy();Jo=void 0}))),!Jo.hasOwnProperty(e)){var i=ti(t).scene.systemScene;(t=new $o[e](i)).setOrigin(0),Jo[e]=t}return Jo[e]};const Ko=Phaser.GameObjects.RenderTexture;class Zo extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if(Go(i)?(i=Uo(d=i,"x",0),s=Uo(d,"y",0),r=Uo(d,"width",1),n=Uo(d,"height",1),h=Uo(d,"key",void 0),a=Uo(d,"baseFrame",void 0),o=Uo(d,"columns",void 0),l=Uo(d,"rows",void 0)):Go(r)?(r=Uo(d=r,"width",1),n=Uo(d,"height",1),h=Uo(d,"key",void 0),a=Uo(d,"baseFrame",void 0),o=Uo(d,"columns",void 0),l=Uo(d,"rows",void 0)):Go(h)?(h=Uo(d=h,"key",void 0),a=Uo(d,"baseFrame",void 0),o=Uo(d,"columns",void 0),l=Uo(d,"rows",void 0)):Go(a)?(a=Uo(d=a,"baseFrame",void 0),o=Uo(d,"columns",void 0),l=Uo(d,"rows",void 0)):Array.isArray(a)?(d=l,l=o,o=a,a=Uo(d,"baseFrame",void 0)):Go(o)&&(o=Uo(d=o,"columns",void 0),l=Uo(d,"rows",void 0)),void 0===a&&(a=Uo(d,"frame",void 0)),void 0===o){var c=Uo(d,"leftWidth",void 0),u=Uo(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=Uo(d,"topHeight",void 0),v=Uo(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(Uo(d,"getFrameNameCallback",void 0)),this.setStretchMode(Uo(d,"stretchMode",0)),this.setPreserveRatio(Uo(d,"preserveRatio",!0));var g=Uo(d,"maxFixedPartScale",1),f=Uo(d,"maxFixedPartScaleX",g),m=Uo(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(h,a,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,No),i}(Ko,"rexNinePatch")){}var Qo={_drawImage:function(t,e,i,s,r,n){var h=qo(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=qo(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(Zo.prototype,Qo);class tl extends ii{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(xo(t,e))return t[e];var i=t.parent;return xo(i,e)?i[e]:void 0}set(t,e,i){return xo(t,e)?t[e]=i:xo(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}}const el=Phaser.Utils.Objects.GetValue;class il extends Zo{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=el(e,"effects",!0);i&&ko(this,i),this.style=new tl(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(il.prototype,_a);const sl=["alpha","tint","flipX","flipY"];var rl=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("barColor")?i="bar":e.hasOwnProperty("leftWidth")?i="nineSlice":e.hasOwnProperty("key")&&(i="image")),i){case"bar":s=new wo(t,e);break;case"image":s=new Ao(t,e);break;case"nineSlice":s=e.hasOwnProperty("stretchMode")?new il(t,e):new Xo(t,e);break;default:s=new Ta(t,e)}return function(t,e){if(!e)return t;for(var i=0,s=sl.length;i=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const Yl=Phaser.Utils.Objects.GetValue,zl=Phaser.Math.Distance.Between;class Al extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=Yl(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(Yl(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(Yl(t,"enable",!0)),this.holdThreshold=Yl(t,"holdThreshold",50),this.pointerOutReleaseEnable=Yl(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return dn(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:zl(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!or(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!or(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const Il=Phaser.Utils.Objects.GetValue;class jl{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(Il(t,"value",0)),this.setSpeed(Il(t,"speed",0)),this.setAcceleration(Il(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class Wl{constructor(){this.value,this.dir,this.movement=new jl}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const Bl={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},Nl=Phaser.Utils.Objects.GetValue;class Gl extends ii{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=Nl(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(Nl(e,"speed",.1)),this.setEnable(Nl(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(Nl(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||or(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const Ul=Phaser.Utils.Objects.GetValue;var $l=function(t,e,i,s){var r,n,h="Y"===(i=i.toUpperCase()),a=2===t.scrollMode,o=t.childrenMap.child,l=`slider${i}`;if(r=a||s.hasOwnProperty(l)?Ul(s,l,void 0):Ul(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=h?1:0,n=function(t,e){void 0===e&&(e={});var i=mt(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new Xl(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r),n.tickLength=Ul(r,"tickLength",void 0);var p=Ul(r,"position",0);"string"==typeof p&&(p=Jl[p]);var v,g,f=Ul(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=Ul(s,"space.slider",void 0))&&(a?f=0:v=Ul(s,"space.child",0)),g=void 0===v?"number"==typeof f:"number"==typeof v,h?0===p?(d=2,c=1,u=void 0===v?g?{left:f}:f:{left:Ul(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:Ul(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:Ul(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:Ul(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=Ul(r,"hideUnscrollableSlider",!1),t[`disableUnscrollableDrag${i}`]=Ul(r,"disableUnscrollableDrag",!1),t[`adaptThumb${i}SizeMode`]=Ul(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=Ul(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`disableUnscrollableDrag${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,b,y=Ul(s,"scrollDetectionMode");"string"==typeof y&&(y=ql[y]);var C=`scroller${i}`;(m=a||s.hasOwnProperty(C)?Ul(s,C,!0):Ul(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==y&&(m.rectBoundsInteractive=1===y),b=new Hl(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var S,w,P,x,O,_=Ul(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);_&&o&&(void 0!==y&&(_.focus=1===y?2:0),S=new Gl(o,_)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,b),t.addChildrenMap(`mouseWheelScroller${i}`,S),a&&!h||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.disableUnscrollableDrag=t[`disableUnscrollableDrag${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",b),t.addChildrenMap("mouseWheelScroller",S)),n&&(a?(w=h?"t":"s",x=`scroll${i}`):(w="t",x="scroll"),n.on("valuechange",(function(e){t[w]=e,t.emit(x,t)}))),b&&(a?(P=`childO${i}`,x=`scroll${i}`):(P="childOY",x="scroll"),b.on("valuechange",(function(e){t[P]=e,t.emit(x,t)}))),S&&(O=a?`addChildO${i}`:"addChildOY",S.on("scroll",(function(e){t[O](-e,!0)})))};const Jl={right:0,left:1,bottom:0,top:1},ql={gameObject:0,rectBounds:1},Kl=Phaser.Utils.Objects.GetValue;var Zl=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=Kl(e,"width"),h=Kl(e,"height");n||Kl(e,"child.expandWidth",!0)||(s[1]=0),h||Kl(e,"child.expandHeight",!0)||(r[1]=0);var a=new $h(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=Jh(i,"child"),r=Jh(s,"gameObject",void 0);if(r){var n=Jh(i,"space.child",0);t.childMargin={};var h=t.childMargin,a={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:h.top=0,h.bottom=0,h.left=0,h.right=0;break;default:h.top=n,h.bottom=n,h.left=n,h.right=n}else switch(t.scrollMode){case 0:h.top=Jh(n,"top",0),h.bottom=Jh(n,"bottom",0),a.left=Jh(n,"left",0),a.right=Jh(n,"right",0);break;case 1:h.top=Jh(n,"left",0),h.bottom=Jh(n,"right",0),a.top=Jh(n,"top",0),a.bottom=Jh(n,"bottom",0);break;default:h.top=Jh(n,"top",0),h.bottom=Jh(n,"bottom",0),h.left=Jh(n,"left",0),h.right=Jh(n,"right",0)}e.add(r,{column:1,row:1,align:Jh(s,"align","center"),padding:a,expand:{width:Jh(s,"expandWidth",!0),height:Jh(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:$l(t,a,"y",e);break;case 1:$l(t,a,"x",e);break;default:$l(t,a,"y",e),$l(t,a,"x",e)}return a},Ql=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}i*="Y"===t?this.scaleY:this.scaleX,s&&s.setBounds(e,i),r&&(r.setEnable(e!==i),r.tickLength&&r.setTick(r.tickLength,e,i))},td=function(t){switch(this.scrollMode){case 0:case 1:(i=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(i,this.isOverflow),(r=this.childrenMap.scroller)&&this.disableUnscrollableDrag&&r.setEnable(this.isOverflow);break;default:var e=this[`isOverflow${t=t.toUpperCase()}`],i=this.childrenMap[`slider${t}`],s=this[`hideUnscrollableSlider${t}`];i&&s&&this.setChildVisible(i,e);var r=this.childrenMap.scroller,n=this[`disableUnscrollableDrag${t}`];r&&n&&r.setEnable(e)}},ed=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(a=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=a.childrenMap.track,s=a.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&n0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const ld=Phaser.Utils.Objects.GetValue,dd=Phaser.Utils.Array.SpliceOne;class cd{constructor(t,e){this.parent=t,this.cells=[],this.cellPool=new od,this.resetFromJSON(e)}resetFromJSON(t){void 0===t&&(t={}),this.colCount=void 0,this.nonZeroDeltaHeightCount=0,this.resetTotalRowsHeight();var e=ld(t,"cellHeight",60),i=ld(t,"cellWidth",60);return this.setDefaultCellHeight(e),this.setDefaultCellWidth(i),this.initCells(ld(t,"cellsCount",0)),this.setColumnCount(ld(t,"columns",1)),this}destroy(t){this.cellPool.destroy(),this.cells=void 0,this.parent=void 0}get defaultCellHeightMode(){return 0===this.nonZeroDeltaHeightCount}setDefaultCellHeight(t){return this.defaultCellHeight=t,this}setDefaultCellWidth(t){return this.defaultCellWidth=t,this}initCells(t){var e=this.cells;e.length=t;for(var i=0;i=0&&t=0&&i0&&s)){if(0===n)return 2===e&&(i+=1),i;if(1===e){var h=i;(s=(i+=1)>=0&&i=this.colCount?null:e*this.colCount+t}rowIndexToHeight(t,e){if(this.defaultCellHeightMode)return(e-t+1)*this.defaultCellHeight;for(var i=0,s=t;s<=e;s++)i+=this.getRowHeight(s);return i}colIndexToWidth(t,e){return(e-t+1)*this.defaultCellWidth}getRowHeight(t){var e=this.colCount;if(e<=1)return this.getCellHeight(this.colRowToCellIndex(0,t));for(var i,s=0,r=0;ri,n=tthis.leftTableOX,n=tt?this.removeCells(t,e-t):this.insertNewCells(e,t-e)),this},insertNewCells:function(t,e){return"object"==typeof t&&(t=t.index),void 0===e&&(e=1),e<=0||(t=zd(t,0,this.cellsCount),this.table.insertNewCells(t,e)),this},removeCells:function(t,e){if("object"==typeof t&&(t=t.index),void 0===e&&(e=1),t<0&&(e+=t,t=0),e<=0)return this;if(t>this.cellsCount)return this;for(var i,s=t,r=t+e;s=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const _=Phaser.Math.DegToRad;var T={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=_(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},E={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=x(t.scaleX,i.scaleX),e.scaleY=x(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},k={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=x(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},D={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},R={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},X={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},L={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(t){void 0===t&&(t=!1);var e=this;return this._mask=null,this.setChildMaskVisible(this),this.children.forEach((function(t){t.clearMask&&t.clearMask(!1),t.hasOwnProperty("isRexContainerLite")||e.setChildMaskVisible(t)})),t&&this.mask&&this.mask.destroy(),this}},Y=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},I=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const W=Phaser.Utils.Array;var V={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Ee=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const ke=/(\S+)\[(\d+)\]/i,Me=Phaser.Utils.Objects.GetValue;var De=function(t,e){return void 0===e?t:t[e]},Re=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Me(e,"left",0),t.right=Me(e,"right",0),t.top=Me(e,"top",0),t.bottom=Me(e,"bottom",0)),t},Xe={getInnerPadding(t){return De(this.space,t)},setInnerPadding(t,e){return Re(this.space,t,e),this},getOuterPadding(t){return De(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Re(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),De(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Re(this.getSizerConfig(t).padding,e,i),this}},Le=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Ye=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},ze=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Ae=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Ie=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},je=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},We={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Ve=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?mi:fi,this.repeatCounter=0,this}stop(){return this.state=gi,this}update(t,e){this.state!==gi&&this.state!==yi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=bi)):(this.nowTime=this.duration,this.state=yi):this.nowTime>=0&&(this.state=mi))}get t(){var t;switch(this.state){case gi:case fi:case bi:t=0;break;case mi:t=this.nowTime/this.duration;break;case yi:t=1}return pi(t,0,1)}set t(t){(t=pi(t,-1,1))<0?(this.state=fi,this.nowTime=-this.delay*t):(this.state=mi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===gi}get isDelay(){return this.state===fi}get isCountDown(){return this.state===mi}get isRunning(){return this.state===fi||this.state===mi}get isDone(){return this.state===yi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const gi=0,fi=1,mi=2,bi=3,yi=-1;class Ci extends di{constructor(t,e){super(t,e),this.timer=new vi}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const Si=Phaser.Utils.Objects.GetValue,wi=Phaser.Utils.Objects.GetAdvancedValue,Pi=Phaser.Tweens.Builders.GetEaseFunction;class xi extends Ci{resetFromJSON(t){return this.timer.resetFromJSON(Si(t,"timer")),this.setEnable(Si(t,"enable",!0)),this.setTarget(Si(t,"target",this.parent)),this.setDelay(wi(t,"delay",0)),this.setDuration(wi(t,"duration",1e3)),this.setEase(Si(t,"ease","Linear")),this.setRepeat(Si(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Pi(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Oi=Phaser.Utils.Objects.GetValue,_i=Phaser.Utils.Objects.GetAdvancedValue,Ti=Phaser.Math.Linear;let Ei=class extends xi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Oi(t,"mode",0)),this.setScaleRange(_i(t,"start",void 0),_i(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=ki[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=_i(t,"x",this.parent.scaleX),this.startY=_i(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=_i(e,"x",void 0),this.endY=_i(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Ti(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Ti(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const ki={stop:0,destroy:1,yoyo:2};var Mi=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new Ei(t,a):r.resetFromJSON(a),r.restart(),r},Di=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Ei&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new Ei(t,h):n.resetFromJSON(h),n.restart(),n},Ri=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Xi=function(t){return Ri(t,"complete")};const Li=Phaser.Utils.Objects.IsPlainObject;var Yi={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Li(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Mi(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Xi(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Li(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Di(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Xi(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Xi(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Li(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new Ei(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Xi(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},zi={};Object.assign(zi,Yi),zi.onInitScale=function(){Yi.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=Ce.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Ai=Phaser.Utils.Objects.GetValue,Ii=Phaser.Utils.Objects.GetAdvancedValue,ji=Phaser.Math.Linear;class Wi extends xi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Ai(t,"mode",0)),this.setAlphaRange(Ii(t,"start",this.parent.alpha),Ii(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Vi[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=ji(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Vi={stop:0,destroy:1,yoyo:2},Fi=Phaser.Utils.Objects.IsPlainObject;var Hi=function(t,e,i,s){var r,n;Fi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Wi(t,h):s.resetFromJSON(h),s.restart(),s},Bi=function(t,e,i,s){i instanceof Wi&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Wi(t,r):s.resetFromJSON(r),s.restart(),s};const Ni=Phaser.Utils.Objects.IsPlainObject;var Gi={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Ni(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Hi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Xi(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Ni(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Bi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Xi(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Xi(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Ui={};Object.assign(Ui,Gi),Ui.onInitFade=function(){Gi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=Ce.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const $i=Phaser.Utils.Objects.GetValue,Ji=Phaser.Utils.Objects.GetAdvancedValue,qi=Phaser.Math.Linear;class Ki extends xi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode($i(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ji(t,"x",void 0),i=Ji(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Zi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Ji(i,"startX",void 0),this.startY=Ji(i,"startY",void 0),this.endX=Ji(i,"endX",void 0),this.endY=Ji(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=qi(this.startX,this.endX,i)),this.hasMoveY&&(t.y=qi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Zi={stop:0,destroy:1,yoyo:2};var Qi=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const ts=Phaser.Utils.Objects.IsPlainObject,es=Phaser.Math.Distance.Between;var is={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(ts(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*es(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Ki&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=Qi(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=Qi(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Ki(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Xi(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Xi(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(ts(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*es(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Ki&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=Qi(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=Qi(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Ki(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Xi(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Xi(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},ss={};Object.assign(ss,is),ss.onInitEaseMove=function(){is.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=Ce.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const rs=Phaser.Utils.Objects.GetValue;class ns extends ai{constructor(t,e){super(t,e),this.timer=new vi,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(rs(t,"timer")),this.setEnable(rs(t,"enable",!0)),this.setMode(rs(t,"mode",1)),this.isRunning=rs(t,"isRunning",!1),this.setMagnitudeMode(rs(t,"magnitudeMode",1)),this.setAxisMode(rs(t,"axis",0)),this.setDuration(rs(t,"duration",500)),this.setMagnitude(rs(t,"magnitude",10)),this.ox=rs(t,"ox",void 0),this.oy=rs(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=hs[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=os[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=as[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=rs(i,"magnitude",void 0),t=rs(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const hs={effect:0,behavior:1},as={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},os={constant:0,decay:1},ls=Phaser.Utils.Objects.IsPlainObject;var ds={shake(t,e,i){if(ls(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new ns(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Xi(this._shake)}};const cs=Phaser.Utils.Objects.GetValue,us=Phaser.Math.Linear;class ps extends xi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=cs(t,"key","value");var i=e[this.propertyKey];return this.fromValue=cs(t,"from",i),this.toValue=cs(t,"to",i),this.setEase(cs(t,"ease",this.ease)),this.setDuration(cs(t,"duration",this.duration)),this.setRepeat(cs(t,"repeat",0)),this.setDelay(cs(t,"delay",0)),this.setRepeatDelay(cs(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=us(this.fromValue,this.toValue,i)}}const vs=Phaser.Utils.Objects.IsPlainObject;class gs extends ii{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new ps(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(vs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(vs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var fs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new gs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Ri(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},ms=Phaser.Utils.Array.Remove,bs={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var Xs={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Ke(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Ls={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=At),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=At),this.transitOutCallback=t,this}},Ys={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},zs={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},As={};Object.assign(As,Xs,Ls,Ys,zs);const Is=Phaser.Utils.Objects.GetValue;class js extends ii{constructor(t,e){super(t,e),this.setTransitInTime(Is(e,"duration.in",200)),this.setTransitOutTime(Is(e,"duration.out",200)),this.setTransitInCallback(Is(e,"transitIn")),this.setTransitOutCallback(Is(e,"transitOut")),this.oneShotMode=Is(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Rs(this,{eventEmitter:!1,initState:Is(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(js.prototype,As);var Ws=function(t){if(t.parentContainer)return Ws(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?Ws(e):t};class Vs extends ii{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Ws(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Fs=Phaser.GameObjects.Rectangle;class Hs extends Fs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Vs(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Bs=Phaser.Utils.Objects.GetValue;class Ns extends ii{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Bs(t,"hitAreaMode",0)),this.setEnable(Bs(t,"enable",!0)),this.setStopMode(Bs(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Gs[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Gs={default:0,fullWindow:1};const Us=Phaser.Utils.Objects.GetValue;class $s extends Hs{constructor(t,e){super(t,Us(e,"color",0),Us(e,"alpha",.8)),this.touchEventStop=new Ns(this,{hitAreaMode:1})}}var Js={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Mi(t,e)},scaleDown(t,e){Di(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Hi(t,e)},fadeOut(t,e){Bi(t,e,!1)}},qs=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Hi(t,e,t.alpha)},Ks=function(t,e){Bi(t,e,!1)},Zs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!nt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Qs=Phaser.Utils.Objects.GetValue;let tr=class extends js{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=er.popUp),null==e.transitOut&&(e.transitOut=er.scaleDown),e.destroy=Qs(e,"destroy",!0),super(t,e);var i=Qs(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new $s(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Qs(i,"transitIn",qs)),this.setCoverTransitOutCallback(Qs(i,"transitOut",Ks)));var s=Qs(e,"touchOutsideClose",!1),r=Qs(e,"duration.hold",-1),n=Qs(e,"timeOutClose",r>=0),h=Qs(e,"anyTouchClose",!1);Qs(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Qs(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Zs(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=er[t]),t){case er.popUp:t=Js.popUp;break;case er.fadeIn:t=Js.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=er[t]),t){case er.scaleDown:t=Js.scaleDown;break;case er.fadeOut:t=Js.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const er={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var ir=function(t){return t&&"function"==typeof t},sr={modal(t,e){return ir(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new tr(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},rr=function(t,e,i,s,r){ir(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},nr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return rr.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return rr.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return rr.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return rr.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return rr.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return rr.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return rr.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return rr.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return rr.call(this,"shutdown",t,e,i,s),this}},hr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=ar),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},ar={},or=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?Zs(t,e.x,e.y,i,s):!!(r=hr(e,n,!0))&&Zs(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const yr={press:0,pointerdown:0,release:1,pointerup:1};var Cr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new br(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},Sr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!wr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return Pr.length=0,!0;return Pr.length=0,!1},Pr=[];const xr=Phaser.Utils.Objects.GetValue;class Or extends ii{constructor(t,e){super(t,e),this._enable=void 0;var i=xr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(xr(t,"enable",!0)),this.setMode(xr(t,"mode",1)),this.setClickInterval(xr(t,"clickInterval",100)),this.setDragThreshold(xr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=_r[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?Sr:or)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const _r={press:0,pointerdown:0,release:1,pointerup:1};var Tr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Or(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Er extends Ds{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const kr=Phaser.Utils.Objects.GetValue;class Mr extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Er,this.parent.setInteractive(kr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(kr(t,"enable",!0)),this.setCooldown(kr(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Dr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&or(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Mr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Mr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Rr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Xr=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Jr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===qr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Jr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Kr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&or(t,s,e,i)}}const Jr=0,qr=1,Kr="IDLE",Zr=Phaser.Utils.Objects.GetValue,Qr=Phaser.Math.Distance.Between;class tn extends $r{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=en},eventEmitter:!1};this.setRecongizedStateObject(new Ds(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Zr(t,"time",250)),this.setTapInterval(Zr(t,"tapInterval",200)),this.setDragThreshold(Zr(t,"threshold",9)),this.setTapOffset(Zr(t,"tapOffset",10));var e=Zr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Zr(t,"maxTaps",void 0)),this.setMinTaps(Zr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case en:this.state=sn;break;case sn:var t=this.lastPointer;Qr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=rn,this.state=sn);break;case rn:this.state=sn}}onDragEnd(){this.state===sn&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=rn))}onDrag(){this.state!==en&&this.pointer.getDistance()>this.dragThreshold&&(this.state=en)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===sn){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=en):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=rn:this.state=en)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===rn&&(this.state=en)}get isTapped(){return this.state===rn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const en="IDLE",sn="BEGIN",rn="RECOGNIZED",nn=Phaser.Utils.Objects.GetValue;class hn extends $r{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=an},eventEmitter:!1};this.setRecongizedStateObject(new Ds(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(nn(t,"threshold",9)),this.setHoldTime(nn(t,"time",251)),this}onDragStart(){this.state=on,0===this.holdTime&&(this.state=ln)}onDragEnd(){this.state=an}onDrag(){this.state!==an&&this.pointer.getDistance()>this.dragThreshold&&(this.state=an)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===on&&t-this.pointer.downTime>=this.holdTime&&(this.state=ln)}get isPressed(){return this.state===ln}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const an="IDLE",on="BEGIN",ln="RECOGNIZED";Phaser.Utils.Objects.GetValue;var dn=function(t){return ti(t).loop.delta};const cn=Phaser.Math.Distance.Between,un=Phaser.Math.Angle.Between;var pn={getDt:function(){return dn(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return cn(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return un(e.x,e.y,t.x,t.y)}},vn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},gn={};const fn=Phaser.Utils.Objects.GetValue,mn=Phaser.Math.RadToDeg;class bn extends $r{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=yn},eventEmitter:!1};this.setRecongizedStateObject(new Ds(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(fn(t,"threshold",10)),this.setVelocityThreshold(fn(t,"velocityThreshold",1e3)),this.setDirectionMode(fn(t,"dir","8dir")),this}onDragStart(){this.state=Cn}onDragEnd(){this.state=yn}onDrag(){this.state===Cn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=Sn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Sn&&(this.state=yn)}get isSwiped(){return this.state===Sn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=vn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=gn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(mn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(bn.prototype,pn);const yn="IDLE",Cn="BEGIN",Sn="RECOGNIZED",wn=Phaser.Utils.Objects.GetValue,Pn=Phaser.Utils.Array.SpliceOne,xn=Phaser.Math.Distance.Between,On=Phaser.Math.Angle.Between;class _n{constructor(t,e){var i=Ke(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(wn(e,"inputConfig",void 0)),this.setEventEmitter(wn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(wn(t,"enable",!0)),this.bounds=wn(t,"bounds",void 0),this.tracerState=En,this.pointers.length=0,ft(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,ft(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case En:this.tracerState=kn,this.onDrag1Start();break;case kn:this.tracerState=Mn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],Pn(this.pointers,e),this.tracerState){case kn:this.tracerState=En,this.onDrag1End();break;case Mn:this.tracerState=kn,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case kn:this.onDrag1();break;case Mn:this.onDrag2()}}}dragCancel(){return this.tracerState===Mn&&this.onDrag2End(),this.pointers.length=0,ft(this.movedState),this.tracerState=En,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0],e=this.pointers[1];return xn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0],e=this.pointers[1];return On(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Tn.x=e.x-i.x,Tn.y=e.y-i.y}else Tn.x=0,Tn.y=0;return Tn}get centerX(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Mn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Mn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Dn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&or(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&or(t,s,e,i)}}Object.assign(_n.prototype,$e);var Tn={};const En=0,kn=1,Mn=2,Dn="IDLE";Phaser.Utils.Objects.GetValue;const Rn=Phaser.Math.RotateAround;var Xn=function(t,e,i,s){return Rn(t,e,i,s),t.rotation+=s,t},Ln={};const Yn=Phaser.Utils.Objects.GetValue,zn=Phaser.Math.Angle.WrapDegrees,An=Phaser.Math.Angle.ShortestBetween,In=Phaser.Math.RadToDeg,jn=Phaser.Math.DegToRad;var Wn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Ln),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=zn(In(this.angleBetween));this.angle=An(this.prevAngle,t),this.prevAngle=t,this.state=Hn}break;case Hn:t=zn(In(this.angleBetween)),this.angle=An(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Hn}get rotation(){return jn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Wn);const Vn="IDLE",Fn="BEGIN",Hn="RECOGNIZED",Bn=Phaser.Utils.Objects.GetValue;var Nn=function(t){var e=Bn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new tn(this,e),this._tap.on("tap",(function(t,e,s){Lr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Lr(i.eventEmitter,`${i.eventNamePrefix}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Gn=Phaser.Utils.Objects.GetValue;var Un=function(t){var e=Gn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new hn(this,e),this._press.on("pressstart",(function(t,e,s){Lr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this).on("pressend",(function(t,e,s){Lr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const $n=Phaser.Utils.Objects.GetValue;var Jn=function(t){var e=$n(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new bn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Lr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Lr(i.eventEmitter,`${i.eventNamePrefix}swipe`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const qn=Phaser.Utils.Objects.GetValue;var Kn=function(t,e){return t.setInteractive(),qn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:qn(e,"targets",[t]),targetMode:qn(e,"targetMode","parent"),eventEmitter:qn(e,"eventEmitter",t),eventNamePrefix:qn(e,"inputEventPrefix","child.")},zr.call(t,e),jr.call(t,e),Fr.call(t,e),Gr.call(t,e),Nn.call(t,e),Un.call(t,e),Jn.call(t,e),t},Zn={getSizerConfig:function(t){return void 0===t&&(t=this),Mt(t)},getChildPrevState:function(t){var e=Mt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Xt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=oe(e,"color"),s=oe(e,"lineWidth");var o=oe(e,"name",!1);o&&(r=oe(o,"createTextCallback",ce),n=oe(o,"createTextCallbackScope",void 0),"string"==typeof(h=oe(o,"align","left-top"))&&(h=zt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new le(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}var d,c,u=this.getAllShownChildren([this]);ue(u,u);for(var p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const ah=Phaser.Utils.Objects.IsPlainObject,oh=Phaser.Utils.Objects.GetValue,lh=Phaser.Display.Align.CENTER,dh={min:0,full:-1};var ch=function(t,e,i,s,r,n,h,a,o,l){var d,c,u,p;me.call(this,t);var v=t.isRexSpace,g=typeof e;if(null===e)return this;if("number"===g);else if("string"===g)e=dh[e];else if(ah(e)){var f;e=oh(f=e,"proportion",void 0),i=oh(f,"align",lh),s=oh(f,"padding",0),r=oh(f,"expand",!1),n=oh(f,"key",void 0),h=oh(f,"index",void 0),t.isRexSizer||(a=oh(f,"minWidth",void 0),o=oh(f,"minHeight",void 0)),l=oh(f,"fitRatio",0),d=oh(f,"offsetX",0),c=oh(f,"offsetY",0),u=oh(f,"offsetOriginX",0),p=oh(f,"offsetOriginY",0)}return"string"==typeof i&&(i=zt[i]),void 0===e&&(e=v?1:0),void 0===i&&(i=lh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(v?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(v?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),(f=this.getSizerConfig(t)).proportion=e,f.align=i,f.padding=ge(s),f.expand=r,f.fitRatio=0===e?l:0,f.alignOffsetX=d,f.alignOffsetY=c,f.alignOffsetOriginX=u,f.alignOffsetOriginY=p,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},uh={add:ch,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),ch.call(this,new nh(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return ah(i)&&(i.index=t),ch.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=hh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const ph=kt.prototype.clear;var vh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),ph.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,vh.call(this,t),this}},mh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=zt[e]),this.getSizerConfig(t).align=e,this}},bh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},yh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},Ch={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},Sh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Be(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Ve.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d,c,u=this.sizerChildren,p=this.innerLeft,v=this.innerTop,g=this.innerWidth,f=this.innerHeight,m=p,b=v,y=this.startChildIndex,C=0,S=u.length;C0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Ae.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Ye.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&sh.call(this,t,void 0),ze.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Ie.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&sh.call(this,void 0,t),je.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(Sh,uh,fh,mh,bh,yh,Ch);var wh=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},Ph={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const xh=Phaser.Utils.Objects.IsPlainObject,Oh=Phaser.Utils.Objects.GetValue;class _h extends th{constructor(t,e,i,s,r,n,h){xh(e)?(e=Oh(h=e,"x",0),i=Oh(h,"y",0),s=Oh(h,"width",void 0),r=Oh(h,"height",void 0),n=Oh(h,"orientation",0)):xh(s)?(s=Oh(h=s,"width",void 0),r=Oh(h,"height",void 0),n=Oh(h,"orientation",0)):xh(n)&&(n=Oh(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Oh(h,"space.item",0)),this.setStartChildIndex(Oh(h,"startChildIndex",0)),this.setRTL(Oh(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=Ph[t]),t}(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=wh.call(this)),this._childrenProportion}}Object.assign(_h.prototype,Sh);var Th={v:0,vertical:0,y:0,h:1,horizontal:1,x:1,xy:2,vh:2},Eh=function(t,e){void 0===e&&(e="scrollMode"),t.hasOwnProperty(e)||(t[e]=kh(t));var i=t[e];return"string"==typeof i&&(i=Th[i]),i},kh=function(t){var e=!!t.sliderY||!!t.scrollerY,i=!!t.sliderX||!!t.scrollerX;return e&&i?2:e?0:i?1:0},Mh=function(){return Array.prototype.reduce.call(arguments,Dh,0)},Dh=function(t,e){return t+e};const Rh=Phaser.Utils.Objects.IsPlainObject,Xh=Phaser.Utils.Objects.GetValue,Lh=Phaser.Display.Align.CENTER;var Yh=function(t,e,i,s,r){if("number"==typeof t||"number"==typeof e){if(void 0===t){for(var n=0;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return Ah(this.sizerChildren,null),vh.call(this,t),this}},jh={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)Ah(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},Hh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Ae.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,Ah(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Ah(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},Nh=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const Gh=Phaser.Utils.Objects.IsPlainObject,Uh=Phaser.Utils.Objects.GetValue;class $h extends th{constructor(t,e,i,s,r,n,h,a,o,l){Gh(e)?(e=Uh(l=e,"x",0),i=Uh(l,"y",0),s=Uh(l,"width",void 0),r=Uh(l,"height",void 0),n=Uh(l,"column",l.col||0),h=Uh(l,"row",0),a=Uh(l,"columnProportions",0),o=Uh(l,"rowProportions",0)):Gh(s)?(s=Uh(l=s,"width",void 0),r=Uh(l,"height",void 0),n=Uh(l,"column",l.col||0),h=Uh(l,"row",0),a=Uh(l,"columnProportions",0),o=Uh(l,"rowProportions",0)):Gh(n)?(n=Uh(l=n,"column",l.col||0),h=Uh(l,"row",0),a=Uh(l,"columnProportions",0),o=Uh(l,"rowProportions",0)):Gh(a)&&(a=Uh(l=a,"columnProportions",0),o=Uh(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(Uh(l,"createCellContainerCallback")),this.setIndentLeft(Uh(l,"space.indentLeftOdd",0),Uh(l,"space.indentLeftEven",0)),this.setIndentTop(Uh(l,"space.indentTopOdd",0),Uh(l,"space.indentTopEven",0)),this.resetGrid(n,h,a,o,Uh(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=Bh.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=Nh.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign($h.prototype,Hh);const Jh=Phaser.Utils.Objects.GetValue;var qh=Phaser.Renderer.WebGL.Utils,Kh=function(t,e,i,s,r,n){for(var h=qh.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),a=i.pathData,o=i.pathIndexes,l=0;l>>16,a=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+h+","+a+","+o+","+n+")"},ia=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,h=(16711680&r)>>>16,a=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+h+","+a+","+o+","+n+")",t.lineWidth=e.lineWidth};const sa=Phaser.Renderer.Canvas.SetTransform;var ra={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=ta(e,i,s),h=r.calcMatrix.copyFrom(n.calc),a=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&Kh(r,h,e,l,a,o),e.isStroked&&Qh(r,e,l,a,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(sa(t,r,e,i,s)){var n=e._displayOriginX,h=e._displayOriginY,a=e.pathData,o=a.length-1,l=a[0]-n,d=a[1]-h;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(ha.prototype,ra);const aa=Phaser.Utils.Objects.GetValue;let oa=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=aa(t,"x",0),i=aa(t,"y",0));var s=this.cornerRadius;s.tl=la(aa(t,"tl",void 0),e,i),s.tr=la(aa(t,"tr",void 0),e,i),s.bl=la(aa(t,"bl",void 0),e,i),s.br=la(aa(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){da(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){da(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){da(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){da(this.cornerRadius.br,t)}};var la=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),ca(t),t},da=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=aa(e,"x",0),t.y=aa(e,"y",0)),ca(t)},ca=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},ua=function(t){return t.x>0&&t.y>0},pa=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const va=Phaser.Math.DegToRad;var ga=function(t,e,i,s,r,n,h,a,o){h&&n>r?n-=360:!h&&n0,h=0,a=e.length;h=0?t.startAt(h+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(h+n,i):t.startAt(h,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(h,i),t.close(),t};const mo=Phaser.Utils.Objects.GetValue,bo=Phaser.Utils.Objects.IsPlainObject;class yo extends(Fa(La)){constructor(t,e,i,s,r,n,h,a){bo(e)?(e=(a=e).x,i=a.y,s=a.width,r=a.height,n=a.barColor,h=a.value):bo(s)?(s=(a=s).width,r=a.height,n=a.barColor,h=a.value):bo(n)&&(n=(a=n).barColor,h=a.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===h&&(h=0),super(t,e,i,s,r,a),this.type="rexLineProgress",this.bootProgressBase(a),this.addShape((new go).setName("trackFill")).addShape((new go).setName("bar")).addShape((new go).setName("trackStroke")),this.setTrackColor(mo(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(mo(a,"trackStrokeThickness",2),mo(a,"trackStrokeColor",void 0)),this.setSkewX(mo(a,"skewX",0)),this.setRTL(mo(a,"rtl",!1)),this.setValue(h)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var Co={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&fo(s,0,0,e,i,t);var r,n,h=this.getShape("bar");h.fillStyle(this.barColor),h.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),fo(h,r,0,n,i,t));var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&fo(a,0,0,e,i,t)}};Object.assign(yo.prototype,Co);var So=function(t){return null==t||""===t||0===t.length},wo=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(So(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(So(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,h=e.length;nWo(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=Wo(t[i]));return e}const Vo=Phaser.Utils.Objects.IsPlainObject,Fo=Phaser.Utils.Objects.GetValue;var Ho=function(t){return"string"==typeof t&&(t=Bo[t]),t};const Bo={scale:0,repeat:1};var No=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},Go={_beginDraw:At,_drawImage:At,_drawTileSprite:At,_endDraw:At,setGetFrameNameCallback:function(t){return void 0===t&&(t=jo),this.getFrameNameCallback=t,this},setBaseTexture:function(t,e,i,s){Array.isArray(e)&&(s=i,i=e,e=void 0),null==e&&(e="__BASE"),"number"==typeof i&&arguments.length>=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=Wo(i),s=Wo(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),h=n.width,a=0,o=0,l=i.length;o0?h/a:0,c=n.height,u=0;for(o=0,l=s.length;o0?0:g,y=0,o=0;for(var P=i.length;o0?0:f),f>=1&&g>=1){var x=typeof(m=this.getFrameNameCallback(o,S,e));"string"!==x&&"number"!==x||r.add(m,0,y+n.cutX,C+n.cutY,f,g)}y+=f}C+=g}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,h,a,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/o,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(u,p);if(u>v){var g=(u-v)*o;d>=0?d+=g:d=g,u=v}if(p>v){var f=(p-v)*l;c>=0?c+=f:c=f,p=v}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,b=0;this._beginDraw();for(var y=0,C=this.rows.count;y0&&a>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(S,y)?0:1)?this._drawImage(this.textureKey,s,m,b,h,a):this._drawTileSprite(this.textureKey,s,m,b,h,a)),m+=h;b+=a}this._endDraw()},setStretchMode:function(t){return Vo(t)?(this.stretchMode.edge=Ho(Fo(t,"edge",0)),this.stretchMode.internal=Ho(Fo(t,"internal",0))):(t=Ho(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return No.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const Uo=Phaser.Utils.Objects.IsPlainObject,$o=Phaser.Utils.Objects.GetValue,Jo=Phaser.GameObjects;var qo=void 0,Ko=function(t,e){if(qo||(qo={},ti(t).events.once("destroy",(function(){for(var t in qo)qo[t].destroy();qo=void 0}))),!qo.hasOwnProperty(e)){var i=ti(t).scene.systemScene;(t=new Jo[e](i)).setOrigin(0),qo[e]=t}return qo[e]};const Zo=Phaser.GameObjects.RenderTexture;class Qo extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if(Uo(i)?(i=$o(d=i,"x",0),s=$o(d,"y",0),r=$o(d,"width",1),n=$o(d,"height",1),h=$o(d,"key",void 0),a=$o(d,"baseFrame",void 0),o=$o(d,"columns",void 0),l=$o(d,"rows",void 0)):Uo(r)?(r=$o(d=r,"width",1),n=$o(d,"height",1),h=$o(d,"key",void 0),a=$o(d,"baseFrame",void 0),o=$o(d,"columns",void 0),l=$o(d,"rows",void 0)):Uo(h)?(h=$o(d=h,"key",void 0),a=$o(d,"baseFrame",void 0),o=$o(d,"columns",void 0),l=$o(d,"rows",void 0)):Uo(a)?(a=$o(d=a,"baseFrame",void 0),o=$o(d,"columns",void 0),l=$o(d,"rows",void 0)):Array.isArray(a)?(d=l,l=o,o=a,a=$o(d,"baseFrame",void 0)):Uo(o)&&(o=$o(d=o,"columns",void 0),l=$o(d,"rows",void 0)),void 0===a&&(a=$o(d,"frame",void 0)),void 0===o){var c=$o(d,"leftWidth",void 0),u=$o(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=$o(d,"topHeight",void 0),v=$o(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback($o(d,"getFrameNameCallback",void 0)),this.setStretchMode($o(d,"stretchMode",0)),this.setPreserveRatio($o(d,"preserveRatio",!0));var g=$o(d,"maxFixedPartScale",1),f=$o(d,"maxFixedPartScaleX",g),m=$o(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(h,a,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,Go),i}(Zo,"rexNinePatch")){}var tl={_drawImage:function(t,e,i,s,r,n){var h=Ko(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=Ko(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(Qo.prototype,tl);class el extends ii{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Oo(t,e))return t[e];var i=t.parent;return Oo(i,e)?i[e]:void 0}set(t,e,i){return Oo(t,e)?t[e]=i:Oo(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}}const il=Phaser.Utils.Objects.GetValue;class sl extends Qo{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=il(e,"effects",!0);i&&Mo(this,i),this.style=new el(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(sl.prototype,_a);const rl=["alpha","tint","flipX","flipY"];var nl=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("barColor")?i="bar":e.hasOwnProperty("leftWidth")?i="nineSlice":e.hasOwnProperty("key")&&(i="image")),i){case"bar":s=new Po(t,e);break;case"image":s=new Io(t,e);break;case"nineSlice":s=e.hasOwnProperty("stretchMode")?new sl(t,e):new Lo(t,e);break;default:s=new Ta(t,e)}return function(t,e){if(!e)return t;for(var i=0,s=rl.length;i=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const zl=Phaser.Utils.Objects.GetValue,Al=Phaser.Math.Distance.Between;class Il extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=zl(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(zl(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(zl(t,"enable",!0)),this.holdThreshold=zl(t,"holdThreshold",50),this.pointerOutReleaseEnable=zl(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return dn(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:Al(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!or(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!or(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const jl=Phaser.Utils.Objects.GetValue;class Wl{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(jl(t,"value",0)),this.setSpeed(jl(t,"speed",0)),this.setAcceleration(jl(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class Vl{constructor(){this.value,this.dir,this.movement=new Wl}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const Nl={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},Gl=Phaser.Utils.Objects.GetValue;class Ul extends ii{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=Gl(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(Gl(e,"speed",.1)),this.setEnable(Gl(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(Gl(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||or(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const $l=Phaser.Utils.Objects.GetValue;var Jl=function(t,e,i,s){var r,n,h="Y"===(i=i.toUpperCase()),a=2===t.scrollMode,o=t.childrenMap.child,l=`slider${i}`;if(r=a||s.hasOwnProperty(l)?$l(s,l,void 0):$l(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=h?1:0,n=function(t,e){void 0===e&&(e={});var i=mt(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new Ll(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r),n.tickLength=$l(r,"tickLength",void 0);var p=$l(r,"position",0);"string"==typeof p&&(p=ql[p]);var v,g,f=$l(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=$l(s,"space.slider",void 0))&&(a?f=0:v=$l(s,"space.child",0)),g=void 0===v?"number"==typeof f:"number"==typeof v,h?0===p?(d=2,c=1,u=void 0===v?g?{left:f}:f:{left:$l(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:$l(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:$l(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:$l(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=$l(r,"hideUnscrollableSlider",!1),t[`disableUnscrollableDrag${i}`]=$l(r,"disableUnscrollableDrag",!1),t[`adaptThumb${i}SizeMode`]=$l(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=$l(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`disableUnscrollableDrag${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,b,y=$l(s,"scrollDetectionMode");"string"==typeof y&&(y=Kl[y]);var C=`scroller${i}`;(m=a||s.hasOwnProperty(C)?$l(s,C,!0):$l(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==y&&(m.rectBoundsInteractive=1===y),b=new Bl(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var S,w,P,x,O,_=$l(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);_&&o&&(void 0!==y&&(_.focus=1===y?2:0),S=new Ul(o,_)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,b),t.addChildrenMap(`mouseWheelScroller${i}`,S),a&&!h||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.disableUnscrollableDrag=t[`disableUnscrollableDrag${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",b),t.addChildrenMap("mouseWheelScroller",S)),n&&(a?(w=h?"t":"s",x=`scroll${i}`):(w="t",x="scroll"),n.on("valuechange",(function(e){t[w]=e,t.emit(x,t)}))),b&&(a?(P=`childO${i}`,x=`scroll${i}`):(P="childOY",x="scroll"),b.on("valuechange",(function(e){t[P]=e,t.emit(x,t)}))),S&&(O=a?`addChildO${i}`:"addChildOY",S.on("scroll",(function(e){t[O](-e,!0)})))};const ql={right:0,left:1,bottom:0,top:1},Kl={gameObject:0,rectBounds:1},Zl=Phaser.Utils.Objects.GetValue;var Ql=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=Zl(e,"width"),h=Zl(e,"height");n||Zl(e,"child.expandWidth",!0)||(s[1]=0),h||Zl(e,"child.expandHeight",!0)||(r[1]=0);var a=new $h(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=Jh(i,"child"),r=Jh(s,"gameObject",void 0);if(r){var n=Jh(i,"space.child",0);t.childMargin={};var h=t.childMargin,a={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:h.top=0,h.bottom=0,h.left=0,h.right=0;break;default:h.top=n,h.bottom=n,h.left=n,h.right=n}else switch(t.scrollMode){case 0:h.top=Jh(n,"top",0),h.bottom=Jh(n,"bottom",0),a.left=Jh(n,"left",0),a.right=Jh(n,"right",0);break;case 1:h.top=Jh(n,"left",0),h.bottom=Jh(n,"right",0),a.top=Jh(n,"top",0),a.bottom=Jh(n,"bottom",0);break;default:h.top=Jh(n,"top",0),h.bottom=Jh(n,"bottom",0),h.left=Jh(n,"left",0),h.right=Jh(n,"right",0)}e.add(r,{column:1,row:1,align:Jh(s,"align","center"),padding:a,expand:{width:Jh(s,"expandWidth",!0),height:Jh(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:Jl(t,a,"y",e);break;case 1:Jl(t,a,"x",e);break;default:Jl(t,a,"y",e),Jl(t,a,"x",e)}return a},td=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}i*="Y"===t?this.scaleY:this.scaleX,s&&s.setBounds(e,i),r&&(r.setEnable(e!==i),r.tickLength&&r.setTick(r.tickLength,e,i))},ed=function(t){switch(this.scrollMode){case 0:case 1:(i=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(i,this.isOverflow),(r=this.childrenMap.scroller)&&this.disableUnscrollableDrag&&r.setEnable(this.isOverflow);break;default:var e=this[`isOverflow${t=t.toUpperCase()}`],i=this.childrenMap[`slider${t}`],s=this[`hideUnscrollableSlider${t}`];i&&s&&this.setChildVisible(i,e);var r=this.childrenMap.scroller,n=this[`disableUnscrollableDrag${t}`];r&&n&&r.setEnable(e)}},id=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(a=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=a.childrenMap.track,s=a.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&n0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const dd=Phaser.Utils.Objects.GetValue,cd=Phaser.Utils.Array.SpliceOne;class ud{constructor(t,e){this.parent=t,this.cells=[],this.cellPool=new ld,this.resetFromJSON(e)}resetFromJSON(t){void 0===t&&(t={}),this.colCount=void 0,this.nonZeroDeltaHeightCount=0,this.resetTotalRowsHeight();var e=dd(t,"cellHeight",60),i=dd(t,"cellWidth",60);return this.setDefaultCellHeight(e),this.setDefaultCellWidth(i),this.initCells(dd(t,"cellsCount",0)),this.setColumnCount(dd(t,"columns",1)),this}destroy(t){this.cellPool.destroy(),this.cells=void 0,this.parent=void 0}get defaultCellHeightMode(){return 0===this.nonZeroDeltaHeightCount}setDefaultCellHeight(t){return this.defaultCellHeight=t,this}setDefaultCellWidth(t){return this.defaultCellWidth=t,this}initCells(t){var e=this.cells;e.length=t;for(var i=0;i=0&&t=0&&i0&&s)){if(0===n)return 2===e&&(i+=1),i;if(1===e){var h=i;(s=(i+=1)>=0&&i=this.colCount?null:e*this.colCount+t}rowIndexToHeight(t,e){if(this.defaultCellHeightMode)return(e-t+1)*this.defaultCellHeight;for(var i=0,s=t;s<=e;s++)i+=this.getRowHeight(s);return i}colIndexToWidth(t,e){return(e-t+1)*this.defaultCellWidth}getRowHeight(t){var e=this.colCount;if(e<=1)return this.getCellHeight(this.colRowToCellIndex(0,t));for(var i,s=0,r=0;ri,n=tthis.leftTableOX,n=tt?this.removeCells(t,e-t):this.insertNewCells(e,t-e)),this},insertNewCells:function(t,e){return"object"==typeof t&&(t=t.index),void 0===e&&(e=1),e<=0||(t=Ad(t,0,this.cellsCount),this.table.insertNewCells(t,e)),this},removeCells:function(t,e){if("object"==typeof t&&(t=t.index),void 0===e&&(e=1),t<0&&(e+=t,t=0),e<=0)return this;if(t>this.cellsCount)return this;for(var i,s=t,r=t+e;s0?-this.delay:0,this.state=this.nowTime>=0?_:k,this.repeatCounter=0,this}stop(){return this.state=T,this}update(t,e){this.state!==T&&this.state!==w&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=E)):(this.nowTime=this.duration,this.state=w):this.nowTime>=0&&(this.state=_))}get t(){var t;switch(this.state){case T:case k:case E:t=0;break;case _:t=this.nowTime/this.duration;break;case w:t=1}return S(t,0,1)}set t(t){(t=S(t,-1,1))<0?(this.state=k,this.nowTime=-this.delay*t):(this.state=_,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===T}get isDelay(){return this.state===k}get isCountDown(){return this.state===_}get isRunning(){return this.state===k||this.state===_}get isDone(){return this.state===w}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const T=0,k=1,_=2,E=3,w=-1;class C extends f{constructor(t,e){super(t,e),this.timer=new b}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const R=Phaser.Utils.Objects.GetValue,A=Phaser.Utils.Objects.GetAdvancedValue,L=Phaser.Tweens.Builders.GetEaseFunction;class O extends C{resetFromJSON(t){return this.timer.resetFromJSON(R(t,"timer")),this.setEnable(R(t,"enable",!0)),this.setTarget(R(t,"target",this.parent)),this.setDelay(A(t,"delay",0)),this.setDuration(A(t,"duration",1e3)),this.setEase(R(t,"ease","Linear")),this.setRepeat(R(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=L(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const V=Phaser.Utils.Objects.GetValue,x=Phaser.Math.Linear;class z extends O{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=V(t,"key","value");var i=e[this.propertyKey];return this.fromValue=V(t,"from",i),this.toValue=V(t,"to",i),this.setEase(V(t,"ease",this.ease)),this.setDuration(V(t,"duration",this.duration)),this.setRepeat(V(t,"repeat",0)),this.setDelay(V(t,"delay",0)),this.setRepeatDelay(V(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=x(this.fromValue,this.toValue,i)}}var j={start:function(t){return this.easeValueTask||(this.easeValueTask=new z(this,{eventEmitter:null})),void 0!==t&&(this.duration=t,this.easeValueTask.stop()),this.easeValueTask.isRunning||(this.easeValueTask.restart({key:"value",from:0,to:1,duration:this.duration,ease:this.ease,repeat:-1,delay:this.delay,repeatDelay:this.repeatDelay}),this.setDirty()),this},stop:function(){return this.easeValueTask?(this.easeValueTask.stop(),this.setDirty(),this):this},pause:function(){return this.easeValueTask?(this.easeValueTask.pause(),this.setDirty(),this):this},resume:function(){return this.easeValueTask?(this.easeValueTask.pause(),this.setDirty(),this):this}};const F=Phaser.Utils.Objects.GetValue;class X extends a{constructor(t,e){super(t,F(e,"x",0),F(e,"y",0),F(e,"width",64),F(e,"height",64)),this.resetFromConfig(e,!0),this.buildShapes(e),F(e,"start",!0)&&this.start()}resetFromConfig(t,e){var i;return void 0===e&&(e=!1),i=e?1e3:this.duration,this.setDuration(F(t,"duration",i)),i=e?"Linear":this.ease,this.setEase(F(t,"ease",i)),i=e?0:this.delay,this.setDelay(F(t,"delay",i)),i=e?0:this.repeatDelay,this.setRepeatDelay(F(t,"repeatDelay",i)),i=e?16777215:this.color,this.setColor(F(t,"color",i)),i=e?0:this.value,this.setValue(F(t,"value",i)),this}buildShapes(){}get centerX(){return this.width/2}get centerY(){return this.height/2}get radius(){return Math.min(this.centerX,this.centerY)}get color(){return this._color}set color(t){this.isColorChanged=this.isColorChanged||this._color!==t,this.dirty=this.dirty||this.isColorChanged,this._color=t,this.setShapesColor(t)}setColor(t){return this.color=t,this}setShapesColor(t){}get value(){return this._value}set value(t){t=Phaser.Math.Clamp(t,0,1),this.dirty=this.dirty||this._value!=t,this._value=t}setValue(t){return this.value=t,this}setDuration(t){return this.duration=t,this}setDelay(t){return this.delay=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return this.ease=t,this}get isRunning(){return!!this.tweenTask&&this.tweenTask.isRunning}}Object.assign(X.prototype,j);var Y={fillStyle:function(t,e){return null==t?this.isFilled=!1:(void 0===e&&(e=1),this.isFilled=!0,this.fillColor=t,this.fillAlpha=e),this},lineStyle:function(t,e,i){return null==t||null==e?this.isStroked=!1:(void 0===i&&(i=1),this.isStroked=!0,this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i),this}},M={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:function(t,e,i){if(!t||"number"==typeof t)return i;if("string"==typeof e){if(t.hasOwnProperty(e))return t[e];if(-1===e.indexOf("."))return i;e=e.split(".")}for(var s=e,r=t,h=i,a=0;a>>16,n=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+a+","+n+","+o+","+h+")"}(t,this),t.fill()),this.isStroked&&(function(t,e,i,s){var r=i||e.strokeColor,h=s||e.strokeAlpha,a=(16711680&r)>>>16,n=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+a+","+n+","+o+","+h+")",t.lineWidth=e.lineWidth}(t,this),t.stroke())}}var U=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],h=i[s-1];if(t===r&&e===h)return i}return i.push(t,e),i};const J=Phaser.Math.DegToRad,K=Phaser.Math.Interpolation.QuadraticBezier,q=Phaser.Math.Interpolation.CubicBezier;var H=function(t){var e=t.length;if(e<2)return t;var i=t[e-2],s=t[e-1];return t.push(i),t.push(s),t},Q={clear(){return this.start(),this},start(){return this.startAt(),this},startAt(t,e){return this.restorePathData(),this.accumulationLengths=void 0,function(t,e,i){i.length=0,null!=t&&i.push(t,e)}(t,e,this.pathData),this.firstPointX=t,this.firstPointY=e,this.lastPointX=t,this.lastPointY=e,this},lineTo(t,e,i){return void 0===i&&(i=!1),i&&(t+=this.lastPointX,e+=this.lastPointY),U(t,e,this.pathData),this.lastPointX=t,this.lastPointY=e,this},verticalLineTo(t,e){return this.lineTo(t,this.lastPointY,e),this},horizontalLineTo(t,e){return this.lineTo(this.lastPointX,t,e),this},ellipticalArc(t,e,i,s,r,h,a){return void 0===a&&(a=!1),function(t,e,i,s,r,h,a,n,o){a&&h>r?h-=360:!a&&h0,a=0,n=e.length;a0?-this.delay:0,this.state=this.nowTime>=0?_:k,this.repeatCounter=0,this}stop(){return this.state=T,this}update(t,e){this.state!==T&&this.state!==w&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=E)):(this.nowTime=this.duration,this.state=w):this.nowTime>=0&&(this.state=_))}get t(){var t;switch(this.state){case T:case k:case E:t=0;break;case _:t=this.nowTime/this.duration;break;case w:t=1}return b(t,0,1)}set t(t){(t=b(t,-1,1))<0?(this.state=k,this.nowTime=-this.delay*t):(this.state=_,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===T}get isDelay(){return this.state===k}get isCountDown(){return this.state===_}get isRunning(){return this.state===k||this.state===_}get isDone(){return this.state===w}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const T=0,k=1,_=2,E=3,w=-1;class C extends f{constructor(t,e){super(t,e),this.timer=new S}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const R=Phaser.Utils.Objects.GetValue,A=Phaser.Utils.Objects.GetAdvancedValue,L=Phaser.Tweens.Builders.GetEaseFunction;class O extends C{resetFromJSON(t){return this.timer.resetFromJSON(R(t,"timer")),this.setEnable(R(t,"enable",!0)),this.setTarget(R(t,"target",this.parent)),this.setDelay(A(t,"delay",0)),this.setDuration(A(t,"duration",1e3)),this.setEase(R(t,"ease","Linear")),this.setRepeat(R(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=L(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const V=Phaser.Utils.Objects.GetValue,x=Phaser.Math.Linear;class z extends O{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=V(t,"key","value");var i=e[this.propertyKey];return this.fromValue=V(t,"from",i),this.toValue=V(t,"to",i),this.setEase(V(t,"ease",this.ease)),this.setDuration(V(t,"duration",this.duration)),this.setRepeat(V(t,"repeat",0)),this.setDelay(V(t,"delay",0)),this.setRepeatDelay(V(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=x(this.fromValue,this.toValue,i)}}var j={start:function(t){return this.easeValueTask||(this.easeValueTask=new z(this,{eventEmitter:null})),void 0!==t&&(this.duration=t,this.easeValueTask.stop()),this.easeValueTask.isRunning||(this.easeValueTask.restart({key:"value",from:0,to:1,duration:this.duration,ease:this.ease,repeat:-1,delay:this.delay,repeatDelay:this.repeatDelay}),this.setDirty()),this},stop:function(){return this.easeValueTask?(this.easeValueTask.stop(),this.setDirty(),this):this},pause:function(){return this.easeValueTask?(this.easeValueTask.pause(),this.setDirty(),this):this},resume:function(){return this.easeValueTask?(this.easeValueTask.pause(),this.setDirty(),this):this}};const F=Phaser.Utils.Objects.GetValue;class X extends a{constructor(t,e){super(t,F(e,"x",0),F(e,"y",0),F(e,"width",64),F(e,"height",64)),this.resetFromConfig(e,!0),this.buildShapes(e),F(e,"start",!0)&&this.start()}resetFromConfig(t,e){var i;return void 0===e&&(e=!1),i=e?1e3:this.duration,this.setDuration(F(t,"duration",i)),i=e?"Linear":this.ease,this.setEase(F(t,"ease",i)),i=e?0:this.delay,this.setDelay(F(t,"delay",i)),i=e?0:this.repeatDelay,this.setRepeatDelay(F(t,"repeatDelay",i)),i=e?16777215:this.color,this.setColor(F(t,"color",i)),i=e?0:this.value,this.setValue(F(t,"value",i)),this}buildShapes(){}get centerX(){return this.width/2}get centerY(){return this.height/2}get radius(){return Math.min(this.centerX,this.centerY)}get color(){return this._color}set color(t){this.isColorChanged=this.isColorChanged||this._color!==t,this.dirty=this.dirty||this.isColorChanged,this._color=t,this.setShapesColor(t)}setColor(t){return this.color=t,this}setShapesColor(t){}get value(){return this._value}set value(t){t=Phaser.Math.Clamp(t,0,1),this.dirty=this.dirty||this._value!=t,this._value=t}setValue(t){return this.value=t,this}setDuration(t){return this.duration=t,this}setDelay(t){return this.delay=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return this.ease=t,this}get isRunning(){return!!this.tweenTask&&this.tweenTask.isRunning}}Object.assign(X.prototype,j);var Y={fillStyle:function(t,e){return null==t?this.isFilled=!1:(void 0===e&&(e=1),this.isFilled=!0,this.fillColor=t,this.fillAlpha=e),this},lineStyle:function(t,e,i){return null==t||null==e?this.isStroked=!1:(void 0===i&&(i=1),this.isStroked=!0,this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i),this}},M={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:function(t,e,i){if(!t||"number"==typeof t)return i;if("string"==typeof e){if(t.hasOwnProperty(e))return t[e];if(-1===e.indexOf("."))return i;e=e.split(".")}for(var s=e,h=t,r=i,a=0;a>>16,n=(65280&h)>>>8,o=255&h;t.fillStyle="rgba("+a+","+n+","+o+","+r+")"}(t,this),t.fill()),this.isStroked&&(function(t,e,i,s){var h=i||e.strokeColor,r=s||e.strokeAlpha,a=(16711680&h)>>>16,n=(65280&h)>>>8,o=255&h;t.strokeStyle="rgba("+a+","+n+","+o+","+r+")",t.lineWidth=e.lineWidth}(t,this),t.stroke())}}var U=function(t,e,i){var s=i.length;if(s>=2){var h=i[s-2],r=i[s-1];if(t===h&&e===r)return i}return i.push(t,e),i};const J=Phaser.Math.DegToRad,K=Phaser.Math.Interpolation.QuadraticBezier,q=Phaser.Math.Interpolation.CubicBezier,H=Phaser.Math.Interpolation.CatmullRom;var Q=function(t){var e=t.length;if(e<2)return t;var i=t[e-2],s=t[e-1];return t.push(i),t.push(s),t},Z={clear(){return this.start(),this},start(){return this.startAt(),this},startAt(t,e){return this.restorePathData(),this.accumulationLengths=void 0,function(t,e,i){i.length=0,null!=t&&i.push(t,e)}(t,e,this.pathData),this.firstPointX=t,this.firstPointY=e,this.lastPointX=t,this.lastPointY=e,this},lineTo(t,e,i){return void 0===i&&(i=!1),i&&(t+=this.lastPointX,e+=this.lastPointY),U(t,e,this.pathData),this.lastPointX=t,this.lastPointY=e,this},verticalLineTo(t,e){return this.lineTo(t,this.lastPointY,e),this},horizontalLineTo(t,e){return this.lineTo(this.lastPointX,t,e),this},ellipticalArc(t,e,i,s,h,r,a){return void 0===a&&(a=!1),function(t,e,i,s,h,r,a,n,o){a&&r>h?r-=360:!a&&r0,a=0,n=e.length;a0?-this.delay:0,this.state=this.nowTime>=0?w:C,this.repeatCounter=0,this}stop(){return this.state=E,this}update(t,e){this.state!==E&&this.state!==R&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=A)):(this.nowTime=this.duration,this.state=R):this.nowTime>=0&&(this.state=w))}get t(){var t;switch(this.state){case E:case C:case A:t=0;break;case w:t=this.nowTime/this.duration;break;case R:t=1}return T(t,0,1)}set t(t){(t=T(t,-1,1))<0?(this.state=C,this.nowTime=-this.delay*t):(this.state=w,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===E}get isDelay(){return this.state===C}get isCountDown(){return this.state===w}get isRunning(){return this.state===C||this.state===w}get isDone(){return this.state===R}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const E=0,C=1,w=2,A=3,R=-1;class V extends D{constructor(t,e){super(t,e),this.timer=new _}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const L=Phaser.Utils.Objects.GetValue,O=Phaser.Utils.Objects.GetAdvancedValue,F=Phaser.Tweens.Builders.GetEaseFunction;class X extends V{resetFromJSON(t){return this.timer.resetFromJSON(L(t,"timer")),this.setEnable(L(t,"enable",!0)),this.setTarget(L(t,"target",this.parent)),this.setDelay(O(t,"delay",0)),this.setDuration(O(t,"duration",1e3)),this.setEase(L(t,"ease","Linear")),this.setRepeat(L(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=F(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const j=Phaser.Utils.Objects.GetValue,x=Phaser.Math.Linear;class M extends X{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=j(t,"key","value");var i=e[this.propertyKey];return this.fromValue=j(t,"from",i),this.toValue=j(t,"to",i),this.setEase(j(t,"ease",this.ease)),this.setDuration(j(t,"duration",this.duration)),this.setRepeat(j(t,"repeat",0)),this.setDelay(j(t,"delay",0)),this.setRepeatDelay(j(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=x(this.fromValue,this.toValue,i)}}const N=Phaser.Math.Percent;var z={setEaseValuePropName:function(t){return this.easeValuePropName=t,this},setEaseValueDuration:function(t){return this.easeValueDuration=t,this},setEaseValueFunction:function(t){return this.easeFunction=t,this},stopEaseValue:function(){return this.easeValueTask&&this.easeValueTask.stop(),this},easeValueTo:function(t,e,i){return null==t||(void 0!==e&&(t=N(t,e,i)),void 0===this.easeValueTask&&(this.easeValueTask=new M(this,{eventEmitter:null})),this.easeValueTask.restart({key:this.easeValuePropName,to:t,duration:this.easeValueDuration,ease:this.easeFunction})),this},easeValueRepeat:function(t,e,i,s){return void 0===i&&(i=-1),void 0===s&&(s=0),void 0===this.easeValueTask&&(this.easeValueTask=new M(this,{eventEmitter:null})),this.easeValueTask.restart({key:this.easeValuePropName,from:t,to:e,duration:this.easeValueDuration,ease:this.easeFunction,repeat:i,repeatDelay:s}),this}};const G=Phaser.Utils.Objects.GetValue,Y=Phaser.Math.Clamp;var B={fillStyle:function(t,e){return null==t?this.isFilled=!1:(void 0===e&&(e=1),this.isFilled=!0,this.fillColor=t,this.fillAlpha=e),this},lineStyle:function(t,e,i){return null==t||null==e?this.isStroked=!1:(void 0===i&&(i=1),this.isStroked=!0,this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i),this}},W={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:function(t,e,i){if(!t||"number"==typeof t)return i;if("string"==typeof e){if(t.hasOwnProperty(e))return t[e];if(-1===e.indexOf("."))return i;e=e.split(".")}for(var s=e,r=t,a=i,h=0;h>>16,n=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+h+","+n+","+o+","+a+")"}(t,this),t.fill()),this.isStroked&&(function(t,e,i,s){var r=i||e.strokeColor,a=s||e.strokeAlpha,h=(16711680&r)>>>16,n=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+h+","+n+","+o+","+a+")",t.lineWidth=e.lineWidth}(t,this),t.stroke())}}var H=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],a=i[s-1];if(t===r&&e===a)return i}return i.push(t,e),i};const Q=Phaser.Math.DegToRad;Phaser.Math.DegToRad;const Z=Phaser.Math.Interpolation.QuadraticBezier,$=Phaser.Math.Interpolation.CubicBezier;var tt=function(t){var e=t.length;if(e<2)return t;var i=t[e-2],s=t[e-1];return t.push(i),t.push(s),t},et={clear(){return this.start(),this},start(){return this.startAt(),this},startAt(t,e){return this.restorePathData(),this.accumulationLengths=void 0,function(t,e,i){i.length=0,null!=t&&i.push(t,e)}(t,e,this.pathData),this.firstPointX=t,this.firstPointY=e,this.lastPointX=t,this.lastPointY=e,this},lineTo(t,e,i){return void 0===i&&(i=!1),i&&(t+=this.lastPointX,e+=this.lastPointY),H(t,e,this.pathData),this.lastPointX=t,this.lastPointY=e,this},verticalLineTo(t,e){return this.lineTo(t,this.lastPointY,e),this},horizontalLineTo(t,e){return this.lineTo(this.lastPointX,t,e),this},ellipticalArc(t,e,i,s,r,a,h){return void 0===h&&(h=!1),function(t,e,i,s,r,a,h,n,o){h&&a>r?a-=360:!h&&a0,h=0,n=e.length;h=0?t.startAt(h+a,i).lineTo(s+a,i).lineTo(s,r).lineTo(e,r).lineTo(e+a,i).lineTo(h+a,i):t.startAt(h,i).lineTo(s,i).lineTo(s-a,r).lineTo(e-a,r).lineTo(e,i).lineTo(h,i),t.close(),t};const kt=Phaser.Utils.Objects.GetValue,Pt=Phaser.Utils.Objects.IsPlainObject;class Dt extends(function(t){class e extends t{bootProgressBase(t){this.eventEmitter=G(t,"eventEmitter",this);var e=G(t,"valuechangeCallback",null);if(null!==e){var i=G(t,"valuechangeCallbackScope",void 0);this.eventEmitter.on("valuechange",e,i)}return this.setEaseValuePropName("value").setEaseValueDuration(G(t,"easeValue.duration",0)).setEaseValueFunction(G(t,"easeValue.ease","Linear")),this}get value(){return this._value}set value(t){t=Y(t,0,1);var e=this._value,i=e!=t;this.dirty=this.dirty||i,this._value=t,i&&this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter)}}return Object.assign(e.prototype,l,z),e}(h)){constructor(t,e,i,s,r,a,h,n){Pt(e)?(e=(n=e).x,i=n.y,s=n.width,r=n.height,a=n.barColor,h=n.value):Pt(s)?(s=(n=s).width,r=n.height,a=n.barColor,h=n.value):Pt(a)&&(a=(n=a).barColor,h=n.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===h&&(h=0),super(t,e,i,s,r,n),this.type="rexLineProgress",this.bootProgressBase(n),this.addShape((new yt).setName("trackFill")).addShape((new yt).setName("bar")).addShape((new yt).setName("trackStroke")),this.setTrackColor(kt(n,"trackColor",void 0)),this.setBarColor(a),this.setTrackStroke(kt(n,"trackStrokeThickness",2),kt(n,"trackStrokeColor",void 0)),this.setSkewX(kt(n,"skewX",0)),this.setRTL(kt(n,"rtl",!1)),this.setValue(h)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var St={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&ft(s,0,0,e,i,t);var r,a,h=this.getShape("bar");h.fillStyle(this.barColor),h.isFilled&&(this.rtl?(r=e*(1-this.value),a=e):(r=0,a=e*this.value),ft(h,r,0,a,i,t));var n=this.getShape("trackStroke");n.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),n.isStroked&&ft(n,0,0,e,i,t)}};return Object.assign(Dt.prototype,St),Dt},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rexlineprogress=e(); +var t,e;t=void 0,e=function(){const t=Phaser.GameObjects.GetCalcMatrix,e=Phaser.Renderer.Canvas.SetTransform;var i={renderWebGL:function(e,i,s,r){i.updateData(),s.addToRenderList(i);var a=e.pipelines.set(i.pipeline),h=t(i,s,r),n=a.calcMatrix.copyFrom(h.calc),o=i._displayOriginX,l=i._displayOriginY,u=s.alpha*i.alpha;e.pipelines.preBatch(i);for(var p,d=i.geom,c=0,v=d.length;c0?-this.delay:0,this.state=this.nowTime>=0?w:C,this.repeatCounter=0,this}stop(){return this.state=E,this}update(t,e){this.state!==E&&this.state!==A&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=R)):(this.nowTime=this.duration,this.state=A):this.nowTime>=0&&(this.state=w))}get t(){var t;switch(this.state){case E:case C:case R:t=0;break;case w:t=this.nowTime/this.duration;break;case A:t=1}return b(t,0,1)}set t(t){(t=b(t,-1,1))<0?(this.state=C,this.nowTime=-this.delay*t):(this.state=w,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===E}get isDelay(){return this.state===C}get isCountDown(){return this.state===w}get isRunning(){return this.state===C||this.state===w}get isDone(){return this.state===A}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const E=0,C=1,w=2,R=3,A=-1;class V extends D{constructor(t,e){super(t,e),this.timer=new _}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const L=Phaser.Utils.Objects.GetValue,O=Phaser.Utils.Objects.GetAdvancedValue,F=Phaser.Tweens.Builders.GetEaseFunction;class X extends V{resetFromJSON(t){return this.timer.resetFromJSON(L(t,"timer")),this.setEnable(L(t,"enable",!0)),this.setTarget(L(t,"target",this.parent)),this.setDelay(O(t,"delay",0)),this.setDuration(O(t,"duration",1e3)),this.setEase(L(t,"ease","Linear")),this.setRepeat(L(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=F(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const j=Phaser.Utils.Objects.GetValue,M=Phaser.Math.Linear;class x extends X{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=j(t,"key","value");var i=e[this.propertyKey];return this.fromValue=j(t,"from",i),this.toValue=j(t,"to",i),this.setEase(j(t,"ease",this.ease)),this.setDuration(j(t,"duration",this.duration)),this.setRepeat(j(t,"repeat",0)),this.setDelay(j(t,"delay",0)),this.setRepeatDelay(j(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=M(this.fromValue,this.toValue,i)}}const N=Phaser.Math.Percent;var z={setEaseValuePropName:function(t){return this.easeValuePropName=t,this},setEaseValueDuration:function(t){return this.easeValueDuration=t,this},setEaseValueFunction:function(t){return this.easeFunction=t,this},stopEaseValue:function(){return this.easeValueTask&&this.easeValueTask.stop(),this},easeValueTo:function(t,e,i){return null==t||(void 0!==e&&(t=N(t,e,i)),void 0===this.easeValueTask&&(this.easeValueTask=new x(this,{eventEmitter:null})),this.easeValueTask.restart({key:this.easeValuePropName,to:t,duration:this.easeValueDuration,ease:this.easeFunction})),this},easeValueRepeat:function(t,e,i,s){return void 0===i&&(i=-1),void 0===s&&(s=0),void 0===this.easeValueTask&&(this.easeValueTask=new x(this,{eventEmitter:null})),this.easeValueTask.restart({key:this.easeValuePropName,from:t,to:e,duration:this.easeValueDuration,ease:this.easeFunction,repeat:i,repeatDelay:s}),this}};const Y=Phaser.Utils.Objects.GetValue,G=Phaser.Math.Clamp;var B={fillStyle:function(t,e){return null==t?this.isFilled=!1:(void 0===e&&(e=1),this.isFilled=!0,this.fillColor=t,this.fillAlpha=e),this},lineStyle:function(t,e,i){return null==t||null==e?this.isStroked=!1:(void 0===i&&(i=1),this.isStroked=!0,this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i),this}},W={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:function(t,e,i){if(!t||"number"==typeof t)return i;if("string"==typeof e){if(t.hasOwnProperty(e))return t[e];if(-1===e.indexOf("."))return i;e=e.split(".")}for(var s=e,r=t,a=i,h=0;h>>16,n=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+h+","+n+","+o+","+a+")"}(t,this),t.fill()),this.isStroked&&(function(t,e,i,s){var r=i||e.strokeColor,a=s||e.strokeAlpha,h=(16711680&r)>>>16,n=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+h+","+n+","+o+","+a+")",t.lineWidth=e.lineWidth}(t,this),t.stroke())}}var H=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],a=i[s-1];if(t===r&&e===a)return i}return i.push(t,e),i};const Q=Phaser.Math.DegToRad;Phaser.Math.DegToRad;const Z=Phaser.Math.Interpolation.QuadraticBezier,$=Phaser.Math.Interpolation.CubicBezier,tt=Phaser.Math.Interpolation.CatmullRom;var et=function(t){var e=t.length;if(e<2)return t;var i=t[e-2],s=t[e-1];return t.push(i),t.push(s),t},it={clear(){return this.start(),this},start(){return this.startAt(),this},startAt(t,e){return this.restorePathData(),this.accumulationLengths=void 0,function(t,e,i){i.length=0,null!=t&&i.push(t,e)}(t,e,this.pathData),this.firstPointX=t,this.firstPointY=e,this.lastPointX=t,this.lastPointY=e,this},lineTo(t,e,i){return void 0===i&&(i=!1),i&&(t+=this.lastPointX,e+=this.lastPointY),H(t,e,this.pathData),this.lastPointX=t,this.lastPointY=e,this},verticalLineTo(t,e){return this.lineTo(t,this.lastPointY,e),this},horizontalLineTo(t,e){return this.lineTo(this.lastPointX,t,e),this},ellipticalArc(t,e,i,s,r,a,h){return void 0===h&&(h=!1),function(t,e,i,s,r,a,h,n,o){h&&a>r?a-=360:!h&&a0,h=0,n=e.length;h=0?t.startAt(h+a,i).lineTo(s+a,i).lineTo(s,r).lineTo(e,r).lineTo(e+a,i).lineTo(h+a,i):t.startAt(h,i).lineTo(s,i).lineTo(s-a,r).lineTo(e-a,r).lineTo(e,i).lineTo(h,i),t.close(),t};const Pt=Phaser.Utils.Objects.GetValue,Dt=Phaser.Utils.Objects.IsPlainObject;class St extends(function(t){class e extends t{bootProgressBase(t){this.eventEmitter=Y(t,"eventEmitter",this);var e=Y(t,"valuechangeCallback",null);if(null!==e){var i=Y(t,"valuechangeCallbackScope",void 0);this.eventEmitter.on("valuechange",e,i)}return this.setEaseValuePropName("value").setEaseValueDuration(Y(t,"easeValue.duration",0)).setEaseValueFunction(Y(t,"easeValue.ease","Linear")),this}get value(){return this._value}set value(t){t=G(t,0,1);var e=this._value,i=e!=t;this.dirty=this.dirty||i,this._value=t,i&&this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter)}}return Object.assign(e.prototype,l,z),e}(h)){constructor(t,e,i,s,r,a,h,n){Dt(e)?(e=(n=e).x,i=n.y,s=n.width,r=n.height,a=n.barColor,h=n.value):Dt(s)?(s=(n=s).width,r=n.height,a=n.barColor,h=n.value):Dt(a)&&(a=(n=a).barColor,h=n.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===h&&(h=0),super(t,e,i,s,r,n),this.type="rexLineProgress",this.bootProgressBase(n),this.addShape((new ft).setName("trackFill")).addShape((new ft).setName("bar")).addShape((new ft).setName("trackStroke")),this.setTrackColor(Pt(n,"trackColor",void 0)),this.setBarColor(a),this.setTrackStroke(Pt(n,"trackStrokeThickness",2),Pt(n,"trackStrokeColor",void 0)),this.setSkewX(Pt(n,"skewX",0)),this.setRTL(Pt(n,"rtl",!1)),this.setValue(h)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var Tt={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&kt(s,0,0,e,i,t);var r,a,h=this.getShape("bar");h.fillStyle(this.barColor),h.isFilled&&(this.rtl?(r=e*(1-this.value),a=e):(r=0,a=e*this.value),kt(h,r,0,a,i,t));var n=this.getShape("trackStroke");n.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),n.isStroked&&kt(n,0,0,e,i,t)}};return Object.assign(St.prototype,Tt),St},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rexlineprogress=e(); diff --git a/dist/rexlineprogressplugin.js b/dist/rexlineprogressplugin.js index 4bff74ba1e..24787d17b8 100644 --- a/dist/rexlineprogressplugin.js +++ b/dist/rexlineprogressplugin.js @@ -1695,6 +1695,32 @@ return pathData; }; + //import CatmullRomInterpolation from '../../utils/math/interpolation/CatmullRomInterpolation.js'; + + const CatmullRomInterpolation = Phaser.Math.Interpolation.CatmullRom; + + var CatmullRomTo = function (points, iterations, pathData) { + var pathDataCnt = pathData.length; + var p0x = pathData[pathDataCnt - 2]; + var p0y = pathData[pathDataCnt - 1]; + + var xList = [p0x]; + var yList = [p0y]; + for (var i = 0, cnt = points.length; i < cnt; i += 2) { + xList.push(points[i]); + yList.push(points[i + 1]); + } + + for (var i = 1, last = iterations - 1; i <= last; i++) { + var t = i / last; + pathData.push( + CatmullRomInterpolation(xList, t), + CatmullRomInterpolation(yList, t) + ); + } + return pathData; + }; + var DuplicateLast = function (pathData) { var len = pathData.length; if (len < 2) { @@ -1806,6 +1832,18 @@ return this; }, + catmullRomTo(...points) { + CatmullRomTo( + points, + this.iterations, + this.pathData + ); + + this.lastPointX = points[points.length-2]; + this.lastPointY = points[points.length-1]; + return this; + }, + close() { // Line to first point var startX = this.pathData[0], @@ -2243,6 +2281,13 @@ return this; } + catmullRomTo(...points) { + this.builder.catmullRomTo(...points); + + this.dirty = true; + return this; + } + close() { this.builder.close(); diff --git a/dist/rexlineprogressplugin.min.js b/dist/rexlineprogressplugin.min.js index a198d8d1d8..e2c66ee232 100644 --- a/dist/rexlineprogressplugin.min.js +++ b/dist/rexlineprogressplugin.min.js @@ -1 +1 @@ -var t,e;t=void 0,e=function(){const t=Phaser.GameObjects.GetCalcMatrix,e=Phaser.Renderer.Canvas.SetTransform;var i={renderWebGL:function(e,i,s,r){i.updateData(),s.addToRenderList(i);var a=e.pipelines.set(i.pipeline),h=t(i,s,r),n=a.calcMatrix.copyFrom(h.calc),o=i._displayOriginX,l=i._displayOriginY,u=s.alpha*i.alpha;e.pipelines.preBatch(i);for(var p,d=i.geom,c=0,v=d.length;c0?-this.delay:0,this.state=this.nowTime>=0?w:C,this.repeatCounter=0,this}stop(){return this.state=E,this}update(t,e){this.state!==E&&this.state!==A&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=R)):(this.nowTime=this.duration,this.state=A):this.nowTime>=0&&(this.state=w))}get t(){var t;switch(this.state){case E:case C:case R:t=0;break;case w:t=this.nowTime/this.duration;break;case A:t=1}return T(t,0,1)}set t(t){(t=T(t,-1,1))<0?(this.state=C,this.nowTime=-this.delay*t):(this.state=w,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===E}get isDelay(){return this.state===C}get isCountDown(){return this.state===w}get isRunning(){return this.state===C||this.state===w}get isDone(){return this.state===A}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const E=0,C=1,w=2,R=3,A=-1;class V extends D{constructor(t,e){super(t,e),this.timer=new _}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const L=Phaser.Utils.Objects.GetValue,O=Phaser.Utils.Objects.GetAdvancedValue,j=Phaser.Tweens.Builders.GetEaseFunction;class F extends V{resetFromJSON(t){return this.timer.resetFromJSON(L(t,"timer")),this.setEnable(L(t,"enable",!0)),this.setTarget(L(t,"target",this.parent)),this.setDelay(O(t,"delay",0)),this.setDuration(O(t,"duration",1e3)),this.setEase(L(t,"ease","Linear")),this.setRepeat(L(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=j(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const X=Phaser.Utils.Objects.GetValue,x=Phaser.Math.Linear;class M extends F{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=X(t,"key","value");var i=e[this.propertyKey];return this.fromValue=X(t,"from",i),this.toValue=X(t,"to",i),this.setEase(X(t,"ease",this.ease)),this.setDuration(X(t,"duration",this.duration)),this.setRepeat(X(t,"repeat",0)),this.setDelay(X(t,"delay",0)),this.setRepeatDelay(X(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=x(this.fromValue,this.toValue,i)}}const G=Phaser.Math.Percent;var N={setEaseValuePropName:function(t){return this.easeValuePropName=t,this},setEaseValueDuration:function(t){return this.easeValueDuration=t,this},setEaseValueFunction:function(t){return this.easeFunction=t,this},stopEaseValue:function(){return this.easeValueTask&&this.easeValueTask.stop(),this},easeValueTo:function(t,e,i){return null==t||(void 0!==e&&(t=G(t,e,i)),void 0===this.easeValueTask&&(this.easeValueTask=new M(this,{eventEmitter:null})),this.easeValueTask.restart({key:this.easeValuePropName,to:t,duration:this.easeValueDuration,ease:this.easeFunction})),this},easeValueRepeat:function(t,e,i,s){return void 0===i&&(i=-1),void 0===s&&(s=0),void 0===this.easeValueTask&&(this.easeValueTask=new M(this,{eventEmitter:null})),this.easeValueTask.restart({key:this.easeValuePropName,from:t,to:e,duration:this.easeValueDuration,ease:this.easeFunction,repeat:i,repeatDelay:s}),this}};const z=Phaser.Utils.Objects.GetValue,Y=Phaser.Math.Clamp;var B={fillStyle:function(t,e){return null==t?this.isFilled=!1:(void 0===e&&(e=1),this.isFilled=!0,this.fillColor=t,this.fillAlpha=e),this},lineStyle:function(t,e,i){return null==t||null==e?this.isStroked=!1:(void 0===i&&(i=1),this.isStroked=!0,this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i),this}},W={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:function(t,e,i){if(!t||"number"==typeof t)return i;if("string"==typeof e){if(t.hasOwnProperty(e))return t[e];if(-1===e.indexOf("."))return i;e=e.split(".")}for(var s=e,r=t,a=i,h=0;h>>16,n=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+h+","+n+","+o+","+a+")"}(t,this),t.fill()),this.isStroked&&(function(t,e,i,s){var r=i||e.strokeColor,a=s||e.strokeAlpha,h=(16711680&r)>>>16,n=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+h+","+n+","+o+","+a+")",t.lineWidth=e.lineWidth}(t,this),t.stroke())}}var H=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],a=i[s-1];if(t===r&&e===a)return i}return i.push(t,e),i};const Q=Phaser.Math.DegToRad;Phaser.Math.DegToRad;const Z=Phaser.Math.Interpolation.QuadraticBezier,$=Phaser.Math.Interpolation.CubicBezier;var tt=function(t){var e=t.length;if(e<2)return t;var i=t[e-2],s=t[e-1];return t.push(i),t.push(s),t},et={clear(){return this.start(),this},start(){return this.startAt(),this},startAt(t,e){return this.restorePathData(),this.accumulationLengths=void 0,function(t,e,i){i.length=0,null!=t&&i.push(t,e)}(t,e,this.pathData),this.firstPointX=t,this.firstPointY=e,this.lastPointX=t,this.lastPointY=e,this},lineTo(t,e,i){return void 0===i&&(i=!1),i&&(t+=this.lastPointX,e+=this.lastPointY),H(t,e,this.pathData),this.lastPointX=t,this.lastPointY=e,this},verticalLineTo(t,e){return this.lineTo(t,this.lastPointY,e),this},horizontalLineTo(t,e){return this.lineTo(this.lastPointX,t,e),this},ellipticalArc(t,e,i,s,r,a,h){return void 0===h&&(h=!1),function(t,e,i,s,r,a,h,n,o){h&&a>r?a-=360:!h&&a0,h=0,n=e.length;h=0?t.startAt(h+a,i).lineTo(s+a,i).lineTo(s,r).lineTo(e,r).lineTo(e+a,i).lineTo(h+a,i):t.startAt(h,i).lineTo(s,i).lineTo(s-a,r).lineTo(e-a,r).lineTo(e,i).lineTo(h,i),t.close(),t};const kt=Phaser.Utils.Objects.GetValue,Pt=Phaser.Utils.Objects.IsPlainObject;class Dt extends(function(t){class e extends t{bootProgressBase(t){this.eventEmitter=z(t,"eventEmitter",this);var e=z(t,"valuechangeCallback",null);if(null!==e){var i=z(t,"valuechangeCallbackScope",void 0);this.eventEmitter.on("valuechange",e,i)}return this.setEaseValuePropName("value").setEaseValueDuration(z(t,"easeValue.duration",0)).setEaseValueFunction(z(t,"easeValue.ease","Linear")),this}get value(){return this._value}set value(t){t=Y(t,0,1);var e=this._value,i=e!=t;this.dirty=this.dirty||i,this._value=t,i&&this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter)}}return Object.assign(e.prototype,l,N),e}(h)){constructor(t,e,i,s,r,a,h,n){Pt(e)?(e=(n=e).x,i=n.y,s=n.width,r=n.height,a=n.barColor,h=n.value):Pt(s)?(s=(n=s).width,r=n.height,a=n.barColor,h=n.value):Pt(a)&&(a=(n=a).barColor,h=n.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===h&&(h=0),super(t,e,i,s,r,n),this.type="rexLineProgress",this.bootProgressBase(n),this.addShape((new yt).setName("trackFill")).addShape((new yt).setName("bar")).addShape((new yt).setName("trackStroke")),this.setTrackColor(kt(n,"trackColor",void 0)),this.setBarColor(a),this.setTrackStroke(kt(n,"trackStrokeThickness",2),kt(n,"trackStrokeColor",void 0)),this.setSkewX(kt(n,"skewX",0)),this.setRTL(kt(n,"rtl",!1)),this.setValue(h)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var St={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&ft(s,0,0,e,i,t);var r,a,h=this.getShape("bar");h.fillStyle(this.barColor),h.isFilled&&(this.rtl?(r=e*(1-this.value),a=e):(r=0,a=e*this.value),ft(h,r,0,a,i,t));var n=this.getShape("trackStroke");n.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),n.isStroked&&ft(n,0,0,e,i,t)}};function bt(t,e,i,s,r,a,h){var n=new Dt(this.scene,t,e,i,s,r,a,h);return this.scene.add.existing(n),n}Object.assign(Dt.prototype,St);const Tt=Phaser.GameObjects.BuildGameObject;function _t(t,e){void 0===t&&(t={}),void 0!==e&&(t.add=e);var i=new Dt(this.scene,t);return Tt(this.scene,i,t),i}var Et=function(t){return null==t||""===t||0===t.length};class Ct extends Phaser.Plugins.BasePlugin{constructor(t){super(t),t.registerGameObject("rexLineProgress",bt,_t)}start(){this.game.events.on("destroy",this.destroy,this)}}return function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t)if(Et(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),a=function(t,e,i){var s=t;if(Et(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var a=0,h=e.length;a0?-this.delay:0,this.state=this.nowTime>=0?w:C,this.repeatCounter=0,this}stop(){return this.state=E,this}update(t,e){this.state!==E&&this.state!==A&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=R)):(this.nowTime=this.duration,this.state=A):this.nowTime>=0&&(this.state=w))}get t(){var t;switch(this.state){case E:case C:case R:t=0;break;case w:t=this.nowTime/this.duration;break;case A:t=1}return T(t,0,1)}set t(t){(t=T(t,-1,1))<0?(this.state=C,this.nowTime=-this.delay*t):(this.state=w,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===E}get isDelay(){return this.state===C}get isCountDown(){return this.state===w}get isRunning(){return this.state===C||this.state===w}get isDone(){return this.state===A}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const E=0,C=1,w=2,R=3,A=-1;class V extends D{constructor(t,e){super(t,e),this.timer=new _}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const L=Phaser.Utils.Objects.GetValue,O=Phaser.Utils.Objects.GetAdvancedValue,j=Phaser.Tweens.Builders.GetEaseFunction;class F extends V{resetFromJSON(t){return this.timer.resetFromJSON(L(t,"timer")),this.setEnable(L(t,"enable",!0)),this.setTarget(L(t,"target",this.parent)),this.setDelay(O(t,"delay",0)),this.setDuration(O(t,"duration",1e3)),this.setEase(L(t,"ease","Linear")),this.setRepeat(L(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=j(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const X=Phaser.Utils.Objects.GetValue,x=Phaser.Math.Linear;class M extends F{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=X(t,"key","value");var i=e[this.propertyKey];return this.fromValue=X(t,"from",i),this.toValue=X(t,"to",i),this.setEase(X(t,"ease",this.ease)),this.setDuration(X(t,"duration",this.duration)),this.setRepeat(X(t,"repeat",0)),this.setDelay(X(t,"delay",0)),this.setRepeatDelay(X(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=x(this.fromValue,this.toValue,i)}}const G=Phaser.Math.Percent;var N={setEaseValuePropName:function(t){return this.easeValuePropName=t,this},setEaseValueDuration:function(t){return this.easeValueDuration=t,this},setEaseValueFunction:function(t){return this.easeFunction=t,this},stopEaseValue:function(){return this.easeValueTask&&this.easeValueTask.stop(),this},easeValueTo:function(t,e,i){return null==t||(void 0!==e&&(t=G(t,e,i)),void 0===this.easeValueTask&&(this.easeValueTask=new M(this,{eventEmitter:null})),this.easeValueTask.restart({key:this.easeValuePropName,to:t,duration:this.easeValueDuration,ease:this.easeFunction})),this},easeValueRepeat:function(t,e,i,s){return void 0===i&&(i=-1),void 0===s&&(s=0),void 0===this.easeValueTask&&(this.easeValueTask=new M(this,{eventEmitter:null})),this.easeValueTask.restart({key:this.easeValuePropName,from:t,to:e,duration:this.easeValueDuration,ease:this.easeFunction,repeat:i,repeatDelay:s}),this}};const z=Phaser.Utils.Objects.GetValue,Y=Phaser.Math.Clamp;var B={fillStyle:function(t,e){return null==t?this.isFilled=!1:(void 0===e&&(e=1),this.isFilled=!0,this.fillColor=t,this.fillAlpha=e),this},lineStyle:function(t,e,i){return null==t||null==e?this.isStroked=!1:(void 0===i&&(i=1),this.isStroked=!0,this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i),this}},W={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:function(t,e,i){if(!t||"number"==typeof t)return i;if("string"==typeof e){if(t.hasOwnProperty(e))return t[e];if(-1===e.indexOf("."))return i;e=e.split(".")}for(var s=e,r=t,a=i,h=0;h>>16,n=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+h+","+n+","+o+","+a+")"}(t,this),t.fill()),this.isStroked&&(function(t,e,i,s){var r=i||e.strokeColor,a=s||e.strokeAlpha,h=(16711680&r)>>>16,n=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+h+","+n+","+o+","+a+")",t.lineWidth=e.lineWidth}(t,this),t.stroke())}}var H=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],a=i[s-1];if(t===r&&e===a)return i}return i.push(t,e),i};const Q=Phaser.Math.DegToRad;Phaser.Math.DegToRad;const Z=Phaser.Math.Interpolation.QuadraticBezier,$=Phaser.Math.Interpolation.CubicBezier,tt=Phaser.Math.Interpolation.CatmullRom;var et=function(t){var e=t.length;if(e<2)return t;var i=t[e-2],s=t[e-1];return t.push(i),t.push(s),t},it={clear(){return this.start(),this},start(){return this.startAt(),this},startAt(t,e){return this.restorePathData(),this.accumulationLengths=void 0,function(t,e,i){i.length=0,null!=t&&i.push(t,e)}(t,e,this.pathData),this.firstPointX=t,this.firstPointY=e,this.lastPointX=t,this.lastPointY=e,this},lineTo(t,e,i){return void 0===i&&(i=!1),i&&(t+=this.lastPointX,e+=this.lastPointY),H(t,e,this.pathData),this.lastPointX=t,this.lastPointY=e,this},verticalLineTo(t,e){return this.lineTo(t,this.lastPointY,e),this},horizontalLineTo(t,e){return this.lineTo(this.lastPointX,t,e),this},ellipticalArc(t,e,i,s,r,a,h){return void 0===h&&(h=!1),function(t,e,i,s,r,a,h,n,o){h&&a>r?a-=360:!h&&a0,h=0,n=e.length;h=0?t.startAt(h+a,i).lineTo(s+a,i).lineTo(s,r).lineTo(e,r).lineTo(e+a,i).lineTo(h+a,i):t.startAt(h,i).lineTo(s,i).lineTo(s-a,r).lineTo(e-a,r).lineTo(e,i).lineTo(h,i),t.close(),t};const Pt=Phaser.Utils.Objects.GetValue,Dt=Phaser.Utils.Objects.IsPlainObject;class St extends(function(t){class e extends t{bootProgressBase(t){this.eventEmitter=z(t,"eventEmitter",this);var e=z(t,"valuechangeCallback",null);if(null!==e){var i=z(t,"valuechangeCallbackScope",void 0);this.eventEmitter.on("valuechange",e,i)}return this.setEaseValuePropName("value").setEaseValueDuration(z(t,"easeValue.duration",0)).setEaseValueFunction(z(t,"easeValue.ease","Linear")),this}get value(){return this._value}set value(t){t=Y(t,0,1);var e=this._value,i=e!=t;this.dirty=this.dirty||i,this._value=t,i&&this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter)}}return Object.assign(e.prototype,l,N),e}(h)){constructor(t,e,i,s,r,a,h,n){Dt(e)?(e=(n=e).x,i=n.y,s=n.width,r=n.height,a=n.barColor,h=n.value):Dt(s)?(s=(n=s).width,r=n.height,a=n.barColor,h=n.value):Dt(a)&&(a=(n=a).barColor,h=n.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===h&&(h=0),super(t,e,i,s,r,n),this.type="rexLineProgress",this.bootProgressBase(n),this.addShape((new ft).setName("trackFill")).addShape((new ft).setName("bar")).addShape((new ft).setName("trackStroke")),this.setTrackColor(Pt(n,"trackColor",void 0)),this.setBarColor(a),this.setTrackStroke(Pt(n,"trackStrokeThickness",2),Pt(n,"trackStrokeColor",void 0)),this.setSkewX(Pt(n,"skewX",0)),this.setRTL(Pt(n,"rtl",!1)),this.setValue(h)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var bt={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&kt(s,0,0,e,i,t);var r,a,h=this.getShape("bar");h.fillStyle(this.barColor),h.isFilled&&(this.rtl?(r=e*(1-this.value),a=e):(r=0,a=e*this.value),kt(h,r,0,a,i,t));var n=this.getShape("trackStroke");n.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),n.isStroked&&kt(n,0,0,e,i,t)}};function Tt(t,e,i,s,r,a,h){var n=new St(this.scene,t,e,i,s,r,a,h);return this.scene.add.existing(n),n}Object.assign(St.prototype,bt);const _t=Phaser.GameObjects.BuildGameObject;function Et(t,e){void 0===t&&(t={}),void 0!==e&&(t.add=e);var i=new St(this.scene,t);return _t(this.scene,i,t),i}var Ct=function(t){return null==t||""===t||0===t.length};class wt extends Phaser.Plugins.BasePlugin{constructor(t){super(t),t.registerGameObject("rexLineProgress",Tt,Et)}start(){this.game.events.on("destroy",this.destroy,this)}}return function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t)if(Ct(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),a=function(t,e,i){var s=t;if(Ct(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var a=0,h=e.length;a>> 16); + var green = ((fillColor & 0xFF00) >>> 8); + var blue = (fillColor & 0xFF); + + ctx.fillStyle = 'rgba(' + red + ',' + green + ',' + blue + ',' + fillAlpha + ')'; + }; + + var LineStyleCanvas = function (ctx, src, altColor, altAlpha) + { + var strokeColor = (altColor) ? altColor : src.strokeColor; + var strokeAlpha = (altAlpha) ? altAlpha : src.strokeAlpha; + + var red = ((strokeColor & 0xFF0000) >>> 16); + var green = ((strokeColor & 0xFF00) >>> 8); + var blue = (strokeColor & 0xFF); + + ctx.strokeStyle = 'rgba(' + red + ',' + green + ',' + blue + ',' + strokeAlpha + ')'; + ctx.lineWidth = src.lineWidth; + }; + + const Earcut = Phaser.Geom.Polygon.Earcut; + + class PathBase extends BaseGeom { + constructor() { + super(); + + this.pathData = []; + this.pathIndexes = []; + this.closePath = false; + } + + updateData() { + this.pathIndexes = Earcut(this.pathData); + + super.updateData(); + return this; + } + + webglRender(pipeline, calcMatrix, alpha, dx, dy) { + if (this.isFilled) { + FillPathWebGL(pipeline, calcMatrix, this, alpha, dx, dy); + } + + if (this.isStroked) { + StrokePathWebGL(pipeline, this, alpha, dx, dy); + } + } + + canvasRender(ctx, dx, dy) { + var path = this.pathData; + var pathLength = path.length - 1; + + var px1 = path[0] - dx; + var py1 = path[1] - dy; + + ctx.beginPath(); + + ctx.moveTo(px1, py1); + + if (!this.closePath) { + pathLength -= 2; + } + + for (var i = 2; i < pathLength; i += 2) { + var px2 = path[i] - dx; + var py2 = path[i + 1] - dy; + ctx.lineTo(px2, py2); + } + + if (this.closePath) { + ctx.closePath(); + } + + + if (this.isFilled) { + FillStyleCanvas(ctx, this); + ctx.fill(); + } + + if (this.isStroked) { + LineStyleCanvas(ctx, this); + ctx.stroke(); + } + } + } + + var LineTo = function (x, y, pathData) { + var cnt = pathData.length; + if (cnt >= 2) { + var lastX = pathData[cnt - 2]; + var lastY = pathData[cnt - 1]; + if ((x === lastX) && (y === lastY)) { + return pathData; + } + } + + pathData.push(x, y); + return pathData; + }; + + const DegToRad$1 = Phaser.Math.DegToRad; + + var ArcTo = function (centerX, centerY, radiusX, radiusY, startAngle, endAngle, antiClockWise, iteration, pathData) { + // startAngle, endAngle: 0 ~ 360 + if (antiClockWise && (endAngle > startAngle)) { + endAngle -= 360; + } else if (!antiClockWise && (endAngle < startAngle)) { + endAngle += 360; + } + + var deltaAngle = endAngle - startAngle; + var step = DegToRad$1(deltaAngle) / iteration; + startAngle = DegToRad$1(startAngle); + for (var i = 0; i <= iteration; i++) { + var angle = startAngle + (step * i); + var x = centerX + (radiusX * Math.cos(angle)); + var y = centerY + (radiusY * Math.sin(angle)); + LineTo(x, y, pathData); + } + return pathData; + }; + + Phaser.Math.DegToRad; + + var StartAt = function (x, y, pathData) { + pathData.length = 0; + + if (x != null) { + pathData.push(x, y); + } + + return pathData; + }; + + //import QuadraticBezierInterpolation from '../../utils/math/interpolation/QuadraticBezierInterpolation.js'; + + const QuadraticBezierInterpolation = Phaser.Math.Interpolation.QuadraticBezier; + + var QuadraticBezierTo = function (cx, cy, x, y, iterations, pathData) { + var pathDataCnt = pathData.length; + var p0x = pathData[pathDataCnt - 2]; + var p0y = pathData[pathDataCnt - 1]; + for (var i = 1, last = iterations - 1; i <= last; i++) { + var t = i / last; + pathData.push( + QuadraticBezierInterpolation(t, p0x, cx, x), + QuadraticBezierInterpolation(t, p0y, cy, y) + ); + } + return pathData; + }; + + // import CubicBezierInterpolation from '../../utils/math/interpolation/CubicBezierInterpolation.js'; + + const CubicBezierInterpolation = Phaser.Math.Interpolation.CubicBezier; + + var CubicBezierCurveTo = function (cx0, cy0, cx1, cy1, x, y, iterations, pathData) { + var pathDataCnt = pathData.length; + var p0x = pathData[pathDataCnt - 2]; + var p0y = pathData[pathDataCnt - 1]; + for (var i = 1, last = iterations - 1; i <= last; i++) { + var t = i / last; + pathData.push( + CubicBezierInterpolation(t, p0x, cx0, cx1, x), + CubicBezierInterpolation(t, p0y, cy0, cy1, y) + ); + } + return pathData; + }; + + //import CatmullRomInterpolation from '../../utils/math/interpolation/CatmullRomInterpolation.js'; + + const CatmullRomInterpolation = Phaser.Math.Interpolation.CatmullRom; + + var CatmullRomTo = function (points, iterations, pathData) { + var pathDataCnt = pathData.length; + var p0x = pathData[pathDataCnt - 2]; + var p0y = pathData[pathDataCnt - 1]; + + var xList = [p0x]; + var yList = [p0y]; + for (var i = 0, cnt = points.length; i < cnt; i += 2) { + xList.push(points[i]); + yList.push(points[i + 1]); + } + + for (var i = 1, last = iterations - 1; i <= last; i++) { + var t = i / last; + pathData.push( + CatmullRomInterpolation(xList, t), + CatmullRomInterpolation(yList, t) + ); + } + return pathData; + }; + + var DuplicateLast = function (pathData) { + var len = pathData.length; + if (len < 2) { + return pathData; + } + + var lastX = pathData[len - 2]; + var lastY = pathData[len - 1]; + pathData.push(lastX); + pathData.push(lastY); + + return pathData; + }; + + var AddPathMethods = { + clear() { + this.start(); + return this; + }, + + start() { + this.startAt(); + return this; + }, + + startAt(x, y) { + this.restorePathData(); + this.accumulationLengths = undefined; + + StartAt(x, y, this.pathData); + this.firstPointX = x; + this.firstPointY = y; + this.lastPointX = x; + this.lastPointY = y; + + return this; + }, + + lineTo(x, y, relative) { + if (relative === undefined) { + relative = false; + } + if (relative) { + x += this.lastPointX; + y += this.lastPointY; + } + + LineTo(x, y, this.pathData); + + this.lastPointX = x; + this.lastPointY = y; + return this; + }, + + verticalLineTo(x, relative) { + this.lineTo(x, this.lastPointY, relative); + return this; + }, + + horizontalLineTo(y, relative) { + this.lineTo(this.lastPointX, y, relative); + return this; + }, + + ellipticalArc(centerX, centerY, radiusX, radiusY, startAngle, endAngle, anticlockwise) { + if (anticlockwise === undefined) { + anticlockwise = false; + } + + ArcTo( + centerX, centerY, + radiusX, radiusY, + startAngle, endAngle, anticlockwise, + this.iterations, + this.pathData + ); + + this.lastPointX = this.pathData[this.pathData.length - 2]; + this.lastPointY = this.pathData[this.pathData.length - 1]; + return this; + }, + + arc(centerX, centerY, radius, startAngle, endAngle, anticlockwise) { + this.ellipticalArc(centerX, centerY, radius, radius, startAngle, endAngle, anticlockwise); + return this; + }, + + quadraticBezierTo(cx, cy, x, y) { + QuadraticBezierTo( + cx, cy, x, y, + this.iterations, + this.pathData + ); + + this.lastPointX = x; + this.lastPointY = y; + return this; + }, + + cubicBezierTo(cx0, cy0, cx1, cy1, x, y) { + CubicBezierCurveTo( + cx0, cy0, cx1, cy1, x, y, + this.iterations, + this.pathData + ); + + this.lastPointX = x; + this.lastPointY = y; + return this; + }, + + catmullRomTo(...points) { + CatmullRomTo( + points, + this.iterations, + this.pathData + ); + + this.lastPointX = points[points.length-2]; + this.lastPointY = points[points.length-1]; + return this; + }, + + close() { + // Line to first point + var startX = this.pathData[0], + startY = this.pathData[1]; + if ((startX !== this.lastPointX) || (startY !== this.lastPointY)) { + this.lineTo(startX, startY); + } + + this.closePath = true; + return this; + }, + + end() { + DuplicateLast(this.pathData); + return this; + }, + + }; + + //import PointRotateAround from '../../utils/math/RotateAround.js'; + + const PointRotateAround = Phaser.Math.RotateAround; + + var RotateAround = function (centerX, centerY, angle, pathData) { + var point = { x: 0, y: 0 }; + for (var i = 0, cnt = pathData.length - 1; i < cnt; i += 2) { + point.x = pathData[i]; + point.y = pathData[i + 1]; + PointRotateAround(point, centerX, centerY, angle); + pathData[i] = point.x; + pathData[i + 1] = point.y; + } + return pathData; + }; + + var Scale = function (centerX, centerY, scaleX, scaleY, pathData) { + for (var i = 0, cnt = pathData.length - 1; i < cnt; i += 2) { + var x = pathData[i] - centerX; + var y = pathData[i + 1] - centerY; + x *= scaleX; + y *= scaleY; + pathData[i] = x + centerX; + pathData[i + 1] = y + centerY; + } + return pathData; + }; + + var Offset = function (x, y, pathData) { + for (var i = 0, cnt = pathData.length - 1; i < cnt; i += 2) { + pathData[i] += x; + pathData[i + 1] += y; + } + return pathData; + }; + + const DegToRad = Phaser.Math.DegToRad; + Phaser.Math.RotateAround; + + var TransformPointsMethods = { + rotateAround(centerX, centerY, angle) { + if (this.pathData.length === 0) { + return this; + } + + angle = DegToRad(angle); + + RotateAround(centerX, centerY, angle, this.pathData); + + var pathDataCnt = this.pathData.length; + this.lastPointX = this.pathData[pathDataCnt - 2]; + this.lastPointY = this.pathData[pathDataCnt - 1]; + return this; + }, + + scale(centerX, centerY, scaleX, scaleY) { + if (this.pathData.length === 0) { + return this; + } + + Scale(centerX, centerY, scaleX, scaleY, this.pathData); + this.lastPointX = this.pathData[pathDataCnt - 2]; + this.lastPointY = this.pathData[pathDataCnt - 1]; + return this; + }, + + offset(x, y) { + Offset(x, y, this.pathData); + return this; + } + + }; + + var Copy = function (dest, src, startIdx, endIdx) { + if (startIdx === undefined) { + startIdx = 0; + } if (endIdx === undefined) { + endIdx = src.length; + } + dest.length = endIdx - startIdx; + for (var i = 0, len = dest.length; i < len; i++) { + dest[i] = src[i + startIdx]; + } + return dest; + }; + + var SavePathDataMethods = { + savePathData() { + if (this.pathDataSaved) { + return this; + } + + this.pathDataSave = [...this.pathData]; + this.pathData.length = 0; + this.pathDataSaved = true; + return this; + }, + + restorePathData() { + if (!this.pathDataSaved) { + return this; + } + + Copy(this.pathData, this.pathDataSave); + this.pathDataSave = undefined; + this.pathDataSaved = false; + return this; + }, + }; + + const DistanceBetween = Phaser.Math.Distance.Between; + const Wrap = Phaser.Math.Wrap; + const Linear = Phaser.Math.Linear; + + var AppendFromPathSegment = function (srcPathData, accumulationLengths, startT, endT, destPathData) { + if (endT === undefined) { + endT = startT; + startT = 0; + } + + startT = WrapT(startT); + endT = WrapT(endT); + + if (startT === endT) { + return; + } + + var totalPathLength = accumulationLengths[accumulationLengths.length - 1]; + var startL = totalPathLength * startT; + var endL = totalPathLength * endT; + if (startT < endT) { + AddPathSegment(srcPathData, accumulationLengths, startL, endL, destPathData); + } else { + AddPathSegment(srcPathData, accumulationLengths, startL, totalPathLength, destPathData); + AddPathSegment(srcPathData, accumulationLengths, 0, endL, destPathData); + } + + DuplicateLast(destPathData); + }; + + var AddPathSegment = function (srcPathData, accumulationLengths, startL, endL, destPathData) { + var skipState = (startL > 0); + for (var i = 0, cnt = accumulationLengths.length; i < cnt; i++) { + var pIdx = i * 2; + var d = accumulationLengths[i]; + + if (skipState) { + if (d < startL) { + continue; + } else if (d == startL) { + skipState = false; + } else { // d > startL + var deltaD = d - accumulationLengths[i - 1]; + var t = 1 - ((d - startL) / deltaD); + destPathData.push(GetInterpolation(srcPathData, pIdx - 2, pIdx, t)); + destPathData.push(GetInterpolation(srcPathData, pIdx - 1, pIdx + 1, t)); + skipState = false; + } + } + + if (d <= endL) { + destPathData.push(srcPathData[pIdx]); + destPathData.push(srcPathData[pIdx + 1]); + if (d === endL) { + break; + } + } else { // d > endL + var deltaD = d - accumulationLengths[i - 1]; + var t = 1 - ((d - endL) / deltaD); + destPathData.push(GetInterpolation(srcPathData, pIdx - 2, pIdx, t)); + destPathData.push(GetInterpolation(srcPathData, pIdx - 1, pIdx + 1, t)); + break; + } + } + }; + + var GetInterpolation = function (pathData, i0, i1, t) { + var p0 = pathData[i0], p1 = pathData[i1]; + return Linear(p0, p1, t); + }; + + var WrapT = function (t) { + if (t === 0) { + return 0; + } else if ((t % 1) === 0) { + return 1; + } + return Wrap(t, 0, 1); + }; + + var PathSegmentMethods = { + updateAccumulationLengths() { + if (this.accumulationLengths == null) { + this.accumulationLengths = []; + } else if (this.accumulationLengths.length === (this.pathData.length / 2)) { + return this; + } + + var accumulationLengths = this.accumulationLengths; + var pathData = this.pathData; + var prevX, prevY, x, y; + var d, accumulationLength = 0; + for (var i = 0, cnt = pathData.length; i < cnt; i += 2) { + x = pathData[i]; + y = pathData[i + 1]; + + d = (prevX === undefined) ? 0 : DistanceBetween(prevX, prevY, x, y); + accumulationLength += d; + accumulationLengths.push(accumulationLength); + + prevX = x; + prevY = y; + } + + this.totalPathLength = accumulationLength; + + return this; + }, + + setDisplayPathSegment(startT, endT) { + if (!this.pathDataSaved) { + this.updateAccumulationLengths(); + this.savePathData(); + } + + this.pathData.length = 0; + AppendFromPathSegment(this.pathDataSave, this.accumulationLengths, startT, endT, this.pathData); + + return this; + }, + + appendFromPathSegment(src, startT, endT) { + if (startT === undefined) { + this.pathData.push(...src.pathData); + } else { + src.updateAccumulationLengths(); + AppendFromPathSegment(src.pathData, src.accumulationLengths, startT, endT, this.pathData); + } + + this.firstPointX = this.pathData[0]; + this.firstPointY = this.pathData[1]; + this.lastPointX = this.pathData[this.pathData.length - 2]; + this.lastPointY = this.pathData[this.pathData.length - 1]; + return this; + }, + }; + + var GraphicsMethods = { + draw(graphics, isFill, isStroke) { + var points = this.toPoints(); + if (isFill) { + graphics.fillPoints(points, this.closePath, this.closePath); + } + if (isStroke) { + graphics.strokePoints(points, this.closePath, this.closePath); + } + + return this; + } + }; + + var ToPoints = function (pathData, points) { + if (points === undefined) { + points = []; + } + for (var i = 0, cnt = pathData.length - 1; i < cnt; i += 2) { + points.push({ + x: pathData[i], + y: pathData[i + 1] + }); + } + return points; + }; + + //import Polygon from '../../utils/geom/polygon/Polygon.js'; + + const Polygon = Phaser.Geom.Polygon; + + var ToPolygon = function (pathData, polygon) { + if (polygon === undefined) { + polygon = new Polygon(); + } + polygon.setTo(pathData); + return polygon; + }; + + class PathDataBuilder { + constructor(pathData) { + if (pathData === undefined) { + pathData = []; + } + + this.pathData = pathData; + this.closePath = false; + this.setIterations(32); + + this.firstPointX = undefined; + this.firstPointY = undefined; + this.lastPointX = undefined; + this.lastPointY = undefined; + this.accumulationLengths = undefined; + } + + setIterations(iterations) { + this.iterations = iterations; + return this; + } + + toPoints() { + return ToPoints(this.pathData); + } + + toPolygon(polygon) { + return ToPolygon(this.pathData, polygon); + } + + } + + Object.assign( + PathDataBuilder.prototype, + AddPathMethods, + TransformPointsMethods, + SavePathDataMethods, + PathSegmentMethods, + GraphicsMethods, + ); + + class Lines extends PathBase { + constructor() { + super(); + this.builder = new PathDataBuilder(this.pathData); + } + + get iterations() { + return this.builder.iterations; + } + + set iterations(value) { + this.dirty = this.dirty || (this.builder.iterations !== value); + this.builder.setIterations(value); + } + + setIterations(iterations) { + this.iterations = iterations; + return this; + } + + get lastPointX() { + return this.builder.lastPointX; + } + + get lastPointY() { + return this.builder.lastPointY; + } + + start() { + this.builder.start(); + + this.dirty = true; + return this; + } + + startAt(x, y) { + this.builder.startAt(x, y); + + this.dirty = true; + return this; + } + + lineTo(x, y, relative) { + this.builder.lineTo(x, y, relative); + + this.dirty = true; + return this; + } + + verticalLineTo(x, relative) { + this.builder.verticalLineTo(x, relative); + + this.dirty = true; + return this; + } + + horizontalLineTo(y, relative) { + this.builder.horizontalLineTo(y, relative); + + this.dirty = true; + return this; + } + + ellipticalArc(centerX, centerY, radiusX, radiusY, startAngle, endAngle, anticlockwise) { + this.builder.ellipticalArc(centerX, centerY, radiusX, radiusY, startAngle, endAngle, anticlockwise); + + this.dirty = true; + return this; + } + + arc(centerX, centerY, radius, startAngle, endAngle, anticlockwise) { + this.builder.arc(centerX, centerY, radius, startAngle, endAngle, anticlockwise); + + this.dirty = true; + return this; + } + + quadraticBezierTo(cx, cy, x, y) { + this.builder.quadraticBezierTo(cx, cy, x, y); + + this.dirty = true; + return this; + } + + cubicBezierTo(cx0, cy0, cx1, cy1, x, y) { + this.builder.cubicBezierTo(cx0, cy0, cx1, cy1, x, y); + + this.dirty = true; + return this; + } + + catmullRomTo(...points) { + this.builder.catmullRomTo(...points); + + this.dirty = true; + return this; + } + + close() { + this.builder.close(); + + this.closePath = this.builder.closePath; + this.dirty = true; + return this; + } + + end() { + this.builder.end(); + this.dirty = true; + return this; + } + + rotateAround(centerX, centerY, angle) { + this.builder.rotateAround(centerX, centerY, angle); + + this.dirty = true; + return this; + } + + scale(centerX, centerY, scaleX, scaleY) { + this.builder.scale(centerX, centerY, scaleX, scaleY); + + this.dirty = true; + return this; + } + + offset(x, y) { + this.builder.offset(x, y); + + this.dirty = true; + return this; + } + + toPolygon(polygon) { + return this.builder.toPolygon(polygon); + } + + appendPathFrom(src, startT, endT) { + this.builder.appendFromPathSegment(src.builder, startT, endT); + return this; + } + + copyPathFrom(src, startT, endT) { + this.builder.clear().appendFromPathSegment(src.builder, startT, endT); + return this; + } + + setDisplayPathSegment(startT, endT) { + this.builder.setDisplayPathSegment(startT, endT); + return this; + } + } + + Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlpha; + + Phaser.Utils.Objects.GetValue; + + Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlpha; + + const BEZIER = 0; + const SPLINE = 1; + const POLYLINE = 2; + const STRAIGHTLINE = 3; + + var DrawQuadraticBezierCurve = function (line) { + var points = this.points; + + var startPoint = points[0]; + var startX = startPoint.x; + var startY = startPoint.y; + + var controlPoint = points[1]; + var cx = controlPoint.x - startX; + var cy = controlPoint.y - startY; + + var endPoint = points[2]; + var endX = endPoint.x - startX; + var endY = endPoint.y - startY; + + line + .startAt(0, 0) + .quadraticBezierTo(cx, cy, endX, endY) + .end(); + + }; + + var DrawBezierCurve = function (line) { + var points = this.points; + var startPoint = points[0]; + var startX = startPoint.x; + var startY = startPoint.y; + + var controlPoint0 = points[1]; + var cx0 = controlPoint0.x - startX; + var cy0 = controlPoint0.y - startY; + + var controlPoint1 = points[2]; + var cx1 = controlPoint1.x - startX; + var cy1 = controlPoint1.y - startY; + + var endPoint = points[3]; + var endX = endPoint.x - startX; + var endY = endPoint.y - startY; + + line + .startAt(0, 0) + .cubicBezierTo(cx0, cy0, cx1, cy1, endX, endY) + .end(); + + }; + + var DrawSpinleCurve = function (line) { + var points = this.points; + var startPoint = points[0]; + var startX = startPoint.x; + var startY = startPoint.y; + + var splinePoints = []; + for (var i = 1, cnt = points.length; i < cnt; i ++) { + var point = points[i]; + splinePoints.push(point.x - startX); + splinePoints.push(point.y - startY); + } + + line + .startAt(0, 0) + .catmullRomTo(...splinePoints) + .end(); + + }; + + var DrawStraightLine = function (line) { + var points = this.points; + var startPoint = points[0]; + var startX = startPoint.x; + var startY = startPoint.y; + + + var pointsCount = points.length; + var endPoint = points[pointsCount - 1]; + var endX = endPoint.x - startX; + var endY = endPoint.y - startY; + + line + .startAt(0, 0) + .lineTo(endX, endY) + .end(); + + }; + + var DrawPolyLine = function (line) { + var points = this.points; + var startPoint = points[0]; + var startX = startPoint.x; + var startY = startPoint.y; + line.startAt(0, 0); + + for (var i = 1, cnt = points.length; i < cnt; i++) { + var point = points[i]; + var x = point.x - startX; + var y = point.y - startY; + line.lineTo(x, y); + } + + line.end(); + }; + + const Rectangle = Phaser.Geom.Rectangle; + + var GetBounds = function (points, out) { + if (out === undefined) { + out = new Rectangle(); + } else if (out === true) { + out = GlobalBounds; + } + + var minX = Infinity; + var minY = Infinity; + var maxX = -minX; + var maxY = -minY; + + for (var i = 0, cnt = points.length; i < cnt; i += 2) { + var x = points[i]; + var y = points[i + 1]; + + minX = Math.min(minX, x); + minY = Math.min(minY, y); + maxX = Math.max(maxX, x); + maxY = Math.max(maxY, y); + } + + out.x = minX; + out.y = minY; + out.width = maxX - minX; + out.height = maxY - minY; + + return out; + }; + + var GlobalBounds = new Rectangle(); + + var SetTransform = function (line) { + // Size + var bounds = GetBounds.call(this, line.pathData, true); + this.setSize(bounds.width, bounds.height); + // Origin + this.setOrigin(-bounds.x / bounds.width, -bounds.y / bounds.height); + // Position + var point = this.points[0]; + this.setPosition(point.x, point.y); + line.offset(-bounds.x, -bounds.y); + }; + + var ShapesUpdateMethods = { + buildShapes() { + this + .addShape(new Lines()); + }, + + updateShapes() { + // Set style + var line = this.getShapes()[0] + .lineStyle(this.lineWidth, this.strokeColor, this.strokeAlpha); + + var points = this.points; + + if ((this.lineType === STRAIGHTLINE) || (points.length == 2)) { + DrawStraightLine.call(this, line); + } else if ((this.lineType === BEZIER) && (points.length === 3)) { + DrawQuadraticBezierCurve.call(this, line); + } else if ((this.lineType === BEZIER) && (points.length === 4)) { + DrawBezierCurve.call(this, line); + } else if (this.lineType === POLYLINE) { + DrawPolyLine.call(this, line); + } else { + DrawSpinleCurve.call(this, line); + } + + SetTransform.call(this, line); + + } + }; + + class Line extends BaseShapes { + constructor(scene, points, lineWidth, color, alpha, lineType) { + if (points !== undefined) { + if (typeof (points) === 'number') { + lineType = alpha; + alpha = color; + color = lineWidth; + lineWidth = points; + points = []; + } else if (!Array.isArray(points)) { + var config = points; + points = config.points; + lineWidth = config.lineWidth; + color = config.color; + alpha = config.alpha; + lineType = config.lineType; + } + } + + if (points === undefined) { points = []; } + if (lineWidth === undefined) { lineWidth = 2; } + if (color === undefined) { color = 0xffffff; } + if (alpha === undefined) { alpha = 1; } + if (lineType === undefined) { lineType = 0; } + + super(scene); + this.type = 'rexPath'; + + this.setCurve(points, lineType); + this.setStrokeStyle(lineWidth, color, alpha); + + this.buildShapes(); + + this.updateData(); + } + + setCurve(points, lineType) { + if (points === undefined) { + points = []; + } + if (lineType !== undefined) { + if (typeof (lineType) === 'string') { + lineType = CURVETYPE_MAP[lineType.toLocaleLowerCase()]; + } + this.lineType = lineType; + } + + this.points = points; + this.dirty = true; + + if (this.geom.length > 0) { + this.updateData(); + } + + return this; + } + + setLineType(lineType) { + if (typeof (lineType) === 'string') { + lineType = CURVETYPE_MAP[lineType.toLocaleLowerCase()]; + } + if (this.lineType === lineType) { + return this; + } + this.lineType = lineType; + this.dirty = true; + + if (this.geom.length > 0) { + this.updateData(); + } + + return this; + } + } + + const CURVETYPE_MAP = { + bezier: BEZIER, + + spline: SPLINE, + + polyline: POLYLINE, + poly: POLYLINE, + + straightline: STRAIGHTLINE, + straight: STRAIGHTLINE, + }; + + Object.assign( + Line.prototype, + ShapesUpdateMethods, + ); + + function Factory (points, lineWidth, color, alpha, lineType) { + var gameObject = new Line(this.scene, points, lineWidth, color, alpha, lineType); + this.scene.add.existing(gameObject); + return gameObject; + } + + const GetAdvancedValue = Phaser.Utils.Objects.GetAdvancedValue; + const GetValue = Phaser.Utils.Objects.GetValue; + const BuildGameObject = Phaser.GameObjects.BuildGameObject; + + function Creator (config, addToScene) { + if (config === undefined) { config = {}; } + if (addToScene !== undefined) { + config.add = addToScene; + } + var points = GetValue(config, 'points', undefined); + var lineWidth = GetAdvancedValue(config, 'lineWidth', 2); + var color = GetAdvancedValue(config, 'color', 0xffffff); + var alpha = GetAdvancedValue(config, 'alpha', 1); + var lineType = GetAdvancedValue(config, 'lineType', 0); + var gameObject = new Line(this.scene, points, lineWidth, color, alpha, lineType); + + BuildGameObject(this.scene, gameObject, config); + + return gameObject; + } + + var IsInValidKey = function (keys) { + return (keys == null) || (keys === '') || (keys.length === 0); + }; + + var GetEntry = function (target, keys, defaultEntry) { + var entry = target; + if (IsInValidKey(keys)) ; else { + if (typeof (keys) === 'string') { + keys = keys.split('.'); + } + + var key; + for (var i = 0, cnt = keys.length; i < cnt; i++) { + key = keys[i]; + if ((entry[key] == null) || (typeof (entry[key]) !== 'object')) { + var newEntry; + if (i === cnt - 1) { + if (defaultEntry === undefined) { + newEntry = {}; + } else { + newEntry = defaultEntry; + } + } else { + newEntry = {}; + } + + entry[key] = newEntry; + } + + entry = entry[key]; + } + } + + return entry; + }; + + var SetValue = function (target, keys, value, delimiter) { + if (delimiter === undefined) { + delimiter = '.'; + } + + // no object + if (typeof (target) !== 'object') { + return; + } + + // invalid key + else if (IsInValidKey(keys)) { + // don't erase target + if (value == null) { + return; + } + // set target to another object + else if (typeof (value) === 'object') { + target = value; + } + } else { + if (typeof (keys) === 'string') { + keys = keys.split(delimiter); + } + + var lastKey = keys.pop(); + var entry = GetEntry(target, keys); + entry[lastKey] = value; + } + + return target; + }; + + class LinePlugin extends Phaser.Plugins.BasePlugin { + + constructor(pluginManager) { + super(pluginManager); + + // Register our new Game Object type + pluginManager.registerGameObject('rexLineShape', Factory, Creator); + } + + start() { + var eventEmitter = this.game.events; + eventEmitter.on('destroy', this.destroy, this); + } + } + + SetValue(window, 'RexPlugins.GameObjects.LineShape', Line); + + return LinePlugin; + +})); diff --git a/dist/rexlineshapeplugin.min.js b/dist/rexlineshapeplugin.min.js new file mode 100644 index 0000000000..facbcff1fb --- /dev/null +++ b/dist/rexlineshapeplugin.min.js @@ -0,0 +1 @@ +var t,i;t=void 0,i=function(){const t=Phaser.GameObjects.GetCalcMatrix,i=Phaser.Renderer.Canvas.SetTransform;var e={renderWebGL:function(i,e,s,h){e.updateData(),s.addToRenderList(e);var a=i.pipelines.set(e.pipeline),r=t(e,s,h),n=a.calcMatrix.copyFrom(r.calc),o=e._displayOriginX,l=e._displayOriginY,u=s.alpha*e.alpha;i.pipelines.preBatch(e);for(var d,p=e.geom,c=0,g=p.length;c>>16,n=(65280&h)>>>8,o=255&h;t.fillStyle="rgba("+r+","+n+","+o+","+a+")"}(t,this),t.fill()),this.isStroked&&(function(t,i,e,s){var h=e||i.strokeColor,a=s||i.strokeAlpha,r=(16711680&h)>>>16,n=(65280&h)>>>8,o=255&h;t.strokeStyle="rgba("+r+","+n+","+o+","+a+")",t.lineWidth=i.lineWidth}(t,this),t.stroke())}}var g=function(t,i,e){var s=e.length;if(s>=2){var h=e[s-2],a=e[s-1];if(t===h&&i===a)return e}return e.push(t,i),e};const v=Phaser.Math.DegToRad;Phaser.Math.DegToRad;const f=Phaser.Math.Interpolation.QuadraticBezier,y=Phaser.Math.Interpolation.CubicBezier,P=Phaser.Math.Interpolation.CatmullRom;var D=function(t){var i=t.length;if(i<2)return t;var e=t[i-2],s=t[i-1];return t.push(e),t.push(s),t},b={clear(){return this.start(),this},start(){return this.startAt(),this},startAt(t,i){return this.restorePathData(),this.accumulationLengths=void 0,function(t,i,e){e.length=0,null!=t&&e.push(t,i)}(t,i,this.pathData),this.firstPointX=t,this.firstPointY=i,this.lastPointX=t,this.lastPointY=i,this},lineTo(t,i,e){return void 0===e&&(e=!1),e&&(t+=this.lastPointX,i+=this.lastPointY),g(t,i,this.pathData),this.lastPointX=t,this.lastPointY=i,this},verticalLineTo(t,i){return this.lineTo(t,this.lastPointY,i),this},horizontalLineTo(t,i){return this.lineTo(this.lastPointX,t,i),this},ellipticalArc(t,i,e,s,h,a,r){return void 0===r&&(r=!1),function(t,i,e,s,h,a,r,n,o){r&&a>h?a-=360:!r&&a0,r=0,n=i.length;r0&&this.updateData(),this}setLineType(t){return"string"==typeof t&&(t=N[t.toLocaleLowerCase()]),this.lineType===t||(this.lineType=t,this.dirty=!0,this.geom.length>0&&this.updateData()),this}}const N={bezier:0,spline:1,polyline:2,poly:2,straightline:3,straight:3};function Q(t,i,e,s,h){var a=new H(this.scene,t,i,e,s,h);return this.scene.add.existing(a),a}Object.assign(H.prototype,E);const J=Phaser.Utils.Objects.GetAdvancedValue,K=Phaser.Utils.Objects.GetValue,Z=Phaser.GameObjects.BuildGameObject;function $(t,i){void 0===t&&(t={}),void 0!==i&&(t.add=i);var e=K(t,"points",void 0),s=J(t,"lineWidth",2),h=J(t,"color",16777215),a=J(t,"alpha",1),r=J(t,"lineType",0),n=new H(this.scene,e,s,h,a,r);return Z(this.scene,n,t),n}var tt=function(t){return null==t||""===t||0===t.length};class it extends Phaser.Plugins.BasePlugin{constructor(t){super(t),t.registerGameObject("rexLineShape",Q,$)}start(){this.game.events.on("destroy",this.destroy,this)}}return function(t,i,e,s){if(void 0===s&&(s="."),"object"==typeof t)if(tt(i)){if(null==e)return;"object"==typeof e&&(t=e)}else{"string"==typeof i&&(i=i.split(s));var h=i.pop(),a=function(t,i,e){var s=t;if(tt(i));else{var h;"string"==typeof i&&(i=i.split("."));for(var a=0,r=i.length;a=this._config.preview;if(s)e.postMessage({results:o,workerId:a.WORKER_ID,finished:l});else if(C(this._config.chunk)&&!i){if(this._config.chunk(o,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);o=void 0,this._completeResults=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(o.data),this._completeResults.errors=this._completeResults.errors.concat(o.errors),this._completeResults.meta=o.meta),this._completed||!l||!C(this._config.complete)||o&&o.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),l||o&&o.meta.paused||this._nextChunk(),o}this._halted=!0},this._sendError=function(t){C(this._config.error)?this._config.error(t):s&&this._config.error&&e.postMessage({workerId:a.WORKER_ID,error:t,finished:!1})}}function l(t){var e;(t=t||{}).chunkSize||(t.chunkSize=a.RemoteChunkSize),h.call(this,t),this._nextChunk=i?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(t){this._input=t,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(e=new XMLHttpRequest,this._config.withCredentials&&(e.withCredentials=this._config.withCredentials),i||(e.onload=x(this._chunkLoaded,this),e.onerror=x(this._chunkError,this)),e.open(this._config.downloadRequestBody?"POST":"GET",this._input,!i),this._config.downloadRequestHeaders){var t=this._config.downloadRequestHeaders;for(var s in t)e.setRequestHeader(s,t[s])}if(this._config.chunkSize){var r=this._start+this._config.chunkSize-1;e.setRequestHeader("Range","bytes="+this._start+"-"+r)}try{e.send(this._config.downloadRequestBody)}catch(t){this._chunkError(t.message)}i&&0===e.status&&this._chunkError()}},this._chunkLoaded=function(){4===e.readyState&&(e.status<200||400<=e.status?this._chunkError():(this._start+=this._config.chunkSize?this._config.chunkSize:e.responseText.length,this._finished=!this._config.chunkSize||this._start>=function(t){var e=t.getResponseHeader("Content-Range");return null===e?-1:parseInt(e.substring(e.lastIndexOf("/")+1))}(e),this.parseChunk(e.responseText)))},this._chunkError=function(t){var i=e.statusText||t;this._sendError(new Error(i))}}function u(t){var e,i;(t=t||{}).chunkSize||(t.chunkSize=a.LocalChunkSize),h.call(this,t);var s="undefined"!=typeof FileReader;this.stream=function(t){this._input=t,i=t.slice||t.webkitSlice||t.mozSlice,s?((e=new FileReader).onload=x(this._chunkLoaded,this),e.onerror=x(this._chunkError,this)):e=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount=this._input.size,this.parseChunk(t.target.result)},this._chunkError=function(){this._sendError(e.error)}}function c(t){var e;h.call(this,t=t||{}),this.stream=function(t){return e=t,this._nextChunk()},this._nextChunk=function(){if(!this._finished){var t,i=this._config.chunkSize;return i?(t=e.substring(0,i),e=e.substring(i)):(t=e,e=""),this._finished=!e,this.parseChunk(t)}}}function d(t){h.call(this,t=t||{});var e=[],i=!0,s=!1;this.pause=function(){h.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){h.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(t){this._input=t,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){s&&1===e.length&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),e.length?this.parseChunk(e.shift()):i=!0},this._streamData=x((function(t){try{e.push("string"==typeof t?t:t.toString(this._config.encoding)),i&&(i=!1,this._checkIsFinished(),this.parseChunk(e.shift()))}catch(t){this._streamError(t)}}),this),this._streamError=x((function(t){this._streamCleanUp(),this._sendError(t)}),this),this._streamEnd=x((function(){this._streamCleanUp(),s=!0,this._streamData("")}),this),this._streamCleanUp=x((function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)}),this)}function p(t){var e,i,s,r=Math.pow(2,53),n=-r,o=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,h=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,l=this,u=0,c=0,d=!1,p=!1,v=[],m={data:[],errors:[],meta:{}};if(C(t.step)){var y=t.step;t.step=function(e){if(m=e,S())k();else{if(k(),0===m.data.length)return;u+=e.data.length,t.preview&&u>t.preview?i.abort():(m.data=m.data[0],y(m,l))}}}function x(e){return"greedy"===t.skipEmptyLines?""===e.join("").trim():1===e.length&&0===e[0].length}function k(){return m&&s&&(_("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+a.DefaultDelimiter+"'"),s=!1),t.skipEmptyLines&&(m.data=m.data.filter((function(t){return!x(t)}))),S()&&function(){if(m)if(Array.isArray(m.data[0])){for(var e=0;S()&&e=v.length?"__parsed_extra":v[s]),t.transform&&(a=t.transform(a,n)),a=w(n,a),"__parsed_extra"===n?(r[n]=r[n]||[],r[n].push(a)):r[n]=a}return t.header&&(s>v.length?_("FieldMismatch","TooManyFields","Too many fields: expected "+v.length+" fields but parsed "+s,c+i):s=s.length/2?"\r\n":"\r"}(r,h)),s=!1,t.delimiter)C(t.delimiter)&&(t.delimiter=t.delimiter(r),m.meta.delimiter=t.delimiter);else{var l=function(e,i,s,r,n){var o,h,l,u;n=n||[",","\t","|",";",a.RECORD_SEP,a.UNIT_SEP];for(var c=0;c=o)return V(!0)}else for(z=u,u++;;){if(-1===(z=a.indexOf(e,z+1)))return p||k.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:x.length,index:u}),W();if(z===f-1)return W(a.substring(u,z).replace(j,e));if(e!==l||a[z+1]!==l){if(e===l||0===z||a[z-1]!==l){-1!==B&&B=o)return V(!0);break}k.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:x.length,index:u}),z++}}else z++}return W();function X(t){x.push(t),w=u}function Y(t){var e=0;if(-1!==t){var i=a.substring(z+1,t);i&&""===i.trim()&&(e=i.length)}return e}function W(t){return p||(void 0===t&&(t=a.substring(u)),S.push(t),u=f,X(S),b&&H()),V()}function $(t){u=t,X(S),S=[],I=a.indexOf(s,u)}function V(t){return{data:x,errors:k,meta:{delimiter:i,linebreak:s,aborted:c,truncated:!!t,cursor:w+(d||0)}}}function H(){n(V()),x=[],k=[]}},this.abort=function(){c=!0},this.getCharIndex=function(){return u}}function v(t){var e=t.data,i=r[e.workerId],s=!1;if(e.error)i.userError(e.error,e.file);else if(e.results&&e.results.data){var n={abort:function(){s=!0,m(e.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:y,resume:y};if(C(i.userStep)){for(var a=0;a>16&255},mr=function(t){return t>>8&255},yr=function(t){return 255&t};const br=Phaser.Events.EventEmitter;var xr=function(t,e,i,s,r,n){return void 0===n?n={}:!0===n&&(n=Cr),"number"!=typeof i&&(i=0,s=0),n.x=r.x+r.width*t+i,n.y=r.y+r.height*e+s,n},Cr={},kr=function(t,e,i,s,r,n,a){if(t.hasOwnProperty("vp"))return t;"function"==typeof i&&(a=i,i=void 0),"function"==typeof r&&(a=r,r=void 0),void 0===i&&(i=.5),void 0===s&&(s=.5),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=xr),function(t){if(t.events)return t;var e=new br,i=t.x;Object.defineProperty(t,"x",{get:function(){return i},set:function(s){i!==s&&(i=s,e.emit("update",t))}});var s=t.y;Object.defineProperty(t,"y",{get:function(){return s},set:function(i){s!==i&&(s=i,e.emit("update",t))}});var r=t.width;Object.defineProperty(t,"width",{get:function(){return r},set:function(i){r!==i&&(r=i,e.emit("update",t))}});var n=t.height;Object.defineProperty(t,"height",{get:function(){return n},set:function(i){n!==i&&(n=i,e.emit("update",t))}}),t.events=e}(e);var o=e.events;t.vp=e;var h=function(){a(i,s,r,n,e,t)};o.on("update",h),t.once("destroy",(function(){o.off("update",h),t.vp=void 0})),Object.defineProperty(t,"vpx",{get:function(){return i},set:function(t){i!==t&&(i=t,h())}}),Object.defineProperty(t,"vpy",{get:function(){return s},set:function(t){s!==t&&(s=t,h())}}),Object.defineProperty(t,"vpxOffset",{get:function(){return r},set:function(t){r!==t&&(r=t,h())}}),Object.defineProperty(t,"vpyOffset",{get:function(){return n},set:function(t){n!==t&&(n=t,h())}}),h()},Sr=function(t,e){if(!t)return!1;if(t.hasOwnProperty(e))return!0;for(;t;){if(Object.getOwnPropertyDescriptor(t,e))return!0;t=t.__proto__}return!1},wr=function(t){return t.preFX?t.preFX:t.postFX?t.postFX:null},_r=function(t,e){t._effectSwitchNames||(t._effectSwitchNames=[],t.clearAllEffects=function(){for(var e=t._effectSwitchNames,i=0,s=e.length;i0&&void 0!==t.setTint},useAlphaFadeEffect(t){return(void 0===this.fadeMode||1===this.fadeMode)&&this.fadeTime>0&&void 0!==t.setAlpha},useRevealEffect(t){return this.fadeMode>=2&&this.fadeMode<=5&&this.fadeTime>0&&(t.preFX||t.postFX)},fadeBob(t,e,i,s){var r=t.gameObject;if(this.useTintFadeEffect(r))void 0!==e&&t.setProperty("tintGray",255*e),t.easeProperty({property:"tintGray",value:Math.floor(255*i),duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s});else if(this.useAlphaFadeEffect(r))void 0!==e&&t.setProperty("alpha",e),t.easeProperty({property:"alpha",value:i,duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s});else if(this.useRevealEffect(r)){var n;switch(Or(r,"reveal"),this.fadeMode){case 2:n="revealUp";break;case 3:n="revealDown";break;case 4:n="revealLeft";break;case 5:n="revealRight"}void 0===e&&(e=0),r[n]=e,t.easeProperty({property:n,value:i,duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s}),t.getTweenTask(n).once("complete",(function(){r[n]=null}))}else s&&s(r);return this}},Ir=function(t){return void 0!==t.displayWidth?t.displayWidth:t.width},jr=function(t){return void 0!==t.displayHeight?t.displayHeight:t.height};const zr=Phaser.Geom.Rectangle,Nr=Phaser.Math.Vector2,Gr=Phaser.Math.RotateAround,Xr=Phaser.GameObjects.Container;var Yr=function(t,e){if(void 0===e?e=new zr:!0===e&&(void 0===Wr&&(Wr=new zr),e=Wr),t.getBounds&&!(t instanceof Xr))return t.getBounds(e);var i,s,r,n,a,o,h,l;if(t.parentContainer){var u=t.parentContainer.getBoundsTransformMatrix();$r(t,e),u.transformPoint(e.x,e.y,e),i=e.x,s=e.y,Vr(t,e),u.transformPoint(e.x,e.y,e),r=e.x,n=e.y,Hr(t,e),u.transformPoint(e.x,e.y,e),a=e.x,o=e.y,Ur(t,e),u.transformPoint(e.x,e.y,e),h=e.x,l=e.y}else $r(t,e),i=e.x,s=e.y,Vr(t,e),r=e.x,n=e.y,Hr(t,e),a=e.x,o=e.y,Ur(t,e),h=e.x,l=e.y;return e.x=Math.min(i,r,a,h),e.y=Math.min(s,n,o,l),e.width=Math.max(i,r,a,h)-e.x,e.height=Math.max(s,n,o,l)-e.y,e},Wr=void 0,$r=function(t,e,i){return void 0===e?e=new Nr:!0===e&&(void 0===qr&&(qr=new Nr),e=qr),t.getTopLeft?t.getTopLeft(e):(e.x=t.x-Ir(t)*t.originX,e.y=t.y-jr(t)*t.originY,Kr(t,e,i))},Vr=function(t,e,i){return void 0===e?e=new Nr:!0===e&&(void 0===qr&&(qr=new Nr),e=qr),t.getTopRight?t.getTopRight(e):(e.x=t.x-Ir(t)*t.originX+Ir(t),e.y=t.y-jr(t)*t.originY,Kr(t,e,i))},Hr=function(t,e,i){return void 0===e?e=new Nr:!0===e&&(void 0===qr&&(qr=new Nr),e=qr),t.getBottomLeft?t.getBottomLeft(e):(e.x=t.x-Ir(t)*t.originX,e.y=t.y-jr(t)*t.originY+jr(t),Kr(t,e,i))},Ur=function(t,e,i){return void 0===e?e=new Nr:!0===e&&(void 0===qr&&(qr=new Nr),e=qr),t.getBottomRight?t.getBottomRight(e):(e.x=t.x-Ir(t)*t.originX+Ir(t),e.y=t.y-jr(t)*t.originY+jr(t),Kr(t,e,i))},qr=void 0,Kr=function(t,e,i){(void 0===i&&(i=!1),0!==t.rotation&&Gr(e,t.x,t.y,t.rotation),i&&t.parentContainer)&&t.parentContainer.getBoundsTransformMatrix().transformPoint(e.x,e.y,e);return e};const Jr=Phaser.Utils.Objects.GetValue;var Zr=function(t,e,i){var s,r,n,a,o;if("number"==typeof i?s=i:(s=Jr(i,"color"),r=Jr(i,"lineWidth"),n=Jr(i,"fillColor"),a=Jr(i,"fillAlpha",1),o=Jr(i,"padding",0)),Array.isArray(t))for(var h=0,l=t.length;h0?-this.delay:0,this.state=this.nowTime>=0?qn:Un,this.repeatCounter=0,this}stop(){return this.state=Hn,this}update(t,e){this.state!==Hn&&this.state!==Jn&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=Kn)):(this.nowTime=this.duration,this.state=Jn):this.nowTime>=0&&(this.state=qn))}get t(){var t;switch(this.state){case Hn:case Un:case Kn:t=0;break;case qn:t=this.nowTime/this.duration;break;case Jn:t=1}return $n(t,0,1)}set t(t){(t=$n(t,-1,1))<0?(this.state=Un,this.nowTime=-this.delay*t):(this.state=qn,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===Hn}get isDelay(){return this.state===Un}get isCountDown(){return this.state===qn}get isRunning(){return this.state===Un||this.state===qn}get isDone(){return this.state===Jn}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}};const Hn=0,Un=1,qn=2,Kn=3,Jn=-1;class Zn extends Xn{constructor(t,e){super(t,e),this.timer=new Vn}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const Qn=Phaser.Utils.Objects.GetValue,ta=Phaser.Utils.Objects.GetAdvancedValue,ea=Phaser.Tweens.Builders.GetEaseFunction;class ia extends Zn{resetFromJSON(t){return this.timer.resetFromJSON(Qn(t,"timer")),this.setEnable(Qn(t,"enable",!0)),this.setTarget(Qn(t,"target",this.parent)),this.setDelay(ta(t,"delay",0)),this.setDuration(ta(t,"duration",1e3)),this.setEase(Qn(t,"ease","Linear")),this.setRepeat(Qn(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=ea(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const sa=Phaser.Sound.BaseSound;var ra=function(t){return t instanceof sa};const na=Phaser.Utils.Objects.GetValue,aa=Phaser.Utils.Objects.GetAdvancedValue,oa=Phaser.Math.Linear;let ha=class extends ia{constructor(t,e,i){ra(t)&&(i=e,e=t,t=void 0),e.active=!0,e.scene=t,e.game=e.manager.game,super(e,i),this.volume={},this.resetFromJSON(i)}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(na(t,"mode",0)),this.setEnable(na(t,"enable",!0)),this.setVolumeRange(aa(t,"volume.start",this.parent.volume),aa(t,"volume.end",0)),this}setMode(t){return"string"==typeof t&&(t=la[t]),this.mode=t,this}setVolumeRange(t,e){return this.volume.start=t,this.volume.end=e,this}start(){return this.timer.isRunning||(this.parent.setVolume(this.volume.start),this.timer.setDelay(this.delay).setDuration(this.duration),super.start()),this}updateTarget(t,e){t.volume=oa(this.volume.start,this.volume.end,e.t)}complete(){switch(super.complete(),this.mode){case 1:this.parent.stop();break;case 2:this.parent.stop(),this.parent.destroy()}return this}};const la={stop:1,destroy:2};var ua=function(t,e,i,s,r){ra(t)&&(r=s,s=i,i=e,e=t,t=void 0),void 0===s&&(s=1),void 0===r&&(r=0);var n,a={mode:0,volume:{start:r,end:s},duration:i};return"string"==typeof e&&(e=t.sys.sound.add(e)),e.hasOwnProperty("_fade")?(n=e._fade).stop().resetFromJSON(a):(n=new ha(t,e,a),e._fade=n),n.start(),e.isPlaying||e.setVolume(r).play(),e},ca=function(t,e,i,s){ra(t)&&(s=i,i=e,e=t,t=void 0),void 0===s&&(s=!0);var r,n={mode:s?2:1,volume:{start:e.volume,end:0},duration:i};return e.hasOwnProperty("_fade")?(r=e._fade).stop().resetFromJSON(n):(r=new ha(t,e,n),e._fade=r),r.start(),e.isPlaying||e.play(),e};const da=Phaser.Utils.Objects.GetValue;var pa={setBackgroundMusicLoop(t){return void 0===t&&(t=!0),this.backgroundMusicLoop=t,this},setBackgroundMusicFadeTime(t){return this.backgroundMusicFadeTime=t,this},getBackgroundMusic(){return this.backgroundMusic},setCurrentBackgroundMusic(t){return this.backgroundMusic=t,t&&(t.once("complete",(function(){this.backgroundMusic===t&&(this.backgroundMusic.destroy(),this.backgroundMusic=void 0)}),this).once("destroy",(function(){this.backgroundMusic===t&&(this.backgroundMusic=void 0)}),this),t.isPlaying||t.play()),this},playBackgroundMusic(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;if(this.backgroundMusic&&this.backgroundMusic.key===t)return this;this.stopBackgroundMusic();var i=this.sound.add(t,{loop:da(e,"loop",this.backgroundMusicLoop),mute:da(e,"mute",this.backgroundMusicMute),volume:da(e,"volume",this.backgroundMusicVolume),detune:da(e,"detune",0),rate:da(e,"rate",1)});return this.setCurrentBackgroundMusic(i),this.backgroundMusicFadeTime>0&&this.fadeInBackgroundMusic(this.backgroundMusicFadeTime),this},pauseBackgroundMusic(){return this.backgroundMusic&&this.backgroundMusic.pause(),this},resumeBackgroundMusic(){return this.backgroundMusic&&this.backgroundMusic.resume(),this},stopBackgroundMusic(){return this.backgroundMusic&&(this.backgroundMusicFadeTime>0?this.fadeOutBackgroundMusic(this.backgroundMusicFadeTime,!0):(this.backgroundMusic.stop(),this.backgroundMusic.destroy(),this.backgroundMusic=void 0)),this},fadeInBackgroundMusic(t){return this.backgroundMusic&&ua(this.backgroundMusic,t,this.backgroundMusicVolume,0),this},fadeOutBackgroundMusic(t,e){return this.backgroundMusic&&ca(this.backgroundMusic,t,e),this},crossFadeBackgroundMusic(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;var i=this.backgroundMusicFadeTime;return this.backgroundMusicFadeTime=0,this.fadeOutBackgroundMusic(e,!0).playBackgroundMusic(t).fadeInBackgroundMusic(e),this.backgroundMusicFadeTime=i,this},setBackgroundMusicMute(t){return void 0===t&&(t=!0),this.backgroundMusicMute=t,this},setBackgroundMusicVolume(t){return this.backgroundMusicVolume=t,this},setBackgroundMusicRate(t){return this.backgroundMusic&&this.backgroundMusic.setRate(t),this},setBackgroundMusicDetune(t){return this.backgroundMusic&&this.backgroundMusic.setDetune(t),this}};const ga=Phaser.Utils.Objects.GetValue;var fa={setBackgroundMusic2Loop(t){return void 0===t&&(t=!0),this.backgroundMusic2Loop=t,this},setBackgroundMusic2FadeTime(t){return this.backgroundMusic2FadeTime=t,this},getBackgroundMusic2(){return this.backgroundMusic2},setCurrentBackgroundMusic2(t){return this.backgroundMusic2=t,t&&(t.once("complete",(function(){this.backgroundMusic2===t&&(this.backgroundMusic2.destroy(),this.backgroundMusic2=void 0)}),this).once("destroy",(function(){this.backgroundMusic2===t&&(this.backgroundMusic2=void 0)}),this),t.isPlaying||t.play()),this},playBackgroundMusic2(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;if(this.backgroundMusic2&&this.backgroundMusic2.key===t)return this;this.stopBackgroundMusic2();var i=this.sound.add(t,{loop:ga(e,"loop",this.backgroundMusicLoop),mute:ga(e,"mute",this.backgroundMusic2Mute),volume:ga(e,"volume",this.backgroundMusic2Volume),detune:ga(e,"detune",0),rate:ga(e,"rate",1)});return this.setCurrentBackgroundMusic2(i),this.backgroundMusic2FadeTime>0&&this.fadeInBackgroundMusic2(this.backgroundMusic2FadeTime),this},pauseBackgroundMusic2(){return this.backgroundMusic2&&this.backgroundMusic2.pause(),this},resumeBackgroundMusic2(){return this.backgroundMusic2&&this.backgroundMusic2.resume(),this},stopBackgroundMusic2(){return this.backgroundMusic2&&(this.backgroundMusic2FadeTime>0?this.fadeOutBackgroundMusic2(this.backgroundMusic2FadeTime,!0):(this.backgroundMusic2.stop(),this.backgroundMusic2.destroy(),this.backgroundMusic2=void 0)),this},fadeInBackgroundMusic2(t){return this.backgroundMusic2&&ua(this.backgroundMusic2,t,this.backgroundMusic2Volume,0),this},fadeOutBackgroundMusic2(t,e){return this.backgroundMusic2&&ca(this.backgroundMusic2,t,e),this},crossFadeBackgroundMusic2(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;var i=this.backgroundMusic2FadeTime;return this.backgroundMusic2FadeTime=0,this.fadeOutBackgroundMusic2(e,!0).playBackgroundMusic2(t).fadeInBackgroundMusic2(e),this.backgroundMusic2FadeTime=i,this},setBackgroundMusic2Mute(t){return void 0===t&&(t=!0),this.backgroundMusic2Mute=t,this},setBackgroundMusic2Volume(t){return this.backgroundMusic2Volume=t,this},setBackgroundMusic2Rate(t){return this.backgroundMusic2&&this.backgroundMusic2.setRate(t),this},setBackgroundMusic2Detune(t){return this.backgroundMusic2&&this.backgroundMusic2.setDetune(t),this}};const va=Phaser.Utils.Array.Remove,ma=Phaser.Utils.Objects.GetValue;var ya={getSoundEffects(){return this.soundEffects},getLastSoundEffect(){return this.soundEffects[this.soundEffects.length-1]},playSoundEffect(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;var i=this.sound.add(t,{mute:ma(e,"mute",this.soundEffectsMute),volume:ma(e,"volume",this.soundEffectsVolume),detune:ma(e,"detune",0),rate:ma(e,"rate",1)});return this.soundEffects.push(i),i.once("complete",(function(){i.destroy(),this.sound&&va(this.soundEffects,i)}),this).once("destroy",(function(){this.sound&&va(this.soundEffects,i)}),this).play(),this},stopAllSoundEffects(){for(var t=this.soundEffects.length-1;t>=0;t--){var e=this.soundEffects[t];e.stop(),e.destroy()}return this},fadeInSoundEffect(t){var e=this.getLastSoundEffect();return e&&ua(e,t,this.soundEffectsVolume,0),this},fadeOutSoundEffect(t,e){var i=this.getLastSoundEffect();return i&&ca(i,t,e),this},fadeOutAllSoundEffects(t,e){for(var i=this.soundEffects.length-1;i>=0;i--)ca(this.soundEffects[i],t,e);return this},setSoundEffectMute(t,e){if(void 0===t&&(t=!0),void 0===e&&(e=!1),e){var i=this.getLastSoundEffect();i&&i.setMute(t)}else this.soundEffectsMute=t;return this},setSoundEffectVolume(t,e){if(void 0===e&&(e=!1),e){var i=this.getLastSoundEffect();i&&i.setVolume(t)}else this.soundEffectsVolume=t;return this},setSoundEffectDetune(t,e){var i;void 0===e&&(e=!1);for(var s=0,r=(i=e?[this.getLastSoundEffect()]:this.soundEffects).length;s=0;t--){var e=this.soundEffects[t];e.stop(),e.destroy()}return this},fadeInSoundEffect2(t){var e=this.getLastSoundEffect2();return e&&ua(e,t,this.soundEffects2Volume,0),this},fadeOutSoundEffect2(t,e){var i=this.getLastSoundEffect2();return i&&ca(i,t,e),this},fadeOutAllSoundEffects2(t,e){for(var i=this.soundEffects2.length-1;i>=0;i--)ca(this.soundEffects2[i],t,e);return this},setSoundEffect2Mute(t,e){if(void 0===t&&(t=!0),void 0===e&&(e=!1),e){var i=this.getLastSoundEffect2();i&&i.setMute(t)}else this.soundEffects2Mute=t;return this},setSoundEffect2Volume(t,e){if(void 0===e&&(e=!1),e){var i=this.getLastSoundEffect2();i&&i.setVolume(t)}else this.soundEffects2Volume=t;return this},setSoundEffect2Detune(t,e){var i;void 0===e&&(e=!1);for(var s=0,r=(i=e?[this.getLastSoundEffect2()]:this.soundEffects2).length;s=0;t--)this.soundEffects[t].destroy();if(this.soundEffects.length=0,this.soundEffects2.length)for(t=this.soundEffects2.length-1;t>=0;t--)this.soundEffects2[t].destroy();return this.soundEffects2.length=0,this.sound=void 0,this}get backgroundMusicMute(){return this._backgroundMusicMute}set backgroundMusicMute(t){this._backgroundMusicMute=t,this.backgroundMusic&&this.backgroundMusic.setMute(mute)}get backgroundMusicVolume(){return this._backgroundMusicVolume}set backgroundMusicVolume(t){this._backgroundMusicVolume=t,this.backgroundMusic&&this.backgroundMusic.setVolume(t)}get backgroundMusic2Mute(){return this._backgroundMusic2Mute}set backgroundMusic2Mute(t){this._backgroundMusic2Mute=t,this.backgroundMusic2&&this.backgroundMusic2.setMute(mute)}get backgroundMusic2Volume(){return this._backgroundMusic2Volume}set backgroundMusic2Volume(t){this._backgroundMusic2Volume=t,this.backgroundMusic2&&this.backgroundMusic2.setVolume(t)}get soundEffectsMute(){return this._soundEffectsMute}set soundEffectsMute(t){this._soundEffectsMute=t;for(var e=this.soundEffects,i=0,s=e.length;i0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const Aa=Phaser.Utils.Objects.GetValue,La=new class extends Da{allocate(){return this.pop()}free(t){t.onFree(),this.push(t)}freeMultiple(t){for(var e=0,i=t.length;e");this.setDelimiters(e[0],e[1]),this.setTranslateTagNameCallback(Q(t,"translateTagNameCallback")),this.isRunning=!1,this.isPaused=!1,this.skipEventFlag=!1,this.justCompleted=!1,this.lastTagStart=null,this.lastTagEnd=null,this.lastContent=null}shutdown(){this.destroyEventEmitter()}destroy(){this.shutdown()}setMultipleLinesTagEnable(t){return void 0===t&&(t=!0),this.multipleLinesTagEnable=t,this}setDelimiters(t,e){void 0===e&&(e=t[1],t=t[0]),this.delimiterLeft=t,this.delimiterRight=e,t=Qa(this.delimiterLeft),e=Qa(this.delimiterRight);var i=this.multipleLinesTagEnable?"gs":"gi";return this.reSplit=RegExp(`${t}(.+?)${e}`,i),this}setTranslateTagNameCallback(t){return this.translateTagNameCallback=t,this}setValueConverter(t){return!0===t?t=$s:t||(t=so),this.valueConverter=t,this}setLoopEnable(t){return void 0===t&&(t=!0),this.loopEnable=t,this}setSource(t){return this.source=t,this}resetIndex(t){return void 0===t&&(t=0),this.progressIndex=t,this.reSplit.lastIndex=t,this.lastTagStart=null,this.lastTagEnd=null,this.lastContent=null,this.justCompleted=!1,this.isRunning=!1,this}start(t){return this.setSource(t).restart(),this}restart(){this.resetIndex().next()}next(){if(this.isPaused&&this.onResume(),this.isRunning)return this;if(this.isRunning=!0,this.justCompleted)return this.isRunning=!1,this;0===this.reSplit.lastIndex&&this.onStart();var t=this.source,e=t.length;for(this.reSplit.lastIndex=this.progressIndex;;){var i=this.reSplit.exec(t);if(!i){if(this.progressIndex");this.setDelimiters(e[0],e[1])}setTagExpression(t){return t||(t=ao),this.tagExpression=t,this}setValueExpression(t){return t||(t=ao),this.valueExpression=t,this}setDelimiters(t,e){super.setDelimiters(t,e);var i=`(${this.tagExpression})(=(${this.valueExpression}))?`;if(this.reTag=RegExp(i,"i"),this.tagExpression!==ao||this.valueExpression!==ao){var s=`${this.tagExpression}(=${this.valueExpression})?`,r=`/${this.tagExpression}`;t=Qa(this.delimiterLeft),e=Qa(this.delimiterRight);var n=this.multipleLinesTagEnable?"gs":"gi";this.reSplit=RegExp(`${t}((${s})|(${r}))${e}`,n)}return this}onTag(t){var e=t.match(this.reTag),i=e[1],s="/"===i.charAt(0);if(s&&(i=i.substring(1,i.length)),this.translateTagNameCallback&&(i=this.translateTagNameCallback(i)),this.skipEventFlag=!1,s)this.emit(`-${i}`),this.skipEventFlag||this.emit("-",i),this.lastTagEnd=i;else{var r=ro(e[3],this.valueConverter);this.emit(`+${i}`,...r),this.skipEventFlag||this.emit("+",i,...r),this.lastTagStart=i}}}const ao="[^=]+";var oo=[function(t){t.on("+color",(function(e){t.addStyle("color",e),t.skipEvent()})).on("-color",(function(){t.removeStyle("color"),t.skipEvent()}))},function(t){t.on("+bgcolor",(function(e){t.addStyle("background-color",e),t.skipEvent()})).on("-bgcolor",(function(){t.removeStyle("background-color"),t.skipEvent()}))},function(t){t.on("+b",(function(){t.addStyle("font-weight","bold"),t.skipEvent()})).on("-b",(function(){t.removeStyle("font-weight"),t.skipEvent()}))},function(t){t.on("+i",(function(){t.addStyle("font-style","italic"),t.skipEvent()})).on("-i",(function(){t.removeStyle("font-style"),t.skipEvent()}))},function(t){t.on("+size",(function(e){"number"==typeof e&&(e=`${e}px`),t.addStyle("font-size",e),t.skipEvent()})).on("-size",(function(){t.removeStyle("font-size"),t.skipEvent()}))},function(t){t.on("+u",(function(){t.addStyle("text-decoration","underline"),t.skipEvent()})).on("-u",(function(){t.removeStyle("text-decoration"),t.skipEvent()}))},function(t){t.on("+shadow",(function(e){t.addStyle("text-shadow",`1px 1px 3px ${e}`),t.skipEvent()})).on("-shadow",(function(){t.removeStyle("text-shadow"),t.skipEvent()}))},function(t){t.on("+round",(function(e,i){void 0===e&&(e=3),void 0===i&&(i=e),"number"==typeof e&&(e=`${e}px`),"number"==typeof i&&(i=`${i}px`),t.addStyle("display","inline-block"),t.addStyle("border-radius",e),t.addStyle("padding",i),t.skipEvent()})).on("-round",(function(){t.removeStyle("display"),t.removeStyle("border-radius"),t.removeStyle("padding"),t.skipEvent()}))},function(t){t.on("+family",(function(e){t.addStyle("font-family",e),t.skipEvent()})).on("-family",(function(){t.removeStyle("font-family"),t.skipEvent()}))},function(t){t.on("content",(function(e){t.addContent(e),t.skipEvent()})).on("+",(function(){t.addContent(t.lastTagSource),t.skipEvent()})).on("-",(function(){t.addContent(t.lastTagSource),t.skipEvent()}))}],ho=function(t){if("object"!=typeof t||null===t)return t;if(Array.isArray(t))t.length=0;else for(var e in t)delete t[e];return t},lo=function(t,e){var i=Array.isArray(t);if(void 0===e?e=i?[]:{}:ho(e),i){e.length=t.length;for(var s=0,r=t.length;s0&&l.fadeInBackgroundMusic(r),a&&this.wait({bgm:!0},o),this):this},"bgm.cross"({key:t,duration:e=500,wait:i=!1},s,r){var n=this.sys.soundManager;return n&&t?(n.crossFadeBackgroundMusic(t,e),i&&this.wait({bgm:!0},s),this):this},"bgm.stop"(t,e,i){var s=this.sys.soundManager;return s?(s.stopBackgroundMusic(),this):this},"bgm.fadeOut"({duration:t=500,stop:e=!0,wait:i=!1},s){var r=this.sys.soundManager;return r?(r.fadeOutBackgroundMusic2(t,e),i&&this.wait({bgm:!0},s),this):this},"bgm.fadeIn"({duration:t=500},e,i){var s=this.sys.soundManager;return s?(s.fadeInBackgroundMusic(t),this):this},"bgm.pause"(t,e,i){var s=this.sys.soundManager;return s?(s.pauseBackgroundMusic(),this):this},"bgm.resume"(t,e,i){var s=this.sys.soundManager;return s?(s.resumeBackgroundMusic(),this):this},"bgm.mute"(t,e,i){var s=this.sys.soundManager;return s?(s.setBackgroundMusicMute(!0),this):this},"bgm.unmute"(t,e,i){var s=this.sys.soundManager;return s?(s.setBackgroundMusicMute(!1),this):this}},xo={"bgm2.set"({volume:t,mute:e,unmute:i}={},s,r){var n=this.sys.soundManager;return n?(void 0!==t&&n.setBackgroundMusic2Volume(t),void 0!==e?n.setBackgroundMusic2Mute(e):void 0!==i&&n.setBackgroundMusic2Mute(!i),this):this},"bgm2.play"({key:t,volume:e,detune:i,rate:s,fadeIn:r=0,loop:n,wait:a=!1}={},o,h){var l=this.sys.soundManager;return l&&t?(void 0!==n&&l.setBackgroundMusic2LoopValue(n),l.playBackgroundMusic2(t),void 0!==e&&l.setBackgroundMusic2Volume(e),void 0!==i&&l.setBackgroundMusic2Detune(i),void 0!==s&&l.setBackgroundMusic2Rate(s),r>0&&l.fadeInBackgroundMusic2(r),a&&this.wait({bgm:!0},o),this):this},"bgm2.cross"({key:t,duration:e=500,wait:i=!1},s,r){var n=this.sys.soundManager;return n&&t?(n.crossFadeBackgroundMusic2(t,e),i&&this.wait({bgm:!0},s),this):this},"bgm2.stop"(t,e,i){var s=this.sys.soundManager;return s?(s.stopBackgroundMusic2(),this):this},"bgm2.fadeOut"({duration:t=500,stop:e=!0,wait:i=!1},s){var r=this.sys.soundManager;return r?(r.fadeOutBackgroundMusic2(t,e),i&&this.wait({bgm:!0},s),this):this},"bgm2.fadeIn"({duration:t=500},e,i){var s=this.sys.soundManager;return s?(s.fadeInBackgroundMusic2(t),this):this},"bgm2.pause"(t,e,i){var s=this.sys.soundManager;return s?(s.pauseBackgroundMusic2(),this):this},"bgm2.resume"(t,e,i){var s=this.sys.soundManager;return s?(s.resumeBackgroundMusic2(),this):this},"bgm2.mute"(t,e,i){var s=this.sys.soundManager;return s?(s.setBackgroundMusic2Mute(!0),this):this},"bgm2.unmute"(t,e,i){var s=this.sys.soundManager;return s?(s.setBackgroundMusic2Mute(!1),this):this}},Co={"se.set"({volume:t,mute:e,unmute:i}={},s,r){var n=this.sys.soundManager;return n?(void 0!==t&&n.setSoundEffectVolume(t),void 0!==e?n.setSoundEffectMute(e):void 0!==i&&n.setSoundEffectMute(!i),this):this},"se.play"({key:t,volume:e,detune:i,rate:s,fadeIn:r=0,wait:n=!1}={},a,o){var h=this.sys.soundManager;return h&&t?(h.playSoundEffect(t),void 0!==e&&h.setSoundEffectVolume(e,!0),void 0!==i&&h.setSoundEffectDetune(i,!0),void 0!==s&&h.setSoundEffectRate(s,!0),r>0&&h.fadeInSoundEffect(r),n&&this.wait({se:!0},a),this):this},"se.stop"(t,e,i){var s=this.sys.soundManager;return s?(s.stopAllSoundEffects(),this):this},"se.fadeOut"({duration:t=500,stop:e=!0,wait:i=!1},s,r){var n=this.sys.soundManager;return n?(n.fadeOutSoundEffect(t,e),i&&this.wait({bgm:!0},s),this):this},"se.mute"(t,e,i){var s=this.sys.soundManager;return s?(s.setSoundEffectMute(!0),this):this},"se.unmute"(t,e,i){var s=this.sys.soundManager;return s?(s.setSoundEffectMute(!1),this):this}},ko={"se2.set"({volume:t,mute:e,unmute:i}={},s,r){var n=this.sys.soundManager;return n?(void 0!==t&&n.setSoundEffect2Volume(t),void 0!==e?n.setSoundEffect2Mute(e):void 0!==i&&n.setSoundEffect2Mute(!i),this):this},"se2.play"({key:t,volume:e,detune:i,rate:s,fadeIn:r=0,wait:n=!1}={},a,o){var h=this.sys.soundManager;return h&&t?(h.playSoundEffect2(t),void 0!==e&&h.setSoundEffect2Volume(e,!0),void 0!==i&&h.setSoundEffect2Detune(i,!0),void 0!==s&&h.setSoundEffect2Rate(s,!0),r>0&&h.fadeInSoundEffect2(r),n&&this.wait({se:!0},a),this):this},"se2.stop"(t,e,i){var s=this.sys.soundManager;return s?(s.stopAllSoundEffects2(),this):this},"se2.fadeOut"({duration:t=500,stop:e=!0,wait:i=!1},s,r){var n=this.sys.soundManager;return n?(n.fadeOutSoundEffect2(t,e),i&&this.wait({bgm:!0},s),this):this},"se2.mute"(t,e,i){var s=this.sys.soundManager;return s?(s.setSoundEffect2Mute(!0),this):this},"se2.unmute"(t,e,i){var s=this.sys.soundManager;return s?(s.setSoundEffect2Mute(!1),this):this}},So={"camera.set"({x:t,y:e,rotate:i,zoom:s,name:r}={},n,a){var o;return(o=r?this.sys.scene.cameras.getCamera(r):this.sys.cameraTarget)?(void 0===t&&void 0===e||o.setScroll(t,e),void 0!==i&&o.setRotation(i),void 0!==s&&o.setZoom(s),this):this},"camera.fadeIn"({duration:t=1e3,red:e,green:i,blue:s,name:r,wait:n=!1}={},a,o){var h;return(h=r?this.sys.scene.cameras.getCamera(r):this.sys.cameraTarget)?(h.fadeIn(t,e,i,s),n&&this.wait({camera:"fadeIn",cameraName:r},a),this):this},"camera.fadeOut"({duration:t=1e3,red:e,green:i,blue:s,name:r,wait:n=!1}={},a,o){var h;return(h=r?this.sys.scene.cameras.getCamera(r):this.sys.cameraTarget)?(h.fadeOut(t,e,i,s),n&&this.wait({camera:"fadeOut",cameraName:r},a),this):this},"camera.flash"({duration:t=1e3,red:e,green:i,blue:s,name:r,wait:n=!1}={},a,o){var h;return(h=r?this.sys.scene.cameras.getCamera(r):this.sys.cameraTarget)?(h.flash(t,e,i,s),n&&this.wait({camera:"flash",cameraName:r},a),this):this},"camera.shake"({duration:t=1e3,intensity:e,name:i,wait:s=!1}={},r,n){var a;return(a=i?this.sys.scene.cameras.getCamera(i):this.sys.cameraTarget)?(a.shake(t,e),s&&this.wait({camera:"shake",cameraName:i},r),this):this},"camera.zoomTo"({duration:t=1e3,zoom:e,name:i,wait:s=!1}={},r,n){var a;return(a=i?this.sys.scene.cameras.getCamera(i):this.sys.cameraTarget)?(a.zoomTo(e,t),s&&this.wait({camera:"zoom",cameraName:i},r),this):this},"camera.rotateTo"({duration:t=1e3,rotate:e,ease:i,name:s,wait:r=!1}={},n,a){var o;return(o=s?this.sys.scene.cameras.getCamera(s):this.sys.cameraTarget)?(o.rotateTo(e,!1,t,i),r&&this.wait({camera:"rotate",cameraName:s},n),this):this},"camera.scrollTo"({duration:t=1e3,x:e,y:i,ease:s,name:r,wait:n=!1}={},a,o){var h;if(!(h=r?this.sys.scene.cameras.getCamera(r):this.sys.cameraTarget))return this;var l=h.scrollX,u=h.scrollY;return h.setScroll(e,i),e+=h.centerX,i+=h.centerY,h.setScroll(l,u),h.pan(e,i,t,s),n&&this.wait({camera:"scroll",cameraName:r},a),this}},wo=function(t){return!t.hasOwnProperty("logEnable")||t.logEnable},_o={log({text:t="",logType:e="log",showTitle:i=!0,title:s,titleColor:r="green"}={},n,a){return wo(a)?(i&&(void 0===s&&(s=a.title),t=`[round][bgcolor=${r}]${s}[/bgcolor][/round] ${t}`),this.sys.logger.log(t,e),this):this},"log.disable"({title:t}={},e,i){return t&&(i=e.getTree(t,i.groupName)),i.hasOwnProperty("logEnable")||i.wrapProperty("logEnable"),i.logEnable=!1,this},"log.enable"({title:t}={},e,i){return t&&(i=e.getTree(t,i.groupName)),i.hasOwnProperty("logEnable")?(i.logEnable=!0,this):this},"log.memory"(t,e,i){if(!wo(i))return this;this.log(t,e,i);var s,r=e.memory,{keys:n}=t;return n?(s={},n.split(",").forEach((function(t){s[t]=r[t]}))):s=r,this.sys.logger.log(s),this}},Eo={addCommand:function(t,e,i){return void 0===i&&(i=this),i&&(e=e.bind(i)),this[t]&&console.warn(`CommandExecutor: method '${t} is existed.`),this[t]=e,this},defaultHandler:function(t,e,i,s){var r=t.split("."),n=r[0];if(this.sys.hasGameObjectMananger(n))e.goType=n,e.id=null;else{if(!this.sys.hasGameObject(void 0,n))return console.warn(`CommandExecutor: '${n}' does not exist`),this;e.goType=void 0,e.id=n}this.bindEventSheetManager(i);var a=r[1],o=!1,h=this.sys.getGameObjectManager(e.goType,e.id);if(h){var l=h.commands[a];if(l){var u=h.getGO(e.id);Array.isArray(u)||(u=[u]);for(var c=0,d=u.length;c0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,a=1/i.zoom,o=r/2,h=n/2,l=r*a,u=n*a;e.x===o&&e.y===h||e.setPosition(o,h),e.width===l&&e.height===u||e.setSize(l,u)}}}const Wo=Phaser.GameObjects.Zone;let $o=class extends Wo{constructor(t){super(t,0,0,2,2),this.fullWindow=new Yo(this)}};const Vo="BG",Ho="SPRITE",Uo="TEXTBOX",qo="TITLE",Ko="CHOICE",Jo="NAMEINPUT";var Zo=!1,Qo=function(t){Zo||(void 0===t&&(t=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return eh(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return ih(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;ihh(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ehh(t).x,getChildLocalY:t=>hh(t).y};const wh=Phaser.Math.DegToRad;var _h={updateChildRotation(t){var e=hh(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=hh(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return hh(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return hh(t).rotation=wh(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=hh(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>hh(t).rotation},Eh={updateChildScale(t){var e=hh(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=hh(t),i=e.parent;return e.scaleX=kh(t.scaleX,i.scaleX),e.scaleY=kh(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=hh(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=hh(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>hh(t).scaleX,getChildLocalScaleY:t=>hh(t).scaleY},Th={updateChildVisible(t){var e=hh(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=hh(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),hh(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),hh(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=hh(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>hh(t).visible},Oh={updateChildAlpha(t){var e=hh(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=hh(t),i=e.parent;return e.alpha=kh(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return hh(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=hh(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>hh(t).alpha},Ph={updateChildActive(t){var e=hh(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return hh(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),hh(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=hh(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>hh(t).active},Mh={updateChildScrollFactor(t){var e=hh(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},Dh={updateCameraFilter(t){var e=hh(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},Ah={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(t){void 0===t&&(t=!1);var e=this;return this._mask=null,this.setChildMaskVisible(this),this.children.forEach((function(t){t.clearMask&&t.clearMask(!1),t.hasOwnProperty("isRexContainerLite")||e.setChildMaskVisible(t)})),t&&this.mask&&this.mask.destroy(),this}},Lh=function(t){return t.filter((function(t){return!!t.displayList||(!!t.parentContainer||void 0)}))},Rh={setDepth(t,e){if(this.depth=t,!e&&this.children)for(var i=this.getAllChildren(),s=0,r=i.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},Fh=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const Ih=Phaser.Utils.Array;var jh={getChildren(t){if(t)for(var e=0,i=this.children.length;e0?u.pop().setTexture(d,T):r(c,d,T),h&&c.add.existing(E),l){var O=b+k*_+a*k,P=x+S*w+o*S;E.setOrigin(a,o).setPosition(O,P).setScale(f,v).setRotation(m),Rl(E,b,x,m)}C.push(E)}return C}(t,e,i,s),a=0,o=n.length;a0&&(a=this.getChildLocalScaleX(s),a/=s.biasScale,this.setChildLocalScale(s,a)),r.biasScale&&(a=this.getChildLocalScaleX(r),a/=r.biasScale,this.setChildLocalScale(r,a));if(e?t.call(e,i,s,r,n):t(i,s,r,n),this.scaleMode)s.biasScale>0&&(a=this.getChildLocalScaleX(s),a*=s.biasScale,this.setChildLocalScale(s,a)),r.biasScale&&(a=this.getChildLocalScaleX(r),a*=r.biasScale,this.setChildLocalScale(r,a))}};Object.assign(Wl.prototype,Il);const Vl={fit:1,FIT:1,envelop:2,ENVELOP:2};const Hl=Phaser.GameObjects.GetCalcMatrix;const Ul=Phaser.Renderer.Canvas.SetTransform;var ql={renderWebGL:function(t,e,i,s){e.updateData(),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Hl(e,i,s),a=r.calcMatrix.copyFrom(n.calc),o=e._displayOriginX,h=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e);for(var u,c=e.geom,d=0,p=c.length;d>>16,o=(65280&r)>>>8,h=255&r;t.fillStyle="rgba("+a+","+o+","+h+","+n+")"},ou=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,a=(16711680&r)>>>16,o=(65280&r)>>>8,h=255&r;t.strokeStyle="rgba("+a+","+o+","+h+","+n+")",t.lineWidth=e.lineWidth};const hu=Phaser.Geom.Polygon.Earcut;class lu extends eu{constructor(){super(),this.pathData=[],this.pathIndexes=[],this.closePath=!1}updateData(){return this.pathIndexes=hu(this.pathData),super.updateData(),this}webglRender(t,e,i,s,r){this.isFilled&&su(t,e,this,i,s,r),this.isStroked&&nu(t,this,i,s,r)}canvasRender(t,e,i){var s=this.pathData,r=s.length-1,n=s[0]-e,a=s[1]-i;t.beginPath(),t.moveTo(n,a),this.closePath||(r-=2);for(var o=2;o=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const cu=Phaser.Math.DegToRad;var du=function(t,e,i,s,r,n,a,o,h){a&&n>r?n-=360:!a&&n0,a=0,o=e.length;a0;this.dirty=this.dirty||this._radiusTL!==t||this._convexTL!==e,this._convexTL=e,this._radiusTL=Math.abs(t)}get radiusTR(){return this._radiusTR}set radiusTR(t){var e=t>0;this.dirty=this.dirty||this._radiusTR!==t||this._convexTR!==e,this._convexTR=e,this._radiusTR=Math.abs(t)}get radiusBL(){return this._radiusBL}set radiusBL(t){var e=t>0;this.dirty=this.dirty||this._radiusBL!==t||this._convexBL!==e,this._convexBL=e,this._radiusBL=Math.abs(t)}get radiusBR(){return this._radiusBR}set radiusBR(t){var e=t>0;this.dirty=this.dirty||this._radiusBR!==t||this._convexBR!==e,this._convexBR=e,this._radiusBR=Math.abs(t)}get radius(){return Math.max(this.radiusTL,this.radiusTR,this.radiusBL,this.radiusBR)}set radius(t){"number"==typeof t?(this.radiusTL=t,this.radiusTR=t,this.radiusBL=t,this.radiusBR=t):(this.radiusTL=zu(t,"tl",0),this.radiusTR=zu(t,"tr",0),this.radiusBL=zu(t,"bl",0),this.radiusBR=zu(t,"br",0))}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}get iterations(){return this._iterations}set iterations(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t}setIterations(t){return this.iterations=t,this}updateData(){var t=this.pathData;t.length=0;var e,i=this.width,s=this.height,r=this.iterations+1;(e=this.radiusTL)>0?this._convexTL?du(e,e,e,e,180,270,!1,r,t):du(0,0,e,e,90,0,!0,r,t):uu(0,0,t);(e=this.radiusTR)>0?this._convexTR?du(i-e,e,e,e,270,360,!1,r,t):du(i,0,e,e,180,90,!0,r,t):uu(i,0,t);(e=this.radiusBR)>0?this._convexBR?du(i-e,s-e,e,e,0,90,!1,r,t):du(i,s,e,e,270,180,!0,r,t):uu(i,s,t);(e=this.radiusBL)>0?this._convexBL?du(e,s-e,e,e,90,180,!1,r,t):du(0,s,e,e,360,270,!0,r,t):uu(0,s,t);return t.push(t[0],t[1]),ku(this.x,this.y,t),super.updateData(),this}},triangle:class extends eu{constructor(t,e,i,s,r,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=0),super(),this.pathData=[],this.closePath=!0,this.setP0(t,e),this.setP1(i,s),this.setP2(r,n)}get x0(){return this._x0}set x0(t){this.dirty=this.dirty||this._x0!==t,this._x0=t}get y0(){return this._y0}set y0(t){this.dirty=this.dirty||this._y0!==t,this._y0=t}setP0(t,e){return this.x0=t,this.y0=e,this}get x1(){return this._x1}set x1(t){this.dirty=this.dirty||this._x1!==t,this._x1=t}get y1(){return this._y1}set y1(t){this.dirty=this.dirty||this._y1!==t,this._y1=t}setP1(t,e){return this.x1=t,this.y1=e,this}get x2(){return this._x2}set x2(t){this.dirty=this.dirty||this._x2!==t,this._x2=t}get y2(){return this._y2}set y2(t){this.dirty=this.dirty||this._y2!==t,this._y2=t}setP2(t,e){return this.dirty=this.dirty||this.x2!==t||this.y2!==e,this.x2=t,this.y2=e,this}updateData(){return this.pathData.length=0,this.pathData.push(this.x0,this.y0),this.pathData.push(this.x1,this.y1),this.pathData.push(this.x2,this.y2),this.pathData.push(this.x0,this.y0),super.updateData(),this}webglRender(t,e,i,s,r){if(this.isFilled){var n=Nu(this.fillColor,this.fillAlpha*i),a=this.x0-s,o=this.y0-r,h=this.x1-s,l=this.y1-r,u=this.x2-s,c=this.y2-r,d=e.getX(a,o),p=e.getY(a,o),g=e.getX(h,l),f=e.getY(h,l),v=e.getX(u,c),m=e.getY(u,c);t.batchTri(d,p,g,f,v,m,n,n,n)}this.isStroked&&nu(t,this,i,s,r)}canvasRender(t,e,i){var s=this.x1-e,r=this.y1-i,n=this.x2-e,a=this.y2-i,o=this.x3-e,h=this.y3-i;t.beginPath(),t.moveTo(s,r),t.lineTo(n,a),t.lineTo(o,h),t.closePath(),this.isFilled&&(au(t,this),t.fill()),this.isStroked&&(ou(t,this),t.stroke())}}},Xu=Phaser.Utils.Objects.GetValue,Yu=Phaser.Utils.Objects.IsPlainObject,Wu=function(){for(var t=this.getShapes(),e=0,i=t.length;e=0;s--)(a=r[s])instanceof e&&(a.destroy(),vc(r,s));else{s=0;for(var r,n=(r=t.postPipelines).length;s0}(e,gc),delete e.effect}})},function(t){t.addTransitionMode("revealRight",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(mc,0,0)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}}).addTransitionMode("revealLeft",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(mc,1,0)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}}).addTransitionMode("revealDown",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(mc,0,1)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}}).addTransitionMode("revealUp",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(mc,1,1)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}})}];class bc extends Wl{constructor(t,e,i,s,r,n){super(t,e,i,s,r,n);for(var a=0,o=yc.length;a0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n")}return i},Yc=function(t){return null==t?t="":Array.isArray(t)?t=t.join("\n"):"number"==typeof t&&(t=t.toString()),t},Wc={clearText(){return this.sections.length=0,this.pageStartIndexes.length=0,this.lines.length=0,this},appendPage(t){var e=this.totalLinesCount;this.sections.push(Yc(t));t=this.sections.join("\n");this.lines=Xc(this.parent,t,this.lines);var i,s=this.totalLinesCount-e;i=this.pageLinesCount>0?Math.ceil(s/this.pageLinesCount):1;for(var r=0;r0?t+i:this.totalLinesCount}var s;switch(e>this.totalLinesCount&&(e=this.totalLinesCount),this.textObjectType){case 0:case 2:s=this.lines.slice(t,e).join("\n");break;case 1:var r=this.lines.getLineStartIndex(t),n=this.lines.getLineEndIndex(e-1);((s=this.lines.getSliceTagText(r,n,!0)).match(/\n/g)||[]).length>e-t-1&&(s=s.substring(0,s.length-1))}return s}};Object.assign(qc,Wc,Vc,Uc);const Kc=Phaser.Utils.Objects.GetValue;Phaser.Math.Clamp;class Jc extends In{constructor(t,e){super(t,{eventEmitter:!1}),this.textObjectType=Gc(this.parent),this.pageStartIndexes=[],this.lines=Xc(this.parent,""),this.sections=[],this.resetFromJSON(e)}resetFromJSON(t){this.setMaxLines(Kc(t,"maxLines",void 0)),this.setPageBreak(Kc(t,"pageBreak","\f\n")),this.setText(Kc(t,"text","")),this.startLineIndex=Kc(t,"start",-1),this.endLineIndex=Kc(t,"end",void 0);var e=Kc(t,"page");return void 0===e?this.resetIndex():this.setPageIndex(e),this}toJSON(){return{maxLines:this.maxLines,text:this.content,start:this.startLineIndex,end:this.endLineIndex,page:this.pageIndex,pageBreak:this.pageBreak}}shutdown(t){if(!this.isShutdown){switch(this.textObjectType){case 0:case 2:this.lines.length=0;break;case 1:this.lines.destroy()}this.pageStartIndexes.length=0,this.sections.length=0,this.lines=void 0,this.pageStartIndexes=void 0,this.sections=void 0,super.shutdown(t)}}setMaxLines(t){return this.maxLines=t,this}setPageBreak(t){return this.pageBreak=t,this}get pageCount(){return this.pageStartIndexes.length}get lastPageIndex(){return this.pageCount-1}get isFirstPage(){return this.pageIndex<=0}get isLastPage(){return this.pageIndex>=this.pageCount-1}get totalLinesCount(){return this.lines?this.lines.length:0}get pageLinesCount(){if(void 0!==this.maxLines)return this.maxLines;var t;switch(this.textObjectType){case 0:case 1:var e=this.parent.style.maxLines;t=e>0?e:Math.floor(function(t){var e,i,s;switch(Gc(t)){case 0:case 1:e=t.height-t.padding.top-t.padding.bottom,i=t.lineSpacing,s=t.style.metrics.fontSize+t.style.strokeThickness;break;case 2:e=t.height,i=0;var r=t.fontSize/t.fontData.size;s=t.fontData.lineHeight*r}return(e-i)/(s+i)}(this.parent));break;case 2:t=this.totalLinesCount}return t}get isFirstLine(){return this.startLineIndex<=0}get isLastLine(){return this.endLineIndex===this.totalLinesCount}get content(){return this.sections.join(this.pageBreak)}}Object.assign(Jc.prototype,qc);var Zc={setText(t){this.setTextCallback&&(t=this.setTextCallbackScope?this.setTextCallback.call(this.setTextCallbackScope,t,this.isLastChar,this.insertIndex):this.setTextCallback(t,this.isLastChar,this.insertIndex)),this.textWrapEnable?Hc(this.parent,t):this.parent.setText(t)},appendText(t){var e=this.text.concat(Yc(t));return this.isTyping?this.setTypingContent(e):this.start(e,void 0,this.textLength),this}},Qc=function(t,e){return t.getPlainText&&(e=t.getPlainText(e)),e},td=function(t,e){for(var i=void 0,s=0;s0)l=ed(n,t,a=(o=i)-u,o);else l="";var c,d=e-u;if(d>0){o=(a=0)+d;this.insertIndex=o,c=ed(n,t,a,o)}else c="",this.insertIndex=0;r=c+l}return this.insertChar=r.charAt(this.insertIndex-1),r},sd={start:function(t,e,i,s){return void 0!==t&&this.setTypingContent(t),void 0!==e&&(this.speed=e),void 0===i&&(i=0),this.typingIndex=i+1,0===this.speed?this.stop(!0):(this.setText(""),this.startTimer(s)),this},startFromLine:function(t,e,i,s,r){var n;if(e>0){void 0===s&&(s=0);var a=Qc(this.parent,t);n=td(a,e)+s}return this.start(t,i,n,r)},stop:function(t){if(this.getTimer()&&this.freeTimer(),t){for(;!this.isLastChar;)id.call(this,this.text,this.typingIndex,this.textLength,this.typeMode),this.emit("typechar",this.insertChar),this.typingIndex++;this.setText(this.text),this.emit("type"),this.emit("complete",this,this.parent)}return this},pause:function(){var t=this.getTimer();return t&&(t.paused=!0),this},resumeTyping:function(){var t=this.getTimer();return t&&(t.paused=!1),this}};Object.assign(sd,Zc);const rd=Phaser.Utils.Objects.GetFastValue,nd=Phaser.Utils.Objects.GetValue;class ad extends In{constructor(t,e){super(t,e),this.timer=null,this.resetFromJSON(e)}resetFromJSON(t){this.setTextWrapEnable(nd(t,"wrap",!1)),this.setTypeMode(nd(t,"typeMode",0)),this.setTypingSpeed(nd(t,"speed",333)),this.setTextCallback=rd(t,"setTextCallback",null),this.setTextCallbackScope=rd(t,"setTextCallbackScope",null),this.setTypingContent(rd(t,"text","")),this.typingIndex=rd(t,"typingIndex",0),this.insertIndex=null,this.insertChar=null;var e=rd(t,"elapsed",null);return null!==e&&this.start(void 0,void 0,this.typingIndex,e),this}shutdown(t){this.isShutdown||(this.freeTimer(),super.shutdown(t))}setTypeMode(t){return"string"==typeof t&&(t=od[t]),this.typeMode=t,this}setTypeSpeed(t){return this.speed=t,this}setTypingSpeed(t){return this.speed=t,this}setTextWrapEnable(t){return void 0===t&&(t=!0),this.textWrapEnable=t,this}set text(t){var e=Yc(t);this.textWrapEnable&&(e=function(t,e){switch(Gc(t)){case 0:t.style.syncFont(t.canvas,t.context),e=t.runWordWrap(e);break;case 1:e=t.getText(e,void 0,void 0,!0);break;case 2:e=t.setText(e).getTextBounds().wrappedText}return e}(this.parent,e)),this._text=e}get text(){return this._text}get isTyping(){return null!==this.getTimer()}get isLastChar(){return this.typingIndex===this.textLength}setTypingContent(t){return this.text=t,this.textLength=Qc(this.parent,this.text).length,this}onTyping(){var t=id.call(this,this.text,this.typingIndex,this.textLength,this.typeMode);this.setText(t),this.emit("typechar",this.insertChar),this.emit("type"),this.isLastChar?(this.freeTimer(),this.scene.sys.events.once("preupdate",(function(){this.emit("complete",this,this.parent)}),this)):(this.timer.delay=this.speed,this.typingIndex++)}startTimer(t){var e;return this.timer&&this.freeTimer(),void 0===t?e=0:(this.speed,e=t),this.timer=this.scene.time.addEvent({delay:1e-4,startAt:e,loop:!0,callback:this.onTyping,callbackScope:this}),this}getTimer(){return this.timer}freeTimer(){return this.timer&&(this.timer.remove(),this.timer=null),this}setText(t){this.setTextCallback&&(t=this.setTextCallbackScope?this.setTextCallback.call(this.setTextCallbackScope,t,this.isLastChar,this.insertIndex):this.setTextCallback(t,this.isLastChar,this.insertIndex)),this.textWrapEnable?Hc(this.parent,t):this.parent.setText(t)}}const od={"left-to-right":0,"right-to-left":1,"middle-to-sides":2,"sides-to-middle":3};Object.assign(ad.prototype,sd);const hd=Phaser.Utils.Objects.GetValue;const ld={page:0,line:1};var ud=function(t){return t.hasOwnProperty("rexSizer")||(t.rexSizer={}),t.rexSizer};const cd=Phaser.Display.Align;var dd={center:cd.CENTER,left:cd.LEFT_CENTER,right:cd.RIGHT_CENTER,top:cd.TOP_CENTER,bottom:cd.BOTTOM_CENTER,"left-top":cd.TOP_LEFT,"top-left":cd.TOP_LEFT,"left-center":cd.LEFT_CENTER,"center-left":cd.LEFT_CENTER,"left-bottom":cd.BOTTOM_LEFT,"bottom-left":cd.BOTTOM_LEFT,"center-top":cd.TOP_CENTER,"top-center":cd.TOP_CENTER,"center-center":cd.CENTER,"center-bottom":cd.BOTTOM_CENTER,"bottom-center":cd.BOTTOM_CENTER,"right-top":cd.TOP_RIGHT,"top-right":cd.TOP_RIGHT,"right-center":cd.RIGHT_CENTER,"center-right":cd.RIGHT_CENTER,"right-bottom":cd.BOTTOM_RIGHT,"bottom-right":cd.BOTTOM_RIGHT},pd=function(){},gd=new Phaser.GameObjects.Zone({sys:{queueDepthSort:pd,events:{once:pd}}},0,0,1,1);gd.setOrigin(0);var fd=0,vd=1,md=2,yd=4,bd=6,xd=8,Cd=10,kd=12,Sd=function(t){var e=jr(t);return t.y+e-e*t.originY},wd=function(t){var e=Ir(t);return t.x-e*t.originX+.5*e},_d=function(t,e){var i=jr(t);return t.y=e-i+i*t.originY,t},Ed=function(t,e){var i=Ir(t),s=i*t.originX;return t.x=e+s-.5*i,t},Td=function(t){var e=Ir(t);return t.x-e*t.originX},Od=function(t,e){var i=Ir(t);return t.x=e+i*t.originX,t},Pd=function(t){var e=Ir(t);return t.x+e-e*t.originX},Md=function(t,e){var i=Ir(t);return t.x=e-i+i*t.originX,t},Dd=function(t,e){var i=jr(t),s=i*t.originY;return t.y=e+s-.5*i,t},Ad=function(t){var e=jr(t);return t.y-e*t.originY+.5*e},Ld=function(t){var e=jr(t);return t.y-e*t.originY},Rd=function(t,e){var i=jr(t);return t.y=e+i*t.originY,t},Fd=[];Fd[11]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Ed(t,wd(e)+i),_d(t,Sd(e)+s),t},Fd[Cd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Od(t,Td(e)-i),_d(t,Sd(e)+s),t},Fd[kd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Md(t,Pd(e)+i),_d(t,Sd(e)+s),t},Fd[bd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),function(t,e,i){Ed(t,e),Dd(t,i)}(t,wd(e)+i,Ad(e)+s),t},Fd[yd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Od(t,Td(e)-i),Dd(t,Ad(e)+s),t},Fd[xd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Md(t,Pd(e)+i),Dd(t,Ad(e)+s),t},Fd[vd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Ed(t,wd(e)+i),Rd(t,Ld(e)-s),t},Fd[fd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Od(t,Td(e)-i),Rd(t,Ld(e)-s),t},Fd[md]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Md(t,Pd(e)+i),Rd(t,Ld(e)-s),t};var Bd=function(t,e,i,s,r){return Fd[i](t,e,s,r)},Id=function(t,e,i,s,r,n){gd.setPosition(e,i).setSize(s,r),Bd(t,gd,n)};const jd=Phaser.Utils.Objects.GetValue,zd=Phaser.GameObjects.Group,Nd=Phaser.GameObjects.Container;var Gd=function(t,e,i){return t.add.text(0,0,"")},Xd=function(t,e){Array.isArray(t)||(t=[t]),void 0===e&&(e=[]);for(var i=0,s=t.length;i=0;e--)this.remove(this.backgroundChildren[e],t);return this}},ip=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const sp=/(\S+)\[(\d+)\]/i;const rp=Phaser.Utils.Objects.GetValue;var np=function(t,e){return void 0===e?t:t[e]},ap=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=rp(e,"left",0),t.right=rp(e,"right",0),t.top=rp(e,"top",0),t.bottom=rp(e,"bottom",0)),t},op={getInnerPadding(t){return np(this.space,t)},setInnerPadding(t,e){return ap(this.space,t,e),this},getOuterPadding(t){return np(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return ap(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),np(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),ap(this.getSizerConfig(t).padding,e,i),this}},hp=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},lp=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},up=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},cp=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},dp=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},pp=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},gp={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},fp=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var kg={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=An(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Sg={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=pd),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=pd),this.transitOutCallback=t,this}},wg={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},_g={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Eg={};Object.assign(Eg,kg,Sg,wg,_g);const Tg=Phaser.Utils.Objects.GetValue;class Og extends In{constructor(t,e){super(t,e),this.setTransitInTime(Tg(e,"duration.in",200)),this.setTransitOutTime(Tg(e,"duration.out",200)),this.setTransitInCallback(Tg(e,"transitIn")),this.setTransitOutCallback(Tg(e,"transitOut")),this.oneShotMode=Tg(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Cg(this,{eventEmitter:!1,initState:Tg(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Og.prototype,Eg);const Pg=Phaser.GameObjects.Rectangle;class Mg extends Pg{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Yo(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Dg=Phaser.Utils.Objects.GetValue;class Ag extends In{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Dg(t,"hitAreaMode",0)),this.setEnable(Dg(t,"enable",!0)),this.setStopMode(Dg(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Lg[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Lg={default:0,fullWindow:1};const Rg=Phaser.Utils.Objects.GetValue;class Fg extends Mg{constructor(t,e){super(t,Rg(e,"color",0),Rg(e,"alpha",.8)),this.touchEventStop=new Ag(this,{hitAreaMode:1})}}var Bg={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Mp(t,e)},scaleDown(t,e){Dp(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Yp(t,e)},fadeOut(t,e){Wp(t,e,!1)}},Ig=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Yp(t,e,t.alpha)},jg=function(t,e){Wp(t,e,!1)},zg=function(t,e,i,s,r){return!!t&&(!(s&&!s(t,e,i))&&(!!Yr(t,!0).contains(e,i)&&!(r&&!r(t,e,i))))};const Ng=Phaser.Utils.Objects.GetValue;let Gg=class extends Og{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Xg.popUp),null==e.transitOut&&(e.transitOut=Xg.scaleDown),e.destroy=Ng(e,"destroy",!0),super(t,e);var i=Ng(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Fg(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Ng(i,"transitIn",Ig)),this.setCoverTransitOutCallback(Ng(i,"transitOut",jg)));var s=Ng(e,"touchOutsideClose",!1),r=Ng(e,"duration.hold",-1),n=Ng(e,"timeOutClose",r>=0),a=Ng(e,"anyTouchClose",!1);Ng(e,"manualClose",!1)&&(s=!1,a=!1,n=!1),a&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),a?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Ng(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&zg(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=Xg[t]),t){case Xg.popUp:t=Bg.popUp;break;case Xg.fadeIn:t=Bg.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Xg[t]),t){case Xg.scaleDown:t=Bg.scaleDown;break;case Xg.fadeOut:t=Bg.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Xg={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Yg=function(t){return t&&"function"==typeof t},Wg={modal(t,e){return Yg(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new Gg(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},$g=function(t,e,i,s,r){Yg(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},Vg={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),vo(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return $g.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return $g.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return $g.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return $g.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return $g.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return $g.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return $g.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return $g.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return $g.call(this,"shutdown",t,e,i,s),this}},Hg=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=Ug),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},Ug={},qg=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,a=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return a?zg(t,e.x,e.y,i,s):!!(r=Hg(e,n,!0))&&zg(t,r.x,r.y,i,s);for(var o=t.scene.input.manager,h=o.pointersTotal,l=o.pointers,u=0;u=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const hf={press:0,pointerdown:0,release:1,pointerup:1};var lf={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new of(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},uf=function(t,e,i,s,r){if(e)return!(i&&!i(t,e))&&(!!cf(t,e)&&!(s&&!s(t,e)));void 0===r&&(r=!1);for(var n=t.scene.input.manager,a=n.pointersTotal,o=n.pointers,h=0;h0)return df.length=0,!0;return df.length=0,!1},df=[];const pf=Phaser.Utils.Objects.GetValue;class gf extends In{constructor(t,e){super(t,e),this._enable=void 0;var i=pf(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(pf(t,"enable",!0)),this.setMode(pf(t,"mode",1)),this.setClickInterval(pf(t,"clickInterval",100)),this.setDragThreshold(pf(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=ff[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?uf:qg)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const ff={press:0,pointerdown:0,release:1,pointerup:1};var vf={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new gf(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class mf extends xg{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const yf=Phaser.Utils.Objects.GetValue;class bf extends In{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new mf,this.parent.setInteractive(yf(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(yf(t,"enable",!0)),this.setCooldown(yf(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var xf={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&qg(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new bf(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new bf(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Cf={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},kf=function(t,e,i,s){if("parent"===t){for(var r,n=0,a=e.length;n0),this.onDragStart()))}onPointerUp(t){this.enable&&((!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=jf,this.onDragEnd()))}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===zf&&this.onDragEnd(),this.pointer=void 0,this.tracerState=jf,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Nf,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&qg(t,s,e,i)}}const jf=0,zf=1,Nf="IDLE",Gf=Phaser.Utils.Objects.GetValue,Xf=Phaser.Math.Distance.Between;class Yf extends If{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=Wf},eventEmitter:!1};this.setRecongizedStateObject(new xg(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Gf(t,"time",250)),this.setTapInterval(Gf(t,"tapInterval",200)),this.setDragThreshold(Gf(t,"threshold",9)),this.setTapOffset(Gf(t,"tapOffset",10));var e=Gf(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Gf(t,"maxTaps",void 0)),this.setMinTaps(Gf(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case Wf:this.state=$f;break;case $f:var t=this.lastPointer;Xf(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=Vf,this.state=$f);break;case Vf:this.state=$f}}onDragEnd(){this.state===$f&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=Vf))}onDrag(){this.state!==Wf&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Wf)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===$f){var i=this.lastPointer;if(i.isDown)t-i.downTime>this.holdTime&&(this.state=Wf);else t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=Vf:this.state=Wf)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Vf&&(this.state=Wf)}get isTapped(){return this.state===Vf}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const Wf="IDLE",$f="BEGIN",Vf="RECOGNIZED",Hf=Phaser.Utils.Objects.GetValue;class Uf extends If{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=qf},eventEmitter:!1};this.setRecongizedStateObject(new xg(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Hf(t,"threshold",9)),this.setHoldTime(Hf(t,"time",251)),this}onDragStart(){this.state=Kf,0===this.holdTime&&(this.state=Jf)}onDragEnd(){this.state=qf}onDrag(){this.state!==qf&&this.pointer.getDistance()>this.dragThreshold&&(this.state=qf)}preUpdate(t,e){this.isRunning&&this.enable&&(this.state===Kf&&t-this.pointer.downTime>=this.holdTime&&(this.state=Jf))}get isPressed(){return this.state===Jf}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const qf="IDLE",Kf="BEGIN",Jf="RECOGNIZED";Phaser.Utils.Objects.GetValue;var Zf=function(t){return Fn(t).loop.delta};const Qf=Phaser.Math.Distance.Between,tv=Phaser.Math.Angle.Between;var ev={getDt:function(){return Zf(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Qf(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return tv(e.x,e.y,t.x,t.y)}},iv={"up&down":0,"left&right":1,"4dir":2,"8dir":3},sv={};const rv=Phaser.Utils.Objects.GetValue,nv=Phaser.Math.RadToDeg;class av extends If{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=ov},eventEmitter:!1};this.setRecongizedStateObject(new xg(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(rv(t,"threshold",10)),this.setVelocityThreshold(rv(t,"velocityThreshold",1e3)),this.setDirectionMode(rv(t,"dir","8dir")),this}onDragStart(){this.state=hv}onDragEnd(){this.state=ov}onDrag(){this.state===hv&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=lv))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===lv&&(this.state=ov)}get isSwiped(){return this.state===lv}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=iv[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=sv),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(nv(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(av.prototype,ev);const ov="IDLE",hv="BEGIN",lv="RECOGNIZED",uv=Phaser.Utils.Objects.GetValue,cv=Phaser.Utils.Array.SpliceOne,dv=Phaser.Math.Distance.Between,pv=Phaser.Math.Angle.Between;class gv{constructor(t,e){var i=An(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(uv(e,"inputConfig",void 0)),this.setEventEmitter(uv(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(uv(t,"enable",!0)),this.bounds=uv(t,"bounds",void 0),this.tracerState=vv,this.pointers.length=0,ho(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,ho(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&(2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t)))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case vv:this.tracerState=mv,this.onDrag1Start();break;case mv:this.tracerState=yv,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],cv(this.pointers,e),this.tracerState){case mv:this.tracerState=vv,this.onDrag1End();break;case yv:this.tracerState=mv,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case mv:this.onDrag1();break;case yv:this.onDrag2()}}}dragCancel(){return this.tracerState===yv&&this.onDrag2End(),this.pointers.length=0,ho(this.movedState),this.tracerState=vv,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==yv)return 0;var t=this.pointers[0],e=this.pointers[1];return dv(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==yv)return 0;var t=this.pointers[0],e=this.pointers[1];return pv(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;fv.x=e.x-i.x,fv.y=e.y-i.y}else fv.x=0,fv.y=0;return fv}get centerX(){if(this.tracerState!==yv)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==yv)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==yv)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==yv)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=bv,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&qg(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&qg(t,s,e,i)}}Object.assign(gv.prototype,hr);var fv={};const vv=0,mv=1,yv=2,bv="IDLE";Phaser.Utils.Objects.GetValue;const xv=Phaser.Math.RotateAround;var Cv=function(t,e,i,s){return xv(t,e,i,s),t.rotation+=s,t},kv={};const Sv=Phaser.Utils.Objects.GetValue,wv=Phaser.Math.Angle.WrapDegrees,_v=Phaser.Math.Angle.ShortestBetween,Ev=Phaser.Math.RadToDeg,Tv=Phaser.Math.DegToRad;var Ov={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=kv),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,a=r.y,o=this.rotation;if(Array.isArray(t))for(var h=t,l=0,u=h.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=wv(Ev(this.angleBetween));this.angle=_v(this.prevAngle,t),this.prevAngle=t,this.state=Dv}break;case Dv:t=wv(Ev(this.angleBetween));this.angle=_v(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Dv}get rotation(){return Tv(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Ov);const Pv="IDLE",Mv="BEGIN",Dv="RECOGNIZED",Av=Phaser.Utils.Objects.GetValue;var Lv=function(t){var e=Av(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new Yf(this,e),this._tap.on("tap",(function(t,e,s){Sf(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Sf(i.eventEmitter,`${i.eventNamePrefix}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Rv=Phaser.Utils.Objects.GetValue;var Fv=function(t){var e=Rv(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new Uf(this,e),this._press.on("pressstart",(function(t,e,s){Sf(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this).on("pressend",(function(t,e,s){Sf(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Bv=Phaser.Utils.Objects.GetValue;var Iv=function(t){var e=Bv(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new av(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Sf(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Sf(i.eventEmitter,`${i.eventNamePrefix}swipe`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const jv=Phaser.Utils.Objects.GetValue;var zv=function(t,e){return t.setInteractive(),jv(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:jv(e,"targets",[t]),targetMode:jv(e,"targetMode","parent"),eventEmitter:jv(e,"eventEmitter",t),eventNamePrefix:jv(e,"inputEventPrefix","child.")},_f.call(t,e),Of.call(t,e),Df.call(t,e),Ff.call(t,e),Lv.call(t,e),Fv.call(t,e),Iv.call(t,e),t},Nv={getSizerConfig:function(t){return void 0===t&&(t=this),ud(t)},getChildPrevState:function(t){var e=ud(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=on(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,a,o=t.scene;if("number"==typeof e)i=e;else{i=jd(e,"color"),s=jd(e,"lineWidth");var h=jd(e,"name",!1);h&&(r=jd(h,"createTextCallback",Gd),n=jd(h,"createTextCallbackScope",void 0),"string"==typeof(a=jd(h,"align","left-top"))&&(a=dd[a]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new zd(o),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}var u,c,d=this.getAllShownChildren([this]);Xd(d,d);for(var p=0,g=d.length;p(h=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(r=h,s=n)}var h;o=i[i.length-1];return r>(h=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(r=h,s=n+1),s};const qv=Phaser.Utils.Objects.IsPlainObject,Kv=Phaser.Utils.Objects.GetValue,Jv=Phaser.Display.Align.CENTER,Zv={min:0,full:-1};var Qv=function(t,e,i,s,r,n,a,o,h,l){var u,c,d,p;$d.call(this,t);var g=t.isRexSpace,f=typeof e;if(null===e)return this;if("number"===f);else if("string"===f)e=Zv[e];else if(qv(e)){var v;e=Kv(v=e,"proportion",void 0),i=Kv(v,"align",Jv),s=Kv(v,"padding",0),r=Kv(v,"expand",!1),n=Kv(v,"key",void 0),a=Kv(v,"index",void 0),t.isRexSizer||(o=Kv(v,"minWidth",void 0),h=Kv(v,"minHeight",void 0)),l=Kv(v,"fitRatio",0),u=Kv(v,"offsetX",0),c=Kv(v,"offsetY",0),d=Kv(v,"offsetOriginX",0),p=Kv(v,"offsetOriginY",0)}return"string"==typeof i&&(i=dd[i]),void 0===e&&(e=g?1:0),void 0===i&&(i=Jv),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===o&&(g?o=0:t.isRexSizer||(o=t._minWidth)),void 0===h&&(g?h=0:t.isRexSizer||(h=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Ir(t)/jr(t)),void 0===u&&(u=0),void 0===c&&(c=0),void 0===d&&(d=0),void 0===p&&(p=0),(v=this.getSizerConfig(t)).proportion=e,v.align=i,v.padding=El(s),v.expand=r,v.fitRatio=0===e?l:0,v.alignOffsetX=u,v.alignOffsetY=c,v.alignOffsetOriginX=d,v.alignOffsetOriginY=p,void 0===a||a>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(a,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===o?Ir(t):o:t.minHeight=void 0===h?jr(t):h),r&&(0===this.orientation?t.minHeight=h:t.minWidth=o)),void 0!==n&&this.addChildrenMap(n,t),this},tm={add:Qv,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),Qv.call(this,new Hv(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,o){return qv(i)&&(i.index=t),Qv.call(this,e,i,s,r,n,a,t,o),this},insertAtPosition(t,e,i,s,r,n,a,o,h){var l=Uv.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,o,h),this}};const em=sl.prototype.clear;var im=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),em.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,im.call(this,t),this}},nm={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=dd[e]),this.getSizerConfig(t).align=e,this}},am={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},om={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},hm={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},lm={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,o=this.sizerChildren,h=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,u=0,c=o.length;u0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?h=!0:n=0)):n=0,h||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,a+=n)));else for(u=0,c=o.length;u0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?h=!0:n=0)):n=0,h||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,a+=n)))}return h?void 0:a+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,a=s.padding;i=n-(a.left+a.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,a=s.padding;i=n-(a.top+a.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(yp(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,fp.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,o,h,l,u,c,d=this.sizerChildren,p=this.innerLeft,g=this.innerTop,f=this.innerWidth,v=this.innerHeight,m=p,y=g,b=this.startChildIndex,x=0,C=d.length;x0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=cp.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||lp.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&$v.call(this,t,void 0),up.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||dp.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&$v.call(this,void 0,t),pp.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],a=n&&n.isRexSpace;return"center"===t?a||this.insertSpace(r+1):a&&this.remove(n,!0),this}};Object.assign(lm,tm,rm,nm,am,om,hm);var um=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},cm={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},dm=function(t){return"string"==typeof t&&(t=cm[t]),t};const pm=Phaser.Utils.Objects.IsPlainObject,gm=Phaser.Utils.Objects.GetValue;class fm extends Xv{constructor(t,e,i,s,r,n,a){pm(e)?(e=gm(a=e,"x",0),i=gm(a,"y",0),s=gm(a,"width",void 0),r=gm(a,"height",void 0),n=gm(a,"orientation",0)):pm(s)?(s=gm(a=s,"width",void 0),r=gm(a,"height",void 0),n=gm(a,"orientation",0)):pm(n)&&(n=gm(a=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,a),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(gm(a,"space.item",0)),this.setStartChildIndex(gm(a,"startChildIndex",0)),this.setRTL(gm(a,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=dm(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=um.call(this)),this._childrenProportion}}Object.assign(fm.prototype,lm);var vm=function(t,e,i){if(t){var s=null==e,r=null==i;return s&&r||(s||(t.displayWidth=e),r||(t.displayHeight=i),s&&(t.scaleX=t.scaleY),r&&(t.scaleY=t.scaleX)),t}},mm=function(t,e){var i;return t||0===t||(t=""),void 0===e&&(e=!0),Array.isArray(t)&&(t=t.join("\n")),(i=e?`${this.text}\n${t}`:`${this.text}${t}`)!=this.text&&this.setText(i),this},ym={appendText:mm,resetDisplayContent:function(t){void 0===t?t={}:"string"==typeof t&&(t={text:t});var e=t.text||"";this.setText(e);var i=this.childrenMap.icon;if(i){t.icon?this.show(i):this.hide(i);var s=t.iconSize;s&&(this.setChildDisplaySize(i,s,s),void 0!==this.iconWidth&&this.setIconSize(s)),!0!==t.icon&&this.setIconTexture(t.icon,t.iconFrame)}var r=this.childrenMap.action;if(r){t.action?this.show(r):this.hide(r);var n=t.actionSize;n&&(this.setChildDisplaySize(r,n,n),void 0!==this.actionWidth&&this.setActionSize(n)),!0!==t.action&&this.setActionTexture(t.action,t.actionFrame)}return this}};class bm extends fm{get text(){var t=this.childrenMap.text;return t?t.text:""}set text(t){var e=this.childrenMap.text;e&&e.setText(t)}setText(t){return this.text=t,this}setIconTexture(t,e){var i=this.childrenMap.icon;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.iconWidth&&void 0!==this.iconHeight&&(vm(i,this.iconWidth,this.iconHeight),this.resetChildScaleState(i)),this):this}setTexture(t,e){return this.setIconTexture(t,e),this}setIconSize(t,e){return void 0===e&&(e=t),this.iconWidth=t,this.iconHeight=e,this}get texture(){var t=this.childrenMap.icon;if(t)return t.texture}get frame(){var t=this.childrenMap.icon;if(t)return t.frame}setActionTexture(t,e){var i=this.childrenMap.action;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.actionWidth&&void 0!==this.actionHeight&&(vm(i,this.actionWidth,this.actionHeight),this.resetChildScaleState(i)),this):this}get actionTexture(){var t=this.childrenMap.action;if(t)return t.texture}get actionFrame(){var t=this.childrenMap.action;if(t)return t.frame}setActionSize(t,e){return void 0===e&&(e=t),this.actionWidth=t,this.actionHeight=e,this}preLayout(){var t=this.childrenMap.icon;t&&void 0!==this.iconWidth&&void 0!==this.iconHeight&&vm(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&vm(e,this.actionWidth,this.actionHeight),super.preLayout()}postLayout(t,e,i){var s=this.childrenMap.iconMask;s&&(s.setPosition(),this.resetChildPositionState(s));var r=this.childrenMap.actionMask;return r&&(r.setPosition(),this.resetChildPositionState(r)),super.postLayout(t,e,i),this}resize(t,e){super.resize(t,e);var i=this.childrenMap.iconMask;i&&i.resize();var s=this.childrenMap.actionMask;return s&&s.resize(),this}}Object.assign(bm.prototype,ym);var xm=function(t,e,i,s){var r=new Ol(e,i,s);if(t&&!t.isRexSizer){var n=r.createGeometryMask();t.setMask(n),this.once("destroy",(function(){t.setMask(),n.destroy()}))}return this.pin(r),r};const Cm=Phaser.Utils.Objects.GetValue;const km=Phaser.Utils.Objects.GetValue;var Sm=/^[\x00-\x7F]+$/,wm=function(t){return Sm.test(t)},_m=function(t,e){for(var i=[],s=t.split("\n"),r=e.style,n=r.wordWrapWidth,a=r.hasOwnProperty("wrapMode")?r.wrapMode:3,o=e.context,h=0,l=s.length;h0&&r.push(h.join("")),r},Tm=0,Om=1,Pm=2,Mm=0,Dm=1,Am=2,Lm=/(?:\r\n|\r|\n)/;const Rm={none:Mm,word:Dm,char:Am,character:Am,mix:3};var Fm=function(t,e){switch(Gc(t)){case 0:switch("string"==typeof e&&(e=Rm[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=_m;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Rm[e]||0),t.style.wrapMode=e}};const Bm=Phaser.Renderer.WebGL.Utils;var Im={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,a=r.height,o=Bm.getTintAppendFloatAlpha,h=t.pipelines.set(e.pipeline,e),l=h.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),h.batchTexture(e,r.glTexture,n,a,e.x,e.y,n/e.resolution,a/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,a,o(e.tintTopLeft,i.alpha*e._alphaTL),o(e.tintTopRight,i.alpha*e._alphaTR),o(e.tintBottomLeft,i.alpha*e._alphaBL),o(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const jm=Phaser.Display.Color;var zm={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,a,o,h,l){var u=this.scene.sys.textures.getFrame(t,e);if(!u)return this;var c=u.cutWidth,d=u.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=d),void 0===a&&(a=0),void 0===o&&(o=0),void 0===h&&(h=c),void 0===l&&(l=d);var p=u.cutX+a,g=u.cutY+o;return this.context.drawImage(u.source.image,p,g,h,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new jm);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var a=i;i=a.red,s=a.green,r=a.blue,n=a.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var o=this.context.createImageData(1,1);return o.data[0]=i,o.data[1]=s,o.data[2]=r,o.data[3]=n,this.context.putImageData(o,t,e),this.dirty=!0,this}},Nm=function(t,e,i,s,r,n,a){var o,h=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===a&&(a=e.height);var u=(o=h.exists(i)?h.get(i):h.createCanvas(i,n,a)).getSourceImage();u.width!==n&&(u.width=n),u.height!==a&&(u.height=a);var c=u.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,a),c.drawImage(e,s,r,n,a),l.gl&&o&&l.canvasToTexture(u,o.source[0].glTexture,!0,0)},Gm={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,Nm(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};Qo();const Xm=Phaser.Display.Canvas.CanvasPool,Ym=Phaser.GameObjects.GameObject,Wm=Phaser.Utils.String.UUID;class $m extends Ym{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=Xm.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=Wm(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){Xm.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}}const Vm=Phaser.GameObjects.Components;Phaser.Class.mixin($m,[Vm.Alpha,Vm.BlendMode,Vm.Crop,Vm.Depth,Vm.Flip,Vm.GetBounds,Vm.Mask,Vm.Origin,Vm.Pipeline,Vm.PostPipeline,Vm.ScrollFactor,Vm.Tint,Vm.Transform,Vm.Visible,Im,zm,Gm]);let Hm=class{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}};Object.assign(Hm.prototype,tu);var Um={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const qm=Phaser.Math.RotateAround;var Km;const Jm=Phaser.Geom.Rectangle;var Zm,Qm=function(t){void 0===Zm&&(Zm=new Jm);var e=t.drawTLX,i=t.drawTLY;return Zm.setTo(e,i,t.drawTRX-e,t.drawBLY-i),Zm};const ty=Phaser.Math.RotateAround;var ey,iy=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===ey&&(ey={}),s=ey),s.x=e,s.y=i,0!==t.rotation&&ty(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const sy=Phaser.GameObjects.Components.TransformMatrix;var ry,ny,ay={},oy=function(t,e,i,s,r){var n=iy(e,i,s,!0),a=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=ay);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===ry&&(ry=new sy,ny=new sy),t.parentContainer?t.getWorldTransformMatrix(ry,ny):ry.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),ry.transformPoint(r,n,s),s}(t,n.x,n.y,r);return a},hy=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,a=e.drawCenterY+s;return oy(t,e,n,a,r)},ly={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Km&&(Km={}),s=Km),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&qm(s,0,0,-i.rotation),s}(t,e,this,!0);return Qm(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return hy(this.parent,this,t,e,i)}};Object.assign(ly,Um);const uy=Phaser.Math.DegToRad,cy=Phaser.Math.RadToDeg,dy=Phaser.Utils.Objects.GetValue;class py extends Hm{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return cy(this._rotation)}set angle(t){this.rotation=uy(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=dy(t,"width",void 0),i=dy(t,"height",void 0),s=dy(t,"scaleX",void 0),r=dy(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(py.prototype,ly);const gy=Phaser.Utils.String.Pad;var fy=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${gy(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},vy=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const my=Phaser.Utils.Objects.GetValue;let yy=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=my(t,"x",0),i=my(t,"y",0));var s=this.cornerRadius;s.tl=by(my(t,"tl",void 0),e,i),s.tr=by(my(t,"tr",void 0),e,i),s.bl=by(my(t,"bl",void 0),e,i),s.br=by(my(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){xy(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){xy(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){xy(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){xy(this.cornerRadius.br,t)}};var by=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Cy(t),t},xy=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=my(e,"x",0),t.y=my(e,"y",0)),Cy(t)},Cy=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const ky=Phaser.Math.DegToRad;var Sy=function(t){return!t.hasOwnProperty("convex")||t.convex},wy=function(t){return t.x>0&&t.y>0},_y=function(t,e,i,s,r,n,a,o,h){if(o&&a>n?a-=360:!o&&a=p?1:s/p,v=r>=g?1:r/g,m=d.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),o=m.tl,wy(o)?(h=o.x*f,l=o.y*v,Sy(o)?_y(t,h,l,h,l,180,270,!1,a):_y(t,0,0,h,l,90,0,!0,a),u=0,c=l):(t.lineTo(0,0),u=0,c=0),o=m.tr,wy(o)?(h=o.x*f,l=o.y*v,Sy(o)?_y(t,s-h,l,h,l,270,360,!1,a):_y(t,s,0,h,l,180,90,!0,a)):t.lineTo(s,0),o=m.br,wy(o)?(h=o.x*f,l=o.y*v,Sy(o)?_y(t,s-h,r-l,h,l,0,90,!1,a):_y(t,s,r,h,l,270,180,!0,a)):t.lineTo(s,r),o=m.bl,wy(o)?(h=o.x*f,l=o.y*v,Sy(o)?_y(t,h,r-l,h,l,90,180,!1,a):_y(t,0,r,h,l,360,270,!0,a)):t.lineTo(0,r),t.lineTo(u,c),t.closePath(),t.restore()}(e,i,s,r,n,a,d),null!=o){var p;if(null!=u)(p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,o),p.addColorStop(1,u),o=p;e.fillStyle=o,e.fill()}null!=h&&l>0&&(e.strokeStyle=h,e.lineWidth=l,e.stroke())},Ty=function(t,e,i,s,r,n,a,o){if(null!=e||null!=i){var h=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var u=s/2;h=Math.max(1,h-s),l=Math.max(1,l-s),Ey(t.canvas,t.context,u,u,h,l,r,e,i,s,n,a,o)}};const Oy=Phaser.Utils.Objects.GetValue;class Py extends py{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(Oy(e,"color",null),Oy(e,"color2",null),Oy(e,"horizontalGradient",!0)),this.setStroke(Oy(e,"stroke",null),Oy(e,"strokeThickness",2)),this.setCornerRadius(Oy(e,"cornerRadius",0),Oy(e,"cornerIteration",null))}set color(t){t=fy(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=fy(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=fy(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,vy("color2",t,this),vy("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,vy("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,vy("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){Ty(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const My=Phaser.Utils.Objects.GetValue;class Dy extends py{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(My(e,"color",null),My(e,"color2",null),My(e,"horizontalGradient",!0)),this.setStroke(My(e,"stroke",null),My(e,"strokeThickness",2))}set color(t){t=fy(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=fy(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=fy(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,My(t,"color2",null),My(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,My(t,"strokeThickness",2))}renderContent(){var t=this.parent.padding,e=t.left,i=t.top,s=this.parent.width-t.left-t.right,r=this.parent.height-t.top-t.bottom,n=this.context;if(null!=this.color){var a,o;if(null!=this.color2)(o=this.horizontalGradient?n.createLinearGradient(0,0,s,0):n.createLinearGradient(0,0,0,r)).addColorStop(0,this.color),o.addColorStop(1,this.color2),a=o;else a=this.color;n.fillStyle=a,n.fillRect(e,i,s,r)}null!=this.stroke&&this.strokeThickness>0&&(n.strokeStyle=this.stroke,n.lineWidth=this.strokeThickness,n.strokeRect(e,i,s,r))}}const Ay=Phaser.Utils.Objects.GetValue;let Ly=class t{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(Ay(t,"bold",!1)),this.setItalic(Ay(t,"italic",!1)),this.setFontSize(Ay(t,"fontSize","16px")),this.setFontFamily(Ay(t,"fontFamily","Courier")),this.setColor(Ay(t,"color","#fff")),this.setStrokeStyle(Ay(t,"stroke",null),Ay(t,"strokeThickness",0)),this.setShadow(Ay(t,"shadowColor",null),Ay(t,"shadowOffsetX",0),Ay(t,"shadowOffsetY",0),Ay(t,"shadowBlur",0)),this.setOffset(Ay(t,"offsetX",0),Ay(t,"offsetY",0)),this.setSpace(Ay(t,"leftSpace",0),Ay(t,"rightSpace",0)),this.setAlign(Ay(t,"align",void 0)),this.setBackgroundColor(Ay(t,"backgroundColor",null)),this.setBackgroundHeight(Ay(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Ay(t,"backgroundBottomY",void 0)),this.setBackgroundLeftX(Ay(t,"backgroundLeftX",0)),this.setBackgroundRightX(Ay(t,"backgroundRightX",0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(vy("stroke",t,this),vy("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(vy("shadowOffsetX",t,this),vy("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),t.hasOwnProperty("backgroundLeftX")&&this.setBackgroundLeftX(t.backgroundLeftX),t.hasOwnProperty("backgroundRightX")&&this.setBackgroundRightX(t.backgroundRightX),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new t(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=fy(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=fy(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=fy(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=fy(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setBackgroundLeftX(t){return this.backgroundLeftX=t,this}setBackgroundRightX(t){return this.backgroundRightX=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}};const Ry=Phaser.Utils.Array.Remove;const Fy=Phaser.Utils.Array.Remove;const By="text",Iy="image",jy="drawer",zy="space",Ny="command";var Gy=function(t){return t.type===By&&"\n"===t.text},Xy=function(t){return t.type===By&&"\f"===t.text},Yy=function(t){return t.type===By};class Wy extends py{constructor(t,e,i){super(t,By),this.updateTextFlag=!1,this.style=new Ly(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX+e.backgroundLeftX,s=i,r=this.drawTRX+e.backgroundRightX-i+1;if(r>0){var n=e.backgroundBottomY;null==n&&(n=this.drawBLY);var a=e.backgroundHeight;null==a&&(a=n-this.drawTLY);var o=n-a;t.fillRect(s,o,r,a)}}var h=e.hasFill,l=e.hasStroke;(h||l)&&(e.syncFont(t).syncStyle(t),l&&(e.syncShadow(t),t.strokeText(this.text,0,0)),h&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var $y=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const Vy=Phaser.Display.Canvas.CanvasPool;var Hy=function(t,e,i,s,r,n,a,o){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===o&&(o=!1),o&&(i=Math.round(i),s=Math.round(s));var h=e.getContext("2d",{willReadFrequently:!0});if(a){var l=Vy.create(null,r,n,Phaser.CANVAS,!0),u=l.getContext("2d",{willReadFrequently:!0});u.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),u.globalCompositeOperation="source-in",u.fillStyle=a,u.fillRect(0,0,r,n),h.drawImage(l,0,0,r,n,i,s,r,n),Vy.remove(l)}else h.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)};Phaser.Display.Canvas.CanvasPool;class Uy extends py{constructor(t,e,i){super(t,Iy),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){Hy(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class qy extends py{constructor(t,e,i,s){super(t,jy),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class Ky extends py{constructor(t,e){super(t,zy),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class Jy extends Hm{constructor(t,e,i,s,r){super(t,Ny),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}var Zy=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const Qy={none:0,word:1,char:2,character:2,mix:3};var tb=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,a=!r&&!n,o=t.length,h=e,l=s.word,u=0,c=!1;h0&&!o){var h=this.fixedHeight-s;if(i>0)n=h/i;else n=(l=rb.call(this)).height,a=l.ascent,i=Math.floor((h-a)/n)}else{var l;n=(l=rb.call(this)).height,a=l.ascent}}else if(this.fixedHeight>0){if(void 0===(i=ab(t,"maxLines"))){h=this.fixedHeight-s;i=Math.floor(h/n)}}else i=ab(t,"maxLines",0);void 0===a&&(a=n);var u=0===i,c=ab(t,"wrapMode");void 0===c&&(c=ab(t,"charWrap",!1)?"char":"word");"string"==typeof c&&(c=Qy[c]);var d=ab(t,"wrapWidth",void 0);void 0===d&&(this.fixedWidth>0?d=this.fixedWidth-r:(d=1/0,c=0));for(var p=ab(t,"letterSpacing",0),g=ab(t,"hAlign",0),f=ab(t,"vAlign",0),v=ab(t,"justifyPercentage",.25),m=Zy({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:g,vAlign:f,justifyPercentage:v,ascent:a,lineHeight:n,wrapWidth:d,wrapMode:c}),y=this.children,b=0,x=y.length;b0&&(P.push({children:M,width:D}),A=Math.max(A,D)),m.start+=O.length,m.isLastPage=!L&&m.start===T,m.maxLineWidth=A,m.linesHeight=P.length*n;var N=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,G=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;!function(t,e,i){for(var s,r,n=t.hAlign,a=t.vAlign,o=t.justifyPercentage,h=t.lines,l=0,u=h.length;l0?(a=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=lb(t,"maxLines",void 0))){var a=this.fixedWidth-r;i=Math.floor(a/n)+1}}else i=lb(t,"maxLines",0);var o=0===i,h=lb(t,"fixedCharacterHeight",void 0);if(void 0===h){var l=lb(t,"charPerLine",void 0);if(void 0!==l){var u=this.fixedHeight-s;h=Math.floor(u/l)}}var c=lb(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var d=lb(t,"letterSpacing",0),p=lb(t,"rtl",!0),g=lb(t,"hAlign",p?2:0),f=lb(t,"vAlign",0),v=Zy({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:d,maxLines:i,hAlign:g,vAlign:f,lineWidth:n,fixedCharacterHeight:h,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(O.push({children:P,height:M}),D=Math.max(D,M)),v.start+=T.length,v.isLastPage=v.start===E,v.maxLineHeight=D,v.linesWidth=O.length*n;var I=this.fixedWidth>0?this.fixedWidth:v.linesWidth+r,j=this.fixedHeight>0?this.fixedHeight:v.maxLineHeight+s;!function(t,e,i){var s,r,n=t.hAlign,a=t.vAlign,o=t.rtl,h=t.lines,l=t.lineWidth,u=t.linesWidth;switch(n){case 1:case"center":s=(e-u)/2;break;case 2:case"right":s=e-u;break;default:s=0}o&&(s+=l);for(var c=0,d=h.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,a=i.bottom;return ap(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||a!=i.bottom,this},getPadding:function(t){return np(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),Ry(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return Fy(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(By);return null===i?i=new Wy(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),hy(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;ri&&(r=Math.floor(i));for(var n={},a=Yb(t,r,e,i,n),o=0;o<=Nb&&0!==a;o++){if((r+=a)<0){r=0;break}a=Yb(t,r,e,i,n)}return o===Nb&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),Wb(t,e,i),t},Xb=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},Yb=function(t,e,i,s,r){var n,a=Xb(t,e,r),o=Xb(t,e+1,r);if(void 0!==s)if(a.height<=s&&o.height>s)n=0;else{if(a.height>s)return-1;n=Math.floor(s-a.height)}if(a.width<=i&&o.width>i)return 0;if(a.width>i)return-1;var h=Math.floor(i-a.width);return void 0===n?h:Math.min(h,n)},Wb=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const $b=Phaser.Utils.Objects.GetValue;var Vb=function(t,e){"number"==typeof e&&(e={minWidth:e});var i=$b(e,"minWidth",0),s=$b(e,"minHeight",0),r=$b(e,"fitHeight",!1);return t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return Gb(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),Gb(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t}),t};const Hb=Phaser.Utils.Objects.GetValue,Ub=[function(t){var e=this.scene,i=Cm(t,"orientation",0);this.setOrientation(i);var s=Cm(t,"icon",void 0),r=Cm(t,"iconMask",void 0),n=Cm(t,"innerBackground",void 0),a=Cm(t,"title",void 0),o=Cm(t,"separator",void 0),h=Cm(t,"text",void 0),l=Cm(t,"action",void 0),u=Cm(t,"actionMask",void 0);if(s){var c=Cm(t,"align.icon","center");m=0===this.orientation?{right:Cm(t,"space.icon",0),top:Cm(t,"space.iconTop",0),bottom:Cm(t,"space.iconBottom",0),left:Cm(t,"space.iconLeft",0)}:{bottom:Cm(t,"space.icon",0),left:Cm(t,"space.iconLeft",0),right:Cm(t,"space.iconRight",0),top:Cm(t,"space.iconTop",0)};var d=Cm(t,"squareFitIcon",!1)?1:0;if(this.add(s,{proportion:0,align:c,padding:m,fitRatio:d}),r&&(r=xm.call(this,s,s,1)),!d){var p=Cm(t,"iconSize",void 0);this.setIconSize(Cm(t,"iconWidth",p),Cm(t,"iconHeight",p))}}var g=new fm(e,{orientation:1});n&&g.addBackground(n);var f=Cm(t,"space.separator",0);if(a){c=Cm(t,"align.title","left");var v=Cm(t,"expandTitleWidth",!1);y=Cm(t,"expandTitleHeight",!1)?1:0,b=v,m={bottom:!o&&h?Cm(t,"space.title",f):0,left:Cm(t,"space.titleLeft",0),right:Cm(t,"space.titleRight",0)},g.add(a,{proportion:y,expand:b,align:c,padding:m})}if(o){var m={top:a?f:0,bottom:h?f:0,left:Cm(t,"space.separatorLeft",0),right:Cm(t,"space.separatorRight",0)};g.add(o,{expand:!0,padding:m})}if(h){c=Cm(t,"align.text","left");var y,b,x=Cm(t,"expandTextWidth",!1);y=Cm(t,"expandTextHeight",!1)?1:0,b=x,m={left:Cm(t,"space.textLeft",0),right:Cm(t,"space.textRight",0)},g.add(h,{proportion:y,expand:b,align:c,padding:m})}m=void 0;if(l&&(m={right:Cm(t,"space.text",0)}),this.add(g,{proportion:1,padding:m}),l){c=Cm(t,"align.action","center");m=0===this.orientation?{top:Cm(t,"space.actionTop",0),bottom:Cm(t,"space.actionBottom",0),right:Cm(t,"space.actionRight",0)}:{left:Cm(t,"space.actionLeft",0),right:Cm(t,"space.actionRight",0),bottom:Cm(t,"space.actionBottom",0)};d=Cm(t,"squareFitAction",!1)?1:0;if(this.add(l,{proportion:0,align:c,padding:m,fitRatio:d}),u&&(u=xm.call(this,l,l,1)),!d){var C=Cm(t,"actionSize");this.setActionSize(Cm(t,"actionWidth",C),Cm(t,"actionHeight",C))}}this.addChildrenMap("icon",s),this.addChildrenMap("iconMask",r),this.addChildrenMap("innerSizer",g),this.addChildrenMap("innerBackground",n),this.addChildrenMap("title",a),this.addChildrenMap("separator",o),this.addChildrenMap("text",h),this.addChildrenMap("action",l),this.addChildrenMap("actionMask",u)},function(t){this.setOrientation(1),this.setRTL(!1);var e=this.scene,i=km(t,"title",void 0),s=km(t,"separator",void 0),r=km(t,"innerBackground",void 0),n=km(t,"icon",void 0),a=km(t,"iconMask",void 0),o=km(t,"text",void 0),h=km(t,"action",void 0),l=km(t,"actionMask",void 0);if(i){var u=km(t,"align.title","left"),c=km(t,"expandTitleWidth",!1);y=km(t,"expandTitleHeight",!1)?1:0,b=c,p={bottom:km(t,"space.title",0),left:km(t,"space.titleLeft",0),right:km(t,"space.titleRight",0)},this.add(i,{proportion:y,expand:b,align:u,padding:p})}if(s){var d=km(t,"space.separator",0),p={top:i?d:0,bottom:o?d:0,left:km(t,"space.separatorLeft",0),right:km(t,"space.separatorRight",0)};this.add(s,{proportion:0,expand:!0,padding:p})}var g=km(t,"orientation",0),f=new fm(e,{orientation:g,rtl:km(t,"rtl",!1),space:{left:km(t,"space.innerLeft",0),right:km(t,"space.innerRight",0),top:km(t,"space.innerTop",0),bottom:km(t,"space.innerBottom",0)}});if(r&&f.addBackground(r),this.add(f,{proportion:1,expand:!0}),n){u=km(t,"align.icon","center");p=0===f.orientation?{right:km(t,"space.icon",0),top:km(t,"space.iconTop",0),bottom:km(t,"space.iconBottom",0),left:km(t,"space.iconLeft",0)}:{bottom:km(t,"space.icon",0),left:km(t,"space.iconLeft",0),right:km(t,"space.iconRight",0),top:km(t,"space.iconTop",0)};var v=km(t,"squareFitIcon",!1)?1:0;if(f.add(n,{proportion:0,align:u,padding:p,fitRatio:v}),a&&(a=xm.call(this,n,n,1)),!v){var m=km(t,"iconSize",void 0);this.setIconSize(km(t,"iconWidth",m),km(t,"iconHeight",m))}}if(o){u=km(t,"align.text","left");var y,b,x=km(t,"space.text",0),C=km(t,"expandTextWidth",!1),k=km(t,"expandTextHeight",!1);0===f.orientation?(y=C?1:0,h&&(p={right:x}),b=k):(y=k?1:0,h&&(p={bottom:x}),b=C),f.add(o,{proportion:y,expand:b,align:u,padding:p})}if(h){u=km(t,"align.action","center");p=0===f.orientation?{top:km(t,"space.actionTop",0),bottom:km(t,"space.actionBottom",0),right:km(t,"space.actionRight",0)}:{left:km(t,"space.actionLeft",0),right:km(t,"space.actionRight",0),bottom:km(t,"space.actionBottom",0)};v=km(t,"squareFitAction",!1)?1:0;if(f.add(h,{proportion:0,align:u,padding:p,fitRatio:v}),l&&(l=xm.call(this,h,h,1)),!v){var S=km(t,"actionSize");this.setActionSize(km(t,"actionWidth",S),km(t,"actionHeight",S))}}this.addChildrenMap("title",i),this.addChildrenMap("separator",s),this.addChildrenMap("innerSizer",f),this.addChildrenMap("innerBackground",r),this.addChildrenMap("icon",n),this.addChildrenMap("iconMask",a),this.addChildrenMap("text",o),this.addChildrenMap("action",h),this.addChildrenMap("actionMask",l)}];class qb extends bm{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexTitleLabel";var i=Hb(e,"background",void 0);i&&this.addBackground(i);var s=Hb(e,"title",void 0),r=Hb(e,"text",void 0);if(s){var n=Hb(e,"wrapTitle",!1),a=Hb(e,"adjustTitleFontSize",!1);n?(!0===n&&(n="word"),Fm(s,n),e.expandTitleWidth=!0,zb(s)):a&&(e.expandTextWidth=!0,e.expandTextHeight=!0,Vb(s,{fitHeight:!0}))}if(r){var o=Hb(e,"wrapText",!1),h=Hb(e,"adjustTextFontSize",!1);o?(!0===o&&(o="word"),Fm(r,o),e.expandTextWidth=!0,zb(r)):h&&(e.expandTextWidth=!0,e.expandTextHeight=!0,Vb(r,{fitHeight:!0}))}var l=Hb(e,"layoutMode",0);(Ub[l]||Ub[0]).call(this,e),this.addChildrenMap("background",e.background)}get title(){var t=this.childrenMap.title;return t?t.title:""}set title(t){var e=this.childrenMap.title;e&&e.setText(t)}setTitle(t){return this.title=t,this}resetDisplayContent(t){void 0===t?t={}:"string"==typeof t&&(t={text:t}),super.resetDisplayContent(t);var e=this.childrenMap.title;return e&&(void 0===t.title||(t.title?(this.show(e),this.setTitle(t.title)):this.hide(e))),this}}class Kb extends(function(t,e){void 0===e&&(e="rexTextBox");return class extends t{constructor(t,i){super(t,i),this.type=e,this.isRunning=!1,this._isPageEnd=!1;var s=this.childrenMap.text,r=hd(i,"expandTextWidth",!1),n=hd(i,"expandTextHeight",!1);if(r||n){var a=Gc(s);switch(a){case 0:case 1:if(s.resize=function(t,e){var i=r?t:0,a=n?e:0;s.setFixedSize(i,a),i>0&&s.setWordWrapWidth(i)},1===a){var o=s.style;0===o.wrapMode&&(o.wrapMode=1)}}r&&(s._minWidth=0),n&&(s._minHeight=0)}this.setTypingMode(hd(i,"typingMode","page")),this.page=new Jc(s,hd(i,"page",void 0)),this.typing=new ad(s,hd(i,"typing",i.type)),this.typing.on("complete",this.onTypingComplete,this).on("type",this.onType,this).on("typechar",this.onTypeChar,this),this.textWidthSave=s.width,this.textHeightSave=s.height}setTypingMode(t){return"string"==typeof t&&(t=ld[t]),this.typingMode=t,this}start(t,e){return void 0!==e&&this.setTypingSpeed(e),this.isRunning=!0,this.page.setText(t),this.emit("start"),0===this.typingMode?this.typeNextPage():this.typeNextLine(),this}more(t,e){if(void 0!==e&&this.setTypingSpeed(e),!this.isRunning){if(this.isRunning=!0,this.page.appendText(t),this.emit("start"),0===this.typingMode){this._isPageEnd=!1;var i=this.page.getPage(),s=this.typing.textLength;this.typing.start(i,void 0,s)}return this}this.page.appendText(t),this.typing.appendText(t)}typeNextPage(){if(!this.isRunning)return this;if(this.isLastPage)this.emit("complete");else{this._isPageEnd=!1;var t=this.page.getNextPage();this.typing.start(t)}return this}typeNextLine(){if(!this.isRunning)return this;if(this.isLastLine)this.isRunning=!1,this.emit("pageend"),this.emit("complete");else{var t,e=this.page.getPageOfNextLine();t=this.isFirstLine?0:this.page.pageLinesCount-1,this.typing.startFromLine(e,t)}}pause(){return this.isRunning?(this.isTyping&&(this.typing.pause(),this.emit("pause")),this):this}resume(){return this.isRunning?(this.isTyping||(this.emit("resume"),this.typing.resume()),this):this}stop(t){return this.isRunning?(this.typing.stop(t),this):this}showLastPage(){return this.isRunning?(this.typing.stop(),0===this.typingMode?this.page.showLastPage():this.page.showLastLine(),this.emit("type"),this.onTypingComplete(),this):this}setTypeSpeed(t){return this.typing.setTypingSpeed(t),this}setTypingSpeed(t){return this.typing.setTypingSpeed(t),this}get isTyping(){return this.typing.isTyping}get isPageEnd(){return this._isPageEnd}get isLastPage(){return this.page.isLastPage}get isFirstPage(){return this.page.isFirstPage}get pageCount(){return this.page.pageCount}get pageIndex(){return this.page.pageIndex}get isLastLine(){return this.page.isLastLine}get isFirstLine(){return this.page.isFirstLine}get lineCound(){return this.page.totalLinesCount}get startLineIndex(){return this.page.startLineIndex}get endLineIndex(){return this.page.endLineIndex}get typingSpeed(){return this.typing.speed}onType(){var t=this.childrenMap.text;this.textWidthSave===t.width&&this.textHeightSave===t.height||(this.textWidthSave=t.width,this.textHeightSave=t.height,this.getTopmostSizer().layout()),this.emit("type")}onTypeChar(t){this.emit("typechar",t)}onTypingComplete(){if(0===this.typingMode){this._isPageEnd=!0;var t=this.isLastPage;this.isRunning=!t,this.emit("pageend"),t&&this.emit("complete")}else this.typeNextLine()}}}(qb)){constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("layoutMode")||(e.layoutMode=1),super(t,e)}}const Jb=Phaser.GameObjects.GetCalcMatrix;const Zb=Phaser.Renderer.Canvas.SetTransform;var Qb={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Jb(e,i,s),a=r.calcMatrix.copyFrom(n.calc),o=e._displayOriginX,h=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&su(r,a,e,l,o,h),e.isStroked&&nu(r,e,l,o,h),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(Zb(t,r,e,i,s)){var n=e._displayOriginX,a=e._displayOriginY,o=e.pathData,h=o.length-1,l=o[0]-n,u=o[1]-a;r.beginPath(),r.moveTo(l,u),e.closePath||(h-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(ex.prototype,Qb);var ix=function(t){return t.x>0&&t.y>0};const sx=Phaser.Utils.Objects.IsPlainObject,rx=Phaser.Utils.Objects.GetValue,nx=Phaser.Geom.Polygon.Earcut;class ax extends ex{constructor(t,e,i,s,r,n,a,o){var h,l,u,c;if(sx(e)){var d=e;e=d.x,i=d.y,s=d.width,r=d.height,n=d.radius,a=d.color,o=d.alpha,h=d.strokeColor,l=d.strokeAlpha,u=d.strokeWidth,c=d.shape}void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=s),void 0===n&&(n=0),void 0===c&&(c=0);var p=new yy;if(super(t,"rexRoundRectangleShape",p),this.setShapeType(c),0===this.shapeType){var g=rx(n,"radius",n);p.setTo(0,0,s,r,g)}else{g={x:s/2,y:r/2};p.setTo(0,0,s,r,g)}this.setIteration(rx(n,"iteration",void 0)),this.setPosition(e,i),this.setFillStyle(a,o),void 0===u&&(u=2),this.setStrokeStyle(u,h,l),this.updateDisplayOrigin(),this.dirty=!0}updateData(){var t=this.geom,e=this.pathData;e.length=0;var i,s=t.width,r=t.height,n=t.cornerRadius,a=this.iteration+1;if(i=n.tl,ix(i))if(i.convex){var o=i.x,h=i.y;du(o,h,i.x,i.y,180,270,!1,a,e)}else{du(o=0,h=0,i.x,i.y,90,0,!0,a,e)}else uu(0,0,e);if(i=n.tr,ix(i))if(i.convex){o=s-i.x,h=i.y;du(o,h,i.x,i.y,270,360,!1,a,e)}else{du(o=s,h=0,i.x,i.y,180,90,!0,a,e)}else uu(s,0,e);if(i=n.br,ix(i))if(i.convex){o=s-i.x,h=r-i.y;du(o,h,i.x,i.y,0,90,!1,a,e)}else{du(o=s,h=r,i.x,i.y,270,180,!0,a,e)}else uu(s,r,e);if(i=n.bl,ix(i))if(i.convex){o=i.x,h=r-i.y;du(o,h,i.x,i.y,90,180,!1,a,e)}else{du(o=0,h=r,i.x,i.y,360,270,!0,a,e)}else uu(0,r,e);return e.push(e[0],e[1]),this.pathIndexes=nx(e),this}setShapeType(t){return"string"==typeof t&&(t=ox[t]),this.shapeType=t,this}setSize(t,e){return void 0===e&&(e=t),this.geom.width===t&&this.geom.height===e||(this.geom.setSize(t,e),1===this.shapeType&&this.setRadius({x:t/2,y:e/2}),this.updateDisplayOrigin(),this.dirty=!0,super.setSize(t,e)),this}get radius(){return this.geom.radius}set radius(t){this.geom.setRadius(t),this.updateDisplayOrigin(),this.dirty=!0}get radiusTL(){return this.geom.radiusTL}set radiusTL(t){this.geom.radiusTL=t,this.dirty=!0}get radiusTR(){return this.geom.radiusTR}set radiusTR(t){this.geom.radiusTR=t,this.dirty=!0}get radiusBL(){return this.geom.radiusBL}set radiusBL(t){this.geom.radiusBL=t,this.dirty=!0}get radiusBR(){return this.geom.radiusBR}set radiusBR(t){this.geom.radiusBR=t,this.dirty=!0}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setRadiusTL(t){return void 0===t&&(t=0),this.radiusTL=t,this}setRadiusTR(t){return void 0===t&&(t=0),this.radiusTR=t,this}setRadiusBL(t){return void 0===t&&(t=0),this.radiusBL=t,this}setRadiusBR(t){return void 0===t&&(t=0),this.radiusBR=t,this}get cornerRadius(){return this.geom.cornerRadius}set cornerRadius(t){this.radius=t}setCornerRadius(t){return this.setRadius(t)}get iteration(){return this._iteration}set iteration(t){void 0!==this._iteration?this._iteration!==t&&(this._iteration=t,this.dirty=!0):this._iteration=t}setIteration(t){return void 0===t&&(t=6),this.iteration=t,this}}const ox={rectangle:0,circle:1};var hx=function(t,e,i,s){if(void 0===i&&(i="."),void 0===s&&(s={}),!t)return s;if(e in t)return Object.assign(s,t[e]);for(var r in e+=i,t)r.startsWith(e)&&(s[r.replace(e,"")]=t[r]);return s},lx=function(t,e,i){if(void 0===i&&(i={}),Array.isArray(e))for(var s=0,r=e.length;s=0?t.startAt(a+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(a+n,i):t.startAt(a,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(a,i),t.close(),t};const yx=Phaser.Utils.Objects.GetValue,bx=Phaser.Utils.Objects.IsPlainObject;class xx extends(oc(Zl)){constructor(t,e,i,s,r,n,a,o){bx(e)?(e=(o=e).x,i=o.y,s=o.width,r=o.height,n=o.barColor,a=o.value):bx(s)?(s=(o=s).width,r=o.height,n=o.barColor,a=o.value):bx(n)&&(n=(o=n).barColor,a=o.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===a&&(a=0),super(t,e,i,s,r,o),this.type="rexLineProgress",this.bootProgressBase(o),this.addShape((new Iu).setName("trackFill")).addShape((new Iu).setName("bar")).addShape((new Iu).setName("trackStroke")),this.setTrackColor(yx(o,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(yx(o,"trackStrokeThickness",2),yx(o,"trackStrokeColor",void 0)),this.setSkewX(yx(o,"skewX",0)),this.setRTL(yx(o,"rtl",!1)),this.setValue(a)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var Cx={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&mx(s,0,0,e,i,t);var r,n,a=this.getShape("bar");(a.fillStyle(this.barColor),a.isFilled)&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),mx(a,r,0,n,i,t));var o=this.getShape("trackStroke");o.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),o.isStroked&&mx(o,0,0,e,i,t)}};Object.assign(xx.prototype,Cx);class kx extends xx{constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("value")||(e.value=0),e.hasOwnProperty("hover.bar")||(e["hover.bar"]=!0),e.hasOwnProperty("easeDuration")||(e.easeDuration=200),e.hasOwnProperty("ease")||(e.ease="Quad"),Z(e,"easeValue.duration",e.easeDuration),Z(e,"easeValue.ease",e.ease),super(t,e),this.type="rexStatesBarRectangleShape",this.barState=!1,e.style=this,e.propertiesMap=Sx,this.addStyleManager(e),delete e.style,delete e.propertiesMap}get bar(){return this.barState}set bar(t){t=!!t,this.barState!==t&&(this.barState=t,this.easeValueTo(this.barState?1:0))}}const Sx={color:"trackColor",strokeColor:"trackStrokeColor",strokeWidth:"trackStrokeThickness"};Object.assign(kx.prototype,gx);let wx=class extends In{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Sr(t,e))return t[e];var i=t.parent;return Sr(i,e)?i[e]:void 0}set(t,e,i){return Sr(t,e)?t[e]=i:Sr(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.texture.key}set key(t){this.key!==t&&this.parent.setTexture(t,this.frame)}get frame(){return this.parent.frame.name}set frame(t){this.frame!==t&&this.parent.setFrame(t)}};const _x=Phaser.GameObjects.NineSlice,Ex=Phaser.Utils.Objects.GetValue;class Tx extends _x{constructor(t,e){void 0===e&&(e={}),super(t,Ex(e,"x",0),Ex(e,"y",0),Ex(e,"key",null),Ex(e,"frame",null),Ex(e,"width",0),Ex(e,"height",0),Ex(e,"leftWidth",0),Ex(e,"rightWidth",0),Ex(e,"topHeight",0),Ex(e,"bottomHeight",0)),this.type="rexStatesNineSlice";var i=Ex(e,"effects",!0);i&&Or(this,i),this.style=new wx(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Tx.prototype,gx);let Ox=class extends In{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Sr(t,e))return t[e];var i=t.parent;return Sr(i,e)?i[e]:void 0}set(t,e,i){return Sr(t,e)?t[e]=i:Sr(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.texture.key}set key(t){this.parent.setTexture(t,this.frame)}get frame(){return this.parent.frame.name}set frame(t){this.parent.setFrame(t)}get scale(){return this.parent.scaleX}set scale(t){this.parent.setScale(t)}};const Px=Phaser.GameObjects.Image,Mx=Phaser.Utils.Objects.GetValue;class Dx extends Px{constructor(t,e){void 0===e&&(e={}),super(t,Mx(e,"x",0),Mx(e,"y",0),Mx(e,"key",""),Mx(e,"frame",void 0)),this.type="rexStatesImage";var i=Mx(e,"effects",!0);i&&Or(this,i),this.style=new Ox(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Dx.prototype,gx);var Ax=function(t,e,i){return"__BASE"===i?`${t},${e}`:`${i}:${t},${e}`};const Lx=Phaser.Utils.Objects.IsPlainObject,Rx=Phaser.Utils.Objects.GetValue;var Fx=function(t){return"string"==typeof t&&(t=Bx[t]),t};const Bx={scale:0,repeat:1};var Ix=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},jx={_beginDraw:pd,_drawImage:pd,_drawTileSprite:pd,_endDraw:pd,setGetFrameNameCallback:function(t){return void 0===t&&(t=Ax),this.getFrameNameCallback=t,this},setBaseTexture:function(t,e,i,s){Array.isArray(e)&&(s=i,i=e,e=void 0),null==e&&(e="__BASE"),"number"==typeof i&&arguments.length>=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=y(i),s=y(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),a=n.width,o=0,h=0,l=i.length;h0?a/o:0,c=n.height,d=0;for(h=0,l=s.length;h0?0:f,x=0;h=0;for(var w=i.length;h0?0:v),v>=1&&f>=1){var _=typeof(m=this.getFrameNameCallback(h,k,e));"string"!==_&&"number"!==_||r.add(m,0,x+n.cutX,C+n.cutY,v,f)}x+=v}C+=f}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,a,o,h=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,u=this.width-h,c=this.height-l,d=u>=0?this.maxFixedPartScaleX:this.width/h,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var g=Math.min(d,p);if(d>g){var f=(d-g)*h;u>=0?u+=f:u=f,d=g}if(p>g){var v=(p-g)*l;c>=0?c+=v:c=v,p=g}}this.columns.scale=d,this.rows.scale=p,e=u>0&&this.columns.stretch>0?u/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,x=this.rows.count;b0&&o>0&&(0===(0===n.stretch&&0===r.stretch||0===this.getStretchMode(C,b)?0:1)?this._drawImage(this.textureKey,s,m,y,a,o):this._drawTileSprite(this.textureKey,s,m,y,a,o)),m+=a;y+=o}this._endDraw()},setStretchMode:function(t){return Lx(t)?(this.stretchMode.edge=Fx(Rx(t,"edge",0)),this.stretchMode.internal=Fx(Rx(t,"internal",0))):(t=Fx(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Ix.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const zx=Phaser.Utils.Objects.IsPlainObject,Nx=Phaser.Utils.Objects.GetValue;const Gx=Phaser.GameObjects;var Xx=void 0,Yx=function(t,e){if(Xx||(Xx={},Fn(t).events.once("destroy",(function(){for(var t in Xx)Xx[t].destroy();Xx=void 0}))),!Xx.hasOwnProperty(e)){var i=Fn(t).scene.systemScene;(t=new Gx[e](i)).setOrigin(0),Xx[e]=t}return Xx[e]};const Wx=Phaser.GameObjects.RenderTexture;class $x extends(function(t,e){class i extends t{constructor(t,i,s,r,n,a,o,h,l,u){if(zx(i)?(i=Nx(u=i,"x",0),s=Nx(u,"y",0),r=Nx(u,"width",1),n=Nx(u,"height",1),a=Nx(u,"key",void 0),o=Nx(u,"baseFrame",void 0),h=Nx(u,"columns",void 0),l=Nx(u,"rows",void 0)):zx(r)?(r=Nx(u=r,"width",1),n=Nx(u,"height",1),a=Nx(u,"key",void 0),o=Nx(u,"baseFrame",void 0),h=Nx(u,"columns",void 0),l=Nx(u,"rows",void 0)):zx(a)?(a=Nx(u=a,"key",void 0),o=Nx(u,"baseFrame",void 0),h=Nx(u,"columns",void 0),l=Nx(u,"rows",void 0)):zx(o)?(o=Nx(u=o,"baseFrame",void 0),h=Nx(u,"columns",void 0),l=Nx(u,"rows",void 0)):Array.isArray(o)?(u=l,l=h,h=o,o=Nx(u,"baseFrame",void 0)):zx(h)&&(h=Nx(u=h,"columns",void 0),l=Nx(u,"rows",void 0)),void 0===o&&(o=Nx(u,"frame",void 0)),void 0===h){var c=Nx(u,"leftWidth",void 0),d=Nx(u,"rightWidth",void 0);void 0!==c&&void 0!==d&&(h=[c,void 0,d])}if(void 0===l){var p=Nx(u,"topHeight",void 0),g=Nx(u,"bottomHeight",void 0);void 0!==p&&void 0!==g&&(l=[p,void 0,g])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(Nx(u,"getFrameNameCallback",void 0)),this.setStretchMode(Nx(u,"stretchMode",0)),this.setPreserveRatio(Nx(u,"preserveRatio",!0));var f=Nx(u,"maxFixedPartScale",1),v=Nx(u,"maxFixedPartScaleX",f),m=Nx(u,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(v,m),this.setBaseTexture(a,o,h,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,jx),i}(Wx,"rexNinePatch")){}var Vx={_drawImage:function(t,e,i,s,r,n){var a=Yx(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(a,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var a=Yx(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(a,i,s)}};Object.assign($x.prototype,Vx);let Hx=class extends In{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Sr(t,e))return t[e];var i=t.parent;return Sr(i,e)?i[e]:void 0}set(t,e,i){return Sr(t,e)?t[e]=i:Sr(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}};const Ux=Phaser.Utils.Objects.GetValue;class qx extends $x{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=Ux(e,"effects",!0);i&&Or(this,i),this.style=new Hx(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(qx.prototype,gx);const Kx=["alpha","tint","flipX","flipY"];var Jx=function(t,e){if(!e)return t;for(var i=0,s=Kx.length;i=this._config.preview;if(s)e.postMessage({results:o,workerId:a.WORKER_ID,finished:l});else if(C(this._config.chunk)&&!i){if(this._config.chunk(o,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);o=void 0,this._completeResults=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(o.data),this._completeResults.errors=this._completeResults.errors.concat(o.errors),this._completeResults.meta=o.meta),this._completed||!l||!C(this._config.complete)||o&&o.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),l||o&&o.meta.paused||this._nextChunk(),o}this._halted=!0},this._sendError=function(t){C(this._config.error)?this._config.error(t):s&&this._config.error&&e.postMessage({workerId:a.WORKER_ID,error:t,finished:!1})}}function l(t){var e;(t=t||{}).chunkSize||(t.chunkSize=a.RemoteChunkSize),h.call(this,t),this._nextChunk=i?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(t){this._input=t,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(e=new XMLHttpRequest,this._config.withCredentials&&(e.withCredentials=this._config.withCredentials),i||(e.onload=x(this._chunkLoaded,this),e.onerror=x(this._chunkError,this)),e.open(this._config.downloadRequestBody?"POST":"GET",this._input,!i),this._config.downloadRequestHeaders){var t=this._config.downloadRequestHeaders;for(var s in t)e.setRequestHeader(s,t[s])}if(this._config.chunkSize){var r=this._start+this._config.chunkSize-1;e.setRequestHeader("Range","bytes="+this._start+"-"+r)}try{e.send(this._config.downloadRequestBody)}catch(t){this._chunkError(t.message)}i&&0===e.status&&this._chunkError()}},this._chunkLoaded=function(){4===e.readyState&&(e.status<200||400<=e.status?this._chunkError():(this._start+=this._config.chunkSize?this._config.chunkSize:e.responseText.length,this._finished=!this._config.chunkSize||this._start>=function(t){var e=t.getResponseHeader("Content-Range");return null===e?-1:parseInt(e.substring(e.lastIndexOf("/")+1))}(e),this.parseChunk(e.responseText)))},this._chunkError=function(t){var i=e.statusText||t;this._sendError(new Error(i))}}function u(t){var e,i;(t=t||{}).chunkSize||(t.chunkSize=a.LocalChunkSize),h.call(this,t);var s="undefined"!=typeof FileReader;this.stream=function(t){this._input=t,i=t.slice||t.webkitSlice||t.mozSlice,s?((e=new FileReader).onload=x(this._chunkLoaded,this),e.onerror=x(this._chunkError,this)):e=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount=this._input.size,this.parseChunk(t.target.result)},this._chunkError=function(){this._sendError(e.error)}}function c(t){var e;h.call(this,t=t||{}),this.stream=function(t){return e=t,this._nextChunk()},this._nextChunk=function(){if(!this._finished){var t,i=this._config.chunkSize;return i?(t=e.substring(0,i),e=e.substring(i)):(t=e,e=""),this._finished=!e,this.parseChunk(t)}}}function d(t){h.call(this,t=t||{});var e=[],i=!0,s=!1;this.pause=function(){h.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){h.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(t){this._input=t,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){s&&1===e.length&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),e.length?this.parseChunk(e.shift()):i=!0},this._streamData=x((function(t){try{e.push("string"==typeof t?t:t.toString(this._config.encoding)),i&&(i=!1,this._checkIsFinished(),this.parseChunk(e.shift()))}catch(t){this._streamError(t)}}),this),this._streamError=x((function(t){this._streamCleanUp(),this._sendError(t)}),this),this._streamEnd=x((function(){this._streamCleanUp(),s=!0,this._streamData("")}),this),this._streamCleanUp=x((function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)}),this)}function p(t){var e,i,s,r=Math.pow(2,53),n=-r,o=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,h=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,l=this,u=0,c=0,d=!1,p=!1,v=[],m={data:[],errors:[],meta:{}};if(C(t.step)){var y=t.step;t.step=function(e){if(m=e,S())k();else{if(k(),0===m.data.length)return;u+=e.data.length,t.preview&&u>t.preview?i.abort():(m.data=m.data[0],y(m,l))}}}function x(e){return"greedy"===t.skipEmptyLines?""===e.join("").trim():1===e.length&&0===e[0].length}function k(){return m&&s&&(_("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+a.DefaultDelimiter+"'"),s=!1),t.skipEmptyLines&&(m.data=m.data.filter((function(t){return!x(t)}))),S()&&function(){if(m)if(Array.isArray(m.data[0])){for(var e=0;S()&&e=v.length?"__parsed_extra":v[s]),t.transform&&(a=t.transform(a,n)),a=w(n,a),"__parsed_extra"===n?(r[n]=r[n]||[],r[n].push(a)):r[n]=a}return t.header&&(s>v.length?_("FieldMismatch","TooManyFields","Too many fields: expected "+v.length+" fields but parsed "+s,c+i):s=s.length/2?"\r\n":"\r"}(r,h)),s=!1,t.delimiter)C(t.delimiter)&&(t.delimiter=t.delimiter(r),m.meta.delimiter=t.delimiter);else{var l=function(e,i,s,r,n){var o,h,l,u;n=n||[",","\t","|",";",a.RECORD_SEP,a.UNIT_SEP];for(var c=0;c=o)return V(!0)}else for(z=u,u++;;){if(-1===(z=a.indexOf(e,z+1)))return p||k.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:x.length,index:u}),W();if(z===f-1)return W(a.substring(u,z).replace(j,e));if(e!==l||a[z+1]!==l){if(e===l||0===z||a[z-1]!==l){-1!==B&&B=o)return V(!0);break}k.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:x.length,index:u}),z++}}else z++}return W();function X(t){x.push(t),w=u}function Y(t){var e=0;if(-1!==t){var i=a.substring(z+1,t);i&&""===i.trim()&&(e=i.length)}return e}function W(t){return p||(void 0===t&&(t=a.substring(u)),S.push(t),u=f,X(S),b&&H()),V()}function $(t){u=t,X(S),S=[],I=a.indexOf(s,u)}function V(t){return{data:x,errors:k,meta:{delimiter:i,linebreak:s,aborted:c,truncated:!!t,cursor:w+(d||0)}}}function H(){n(V()),x=[],k=[]}},this.abort=function(){c=!0},this.getCharIndex=function(){return u}}function v(t){var e=t.data,i=r[e.workerId],s=!1;if(e.error)i.userError(e.error,e.file);else if(e.results&&e.results.data){var n={abort:function(){s=!0,m(e.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:y,resume:y};if(C(i.userStep)){for(var a=0;a>16&255},mr=function(t){return t>>8&255},yr=function(t){return 255&t};const br=Phaser.Events.EventEmitter;var xr=function(t,e,i,s,r,n){return void 0===n?n={}:!0===n&&(n=Cr),"number"!=typeof i&&(i=0,s=0),n.x=r.x+r.width*t+i,n.y=r.y+r.height*e+s,n},Cr={},kr=function(t,e,i,s,r,n,a){if(t.hasOwnProperty("vp"))return t;"function"==typeof i&&(a=i,i=void 0),"function"==typeof r&&(a=r,r=void 0),void 0===i&&(i=.5),void 0===s&&(s=.5),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=xr),function(t){if(t.events)return t;var e=new br,i=t.x;Object.defineProperty(t,"x",{get:function(){return i},set:function(s){i!==s&&(i=s,e.emit("update",t))}});var s=t.y;Object.defineProperty(t,"y",{get:function(){return s},set:function(i){s!==i&&(s=i,e.emit("update",t))}});var r=t.width;Object.defineProperty(t,"width",{get:function(){return r},set:function(i){r!==i&&(r=i,e.emit("update",t))}});var n=t.height;Object.defineProperty(t,"height",{get:function(){return n},set:function(i){n!==i&&(n=i,e.emit("update",t))}}),t.events=e}(e);var o=e.events;t.vp=e;var h=function(){a(i,s,r,n,e,t)};o.on("update",h),t.once("destroy",(function(){o.off("update",h),t.vp=void 0})),Object.defineProperty(t,"vpx",{get:function(){return i},set:function(t){i!==t&&(i=t,h())}}),Object.defineProperty(t,"vpy",{get:function(){return s},set:function(t){s!==t&&(s=t,h())}}),Object.defineProperty(t,"vpxOffset",{get:function(){return r},set:function(t){r!==t&&(r=t,h())}}),Object.defineProperty(t,"vpyOffset",{get:function(){return n},set:function(t){n!==t&&(n=t,h())}}),h()},Sr=function(t,e){if(!t)return!1;if(t.hasOwnProperty(e))return!0;for(;t;){if(Object.getOwnPropertyDescriptor(t,e))return!0;t=t.__proto__}return!1},wr=function(t){return t.preFX?t.preFX:t.postFX?t.postFX:null},_r=function(t,e){t._effectSwitchNames||(t._effectSwitchNames=[],t.clearAllEffects=function(){for(var e=t._effectSwitchNames,i=0,s=e.length;i0&&void 0!==t.setTint},useAlphaFadeEffect(t){return(void 0===this.fadeMode||1===this.fadeMode)&&this.fadeTime>0&&void 0!==t.setAlpha},useRevealEffect(t){return this.fadeMode>=2&&this.fadeMode<=5&&this.fadeTime>0&&(t.preFX||t.postFX)},fadeBob(t,e,i,s){var r=t.gameObject;if(this.useTintFadeEffect(r))void 0!==e&&t.setProperty("tintGray",255*e),t.easeProperty({property:"tintGray",value:Math.floor(255*i),duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s});else if(this.useAlphaFadeEffect(r))void 0!==e&&t.setProperty("alpha",e),t.easeProperty({property:"alpha",value:i,duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s});else if(this.useRevealEffect(r)){var n;switch(Or(r,"reveal"),this.fadeMode){case 2:n="revealUp";break;case 3:n="revealDown";break;case 4:n="revealLeft";break;case 5:n="revealRight"}void 0===e&&(e=0),r[n]=e,t.easeProperty({property:n,value:i,duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s}),t.getTweenTask(n).once("complete",(function(){r[n]=null}))}else s&&s(r);return this}},Ir=function(t){return void 0!==t.displayWidth?t.displayWidth:t.width},jr=function(t){return void 0!==t.displayHeight?t.displayHeight:t.height};const zr=Phaser.Geom.Rectangle,Nr=Phaser.Math.Vector2,Gr=Phaser.Math.RotateAround,Xr=Phaser.GameObjects.Container;var Yr=function(t,e){if(void 0===e?e=new zr:!0===e&&(void 0===Wr&&(Wr=new zr),e=Wr),t.getBounds&&!(t instanceof Xr))return t.getBounds(e);var i,s,r,n,a,o,h,l;if(t.parentContainer){var u=t.parentContainer.getBoundsTransformMatrix();$r(t,e),u.transformPoint(e.x,e.y,e),i=e.x,s=e.y,Vr(t,e),u.transformPoint(e.x,e.y,e),r=e.x,n=e.y,Hr(t,e),u.transformPoint(e.x,e.y,e),a=e.x,o=e.y,Ur(t,e),u.transformPoint(e.x,e.y,e),h=e.x,l=e.y}else $r(t,e),i=e.x,s=e.y,Vr(t,e),r=e.x,n=e.y,Hr(t,e),a=e.x,o=e.y,Ur(t,e),h=e.x,l=e.y;return e.x=Math.min(i,r,a,h),e.y=Math.min(s,n,o,l),e.width=Math.max(i,r,a,h)-e.x,e.height=Math.max(s,n,o,l)-e.y,e},Wr=void 0,$r=function(t,e,i){return void 0===e?e=new Nr:!0===e&&(void 0===qr&&(qr=new Nr),e=qr),t.getTopLeft?t.getTopLeft(e):(e.x=t.x-Ir(t)*t.originX,e.y=t.y-jr(t)*t.originY,Kr(t,e,i))},Vr=function(t,e,i){return void 0===e?e=new Nr:!0===e&&(void 0===qr&&(qr=new Nr),e=qr),t.getTopRight?t.getTopRight(e):(e.x=t.x-Ir(t)*t.originX+Ir(t),e.y=t.y-jr(t)*t.originY,Kr(t,e,i))},Hr=function(t,e,i){return void 0===e?e=new Nr:!0===e&&(void 0===qr&&(qr=new Nr),e=qr),t.getBottomLeft?t.getBottomLeft(e):(e.x=t.x-Ir(t)*t.originX,e.y=t.y-jr(t)*t.originY+jr(t),Kr(t,e,i))},Ur=function(t,e,i){return void 0===e?e=new Nr:!0===e&&(void 0===qr&&(qr=new Nr),e=qr),t.getBottomRight?t.getBottomRight(e):(e.x=t.x-Ir(t)*t.originX+Ir(t),e.y=t.y-jr(t)*t.originY+jr(t),Kr(t,e,i))},qr=void 0,Kr=function(t,e,i){(void 0===i&&(i=!1),0!==t.rotation&&Gr(e,t.x,t.y,t.rotation),i&&t.parentContainer)&&t.parentContainer.getBoundsTransformMatrix().transformPoint(e.x,e.y,e);return e};const Jr=Phaser.Utils.Objects.GetValue;var Zr=function(t,e,i){var s,r,n,a,o;if("number"==typeof i?s=i:(s=Jr(i,"color"),r=Jr(i,"lineWidth"),n=Jr(i,"fillColor"),a=Jr(i,"fillAlpha",1),o=Jr(i,"padding",0)),Array.isArray(t))for(var h=0,l=t.length;h0?-this.delay:0,this.state=this.nowTime>=0?qn:Un,this.repeatCounter=0,this}stop(){return this.state=Hn,this}update(t,e){this.state!==Hn&&this.state!==Jn&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=Kn)):(this.nowTime=this.duration,this.state=Jn):this.nowTime>=0&&(this.state=qn))}get t(){var t;switch(this.state){case Hn:case Un:case Kn:t=0;break;case qn:t=this.nowTime/this.duration;break;case Jn:t=1}return $n(t,0,1)}set t(t){(t=$n(t,-1,1))<0?(this.state=Un,this.nowTime=-this.delay*t):(this.state=qn,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===Hn}get isDelay(){return this.state===Un}get isCountDown(){return this.state===qn}get isRunning(){return this.state===Un||this.state===qn}get isDone(){return this.state===Jn}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}};const Hn=0,Un=1,qn=2,Kn=3,Jn=-1;class Zn extends Xn{constructor(t,e){super(t,e),this.timer=new Vn}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const Qn=Phaser.Utils.Objects.GetValue,ta=Phaser.Utils.Objects.GetAdvancedValue,ea=Phaser.Tweens.Builders.GetEaseFunction;class ia extends Zn{resetFromJSON(t){return this.timer.resetFromJSON(Qn(t,"timer")),this.setEnable(Qn(t,"enable",!0)),this.setTarget(Qn(t,"target",this.parent)),this.setDelay(ta(t,"delay",0)),this.setDuration(ta(t,"duration",1e3)),this.setEase(Qn(t,"ease","Linear")),this.setRepeat(Qn(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=ea(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const sa=Phaser.Sound.BaseSound;var ra=function(t){return t instanceof sa};const na=Phaser.Utils.Objects.GetValue,aa=Phaser.Utils.Objects.GetAdvancedValue,oa=Phaser.Math.Linear;let ha=class extends ia{constructor(t,e,i){ra(t)&&(i=e,e=t,t=void 0),e.active=!0,e.scene=t,e.game=e.manager.game,super(e,i),this.volume={},this.resetFromJSON(i)}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(na(t,"mode",0)),this.setEnable(na(t,"enable",!0)),this.setVolumeRange(aa(t,"volume.start",this.parent.volume),aa(t,"volume.end",0)),this}setMode(t){return"string"==typeof t&&(t=la[t]),this.mode=t,this}setVolumeRange(t,e){return this.volume.start=t,this.volume.end=e,this}start(){return this.timer.isRunning||(this.parent.setVolume(this.volume.start),this.timer.setDelay(this.delay).setDuration(this.duration),super.start()),this}updateTarget(t,e){t.volume=oa(this.volume.start,this.volume.end,e.t)}complete(){switch(super.complete(),this.mode){case 1:this.parent.stop();break;case 2:this.parent.stop(),this.parent.destroy()}return this}};const la={stop:1,destroy:2};var ua=function(t,e,i,s,r){ra(t)&&(r=s,s=i,i=e,e=t,t=void 0),void 0===s&&(s=1),void 0===r&&(r=0);var n,a={mode:0,volume:{start:r,end:s},duration:i};return"string"==typeof e&&(e=t.sys.sound.add(e)),e.hasOwnProperty("_fade")?(n=e._fade).stop().resetFromJSON(a):(n=new ha(t,e,a),e._fade=n),n.start(),e.isPlaying||e.setVolume(r).play(),e},ca=function(t,e,i,s){ra(t)&&(s=i,i=e,e=t,t=void 0),void 0===s&&(s=!0);var r,n={mode:s?2:1,volume:{start:e.volume,end:0},duration:i};return e.hasOwnProperty("_fade")?(r=e._fade).stop().resetFromJSON(n):(r=new ha(t,e,n),e._fade=r),r.start(),e.isPlaying||e.play(),e};const da=Phaser.Utils.Objects.GetValue;var pa={setBackgroundMusicLoop(t){return void 0===t&&(t=!0),this.backgroundMusicLoop=t,this},setBackgroundMusicFadeTime(t){return this.backgroundMusicFadeTime=t,this},getBackgroundMusic(){return this.backgroundMusic},setCurrentBackgroundMusic(t){return this.backgroundMusic=t,t&&(t.once("complete",(function(){this.backgroundMusic===t&&(this.backgroundMusic.destroy(),this.backgroundMusic=void 0)}),this).once("destroy",(function(){this.backgroundMusic===t&&(this.backgroundMusic=void 0)}),this),t.isPlaying||t.play()),this},playBackgroundMusic(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;if(this.backgroundMusic&&this.backgroundMusic.key===t)return this;this.stopBackgroundMusic();var i=this.sound.add(t,{loop:da(e,"loop",this.backgroundMusicLoop),mute:da(e,"mute",this.backgroundMusicMute),volume:da(e,"volume",this.backgroundMusicVolume),detune:da(e,"detune",0),rate:da(e,"rate",1)});return this.setCurrentBackgroundMusic(i),this.backgroundMusicFadeTime>0&&this.fadeInBackgroundMusic(this.backgroundMusicFadeTime),this},pauseBackgroundMusic(){return this.backgroundMusic&&this.backgroundMusic.pause(),this},resumeBackgroundMusic(){return this.backgroundMusic&&this.backgroundMusic.resume(),this},stopBackgroundMusic(){return this.backgroundMusic&&(this.backgroundMusicFadeTime>0?this.fadeOutBackgroundMusic(this.backgroundMusicFadeTime,!0):(this.backgroundMusic.stop(),this.backgroundMusic.destroy(),this.backgroundMusic=void 0)),this},fadeInBackgroundMusic(t){return this.backgroundMusic&&ua(this.backgroundMusic,t,this.backgroundMusicVolume,0),this},fadeOutBackgroundMusic(t,e){return this.backgroundMusic&&ca(this.backgroundMusic,t,e),this},crossFadeBackgroundMusic(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;var i=this.backgroundMusicFadeTime;return this.backgroundMusicFadeTime=0,this.fadeOutBackgroundMusic(e,!0).playBackgroundMusic(t).fadeInBackgroundMusic(e),this.backgroundMusicFadeTime=i,this},setBackgroundMusicMute(t){return void 0===t&&(t=!0),this.backgroundMusicMute=t,this},setBackgroundMusicVolume(t){return this.backgroundMusicVolume=t,this},setBackgroundMusicRate(t){return this.backgroundMusic&&this.backgroundMusic.setRate(t),this},setBackgroundMusicDetune(t){return this.backgroundMusic&&this.backgroundMusic.setDetune(t),this}};const ga=Phaser.Utils.Objects.GetValue;var fa={setBackgroundMusic2Loop(t){return void 0===t&&(t=!0),this.backgroundMusic2Loop=t,this},setBackgroundMusic2FadeTime(t){return this.backgroundMusic2FadeTime=t,this},getBackgroundMusic2(){return this.backgroundMusic2},setCurrentBackgroundMusic2(t){return this.backgroundMusic2=t,t&&(t.once("complete",(function(){this.backgroundMusic2===t&&(this.backgroundMusic2.destroy(),this.backgroundMusic2=void 0)}),this).once("destroy",(function(){this.backgroundMusic2===t&&(this.backgroundMusic2=void 0)}),this),t.isPlaying||t.play()),this},playBackgroundMusic2(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;if(this.backgroundMusic2&&this.backgroundMusic2.key===t)return this;this.stopBackgroundMusic2();var i=this.sound.add(t,{loop:ga(e,"loop",this.backgroundMusicLoop),mute:ga(e,"mute",this.backgroundMusic2Mute),volume:ga(e,"volume",this.backgroundMusic2Volume),detune:ga(e,"detune",0),rate:ga(e,"rate",1)});return this.setCurrentBackgroundMusic2(i),this.backgroundMusic2FadeTime>0&&this.fadeInBackgroundMusic2(this.backgroundMusic2FadeTime),this},pauseBackgroundMusic2(){return this.backgroundMusic2&&this.backgroundMusic2.pause(),this},resumeBackgroundMusic2(){return this.backgroundMusic2&&this.backgroundMusic2.resume(),this},stopBackgroundMusic2(){return this.backgroundMusic2&&(this.backgroundMusic2FadeTime>0?this.fadeOutBackgroundMusic2(this.backgroundMusic2FadeTime,!0):(this.backgroundMusic2.stop(),this.backgroundMusic2.destroy(),this.backgroundMusic2=void 0)),this},fadeInBackgroundMusic2(t){return this.backgroundMusic2&&ua(this.backgroundMusic2,t,this.backgroundMusic2Volume,0),this},fadeOutBackgroundMusic2(t,e){return this.backgroundMusic2&&ca(this.backgroundMusic2,t,e),this},crossFadeBackgroundMusic2(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;var i=this.backgroundMusic2FadeTime;return this.backgroundMusic2FadeTime=0,this.fadeOutBackgroundMusic2(e,!0).playBackgroundMusic2(t).fadeInBackgroundMusic2(e),this.backgroundMusic2FadeTime=i,this},setBackgroundMusic2Mute(t){return void 0===t&&(t=!0),this.backgroundMusic2Mute=t,this},setBackgroundMusic2Volume(t){return this.backgroundMusic2Volume=t,this},setBackgroundMusic2Rate(t){return this.backgroundMusic2&&this.backgroundMusic2.setRate(t),this},setBackgroundMusic2Detune(t){return this.backgroundMusic2&&this.backgroundMusic2.setDetune(t),this}};const va=Phaser.Utils.Array.Remove,ma=Phaser.Utils.Objects.GetValue;var ya={getSoundEffects(){return this.soundEffects},getLastSoundEffect(){return this.soundEffects[this.soundEffects.length-1]},playSoundEffect(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;var i=this.sound.add(t,{mute:ma(e,"mute",this.soundEffectsMute),volume:ma(e,"volume",this.soundEffectsVolume),detune:ma(e,"detune",0),rate:ma(e,"rate",1)});return this.soundEffects.push(i),i.once("complete",(function(){i.destroy(),this.sound&&va(this.soundEffects,i)}),this).once("destroy",(function(){this.sound&&va(this.soundEffects,i)}),this).play(),this},stopAllSoundEffects(){for(var t=this.soundEffects.length-1;t>=0;t--){var e=this.soundEffects[t];e.stop(),e.destroy()}return this},fadeInSoundEffect(t){var e=this.getLastSoundEffect();return e&&ua(e,t,this.soundEffectsVolume,0),this},fadeOutSoundEffect(t,e){var i=this.getLastSoundEffect();return i&&ca(i,t,e),this},fadeOutAllSoundEffects(t,e){for(var i=this.soundEffects.length-1;i>=0;i--)ca(this.soundEffects[i],t,e);return this},setSoundEffectMute(t,e){if(void 0===t&&(t=!0),void 0===e&&(e=!1),e){var i=this.getLastSoundEffect();i&&i.setMute(t)}else this.soundEffectsMute=t;return this},setSoundEffectVolume(t,e){if(void 0===e&&(e=!1),e){var i=this.getLastSoundEffect();i&&i.setVolume(t)}else this.soundEffectsVolume=t;return this},setSoundEffectDetune(t,e){var i;void 0===e&&(e=!1);for(var s=0,r=(i=e?[this.getLastSoundEffect()]:this.soundEffects).length;s=0;t--){var e=this.soundEffects[t];e.stop(),e.destroy()}return this},fadeInSoundEffect2(t){var e=this.getLastSoundEffect2();return e&&ua(e,t,this.soundEffects2Volume,0),this},fadeOutSoundEffect2(t,e){var i=this.getLastSoundEffect2();return i&&ca(i,t,e),this},fadeOutAllSoundEffects2(t,e){for(var i=this.soundEffects2.length-1;i>=0;i--)ca(this.soundEffects2[i],t,e);return this},setSoundEffect2Mute(t,e){if(void 0===t&&(t=!0),void 0===e&&(e=!1),e){var i=this.getLastSoundEffect2();i&&i.setMute(t)}else this.soundEffects2Mute=t;return this},setSoundEffect2Volume(t,e){if(void 0===e&&(e=!1),e){var i=this.getLastSoundEffect2();i&&i.setVolume(t)}else this.soundEffects2Volume=t;return this},setSoundEffect2Detune(t,e){var i;void 0===e&&(e=!1);for(var s=0,r=(i=e?[this.getLastSoundEffect2()]:this.soundEffects2).length;s=0;t--)this.soundEffects[t].destroy();if(this.soundEffects.length=0,this.soundEffects2.length)for(t=this.soundEffects2.length-1;t>=0;t--)this.soundEffects2[t].destroy();return this.soundEffects2.length=0,this.sound=void 0,this}get backgroundMusicMute(){return this._backgroundMusicMute}set backgroundMusicMute(t){this._backgroundMusicMute=t,this.backgroundMusic&&this.backgroundMusic.setMute(mute)}get backgroundMusicVolume(){return this._backgroundMusicVolume}set backgroundMusicVolume(t){this._backgroundMusicVolume=t,this.backgroundMusic&&this.backgroundMusic.setVolume(t)}get backgroundMusic2Mute(){return this._backgroundMusic2Mute}set backgroundMusic2Mute(t){this._backgroundMusic2Mute=t,this.backgroundMusic2&&this.backgroundMusic2.setMute(mute)}get backgroundMusic2Volume(){return this._backgroundMusic2Volume}set backgroundMusic2Volume(t){this._backgroundMusic2Volume=t,this.backgroundMusic2&&this.backgroundMusic2.setVolume(t)}get soundEffectsMute(){return this._soundEffectsMute}set soundEffectsMute(t){this._soundEffectsMute=t;for(var e=this.soundEffects,i=0,s=e.length;i0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const Aa=Phaser.Utils.Objects.GetValue,La=new class extends Da{allocate(){return this.pop()}free(t){t.onFree(),this.push(t)}freeMultiple(t){for(var e=0,i=t.length;e");this.setDelimiters(e[0],e[1]),this.setTranslateTagNameCallback(Q(t,"translateTagNameCallback")),this.isRunning=!1,this.isPaused=!1,this.skipEventFlag=!1,this.justCompleted=!1,this.lastTagStart=null,this.lastTagEnd=null,this.lastContent=null}shutdown(){this.destroyEventEmitter()}destroy(){this.shutdown()}setMultipleLinesTagEnable(t){return void 0===t&&(t=!0),this.multipleLinesTagEnable=t,this}setDelimiters(t,e){void 0===e&&(e=t[1],t=t[0]),this.delimiterLeft=t,this.delimiterRight=e,t=Qa(this.delimiterLeft),e=Qa(this.delimiterRight);var i=this.multipleLinesTagEnable?"gs":"gi";return this.reSplit=RegExp(`${t}(.+?)${e}`,i),this}setTranslateTagNameCallback(t){return this.translateTagNameCallback=t,this}setValueConverter(t){return!0===t?t=$s:t||(t=so),this.valueConverter=t,this}setLoopEnable(t){return void 0===t&&(t=!0),this.loopEnable=t,this}setSource(t){return this.source=t,this}resetIndex(t){return void 0===t&&(t=0),this.progressIndex=t,this.reSplit.lastIndex=t,this.lastTagStart=null,this.lastTagEnd=null,this.lastContent=null,this.justCompleted=!1,this.isRunning=!1,this}start(t){return this.setSource(t).restart(),this}restart(){this.resetIndex().next()}next(){if(this.isPaused&&this.onResume(),this.isRunning)return this;if(this.isRunning=!0,this.justCompleted)return this.isRunning=!1,this;0===this.reSplit.lastIndex&&this.onStart();var t=this.source,e=t.length;for(this.reSplit.lastIndex=this.progressIndex;;){var i=this.reSplit.exec(t);if(!i){if(this.progressIndex");this.setDelimiters(e[0],e[1])}setTagExpression(t){return t||(t=ao),this.tagExpression=t,this}setValueExpression(t){return t||(t=ao),this.valueExpression=t,this}setDelimiters(t,e){super.setDelimiters(t,e);var i=`(${this.tagExpression})(=(${this.valueExpression}))?`;if(this.reTag=RegExp(i,"i"),this.tagExpression!==ao||this.valueExpression!==ao){var s=`${this.tagExpression}(=${this.valueExpression})?`,r=`/${this.tagExpression}`;t=Qa(this.delimiterLeft),e=Qa(this.delimiterRight);var n=this.multipleLinesTagEnable?"gs":"gi";this.reSplit=RegExp(`${t}((${s})|(${r}))${e}`,n)}return this}onTag(t){var e=t.match(this.reTag),i=e[1],s="/"===i.charAt(0);if(s&&(i=i.substring(1,i.length)),this.translateTagNameCallback&&(i=this.translateTagNameCallback(i)),this.skipEventFlag=!1,s)this.emit(`-${i}`),this.skipEventFlag||this.emit("-",i),this.lastTagEnd=i;else{var r=ro(e[3],this.valueConverter);this.emit(`+${i}`,...r),this.skipEventFlag||this.emit("+",i,...r),this.lastTagStart=i}}}const ao="[^=]+";var oo=[function(t){t.on("+color",(function(e){t.addStyle("color",e),t.skipEvent()})).on("-color",(function(){t.removeStyle("color"),t.skipEvent()}))},function(t){t.on("+bgcolor",(function(e){t.addStyle("background-color",e),t.skipEvent()})).on("-bgcolor",(function(){t.removeStyle("background-color"),t.skipEvent()}))},function(t){t.on("+b",(function(){t.addStyle("font-weight","bold"),t.skipEvent()})).on("-b",(function(){t.removeStyle("font-weight"),t.skipEvent()}))},function(t){t.on("+i",(function(){t.addStyle("font-style","italic"),t.skipEvent()})).on("-i",(function(){t.removeStyle("font-style"),t.skipEvent()}))},function(t){t.on("+size",(function(e){"number"==typeof e&&(e=`${e}px`),t.addStyle("font-size",e),t.skipEvent()})).on("-size",(function(){t.removeStyle("font-size"),t.skipEvent()}))},function(t){t.on("+u",(function(){t.addStyle("text-decoration","underline"),t.skipEvent()})).on("-u",(function(){t.removeStyle("text-decoration"),t.skipEvent()}))},function(t){t.on("+shadow",(function(e){t.addStyle("text-shadow",`1px 1px 3px ${e}`),t.skipEvent()})).on("-shadow",(function(){t.removeStyle("text-shadow"),t.skipEvent()}))},function(t){t.on("+round",(function(e,i){void 0===e&&(e=3),void 0===i&&(i=e),"number"==typeof e&&(e=`${e}px`),"number"==typeof i&&(i=`${i}px`),t.addStyle("display","inline-block"),t.addStyle("border-radius",e),t.addStyle("padding",i),t.skipEvent()})).on("-round",(function(){t.removeStyle("display"),t.removeStyle("border-radius"),t.removeStyle("padding"),t.skipEvent()}))},function(t){t.on("+family",(function(e){t.addStyle("font-family",e),t.skipEvent()})).on("-family",(function(){t.removeStyle("font-family"),t.skipEvent()}))},function(t){t.on("content",(function(e){t.addContent(e),t.skipEvent()})).on("+",(function(){t.addContent(t.lastTagSource),t.skipEvent()})).on("-",(function(){t.addContent(t.lastTagSource),t.skipEvent()}))}],ho=function(t){if("object"!=typeof t||null===t)return t;if(Array.isArray(t))t.length=0;else for(var e in t)delete t[e];return t},lo=function(t,e){var i=Array.isArray(t);if(void 0===e?e=i?[]:{}:ho(e),i){e.length=t.length;for(var s=0,r=t.length;s0&&l.fadeInBackgroundMusic(r),a&&this.wait({bgm:!0},o),this):this},"bgm.cross"({key:t,duration:e=500,wait:i=!1},s,r){var n=this.sys.soundManager;return n&&t?(n.crossFadeBackgroundMusic(t,e),i&&this.wait({bgm:!0},s),this):this},"bgm.stop"(t,e,i){var s=this.sys.soundManager;return s?(s.stopBackgroundMusic(),this):this},"bgm.fadeOut"({duration:t=500,stop:e=!0,wait:i=!1},s){var r=this.sys.soundManager;return r?(r.fadeOutBackgroundMusic2(t,e),i&&this.wait({bgm:!0},s),this):this},"bgm.fadeIn"({duration:t=500},e,i){var s=this.sys.soundManager;return s?(s.fadeInBackgroundMusic(t),this):this},"bgm.pause"(t,e,i){var s=this.sys.soundManager;return s?(s.pauseBackgroundMusic(),this):this},"bgm.resume"(t,e,i){var s=this.sys.soundManager;return s?(s.resumeBackgroundMusic(),this):this},"bgm.mute"(t,e,i){var s=this.sys.soundManager;return s?(s.setBackgroundMusicMute(!0),this):this},"bgm.unmute"(t,e,i){var s=this.sys.soundManager;return s?(s.setBackgroundMusicMute(!1),this):this}},xo={"bgm2.set"({volume:t,mute:e,unmute:i}={},s,r){var n=this.sys.soundManager;return n?(void 0!==t&&n.setBackgroundMusic2Volume(t),void 0!==e?n.setBackgroundMusic2Mute(e):void 0!==i&&n.setBackgroundMusic2Mute(!i),this):this},"bgm2.play"({key:t,volume:e,detune:i,rate:s,fadeIn:r=0,loop:n,wait:a=!1}={},o,h){var l=this.sys.soundManager;return l&&t?(void 0!==n&&l.setBackgroundMusic2LoopValue(n),l.playBackgroundMusic2(t),void 0!==e&&l.setBackgroundMusic2Volume(e),void 0!==i&&l.setBackgroundMusic2Detune(i),void 0!==s&&l.setBackgroundMusic2Rate(s),r>0&&l.fadeInBackgroundMusic2(r),a&&this.wait({bgm:!0},o),this):this},"bgm2.cross"({key:t,duration:e=500,wait:i=!1},s,r){var n=this.sys.soundManager;return n&&t?(n.crossFadeBackgroundMusic2(t,e),i&&this.wait({bgm:!0},s),this):this},"bgm2.stop"(t,e,i){var s=this.sys.soundManager;return s?(s.stopBackgroundMusic2(),this):this},"bgm2.fadeOut"({duration:t=500,stop:e=!0,wait:i=!1},s){var r=this.sys.soundManager;return r?(r.fadeOutBackgroundMusic2(t,e),i&&this.wait({bgm:!0},s),this):this},"bgm2.fadeIn"({duration:t=500},e,i){var s=this.sys.soundManager;return s?(s.fadeInBackgroundMusic2(t),this):this},"bgm2.pause"(t,e,i){var s=this.sys.soundManager;return s?(s.pauseBackgroundMusic2(),this):this},"bgm2.resume"(t,e,i){var s=this.sys.soundManager;return s?(s.resumeBackgroundMusic2(),this):this},"bgm2.mute"(t,e,i){var s=this.sys.soundManager;return s?(s.setBackgroundMusic2Mute(!0),this):this},"bgm2.unmute"(t,e,i){var s=this.sys.soundManager;return s?(s.setBackgroundMusic2Mute(!1),this):this}},Co={"se.set"({volume:t,mute:e,unmute:i}={},s,r){var n=this.sys.soundManager;return n?(void 0!==t&&n.setSoundEffectVolume(t),void 0!==e?n.setSoundEffectMute(e):void 0!==i&&n.setSoundEffectMute(!i),this):this},"se.play"({key:t,volume:e,detune:i,rate:s,fadeIn:r=0,wait:n=!1}={},a,o){var h=this.sys.soundManager;return h&&t?(h.playSoundEffect(t),void 0!==e&&h.setSoundEffectVolume(e,!0),void 0!==i&&h.setSoundEffectDetune(i,!0),void 0!==s&&h.setSoundEffectRate(s,!0),r>0&&h.fadeInSoundEffect(r),n&&this.wait({se:!0},a),this):this},"se.stop"(t,e,i){var s=this.sys.soundManager;return s?(s.stopAllSoundEffects(),this):this},"se.fadeOut"({duration:t=500,stop:e=!0,wait:i=!1},s,r){var n=this.sys.soundManager;return n?(n.fadeOutSoundEffect(t,e),i&&this.wait({bgm:!0},s),this):this},"se.mute"(t,e,i){var s=this.sys.soundManager;return s?(s.setSoundEffectMute(!0),this):this},"se.unmute"(t,e,i){var s=this.sys.soundManager;return s?(s.setSoundEffectMute(!1),this):this}},ko={"se2.set"({volume:t,mute:e,unmute:i}={},s,r){var n=this.sys.soundManager;return n?(void 0!==t&&n.setSoundEffect2Volume(t),void 0!==e?n.setSoundEffect2Mute(e):void 0!==i&&n.setSoundEffect2Mute(!i),this):this},"se2.play"({key:t,volume:e,detune:i,rate:s,fadeIn:r=0,wait:n=!1}={},a,o){var h=this.sys.soundManager;return h&&t?(h.playSoundEffect2(t),void 0!==e&&h.setSoundEffect2Volume(e,!0),void 0!==i&&h.setSoundEffect2Detune(i,!0),void 0!==s&&h.setSoundEffect2Rate(s,!0),r>0&&h.fadeInSoundEffect2(r),n&&this.wait({se:!0},a),this):this},"se2.stop"(t,e,i){var s=this.sys.soundManager;return s?(s.stopAllSoundEffects2(),this):this},"se2.fadeOut"({duration:t=500,stop:e=!0,wait:i=!1},s,r){var n=this.sys.soundManager;return n?(n.fadeOutSoundEffect2(t,e),i&&this.wait({bgm:!0},s),this):this},"se2.mute"(t,e,i){var s=this.sys.soundManager;return s?(s.setSoundEffect2Mute(!0),this):this},"se2.unmute"(t,e,i){var s=this.sys.soundManager;return s?(s.setSoundEffect2Mute(!1),this):this}},So={"camera.set"({x:t,y:e,rotate:i,zoom:s,name:r}={},n,a){var o;return(o=r?this.sys.scene.cameras.getCamera(r):this.sys.cameraTarget)?(void 0===t&&void 0===e||o.setScroll(t,e),void 0!==i&&o.setRotation(i),void 0!==s&&o.setZoom(s),this):this},"camera.fadeIn"({duration:t=1e3,red:e,green:i,blue:s,name:r,wait:n=!1}={},a,o){var h;return(h=r?this.sys.scene.cameras.getCamera(r):this.sys.cameraTarget)?(h.fadeIn(t,e,i,s),n&&this.wait({camera:"fadeIn",cameraName:r},a),this):this},"camera.fadeOut"({duration:t=1e3,red:e,green:i,blue:s,name:r,wait:n=!1}={},a,o){var h;return(h=r?this.sys.scene.cameras.getCamera(r):this.sys.cameraTarget)?(h.fadeOut(t,e,i,s),n&&this.wait({camera:"fadeOut",cameraName:r},a),this):this},"camera.flash"({duration:t=1e3,red:e,green:i,blue:s,name:r,wait:n=!1}={},a,o){var h;return(h=r?this.sys.scene.cameras.getCamera(r):this.sys.cameraTarget)?(h.flash(t,e,i,s),n&&this.wait({camera:"flash",cameraName:r},a),this):this},"camera.shake"({duration:t=1e3,intensity:e,name:i,wait:s=!1}={},r,n){var a;return(a=i?this.sys.scene.cameras.getCamera(i):this.sys.cameraTarget)?(a.shake(t,e),s&&this.wait({camera:"shake",cameraName:i},r),this):this},"camera.zoomTo"({duration:t=1e3,zoom:e,name:i,wait:s=!1}={},r,n){var a;return(a=i?this.sys.scene.cameras.getCamera(i):this.sys.cameraTarget)?(a.zoomTo(e,t),s&&this.wait({camera:"zoom",cameraName:i},r),this):this},"camera.rotateTo"({duration:t=1e3,rotate:e,ease:i,name:s,wait:r=!1}={},n,a){var o;return(o=s?this.sys.scene.cameras.getCamera(s):this.sys.cameraTarget)?(o.rotateTo(e,!1,t,i),r&&this.wait({camera:"rotate",cameraName:s},n),this):this},"camera.scrollTo"({duration:t=1e3,x:e,y:i,ease:s,name:r,wait:n=!1}={},a,o){var h;if(!(h=r?this.sys.scene.cameras.getCamera(r):this.sys.cameraTarget))return this;var l=h.scrollX,u=h.scrollY;return h.setScroll(e,i),e+=h.centerX,i+=h.centerY,h.setScroll(l,u),h.pan(e,i,t,s),n&&this.wait({camera:"scroll",cameraName:r},a),this}},wo=function(t){return!t.hasOwnProperty("logEnable")||t.logEnable},_o={log({text:t="",logType:e="log",showTitle:i=!0,title:s,titleColor:r="green"}={},n,a){return wo(a)?(i&&(void 0===s&&(s=a.title),t=`[round][bgcolor=${r}]${s}[/bgcolor][/round] ${t}`),this.sys.logger.log(t,e),this):this},"log.disable"({title:t}={},e,i){return t&&(i=e.getTree(t,i.groupName)),i.hasOwnProperty("logEnable")||i.wrapProperty("logEnable"),i.logEnable=!1,this},"log.enable"({title:t}={},e,i){return t&&(i=e.getTree(t,i.groupName)),i.hasOwnProperty("logEnable")?(i.logEnable=!0,this):this},"log.memory"(t,e,i){if(!wo(i))return this;this.log(t,e,i);var s,r=e.memory,{keys:n}=t;return n?(s={},n.split(",").forEach((function(t){s[t]=r[t]}))):s=r,this.sys.logger.log(s),this}},Eo={addCommand:function(t,e,i){return void 0===i&&(i=this),i&&(e=e.bind(i)),this[t]&&console.warn(`CommandExecutor: method '${t} is existed.`),this[t]=e,this},defaultHandler:function(t,e,i,s){var r=t.split("."),n=r[0];if(this.sys.hasGameObjectMananger(n))e.goType=n,e.id=null;else{if(!this.sys.hasGameObject(void 0,n))return console.warn(`CommandExecutor: '${n}' does not exist`),this;e.goType=void 0,e.id=n}this.bindEventSheetManager(i);var a=r[1],o=!1,h=this.sys.getGameObjectManager(e.goType,e.id);if(h){var l=h.commands[a];if(l){var u=h.getGO(e.id);Array.isArray(u)||(u=[u]);for(var c=0,d=u.length;c0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,a=1/i.zoom,o=r/2,h=n/2,l=r*a,u=n*a;e.x===o&&e.y===h||e.setPosition(o,h),e.width===l&&e.height===u||e.setSize(l,u)}}}const Wo=Phaser.GameObjects.Zone;let $o=class extends Wo{constructor(t){super(t,0,0,2,2),this.fullWindow=new Yo(this)}};const Vo="BG",Ho="SPRITE",Uo="TEXTBOX",qo="TITLE",Ko="CHOICE",Jo="NAMEINPUT";var Zo=!1,Qo=function(t){Zo||(void 0===t&&(t=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return eh(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return ih(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;ihh(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ehh(t).x,getChildLocalY:t=>hh(t).y};const wh=Phaser.Math.DegToRad;var _h={updateChildRotation(t){var e=hh(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=hh(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return hh(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return hh(t).rotation=wh(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=hh(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>hh(t).rotation},Eh={updateChildScale(t){var e=hh(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=hh(t),i=e.parent;return e.scaleX=kh(t.scaleX,i.scaleX),e.scaleY=kh(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=hh(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=hh(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>hh(t).scaleX,getChildLocalScaleY:t=>hh(t).scaleY},Th={updateChildVisible(t){var e=hh(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=hh(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),hh(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),hh(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=hh(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>hh(t).visible},Oh={updateChildAlpha(t){var e=hh(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=hh(t),i=e.parent;return e.alpha=kh(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return hh(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=hh(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>hh(t).alpha},Ph={updateChildActive(t){var e=hh(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return hh(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),hh(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=hh(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>hh(t).active},Mh={updateChildScrollFactor(t){var e=hh(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},Dh={updateCameraFilter(t){var e=hh(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},Ah={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(t){void 0===t&&(t=!1);var e=this;return this._mask=null,this.setChildMaskVisible(this),this.children.forEach((function(t){t.clearMask&&t.clearMask(!1),t.hasOwnProperty("isRexContainerLite")||e.setChildMaskVisible(t)})),t&&this.mask&&this.mask.destroy(),this}},Lh=function(t){return t.filter((function(t){return!!t.displayList||(!!t.parentContainer||void 0)}))},Rh={setDepth(t,e){if(this.depth=t,!e&&this.children)for(var i=this.getAllChildren(),s=0,r=i.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},Fh=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const Ih=Phaser.Utils.Array;var jh={getChildren(t){if(t)for(var e=0,i=this.children.length;e0?u.pop().setTexture(d,T):r(c,d,T),h&&c.add.existing(E),l){var O=b+k*_+a*k,P=x+S*w+o*S;E.setOrigin(a,o).setPosition(O,P).setScale(f,v).setRotation(m),Rl(E,b,x,m)}C.push(E)}return C}(t,e,i,s),a=0,o=n.length;a0&&(a=this.getChildLocalScaleX(s),a/=s.biasScale,this.setChildLocalScale(s,a)),r.biasScale&&(a=this.getChildLocalScaleX(r),a/=r.biasScale,this.setChildLocalScale(r,a));if(e?t.call(e,i,s,r,n):t(i,s,r,n),this.scaleMode)s.biasScale>0&&(a=this.getChildLocalScaleX(s),a*=s.biasScale,this.setChildLocalScale(s,a)),r.biasScale&&(a=this.getChildLocalScaleX(r),a*=r.biasScale,this.setChildLocalScale(r,a))}};Object.assign(Wl.prototype,Il);const Vl={fit:1,FIT:1,envelop:2,ENVELOP:2};const Hl=Phaser.GameObjects.GetCalcMatrix;const Ul=Phaser.Renderer.Canvas.SetTransform;var ql={renderWebGL:function(t,e,i,s){e.updateData(),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Hl(e,i,s),a=r.calcMatrix.copyFrom(n.calc),o=e._displayOriginX,h=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e);for(var u,c=e.geom,d=0,p=c.length;d>>16,o=(65280&r)>>>8,h=255&r;t.fillStyle="rgba("+a+","+o+","+h+","+n+")"},ou=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,a=(16711680&r)>>>16,o=(65280&r)>>>8,h=255&r;t.strokeStyle="rgba("+a+","+o+","+h+","+n+")",t.lineWidth=e.lineWidth};const hu=Phaser.Geom.Polygon.Earcut;class lu extends eu{constructor(){super(),this.pathData=[],this.pathIndexes=[],this.closePath=!1}updateData(){return this.pathIndexes=hu(this.pathData),super.updateData(),this}webglRender(t,e,i,s,r){this.isFilled&&su(t,e,this,i,s,r),this.isStroked&&nu(t,this,i,s,r)}canvasRender(t,e,i){var s=this.pathData,r=s.length-1,n=s[0]-e,a=s[1]-i;t.beginPath(),t.moveTo(n,a),this.closePath||(r-=2);for(var o=2;o=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const cu=Phaser.Math.DegToRad;var du=function(t,e,i,s,r,n,a,o,h){a&&n>r?n-=360:!a&&n0,a=0,o=e.length;a0;this.dirty=this.dirty||this._radiusTL!==t||this._convexTL!==e,this._convexTL=e,this._radiusTL=Math.abs(t)}get radiusTR(){return this._radiusTR}set radiusTR(t){var e=t>0;this.dirty=this.dirty||this._radiusTR!==t||this._convexTR!==e,this._convexTR=e,this._radiusTR=Math.abs(t)}get radiusBL(){return this._radiusBL}set radiusBL(t){var e=t>0;this.dirty=this.dirty||this._radiusBL!==t||this._convexBL!==e,this._convexBL=e,this._radiusBL=Math.abs(t)}get radiusBR(){return this._radiusBR}set radiusBR(t){var e=t>0;this.dirty=this.dirty||this._radiusBR!==t||this._convexBR!==e,this._convexBR=e,this._radiusBR=Math.abs(t)}get radius(){return Math.max(this.radiusTL,this.radiusTR,this.radiusBL,this.radiusBR)}set radius(t){"number"==typeof t?(this.radiusTL=t,this.radiusTR=t,this.radiusBL=t,this.radiusBR=t):(this.radiusTL=Nu(t,"tl",0),this.radiusTR=Nu(t,"tr",0),this.radiusBL=Nu(t,"bl",0),this.radiusBR=Nu(t,"br",0))}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}get iterations(){return this._iterations}set iterations(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t}setIterations(t){return this.iterations=t,this}updateData(){var t=this.pathData;t.length=0;var e,i=this.width,s=this.height,r=this.iterations+1;(e=this.radiusTL)>0?this._convexTL?du(e,e,e,e,180,270,!1,r,t):du(0,0,e,e,90,0,!0,r,t):uu(0,0,t);(e=this.radiusTR)>0?this._convexTR?du(i-e,e,e,e,270,360,!1,r,t):du(i,0,e,e,180,90,!0,r,t):uu(i,0,t);(e=this.radiusBR)>0?this._convexBR?du(i-e,s-e,e,e,0,90,!1,r,t):du(i,s,e,e,270,180,!0,r,t):uu(i,s,t);(e=this.radiusBL)>0?this._convexBL?du(e,s-e,e,e,90,180,!1,r,t):du(0,s,e,e,360,270,!0,r,t):uu(0,s,t);return t.push(t[0],t[1]),Su(this.x,this.y,t),super.updateData(),this}},triangle:class extends eu{constructor(t,e,i,s,r,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=0),super(),this.pathData=[],this.closePath=!0,this.setP0(t,e),this.setP1(i,s),this.setP2(r,n)}get x0(){return this._x0}set x0(t){this.dirty=this.dirty||this._x0!==t,this._x0=t}get y0(){return this._y0}set y0(t){this.dirty=this.dirty||this._y0!==t,this._y0=t}setP0(t,e){return this.x0=t,this.y0=e,this}get x1(){return this._x1}set x1(t){this.dirty=this.dirty||this._x1!==t,this._x1=t}get y1(){return this._y1}set y1(t){this.dirty=this.dirty||this._y1!==t,this._y1=t}setP1(t,e){return this.x1=t,this.y1=e,this}get x2(){return this._x2}set x2(t){this.dirty=this.dirty||this._x2!==t,this._x2=t}get y2(){return this._y2}set y2(t){this.dirty=this.dirty||this._y2!==t,this._y2=t}setP2(t,e){return this.dirty=this.dirty||this.x2!==t||this.y2!==e,this.x2=t,this.y2=e,this}updateData(){return this.pathData.length=0,this.pathData.push(this.x0,this.y0),this.pathData.push(this.x1,this.y1),this.pathData.push(this.x2,this.y2),this.pathData.push(this.x0,this.y0),super.updateData(),this}webglRender(t,e,i,s,r){if(this.isFilled){var n=Gu(this.fillColor,this.fillAlpha*i),a=this.x0-s,o=this.y0-r,h=this.x1-s,l=this.y1-r,u=this.x2-s,c=this.y2-r,d=e.getX(a,o),p=e.getY(a,o),g=e.getX(h,l),f=e.getY(h,l),v=e.getX(u,c),m=e.getY(u,c);t.batchTri(d,p,g,f,v,m,n,n,n)}this.isStroked&&nu(t,this,i,s,r)}canvasRender(t,e,i){var s=this.x1-e,r=this.y1-i,n=this.x2-e,a=this.y2-i,o=this.x3-e,h=this.y3-i;t.beginPath(),t.moveTo(s,r),t.lineTo(n,a),t.lineTo(o,h),t.closePath(),this.isFilled&&(au(t,this),t.fill()),this.isStroked&&(ou(t,this),t.stroke())}}},Yu=Phaser.Utils.Objects.GetValue,Wu=Phaser.Utils.Objects.IsPlainObject,$u=function(){for(var t=this.getShapes(),e=0,i=t.length;e=0;s--)(a=r[s])instanceof e&&(a.destroy(),mc(r,s));else{s=0;for(var r,n=(r=t.postPipelines).length;s0}(e,fc),delete e.effect}})},function(t){t.addTransitionMode("revealRight",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(yc,0,0)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}}).addTransitionMode("revealLeft",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(yc,1,0)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}}).addTransitionMode("revealDown",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(yc,0,1)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}}).addTransitionMode("revealUp",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(yc,1,1)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}})}];class xc extends Wl{constructor(t,e,i,s,r,n){super(t,e,i,s,r,n);for(var a=0,o=bc.length;a0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n")}return i},Wc=function(t){return null==t?t="":Array.isArray(t)?t=t.join("\n"):"number"==typeof t&&(t=t.toString()),t},$c={clearText(){return this.sections.length=0,this.pageStartIndexes.length=0,this.lines.length=0,this},appendPage(t){var e=this.totalLinesCount;this.sections.push(Wc(t));t=this.sections.join("\n");this.lines=Yc(this.parent,t,this.lines);var i,s=this.totalLinesCount-e;i=this.pageLinesCount>0?Math.ceil(s/this.pageLinesCount):1;for(var r=0;r0?t+i:this.totalLinesCount}var s;switch(e>this.totalLinesCount&&(e=this.totalLinesCount),this.textObjectType){case 0:case 2:s=this.lines.slice(t,e).join("\n");break;case 1:var r=this.lines.getLineStartIndex(t),n=this.lines.getLineEndIndex(e-1);((s=this.lines.getSliceTagText(r,n,!0)).match(/\n/g)||[]).length>e-t-1&&(s=s.substring(0,s.length-1))}return s}};Object.assign(Kc,$c,Hc,qc);const Jc=Phaser.Utils.Objects.GetValue;Phaser.Math.Clamp;class Zc extends In{constructor(t,e){super(t,{eventEmitter:!1}),this.textObjectType=Xc(this.parent),this.pageStartIndexes=[],this.lines=Yc(this.parent,""),this.sections=[],this.resetFromJSON(e)}resetFromJSON(t){this.setMaxLines(Jc(t,"maxLines",void 0)),this.setPageBreak(Jc(t,"pageBreak","\f\n")),this.setText(Jc(t,"text","")),this.startLineIndex=Jc(t,"start",-1),this.endLineIndex=Jc(t,"end",void 0);var e=Jc(t,"page");return void 0===e?this.resetIndex():this.setPageIndex(e),this}toJSON(){return{maxLines:this.maxLines,text:this.content,start:this.startLineIndex,end:this.endLineIndex,page:this.pageIndex,pageBreak:this.pageBreak}}shutdown(t){if(!this.isShutdown){switch(this.textObjectType){case 0:case 2:this.lines.length=0;break;case 1:this.lines.destroy()}this.pageStartIndexes.length=0,this.sections.length=0,this.lines=void 0,this.pageStartIndexes=void 0,this.sections=void 0,super.shutdown(t)}}setMaxLines(t){return this.maxLines=t,this}setPageBreak(t){return this.pageBreak=t,this}get pageCount(){return this.pageStartIndexes.length}get lastPageIndex(){return this.pageCount-1}get isFirstPage(){return this.pageIndex<=0}get isLastPage(){return this.pageIndex>=this.pageCount-1}get totalLinesCount(){return this.lines?this.lines.length:0}get pageLinesCount(){if(void 0!==this.maxLines)return this.maxLines;var t;switch(this.textObjectType){case 0:case 1:var e=this.parent.style.maxLines;t=e>0?e:Math.floor(function(t){var e,i,s;switch(Xc(t)){case 0:case 1:e=t.height-t.padding.top-t.padding.bottom,i=t.lineSpacing,s=t.style.metrics.fontSize+t.style.strokeThickness;break;case 2:e=t.height,i=0;var r=t.fontSize/t.fontData.size;s=t.fontData.lineHeight*r}return(e-i)/(s+i)}(this.parent));break;case 2:t=this.totalLinesCount}return t}get isFirstLine(){return this.startLineIndex<=0}get isLastLine(){return this.endLineIndex===this.totalLinesCount}get content(){return this.sections.join(this.pageBreak)}}Object.assign(Zc.prototype,Kc);var Qc={setText(t){this.setTextCallback&&(t=this.setTextCallbackScope?this.setTextCallback.call(this.setTextCallbackScope,t,this.isLastChar,this.insertIndex):this.setTextCallback(t,this.isLastChar,this.insertIndex)),this.textWrapEnable?Uc(this.parent,t):this.parent.setText(t)},appendText(t){var e=this.text.concat(Wc(t));return this.isTyping?this.setTypingContent(e):this.start(e,void 0,this.textLength),this}},td=function(t,e){return t.getPlainText&&(e=t.getPlainText(e)),e},ed=function(t,e){for(var i=void 0,s=0;s0)l=id(n,t,a=(o=i)-u,o);else l="";var c,d=e-u;if(d>0){o=(a=0)+d;this.insertIndex=o,c=id(n,t,a,o)}else c="",this.insertIndex=0;r=c+l}return this.insertChar=r.charAt(this.insertIndex-1),r},rd={start:function(t,e,i,s){return void 0!==t&&this.setTypingContent(t),void 0!==e&&(this.speed=e),void 0===i&&(i=0),this.typingIndex=i+1,0===this.speed?this.stop(!0):(this.setText(""),this.startTimer(s)),this},startFromLine:function(t,e,i,s,r){var n;if(e>0){void 0===s&&(s=0);var a=td(this.parent,t);n=ed(a,e)+s}return this.start(t,i,n,r)},stop:function(t){if(this.getTimer()&&this.freeTimer(),t){for(;!this.isLastChar;)sd.call(this,this.text,this.typingIndex,this.textLength,this.typeMode),this.emit("typechar",this.insertChar),this.typingIndex++;this.setText(this.text),this.emit("type"),this.emit("complete",this,this.parent)}return this},pause:function(){var t=this.getTimer();return t&&(t.paused=!0),this},resumeTyping:function(){var t=this.getTimer();return t&&(t.paused=!1),this}};Object.assign(rd,Qc);const nd=Phaser.Utils.Objects.GetFastValue,ad=Phaser.Utils.Objects.GetValue;class od extends In{constructor(t,e){super(t,e),this.timer=null,this.resetFromJSON(e)}resetFromJSON(t){this.setTextWrapEnable(ad(t,"wrap",!1)),this.setTypeMode(ad(t,"typeMode",0)),this.setTypingSpeed(ad(t,"speed",333)),this.setTextCallback=nd(t,"setTextCallback",null),this.setTextCallbackScope=nd(t,"setTextCallbackScope",null),this.setTypingContent(nd(t,"text","")),this.typingIndex=nd(t,"typingIndex",0),this.insertIndex=null,this.insertChar=null;var e=nd(t,"elapsed",null);return null!==e&&this.start(void 0,void 0,this.typingIndex,e),this}shutdown(t){this.isShutdown||(this.freeTimer(),super.shutdown(t))}setTypeMode(t){return"string"==typeof t&&(t=hd[t]),this.typeMode=t,this}setTypeSpeed(t){return this.speed=t,this}setTypingSpeed(t){return this.speed=t,this}setTextWrapEnable(t){return void 0===t&&(t=!0),this.textWrapEnable=t,this}set text(t){var e=Wc(t);this.textWrapEnable&&(e=function(t,e){switch(Xc(t)){case 0:t.style.syncFont(t.canvas,t.context),e=t.runWordWrap(e);break;case 1:e=t.getText(e,void 0,void 0,!0);break;case 2:e=t.setText(e).getTextBounds().wrappedText}return e}(this.parent,e)),this._text=e}get text(){return this._text}get isTyping(){return null!==this.getTimer()}get isLastChar(){return this.typingIndex===this.textLength}setTypingContent(t){return this.text=t,this.textLength=td(this.parent,this.text).length,this}onTyping(){var t=sd.call(this,this.text,this.typingIndex,this.textLength,this.typeMode);this.setText(t),this.emit("typechar",this.insertChar),this.emit("type"),this.isLastChar?(this.freeTimer(),this.scene.sys.events.once("preupdate",(function(){this.emit("complete",this,this.parent)}),this)):(this.timer.delay=this.speed,this.typingIndex++)}startTimer(t){var e;return this.timer&&this.freeTimer(),void 0===t?e=0:(this.speed,e=t),this.timer=this.scene.time.addEvent({delay:1e-4,startAt:e,loop:!0,callback:this.onTyping,callbackScope:this}),this}getTimer(){return this.timer}freeTimer(){return this.timer&&(this.timer.remove(),this.timer=null),this}setText(t){this.setTextCallback&&(t=this.setTextCallbackScope?this.setTextCallback.call(this.setTextCallbackScope,t,this.isLastChar,this.insertIndex):this.setTextCallback(t,this.isLastChar,this.insertIndex)),this.textWrapEnable?Uc(this.parent,t):this.parent.setText(t)}}const hd={"left-to-right":0,"right-to-left":1,"middle-to-sides":2,"sides-to-middle":3};Object.assign(od.prototype,rd);const ld=Phaser.Utils.Objects.GetValue;const ud={page:0,line:1};var cd=function(t){return t.hasOwnProperty("rexSizer")||(t.rexSizer={}),t.rexSizer};const dd=Phaser.Display.Align;var pd={center:dd.CENTER,left:dd.LEFT_CENTER,right:dd.RIGHT_CENTER,top:dd.TOP_CENTER,bottom:dd.BOTTOM_CENTER,"left-top":dd.TOP_LEFT,"top-left":dd.TOP_LEFT,"left-center":dd.LEFT_CENTER,"center-left":dd.LEFT_CENTER,"left-bottom":dd.BOTTOM_LEFT,"bottom-left":dd.BOTTOM_LEFT,"center-top":dd.TOP_CENTER,"top-center":dd.TOP_CENTER,"center-center":dd.CENTER,"center-bottom":dd.BOTTOM_CENTER,"bottom-center":dd.BOTTOM_CENTER,"right-top":dd.TOP_RIGHT,"top-right":dd.TOP_RIGHT,"right-center":dd.RIGHT_CENTER,"center-right":dd.RIGHT_CENTER,"right-bottom":dd.BOTTOM_RIGHT,"bottom-right":dd.BOTTOM_RIGHT},gd=function(){},fd=new Phaser.GameObjects.Zone({sys:{queueDepthSort:gd,events:{once:gd}}},0,0,1,1);fd.setOrigin(0);var vd=0,md=1,yd=2,bd=4,xd=6,Cd=8,kd=10,Sd=12,wd=function(t){var e=jr(t);return t.y+e-e*t.originY},_d=function(t){var e=Ir(t);return t.x-e*t.originX+.5*e},Ed=function(t,e){var i=jr(t);return t.y=e-i+i*t.originY,t},Td=function(t,e){var i=Ir(t),s=i*t.originX;return t.x=e+s-.5*i,t},Od=function(t){var e=Ir(t);return t.x-e*t.originX},Pd=function(t,e){var i=Ir(t);return t.x=e+i*t.originX,t},Md=function(t){var e=Ir(t);return t.x+e-e*t.originX},Dd=function(t,e){var i=Ir(t);return t.x=e-i+i*t.originX,t},Ad=function(t,e){var i=jr(t),s=i*t.originY;return t.y=e+s-.5*i,t},Ld=function(t){var e=jr(t);return t.y-e*t.originY+.5*e},Rd=function(t){var e=jr(t);return t.y-e*t.originY},Fd=function(t,e){var i=jr(t);return t.y=e+i*t.originY,t},Bd=[];Bd[11]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Td(t,_d(e)+i),Ed(t,wd(e)+s),t},Bd[kd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Pd(t,Od(e)-i),Ed(t,wd(e)+s),t},Bd[Sd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Dd(t,Md(e)+i),Ed(t,wd(e)+s),t},Bd[xd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),function(t,e,i){Td(t,e),Ad(t,i)}(t,_d(e)+i,Ld(e)+s),t},Bd[bd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Pd(t,Od(e)-i),Ad(t,Ld(e)+s),t},Bd[Cd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Dd(t,Md(e)+i),Ad(t,Ld(e)+s),t},Bd[md]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Td(t,_d(e)+i),Fd(t,Rd(e)-s),t},Bd[vd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Pd(t,Od(e)-i),Fd(t,Rd(e)-s),t},Bd[yd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Dd(t,Md(e)+i),Fd(t,Rd(e)-s),t};var Id=function(t,e,i,s,r){return Bd[i](t,e,s,r)},jd=function(t,e,i,s,r,n){fd.setPosition(e,i).setSize(s,r),Id(t,fd,n)};const zd=Phaser.Utils.Objects.GetValue,Nd=Phaser.GameObjects.Group,Gd=Phaser.GameObjects.Container;var Xd=function(t,e,i){return t.add.text(0,0,"")},Yd=function(t,e){Array.isArray(t)||(t=[t]),void 0===e&&(e=[]);for(var i=0,s=t.length;i=0;e--)this.remove(this.backgroundChildren[e],t);return this}},sp=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const rp=/(\S+)\[(\d+)\]/i;const np=Phaser.Utils.Objects.GetValue;var ap=function(t,e){return void 0===e?t:t[e]},op=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=np(e,"left",0),t.right=np(e,"right",0),t.top=np(e,"top",0),t.bottom=np(e,"bottom",0)),t},hp={getInnerPadding(t){return ap(this.space,t)},setInnerPadding(t,e){return op(this.space,t,e),this},getOuterPadding(t){return ap(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return op(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),ap(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),op(this.getSizerConfig(t).padding,e,i),this}},lp=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},up=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},cp=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},dp=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},pp=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},gp=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},fp={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},vp=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var Sg={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=An(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},wg={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=gd),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=gd),this.transitOutCallback=t,this}},_g={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Eg={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Tg={};Object.assign(Tg,Sg,wg,_g,Eg);const Og=Phaser.Utils.Objects.GetValue;class Pg extends In{constructor(t,e){super(t,e),this.setTransitInTime(Og(e,"duration.in",200)),this.setTransitOutTime(Og(e,"duration.out",200)),this.setTransitInCallback(Og(e,"transitIn")),this.setTransitOutCallback(Og(e,"transitOut")),this.oneShotMode=Og(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new kg(this,{eventEmitter:!1,initState:Og(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Pg.prototype,Tg);const Mg=Phaser.GameObjects.Rectangle;class Dg extends Mg{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Yo(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Ag=Phaser.Utils.Objects.GetValue;class Lg extends In{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Ag(t,"hitAreaMode",0)),this.setEnable(Ag(t,"enable",!0)),this.setStopMode(Ag(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Rg[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Rg={default:0,fullWindow:1};const Fg=Phaser.Utils.Objects.GetValue;class Bg extends Dg{constructor(t,e){super(t,Fg(e,"color",0),Fg(e,"alpha",.8)),this.touchEventStop=new Lg(this,{hitAreaMode:1})}}var Ig={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Dp(t,e)},scaleDown(t,e){Ap(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Wp(t,e)},fadeOut(t,e){$p(t,e,!1)}},jg=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Wp(t,e,t.alpha)},zg=function(t,e){$p(t,e,!1)},Ng=function(t,e,i,s,r){return!!t&&(!(s&&!s(t,e,i))&&(!!Yr(t,!0).contains(e,i)&&!(r&&!r(t,e,i))))};const Gg=Phaser.Utils.Objects.GetValue;let Xg=class extends Pg{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Yg.popUp),null==e.transitOut&&(e.transitOut=Yg.scaleDown),e.destroy=Gg(e,"destroy",!0),super(t,e);var i=Gg(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Bg(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Gg(i,"transitIn",jg)),this.setCoverTransitOutCallback(Gg(i,"transitOut",zg)));var s=Gg(e,"touchOutsideClose",!1),r=Gg(e,"duration.hold",-1),n=Gg(e,"timeOutClose",r>=0),a=Gg(e,"anyTouchClose",!1);Gg(e,"manualClose",!1)&&(s=!1,a=!1,n=!1),a&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),a?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Gg(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Ng(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=Yg[t]),t){case Yg.popUp:t=Ig.popUp;break;case Yg.fadeIn:t=Ig.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Yg[t]),t){case Yg.scaleDown:t=Ig.scaleDown;break;case Yg.fadeOut:t=Ig.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Yg={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Wg=function(t){return t&&"function"==typeof t},$g={modal(t,e){return Wg(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new Xg(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},Vg=function(t,e,i,s,r){Wg(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},Hg={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),vo(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return Vg.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return Vg.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return Vg.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return Vg.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return Vg.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return Vg.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return Vg.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return Vg.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return Vg.call(this,"shutdown",t,e,i,s),this}},Ug=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=qg),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},qg={},Kg=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,a=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return a?Ng(t,e.x,e.y,i,s):!!(r=Ug(e,n,!0))&&Ng(t,r.x,r.y,i,s);for(var o=t.scene.input.manager,h=o.pointersTotal,l=o.pointers,u=0;u=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const lf={press:0,pointerdown:0,release:1,pointerup:1};var uf={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new hf(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},cf=function(t,e,i,s,r){if(e)return!(i&&!i(t,e))&&(!!df(t,e)&&!(s&&!s(t,e)));void 0===r&&(r=!1);for(var n=t.scene.input.manager,a=n.pointersTotal,o=n.pointers,h=0;h0)return pf.length=0,!0;return pf.length=0,!1},pf=[];const gf=Phaser.Utils.Objects.GetValue;class ff extends In{constructor(t,e){super(t,e),this._enable=void 0;var i=gf(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(gf(t,"enable",!0)),this.setMode(gf(t,"mode",1)),this.setClickInterval(gf(t,"clickInterval",100)),this.setDragThreshold(gf(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=vf[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?cf:Kg)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const vf={press:0,pointerdown:0,release:1,pointerup:1};var mf={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new ff(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class yf extends Cg{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const bf=Phaser.Utils.Objects.GetValue;class xf extends In{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new yf,this.parent.setInteractive(bf(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(bf(t,"enable",!0)),this.setCooldown(bf(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Cf={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&Kg(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new xf(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new xf(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},kf={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Sf=function(t,e,i,s){if("parent"===t){for(var r,n=0,a=e.length;n0),this.onDragStart()))}onPointerUp(t){this.enable&&((!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=zf,this.onDragEnd()))}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Nf&&this.onDragEnd(),this.pointer=void 0,this.tracerState=zf,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Gf,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&Kg(t,s,e,i)}}const zf=0,Nf=1,Gf="IDLE",Xf=Phaser.Utils.Objects.GetValue,Yf=Phaser.Math.Distance.Between;class Wf extends jf{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=$f},eventEmitter:!1};this.setRecongizedStateObject(new Cg(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Xf(t,"time",250)),this.setTapInterval(Xf(t,"tapInterval",200)),this.setDragThreshold(Xf(t,"threshold",9)),this.setTapOffset(Xf(t,"tapOffset",10));var e=Xf(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Xf(t,"maxTaps",void 0)),this.setMinTaps(Xf(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case $f:this.state=Vf;break;case Vf:var t=this.lastPointer;Yf(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=Hf,this.state=Vf);break;case Hf:this.state=Vf}}onDragEnd(){this.state===Vf&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=Hf))}onDrag(){this.state!==$f&&this.pointer.getDistance()>this.dragThreshold&&(this.state=$f)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Vf){var i=this.lastPointer;if(i.isDown)t-i.downTime>this.holdTime&&(this.state=$f);else t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=Hf:this.state=$f)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Hf&&(this.state=$f)}get isTapped(){return this.state===Hf}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const $f="IDLE",Vf="BEGIN",Hf="RECOGNIZED",Uf=Phaser.Utils.Objects.GetValue;class qf extends jf{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=Kf},eventEmitter:!1};this.setRecongizedStateObject(new Cg(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Uf(t,"threshold",9)),this.setHoldTime(Uf(t,"time",251)),this}onDragStart(){this.state=Jf,0===this.holdTime&&(this.state=Zf)}onDragEnd(){this.state=Kf}onDrag(){this.state!==Kf&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Kf)}preUpdate(t,e){this.isRunning&&this.enable&&(this.state===Jf&&t-this.pointer.downTime>=this.holdTime&&(this.state=Zf))}get isPressed(){return this.state===Zf}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const Kf="IDLE",Jf="BEGIN",Zf="RECOGNIZED";Phaser.Utils.Objects.GetValue;var Qf=function(t){return Fn(t).loop.delta};const tv=Phaser.Math.Distance.Between,ev=Phaser.Math.Angle.Between;var iv={getDt:function(){return Qf(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return tv(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return ev(e.x,e.y,t.x,t.y)}},sv={"up&down":0,"left&right":1,"4dir":2,"8dir":3},rv={};const nv=Phaser.Utils.Objects.GetValue,av=Phaser.Math.RadToDeg;class ov extends jf{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=hv},eventEmitter:!1};this.setRecongizedStateObject(new Cg(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(nv(t,"threshold",10)),this.setVelocityThreshold(nv(t,"velocityThreshold",1e3)),this.setDirectionMode(nv(t,"dir","8dir")),this}onDragStart(){this.state=lv}onDragEnd(){this.state=hv}onDrag(){this.state===lv&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=uv))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===uv&&(this.state=hv)}get isSwiped(){return this.state===uv}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=sv[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=rv),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(av(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(ov.prototype,iv);const hv="IDLE",lv="BEGIN",uv="RECOGNIZED",cv=Phaser.Utils.Objects.GetValue,dv=Phaser.Utils.Array.SpliceOne,pv=Phaser.Math.Distance.Between,gv=Phaser.Math.Angle.Between;class fv{constructor(t,e){var i=An(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(cv(e,"inputConfig",void 0)),this.setEventEmitter(cv(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(cv(t,"enable",!0)),this.bounds=cv(t,"bounds",void 0),this.tracerState=mv,this.pointers.length=0,ho(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,ho(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&(2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t)))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case mv:this.tracerState=yv,this.onDrag1Start();break;case yv:this.tracerState=bv,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],dv(this.pointers,e),this.tracerState){case yv:this.tracerState=mv,this.onDrag1End();break;case bv:this.tracerState=yv,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case yv:this.onDrag1();break;case bv:this.onDrag2()}}}dragCancel(){return this.tracerState===bv&&this.onDrag2End(),this.pointers.length=0,ho(this.movedState),this.tracerState=mv,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==bv)return 0;var t=this.pointers[0],e=this.pointers[1];return pv(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==bv)return 0;var t=this.pointers[0],e=this.pointers[1];return gv(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;vv.x=e.x-i.x,vv.y=e.y-i.y}else vv.x=0,vv.y=0;return vv}get centerX(){if(this.tracerState!==bv)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==bv)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==bv)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==bv)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=xv,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&Kg(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&Kg(t,s,e,i)}}Object.assign(fv.prototype,hr);var vv={};const mv=0,yv=1,bv=2,xv="IDLE";Phaser.Utils.Objects.GetValue;const Cv=Phaser.Math.RotateAround;var kv=function(t,e,i,s){return Cv(t,e,i,s),t.rotation+=s,t},Sv={};const wv=Phaser.Utils.Objects.GetValue,_v=Phaser.Math.Angle.WrapDegrees,Ev=Phaser.Math.Angle.ShortestBetween,Tv=Phaser.Math.RadToDeg,Ov=Phaser.Math.DegToRad;var Pv={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Sv),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,a=r.y,o=this.rotation;if(Array.isArray(t))for(var h=t,l=0,u=h.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=_v(Tv(this.angleBetween));this.angle=Ev(this.prevAngle,t),this.prevAngle=t,this.state=Av}break;case Av:t=_v(Tv(this.angleBetween));this.angle=Ev(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Av}get rotation(){return Ov(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Pv);const Mv="IDLE",Dv="BEGIN",Av="RECOGNIZED",Lv=Phaser.Utils.Objects.GetValue;var Rv=function(t){var e=Lv(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new Wf(this,e),this._tap.on("tap",(function(t,e,s){wf(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),wf(i.eventEmitter,`${i.eventNamePrefix}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Fv=Phaser.Utils.Objects.GetValue;var Bv=function(t){var e=Fv(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new qf(this,e),this._press.on("pressstart",(function(t,e,s){wf(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this).on("pressend",(function(t,e,s){wf(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Iv=Phaser.Utils.Objects.GetValue;var jv=function(t){var e=Iv(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new ov(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";wf(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),wf(i.eventEmitter,`${i.eventNamePrefix}swipe`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const zv=Phaser.Utils.Objects.GetValue;var Nv=function(t,e){return t.setInteractive(),zv(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:zv(e,"targets",[t]),targetMode:zv(e,"targetMode","parent"),eventEmitter:zv(e,"eventEmitter",t),eventNamePrefix:zv(e,"inputEventPrefix","child.")},Ef.call(t,e),Pf.call(t,e),Af.call(t,e),Bf.call(t,e),Rv.call(t,e),Bv.call(t,e),jv.call(t,e),t},Gv={getSizerConfig:function(t){return void 0===t&&(t=this),cd(t)},getChildPrevState:function(t){var e=cd(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=on(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,a,o=t.scene;if("number"==typeof e)i=e;else{i=zd(e,"color"),s=zd(e,"lineWidth");var h=zd(e,"name",!1);h&&(r=zd(h,"createTextCallback",Xd),n=zd(h,"createTextCallbackScope",void 0),"string"==typeof(a=zd(h,"align","left-top"))&&(a=pd[a]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new Nd(o),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}var u,c,d=this.getAllShownChildren([this]);Yd(d,d);for(var p=0,g=d.length;p(h=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(r=h,s=n)}var h;o=i[i.length-1];return r>(h=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(r=h,s=n+1),s};const Kv=Phaser.Utils.Objects.IsPlainObject,Jv=Phaser.Utils.Objects.GetValue,Zv=Phaser.Display.Align.CENTER,Qv={min:0,full:-1};var tm=function(t,e,i,s,r,n,a,o,h,l){var u,c,d,p;Vd.call(this,t);var g=t.isRexSpace,f=typeof e;if(null===e)return this;if("number"===f);else if("string"===f)e=Qv[e];else if(Kv(e)){var v;e=Jv(v=e,"proportion",void 0),i=Jv(v,"align",Zv),s=Jv(v,"padding",0),r=Jv(v,"expand",!1),n=Jv(v,"key",void 0),a=Jv(v,"index",void 0),t.isRexSizer||(o=Jv(v,"minWidth",void 0),h=Jv(v,"minHeight",void 0)),l=Jv(v,"fitRatio",0),u=Jv(v,"offsetX",0),c=Jv(v,"offsetY",0),d=Jv(v,"offsetOriginX",0),p=Jv(v,"offsetOriginY",0)}return"string"==typeof i&&(i=pd[i]),void 0===e&&(e=g?1:0),void 0===i&&(i=Zv),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===o&&(g?o=0:t.isRexSizer||(o=t._minWidth)),void 0===h&&(g?h=0:t.isRexSizer||(h=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Ir(t)/jr(t)),void 0===u&&(u=0),void 0===c&&(c=0),void 0===d&&(d=0),void 0===p&&(p=0),(v=this.getSizerConfig(t)).proportion=e,v.align=i,v.padding=El(s),v.expand=r,v.fitRatio=0===e?l:0,v.alignOffsetX=u,v.alignOffsetY=c,v.alignOffsetOriginX=d,v.alignOffsetOriginY=p,void 0===a||a>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(a,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===o?Ir(t):o:t.minHeight=void 0===h?jr(t):h),r&&(0===this.orientation?t.minHeight=h:t.minWidth=o)),void 0!==n&&this.addChildrenMap(n,t),this},em={add:tm,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),tm.call(this,new Uv(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,o){return Kv(i)&&(i.index=t),tm.call(this,e,i,s,r,n,a,t,o),this},insertAtPosition(t,e,i,s,r,n,a,o,h){var l=qv.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,o,h),this}};const im=sl.prototype.clear;var sm=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),im.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,sm.call(this,t),this}},am={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=pd[e]),this.getSizerConfig(t).align=e,this}},om={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},hm={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},lm={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},um={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,o=this.sizerChildren,h=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,u=0,c=o.length;u0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?h=!0:n=0)):n=0,h||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,a+=n)));else for(u=0,c=o.length;u0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?h=!0:n=0)):n=0,h||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,a+=n)))}return h?void 0:a+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,a=s.padding;i=n-(a.left+a.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,a=s.padding;i=n-(a.top+a.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(bp(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,vp.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,o,h,l,u,c,d=this.sizerChildren,p=this.innerLeft,g=this.innerTop,f=this.innerWidth,v=this.innerHeight,m=p,y=g,b=this.startChildIndex,x=0,C=d.length;x0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=dp.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||up.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&Vv.call(this,t,void 0),cp.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||pp.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&Vv.call(this,void 0,t),gp.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],a=n&&n.isRexSpace;return"center"===t?a||this.insertSpace(r+1):a&&this.remove(n,!0),this}};Object.assign(um,em,nm,am,om,hm,lm);var cm=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},dm={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},pm=function(t){return"string"==typeof t&&(t=dm[t]),t};const gm=Phaser.Utils.Objects.IsPlainObject,fm=Phaser.Utils.Objects.GetValue;class vm extends Yv{constructor(t,e,i,s,r,n,a){gm(e)?(e=fm(a=e,"x",0),i=fm(a,"y",0),s=fm(a,"width",void 0),r=fm(a,"height",void 0),n=fm(a,"orientation",0)):gm(s)?(s=fm(a=s,"width",void 0),r=fm(a,"height",void 0),n=fm(a,"orientation",0)):gm(n)&&(n=fm(a=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,a),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(fm(a,"space.item",0)),this.setStartChildIndex(fm(a,"startChildIndex",0)),this.setRTL(fm(a,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=pm(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=cm.call(this)),this._childrenProportion}}Object.assign(vm.prototype,um);var mm=function(t,e,i){if(t){var s=null==e,r=null==i;return s&&r||(s||(t.displayWidth=e),r||(t.displayHeight=i),s&&(t.scaleX=t.scaleY),r&&(t.scaleY=t.scaleX)),t}},ym=function(t,e){var i;return t||0===t||(t=""),void 0===e&&(e=!0),Array.isArray(t)&&(t=t.join("\n")),(i=e?`${this.text}\n${t}`:`${this.text}${t}`)!=this.text&&this.setText(i),this},bm={appendText:ym,resetDisplayContent:function(t){void 0===t?t={}:"string"==typeof t&&(t={text:t});var e=t.text||"";this.setText(e);var i=this.childrenMap.icon;if(i){t.icon?this.show(i):this.hide(i);var s=t.iconSize;s&&(this.setChildDisplaySize(i,s,s),void 0!==this.iconWidth&&this.setIconSize(s)),!0!==t.icon&&this.setIconTexture(t.icon,t.iconFrame)}var r=this.childrenMap.action;if(r){t.action?this.show(r):this.hide(r);var n=t.actionSize;n&&(this.setChildDisplaySize(r,n,n),void 0!==this.actionWidth&&this.setActionSize(n)),!0!==t.action&&this.setActionTexture(t.action,t.actionFrame)}return this}};class xm extends vm{get text(){var t=this.childrenMap.text;return t?t.text:""}set text(t){var e=this.childrenMap.text;e&&e.setText(t)}setText(t){return this.text=t,this}setIconTexture(t,e){var i=this.childrenMap.icon;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.iconWidth&&void 0!==this.iconHeight&&(mm(i,this.iconWidth,this.iconHeight),this.resetChildScaleState(i)),this):this}setTexture(t,e){return this.setIconTexture(t,e),this}setIconSize(t,e){return void 0===e&&(e=t),this.iconWidth=t,this.iconHeight=e,this}get texture(){var t=this.childrenMap.icon;if(t)return t.texture}get frame(){var t=this.childrenMap.icon;if(t)return t.frame}setActionTexture(t,e){var i=this.childrenMap.action;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.actionWidth&&void 0!==this.actionHeight&&(mm(i,this.actionWidth,this.actionHeight),this.resetChildScaleState(i)),this):this}get actionTexture(){var t=this.childrenMap.action;if(t)return t.texture}get actionFrame(){var t=this.childrenMap.action;if(t)return t.frame}setActionSize(t,e){return void 0===e&&(e=t),this.actionWidth=t,this.actionHeight=e,this}preLayout(){var t=this.childrenMap.icon;t&&void 0!==this.iconWidth&&void 0!==this.iconHeight&&mm(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&mm(e,this.actionWidth,this.actionHeight),super.preLayout()}postLayout(t,e,i){var s=this.childrenMap.iconMask;s&&(s.setPosition(),this.resetChildPositionState(s));var r=this.childrenMap.actionMask;return r&&(r.setPosition(),this.resetChildPositionState(r)),super.postLayout(t,e,i),this}resize(t,e){super.resize(t,e);var i=this.childrenMap.iconMask;i&&i.resize();var s=this.childrenMap.actionMask;return s&&s.resize(),this}}Object.assign(xm.prototype,bm);var Cm=function(t,e,i,s){var r=new Ol(e,i,s);if(t&&!t.isRexSizer){var n=r.createGeometryMask();t.setMask(n),this.once("destroy",(function(){t.setMask(),n.destroy()}))}return this.pin(r),r};const km=Phaser.Utils.Objects.GetValue;const Sm=Phaser.Utils.Objects.GetValue;var wm=/^[\x00-\x7F]+$/,_m=function(t){return wm.test(t)},Em=function(t,e){for(var i=[],s=t.split("\n"),r=e.style,n=r.wordWrapWidth,a=r.hasOwnProperty("wrapMode")?r.wrapMode:3,o=e.context,h=0,l=s.length;h0&&r.push(h.join("")),r},Om=0,Pm=1,Mm=2,Dm=0,Am=1,Lm=2,Rm=/(?:\r\n|\r|\n)/;const Fm={none:Dm,word:Am,char:Lm,character:Lm,mix:3};var Bm=function(t,e){switch(Xc(t)){case 0:switch("string"==typeof e&&(e=Fm[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=Em;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Fm[e]||0),t.style.wrapMode=e}};const Im=Phaser.Renderer.WebGL.Utils;var jm={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,a=r.height,o=Im.getTintAppendFloatAlpha,h=t.pipelines.set(e.pipeline,e),l=h.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),h.batchTexture(e,r.glTexture,n,a,e.x,e.y,n/e.resolution,a/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,a,o(e.tintTopLeft,i.alpha*e._alphaTL),o(e.tintTopRight,i.alpha*e._alphaTR),o(e.tintBottomLeft,i.alpha*e._alphaBL),o(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const zm=Phaser.Display.Color;var Nm={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,a,o,h,l){var u=this.scene.sys.textures.getFrame(t,e);if(!u)return this;var c=u.cutWidth,d=u.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=d),void 0===a&&(a=0),void 0===o&&(o=0),void 0===h&&(h=c),void 0===l&&(l=d);var p=u.cutX+a,g=u.cutY+o;return this.context.drawImage(u.source.image,p,g,h,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new zm);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var a=i;i=a.red,s=a.green,r=a.blue,n=a.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var o=this.context.createImageData(1,1);return o.data[0]=i,o.data[1]=s,o.data[2]=r,o.data[3]=n,this.context.putImageData(o,t,e),this.dirty=!0,this}},Gm=function(t,e,i,s,r,n,a){var o,h=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===a&&(a=e.height);var u=(o=h.exists(i)?h.get(i):h.createCanvas(i,n,a)).getSourceImage();u.width!==n&&(u.width=n),u.height!==a&&(u.height=a);var c=u.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,a),c.drawImage(e,s,r,n,a),l.gl&&o&&l.canvasToTexture(u,o.source[0].glTexture,!0,0)},Xm={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,Gm(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};Qo();const Ym=Phaser.Display.Canvas.CanvasPool,Wm=Phaser.GameObjects.GameObject,$m=Phaser.Utils.String.UUID;class Vm extends Wm{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=Ym.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=$m(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){Ym.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}}const Hm=Phaser.GameObjects.Components;Phaser.Class.mixin(Vm,[Hm.Alpha,Hm.BlendMode,Hm.Crop,Hm.Depth,Hm.Flip,Hm.GetBounds,Hm.Mask,Hm.Origin,Hm.Pipeline,Hm.PostPipeline,Hm.ScrollFactor,Hm.Tint,Hm.Transform,Hm.Visible,jm,Nm,Xm]);let Um=class{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}};Object.assign(Um.prototype,tu);var qm={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const Km=Phaser.Math.RotateAround;var Jm;const Zm=Phaser.Geom.Rectangle;var Qm,ty=function(t){void 0===Qm&&(Qm=new Zm);var e=t.drawTLX,i=t.drawTLY;return Qm.setTo(e,i,t.drawTRX-e,t.drawBLY-i),Qm};const ey=Phaser.Math.RotateAround;var iy,sy=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===iy&&(iy={}),s=iy),s.x=e,s.y=i,0!==t.rotation&&ey(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const ry=Phaser.GameObjects.Components.TransformMatrix;var ny,ay,oy={},hy=function(t,e,i,s,r){var n=sy(e,i,s,!0),a=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=oy);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===ny&&(ny=new ry,ay=new ry),t.parentContainer?t.getWorldTransformMatrix(ny,ay):ny.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),ny.transformPoint(r,n,s),s}(t,n.x,n.y,r);return a},ly=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,a=e.drawCenterY+s;return hy(t,e,n,a,r)},uy={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Jm&&(Jm={}),s=Jm),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&Km(s,0,0,-i.rotation),s}(t,e,this,!0);return ty(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return ly(this.parent,this,t,e,i)}};Object.assign(uy,qm);const cy=Phaser.Math.DegToRad,dy=Phaser.Math.RadToDeg,py=Phaser.Utils.Objects.GetValue;class gy extends Um{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return dy(this._rotation)}set angle(t){this.rotation=cy(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=py(t,"width",void 0),i=py(t,"height",void 0),s=py(t,"scaleX",void 0),r=py(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(gy.prototype,uy);const fy=Phaser.Utils.String.Pad;var vy=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${fy(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},my=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const yy=Phaser.Utils.Objects.GetValue;let by=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=yy(t,"x",0),i=yy(t,"y",0));var s=this.cornerRadius;s.tl=xy(yy(t,"tl",void 0),e,i),s.tr=xy(yy(t,"tr",void 0),e,i),s.bl=xy(yy(t,"bl",void 0),e,i),s.br=xy(yy(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Cy(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Cy(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Cy(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Cy(this.cornerRadius.br,t)}};var xy=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),ky(t),t},Cy=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=yy(e,"x",0),t.y=yy(e,"y",0)),ky(t)},ky=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const Sy=Phaser.Math.DegToRad;var wy=function(t){return!t.hasOwnProperty("convex")||t.convex},_y=function(t){return t.x>0&&t.y>0},Ey=function(t,e,i,s,r,n,a,o,h){if(o&&a>n?a-=360:!o&&a=p?1:s/p,v=r>=g?1:r/g,m=d.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),o=m.tl,_y(o)?(h=o.x*f,l=o.y*v,wy(o)?Ey(t,h,l,h,l,180,270,!1,a):Ey(t,0,0,h,l,90,0,!0,a),u=0,c=l):(t.lineTo(0,0),u=0,c=0),o=m.tr,_y(o)?(h=o.x*f,l=o.y*v,wy(o)?Ey(t,s-h,l,h,l,270,360,!1,a):Ey(t,s,0,h,l,180,90,!0,a)):t.lineTo(s,0),o=m.br,_y(o)?(h=o.x*f,l=o.y*v,wy(o)?Ey(t,s-h,r-l,h,l,0,90,!1,a):Ey(t,s,r,h,l,270,180,!0,a)):t.lineTo(s,r),o=m.bl,_y(o)?(h=o.x*f,l=o.y*v,wy(o)?Ey(t,h,r-l,h,l,90,180,!1,a):Ey(t,0,r,h,l,360,270,!0,a)):t.lineTo(0,r),t.lineTo(u,c),t.closePath(),t.restore()}(e,i,s,r,n,a,d),null!=o){var p;if(null!=u)(p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,o),p.addColorStop(1,u),o=p;e.fillStyle=o,e.fill()}null!=h&&l>0&&(e.strokeStyle=h,e.lineWidth=l,e.stroke())},Oy=function(t,e,i,s,r,n,a,o){if(null!=e||null!=i){var h=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var u=s/2;h=Math.max(1,h-s),l=Math.max(1,l-s),Ty(t.canvas,t.context,u,u,h,l,r,e,i,s,n,a,o)}};const Py=Phaser.Utils.Objects.GetValue;class My extends gy{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(Py(e,"color",null),Py(e,"color2",null),Py(e,"horizontalGradient",!0)),this.setStroke(Py(e,"stroke",null),Py(e,"strokeThickness",2)),this.setCornerRadius(Py(e,"cornerRadius",0),Py(e,"cornerIteration",null))}set color(t){t=vy(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=vy(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=vy(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,my("color2",t,this),my("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,my("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,my("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){Oy(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Dy=Phaser.Utils.Objects.GetValue;class Ay extends gy{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(Dy(e,"color",null),Dy(e,"color2",null),Dy(e,"horizontalGradient",!0)),this.setStroke(Dy(e,"stroke",null),Dy(e,"strokeThickness",2))}set color(t){t=vy(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=vy(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=vy(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,Dy(t,"color2",null),Dy(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Dy(t,"strokeThickness",2))}renderContent(){var t=this.parent.padding,e=t.left,i=t.top,s=this.parent.width-t.left-t.right,r=this.parent.height-t.top-t.bottom,n=this.context;if(null!=this.color){var a,o;if(null!=this.color2)(o=this.horizontalGradient?n.createLinearGradient(0,0,s,0):n.createLinearGradient(0,0,0,r)).addColorStop(0,this.color),o.addColorStop(1,this.color2),a=o;else a=this.color;n.fillStyle=a,n.fillRect(e,i,s,r)}null!=this.stroke&&this.strokeThickness>0&&(n.strokeStyle=this.stroke,n.lineWidth=this.strokeThickness,n.strokeRect(e,i,s,r))}}const Ly=Phaser.Utils.Objects.GetValue;let Ry=class t{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(Ly(t,"bold",!1)),this.setItalic(Ly(t,"italic",!1)),this.setFontSize(Ly(t,"fontSize","16px")),this.setFontFamily(Ly(t,"fontFamily","Courier")),this.setColor(Ly(t,"color","#fff")),this.setStrokeStyle(Ly(t,"stroke",null),Ly(t,"strokeThickness",0)),this.setShadow(Ly(t,"shadowColor",null),Ly(t,"shadowOffsetX",0),Ly(t,"shadowOffsetY",0),Ly(t,"shadowBlur",0)),this.setOffset(Ly(t,"offsetX",0),Ly(t,"offsetY",0)),this.setSpace(Ly(t,"leftSpace",0),Ly(t,"rightSpace",0)),this.setAlign(Ly(t,"align",void 0)),this.setBackgroundColor(Ly(t,"backgroundColor",null)),this.setBackgroundHeight(Ly(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Ly(t,"backgroundBottomY",void 0)),this.setBackgroundLeftX(Ly(t,"backgroundLeftX",0)),this.setBackgroundRightX(Ly(t,"backgroundRightX",0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(my("stroke",t,this),my("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(my("shadowOffsetX",t,this),my("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),t.hasOwnProperty("backgroundLeftX")&&this.setBackgroundLeftX(t.backgroundLeftX),t.hasOwnProperty("backgroundRightX")&&this.setBackgroundRightX(t.backgroundRightX),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new t(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=vy(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=vy(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=vy(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=vy(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setBackgroundLeftX(t){return this.backgroundLeftX=t,this}setBackgroundRightX(t){return this.backgroundRightX=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}};const Fy=Phaser.Utils.Array.Remove;const By=Phaser.Utils.Array.Remove;const Iy="text",jy="image",zy="drawer",Ny="space",Gy="command";var Xy=function(t){return t.type===Iy&&"\n"===t.text},Yy=function(t){return t.type===Iy&&"\f"===t.text},Wy=function(t){return t.type===Iy};class $y extends gy{constructor(t,e,i){super(t,Iy),this.updateTextFlag=!1,this.style=new Ry(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX+e.backgroundLeftX,s=i,r=this.drawTRX+e.backgroundRightX-i+1;if(r>0){var n=e.backgroundBottomY;null==n&&(n=this.drawBLY);var a=e.backgroundHeight;null==a&&(a=n-this.drawTLY);var o=n-a;t.fillRect(s,o,r,a)}}var h=e.hasFill,l=e.hasStroke;(h||l)&&(e.syncFont(t).syncStyle(t),l&&(e.syncShadow(t),t.strokeText(this.text,0,0)),h&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var Vy=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const Hy=Phaser.Display.Canvas.CanvasPool;var Uy=function(t,e,i,s,r,n,a,o){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===o&&(o=!1),o&&(i=Math.round(i),s=Math.round(s));var h=e.getContext("2d",{willReadFrequently:!0});if(a){var l=Hy.create(null,r,n,Phaser.CANVAS,!0),u=l.getContext("2d",{willReadFrequently:!0});u.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),u.globalCompositeOperation="source-in",u.fillStyle=a,u.fillRect(0,0,r,n),h.drawImage(l,0,0,r,n,i,s,r,n),Hy.remove(l)}else h.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)};Phaser.Display.Canvas.CanvasPool;class qy extends gy{constructor(t,e,i){super(t,jy),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){Uy(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class Ky extends gy{constructor(t,e,i,s){super(t,zy),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class Jy extends gy{constructor(t,e){super(t,Ny),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class Zy extends Um{constructor(t,e,i,s,r){super(t,Gy),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}var Qy=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const tb={none:0,word:1,char:2,character:2,mix:3};var eb=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,a=!r&&!n,o=t.length,h=e,l=s.word,u=0,c=!1;h0&&!o){var h=this.fixedHeight-s;if(i>0)n=h/i;else n=(l=nb.call(this)).height,a=l.ascent,i=Math.floor((h-a)/n)}else{var l;n=(l=nb.call(this)).height,a=l.ascent}}else if(this.fixedHeight>0){if(void 0===(i=ob(t,"maxLines"))){h=this.fixedHeight-s;i=Math.floor(h/n)}}else i=ob(t,"maxLines",0);void 0===a&&(a=n);var u=0===i,c=ob(t,"wrapMode");void 0===c&&(c=ob(t,"charWrap",!1)?"char":"word");"string"==typeof c&&(c=tb[c]);var d=ob(t,"wrapWidth",void 0);void 0===d&&(this.fixedWidth>0?d=this.fixedWidth-r:(d=1/0,c=0));for(var p=ob(t,"letterSpacing",0),g=ob(t,"hAlign",0),f=ob(t,"vAlign",0),v=ob(t,"justifyPercentage",.25),m=Qy({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:g,vAlign:f,justifyPercentage:v,ascent:a,lineHeight:n,wrapWidth:d,wrapMode:c}),y=this.children,b=0,x=y.length;b0&&(P.push({children:M,width:D}),A=Math.max(A,D)),m.start+=O.length,m.isLastPage=!L&&m.start===T,m.maxLineWidth=A,m.linesHeight=P.length*n;var N=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,G=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;!function(t,e,i){for(var s,r,n=t.hAlign,a=t.vAlign,o=t.justifyPercentage,h=t.lines,l=0,u=h.length;l0?(a=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=ub(t,"maxLines",void 0))){var a=this.fixedWidth-r;i=Math.floor(a/n)+1}}else i=ub(t,"maxLines",0);var o=0===i,h=ub(t,"fixedCharacterHeight",void 0);if(void 0===h){var l=ub(t,"charPerLine",void 0);if(void 0!==l){var u=this.fixedHeight-s;h=Math.floor(u/l)}}var c=ub(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var d=ub(t,"letterSpacing",0),p=ub(t,"rtl",!0),g=ub(t,"hAlign",p?2:0),f=ub(t,"vAlign",0),v=Qy({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:d,maxLines:i,hAlign:g,vAlign:f,lineWidth:n,fixedCharacterHeight:h,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(O.push({children:P,height:M}),D=Math.max(D,M)),v.start+=T.length,v.isLastPage=v.start===E,v.maxLineHeight=D,v.linesWidth=O.length*n;var I=this.fixedWidth>0?this.fixedWidth:v.linesWidth+r,j=this.fixedHeight>0?this.fixedHeight:v.maxLineHeight+s;!function(t,e,i){var s,r,n=t.hAlign,a=t.vAlign,o=t.rtl,h=t.lines,l=t.lineWidth,u=t.linesWidth;switch(n){case 1:case"center":s=(e-u)/2;break;case 2:case"right":s=e-u;break;default:s=0}o&&(s+=l);for(var c=0,d=h.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,a=i.bottom;return op(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||a!=i.bottom,this},getPadding:function(t){return ap(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),Fy(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return By(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(Iy);return null===i?i=new $y(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),ly(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;ri&&(r=Math.floor(i));for(var n={},a=Wb(t,r,e,i,n),o=0;o<=Gb&&0!==a;o++){if((r+=a)<0){r=0;break}a=Wb(t,r,e,i,n)}return o===Gb&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),$b(t,e,i),t},Yb=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},Wb=function(t,e,i,s,r){var n,a=Yb(t,e,r),o=Yb(t,e+1,r);if(void 0!==s)if(a.height<=s&&o.height>s)n=0;else{if(a.height>s)return-1;n=Math.floor(s-a.height)}if(a.width<=i&&o.width>i)return 0;if(a.width>i)return-1;var h=Math.floor(i-a.width);return void 0===n?h:Math.min(h,n)},$b=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const Vb=Phaser.Utils.Objects.GetValue;var Hb=function(t,e){"number"==typeof e&&(e={minWidth:e});var i=Vb(e,"minWidth",0),s=Vb(e,"minHeight",0),r=Vb(e,"fitHeight",!1);return t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return Xb(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),Xb(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t}),t};const Ub=Phaser.Utils.Objects.GetValue,qb=[function(t){var e=this.scene,i=km(t,"orientation",0);this.setOrientation(i);var s=km(t,"icon",void 0),r=km(t,"iconMask",void 0),n=km(t,"innerBackground",void 0),a=km(t,"title",void 0),o=km(t,"separator",void 0),h=km(t,"text",void 0),l=km(t,"action",void 0),u=km(t,"actionMask",void 0);if(s){var c=km(t,"align.icon","center");m=0===this.orientation?{right:km(t,"space.icon",0),top:km(t,"space.iconTop",0),bottom:km(t,"space.iconBottom",0),left:km(t,"space.iconLeft",0)}:{bottom:km(t,"space.icon",0),left:km(t,"space.iconLeft",0),right:km(t,"space.iconRight",0),top:km(t,"space.iconTop",0)};var d=km(t,"squareFitIcon",!1)?1:0;if(this.add(s,{proportion:0,align:c,padding:m,fitRatio:d}),r&&(r=Cm.call(this,s,s,1)),!d){var p=km(t,"iconSize",void 0);this.setIconSize(km(t,"iconWidth",p),km(t,"iconHeight",p))}}var g=new vm(e,{orientation:1});n&&g.addBackground(n);var f=km(t,"space.separator",0);if(a){c=km(t,"align.title","left");var v=km(t,"expandTitleWidth",!1);y=km(t,"expandTitleHeight",!1)?1:0,b=v,m={bottom:!o&&h?km(t,"space.title",f):0,left:km(t,"space.titleLeft",0),right:km(t,"space.titleRight",0)},g.add(a,{proportion:y,expand:b,align:c,padding:m})}if(o){var m={top:a?f:0,bottom:h?f:0,left:km(t,"space.separatorLeft",0),right:km(t,"space.separatorRight",0)};g.add(o,{expand:!0,padding:m})}if(h){c=km(t,"align.text","left");var y,b,x=km(t,"expandTextWidth",!1);y=km(t,"expandTextHeight",!1)?1:0,b=x,m={left:km(t,"space.textLeft",0),right:km(t,"space.textRight",0)},g.add(h,{proportion:y,expand:b,align:c,padding:m})}m=void 0;if(l&&(m={right:km(t,"space.text",0)}),this.add(g,{proportion:1,padding:m}),l){c=km(t,"align.action","center");m=0===this.orientation?{top:km(t,"space.actionTop",0),bottom:km(t,"space.actionBottom",0),right:km(t,"space.actionRight",0)}:{left:km(t,"space.actionLeft",0),right:km(t,"space.actionRight",0),bottom:km(t,"space.actionBottom",0)};d=km(t,"squareFitAction",!1)?1:0;if(this.add(l,{proportion:0,align:c,padding:m,fitRatio:d}),u&&(u=Cm.call(this,l,l,1)),!d){var C=km(t,"actionSize");this.setActionSize(km(t,"actionWidth",C),km(t,"actionHeight",C))}}this.addChildrenMap("icon",s),this.addChildrenMap("iconMask",r),this.addChildrenMap("innerSizer",g),this.addChildrenMap("innerBackground",n),this.addChildrenMap("title",a),this.addChildrenMap("separator",o),this.addChildrenMap("text",h),this.addChildrenMap("action",l),this.addChildrenMap("actionMask",u)},function(t){this.setOrientation(1),this.setRTL(!1);var e=this.scene,i=Sm(t,"title",void 0),s=Sm(t,"separator",void 0),r=Sm(t,"innerBackground",void 0),n=Sm(t,"icon",void 0),a=Sm(t,"iconMask",void 0),o=Sm(t,"text",void 0),h=Sm(t,"action",void 0),l=Sm(t,"actionMask",void 0);if(i){var u=Sm(t,"align.title","left"),c=Sm(t,"expandTitleWidth",!1);y=Sm(t,"expandTitleHeight",!1)?1:0,b=c,p={bottom:Sm(t,"space.title",0),left:Sm(t,"space.titleLeft",0),right:Sm(t,"space.titleRight",0)},this.add(i,{proportion:y,expand:b,align:u,padding:p})}if(s){var d=Sm(t,"space.separator",0),p={top:i?d:0,bottom:o?d:0,left:Sm(t,"space.separatorLeft",0),right:Sm(t,"space.separatorRight",0)};this.add(s,{proportion:0,expand:!0,padding:p})}var g=Sm(t,"orientation",0),f=new vm(e,{orientation:g,rtl:Sm(t,"rtl",!1),space:{left:Sm(t,"space.innerLeft",0),right:Sm(t,"space.innerRight",0),top:Sm(t,"space.innerTop",0),bottom:Sm(t,"space.innerBottom",0)}});if(r&&f.addBackground(r),this.add(f,{proportion:1,expand:!0}),n){u=Sm(t,"align.icon","center");p=0===f.orientation?{right:Sm(t,"space.icon",0),top:Sm(t,"space.iconTop",0),bottom:Sm(t,"space.iconBottom",0),left:Sm(t,"space.iconLeft",0)}:{bottom:Sm(t,"space.icon",0),left:Sm(t,"space.iconLeft",0),right:Sm(t,"space.iconRight",0),top:Sm(t,"space.iconTop",0)};var v=Sm(t,"squareFitIcon",!1)?1:0;if(f.add(n,{proportion:0,align:u,padding:p,fitRatio:v}),a&&(a=Cm.call(this,n,n,1)),!v){var m=Sm(t,"iconSize",void 0);this.setIconSize(Sm(t,"iconWidth",m),Sm(t,"iconHeight",m))}}if(o){u=Sm(t,"align.text","left");var y,b,x=Sm(t,"space.text",0),C=Sm(t,"expandTextWidth",!1),k=Sm(t,"expandTextHeight",!1);0===f.orientation?(y=C?1:0,h&&(p={right:x}),b=k):(y=k?1:0,h&&(p={bottom:x}),b=C),f.add(o,{proportion:y,expand:b,align:u,padding:p})}if(h){u=Sm(t,"align.action","center");p=0===f.orientation?{top:Sm(t,"space.actionTop",0),bottom:Sm(t,"space.actionBottom",0),right:Sm(t,"space.actionRight",0)}:{left:Sm(t,"space.actionLeft",0),right:Sm(t,"space.actionRight",0),bottom:Sm(t,"space.actionBottom",0)};v=Sm(t,"squareFitAction",!1)?1:0;if(f.add(h,{proportion:0,align:u,padding:p,fitRatio:v}),l&&(l=Cm.call(this,h,h,1)),!v){var S=Sm(t,"actionSize");this.setActionSize(Sm(t,"actionWidth",S),Sm(t,"actionHeight",S))}}this.addChildrenMap("title",i),this.addChildrenMap("separator",s),this.addChildrenMap("innerSizer",f),this.addChildrenMap("innerBackground",r),this.addChildrenMap("icon",n),this.addChildrenMap("iconMask",a),this.addChildrenMap("text",o),this.addChildrenMap("action",h),this.addChildrenMap("actionMask",l)}];class Kb extends xm{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexTitleLabel";var i=Ub(e,"background",void 0);i&&this.addBackground(i);var s=Ub(e,"title",void 0),r=Ub(e,"text",void 0);if(s){var n=Ub(e,"wrapTitle",!1),a=Ub(e,"adjustTitleFontSize",!1);n?(!0===n&&(n="word"),Bm(s,n),e.expandTitleWidth=!0,Nb(s)):a&&(e.expandTextWidth=!0,e.expandTextHeight=!0,Hb(s,{fitHeight:!0}))}if(r){var o=Ub(e,"wrapText",!1),h=Ub(e,"adjustTextFontSize",!1);o?(!0===o&&(o="word"),Bm(r,o),e.expandTextWidth=!0,Nb(r)):h&&(e.expandTextWidth=!0,e.expandTextHeight=!0,Hb(r,{fitHeight:!0}))}var l=Ub(e,"layoutMode",0);(qb[l]||qb[0]).call(this,e),this.addChildrenMap("background",e.background)}get title(){var t=this.childrenMap.title;return t?t.title:""}set title(t){var e=this.childrenMap.title;e&&e.setText(t)}setTitle(t){return this.title=t,this}resetDisplayContent(t){void 0===t?t={}:"string"==typeof t&&(t={text:t}),super.resetDisplayContent(t);var e=this.childrenMap.title;return e&&(void 0===t.title||(t.title?(this.show(e),this.setTitle(t.title)):this.hide(e))),this}}class Jb extends(function(t,e){void 0===e&&(e="rexTextBox");return class extends t{constructor(t,i){super(t,i),this.type=e,this.isRunning=!1,this._isPageEnd=!1;var s=this.childrenMap.text,r=ld(i,"expandTextWidth",!1),n=ld(i,"expandTextHeight",!1);if(r||n){var a=Xc(s);switch(a){case 0:case 1:if(s.resize=function(t,e){var i=r?t:0,a=n?e:0;s.setFixedSize(i,a),i>0&&s.setWordWrapWidth(i)},1===a){var o=s.style;0===o.wrapMode&&(o.wrapMode=1)}}r&&(s._minWidth=0),n&&(s._minHeight=0)}this.setTypingMode(ld(i,"typingMode","page")),this.page=new Zc(s,ld(i,"page",void 0)),this.typing=new od(s,ld(i,"typing",i.type)),this.typing.on("complete",this.onTypingComplete,this).on("type",this.onType,this).on("typechar",this.onTypeChar,this),this.textWidthSave=s.width,this.textHeightSave=s.height}setTypingMode(t){return"string"==typeof t&&(t=ud[t]),this.typingMode=t,this}start(t,e){return void 0!==e&&this.setTypingSpeed(e),this.isRunning=!0,this.page.setText(t),this.emit("start"),0===this.typingMode?this.typeNextPage():this.typeNextLine(),this}more(t,e){if(void 0!==e&&this.setTypingSpeed(e),!this.isRunning){if(this.isRunning=!0,this.page.appendText(t),this.emit("start"),0===this.typingMode){this._isPageEnd=!1;var i=this.page.getPage(),s=this.typing.textLength;this.typing.start(i,void 0,s)}return this}this.page.appendText(t),this.typing.appendText(t)}typeNextPage(){if(!this.isRunning)return this;if(this.isLastPage)this.emit("complete");else{this._isPageEnd=!1;var t=this.page.getNextPage();this.typing.start(t)}return this}typeNextLine(){if(!this.isRunning)return this;if(this.isLastLine)this.isRunning=!1,this.emit("pageend"),this.emit("complete");else{var t,e=this.page.getPageOfNextLine();t=this.isFirstLine?0:this.page.pageLinesCount-1,this.typing.startFromLine(e,t)}}pause(){return this.isRunning?(this.isTyping&&(this.typing.pause(),this.emit("pause")),this):this}resume(){return this.isRunning?(this.isTyping||(this.emit("resume"),this.typing.resume()),this):this}stop(t){return this.isRunning?(this.typing.stop(t),this):this}showLastPage(){return this.isRunning?(this.typing.stop(),0===this.typingMode?this.page.showLastPage():this.page.showLastLine(),this.emit("type"),this.onTypingComplete(),this):this}setTypeSpeed(t){return this.typing.setTypingSpeed(t),this}setTypingSpeed(t){return this.typing.setTypingSpeed(t),this}get isTyping(){return this.typing.isTyping}get isPageEnd(){return this._isPageEnd}get isLastPage(){return this.page.isLastPage}get isFirstPage(){return this.page.isFirstPage}get pageCount(){return this.page.pageCount}get pageIndex(){return this.page.pageIndex}get isLastLine(){return this.page.isLastLine}get isFirstLine(){return this.page.isFirstLine}get lineCound(){return this.page.totalLinesCount}get startLineIndex(){return this.page.startLineIndex}get endLineIndex(){return this.page.endLineIndex}get typingSpeed(){return this.typing.speed}onType(){var t=this.childrenMap.text;this.textWidthSave===t.width&&this.textHeightSave===t.height||(this.textWidthSave=t.width,this.textHeightSave=t.height,this.getTopmostSizer().layout()),this.emit("type")}onTypeChar(t){this.emit("typechar",t)}onTypingComplete(){if(0===this.typingMode){this._isPageEnd=!0;var t=this.isLastPage;this.isRunning=!t,this.emit("pageend"),t&&this.emit("complete")}else this.typeNextLine()}}}(Kb)){constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("layoutMode")||(e.layoutMode=1),super(t,e)}}const Zb=Phaser.GameObjects.GetCalcMatrix;const Qb=Phaser.Renderer.Canvas.SetTransform;var tx={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Zb(e,i,s),a=r.calcMatrix.copyFrom(n.calc),o=e._displayOriginX,h=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&su(r,a,e,l,o,h),e.isStroked&&nu(r,e,l,o,h),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(Qb(t,r,e,i,s)){var n=e._displayOriginX,a=e._displayOriginY,o=e.pathData,h=o.length-1,l=o[0]-n,u=o[1]-a;r.beginPath(),r.moveTo(l,u),e.closePath||(h-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(ix.prototype,tx);var sx=function(t){return t.x>0&&t.y>0};const rx=Phaser.Utils.Objects.IsPlainObject,nx=Phaser.Utils.Objects.GetValue,ax=Phaser.Geom.Polygon.Earcut;class ox extends ix{constructor(t,e,i,s,r,n,a,o){var h,l,u,c;if(rx(e)){var d=e;e=d.x,i=d.y,s=d.width,r=d.height,n=d.radius,a=d.color,o=d.alpha,h=d.strokeColor,l=d.strokeAlpha,u=d.strokeWidth,c=d.shape}void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=s),void 0===n&&(n=0),void 0===c&&(c=0);var p=new by;if(super(t,"rexRoundRectangleShape",p),this.setShapeType(c),0===this.shapeType){var g=nx(n,"radius",n);p.setTo(0,0,s,r,g)}else{g={x:s/2,y:r/2};p.setTo(0,0,s,r,g)}this.setIteration(nx(n,"iteration",void 0)),this.setPosition(e,i),this.setFillStyle(a,o),void 0===u&&(u=2),this.setStrokeStyle(u,h,l),this.updateDisplayOrigin(),this.dirty=!0}updateData(){var t=this.geom,e=this.pathData;e.length=0;var i,s=t.width,r=t.height,n=t.cornerRadius,a=this.iteration+1;if(i=n.tl,sx(i))if(i.convex){var o=i.x,h=i.y;du(o,h,i.x,i.y,180,270,!1,a,e)}else{du(o=0,h=0,i.x,i.y,90,0,!0,a,e)}else uu(0,0,e);if(i=n.tr,sx(i))if(i.convex){o=s-i.x,h=i.y;du(o,h,i.x,i.y,270,360,!1,a,e)}else{du(o=s,h=0,i.x,i.y,180,90,!0,a,e)}else uu(s,0,e);if(i=n.br,sx(i))if(i.convex){o=s-i.x,h=r-i.y;du(o,h,i.x,i.y,0,90,!1,a,e)}else{du(o=s,h=r,i.x,i.y,270,180,!0,a,e)}else uu(s,r,e);if(i=n.bl,sx(i))if(i.convex){o=i.x,h=r-i.y;du(o,h,i.x,i.y,90,180,!1,a,e)}else{du(o=0,h=r,i.x,i.y,360,270,!0,a,e)}else uu(0,r,e);return e.push(e[0],e[1]),this.pathIndexes=ax(e),this}setShapeType(t){return"string"==typeof t&&(t=hx[t]),this.shapeType=t,this}setSize(t,e){return void 0===e&&(e=t),this.geom.width===t&&this.geom.height===e||(this.geom.setSize(t,e),1===this.shapeType&&this.setRadius({x:t/2,y:e/2}),this.updateDisplayOrigin(),this.dirty=!0,super.setSize(t,e)),this}get radius(){return this.geom.radius}set radius(t){this.geom.setRadius(t),this.updateDisplayOrigin(),this.dirty=!0}get radiusTL(){return this.geom.radiusTL}set radiusTL(t){this.geom.radiusTL=t,this.dirty=!0}get radiusTR(){return this.geom.radiusTR}set radiusTR(t){this.geom.radiusTR=t,this.dirty=!0}get radiusBL(){return this.geom.radiusBL}set radiusBL(t){this.geom.radiusBL=t,this.dirty=!0}get radiusBR(){return this.geom.radiusBR}set radiusBR(t){this.geom.radiusBR=t,this.dirty=!0}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setRadiusTL(t){return void 0===t&&(t=0),this.radiusTL=t,this}setRadiusTR(t){return void 0===t&&(t=0),this.radiusTR=t,this}setRadiusBL(t){return void 0===t&&(t=0),this.radiusBL=t,this}setRadiusBR(t){return void 0===t&&(t=0),this.radiusBR=t,this}get cornerRadius(){return this.geom.cornerRadius}set cornerRadius(t){this.radius=t}setCornerRadius(t){return this.setRadius(t)}get iteration(){return this._iteration}set iteration(t){void 0!==this._iteration?this._iteration!==t&&(this._iteration=t,this.dirty=!0):this._iteration=t}setIteration(t){return void 0===t&&(t=6),this.iteration=t,this}}const hx={rectangle:0,circle:1};var lx=function(t,e,i,s){if(void 0===i&&(i="."),void 0===s&&(s={}),!t)return s;if(e in t)return Object.assign(s,t[e]);for(var r in e+=i,t)r.startsWith(e)&&(s[r.replace(e,"")]=t[r]);return s},ux=function(t,e,i){if(void 0===i&&(i={}),Array.isArray(e))for(var s=0,r=e.length;s=0?t.startAt(a+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(a+n,i):t.startAt(a,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(a,i),t.close(),t};const bx=Phaser.Utils.Objects.GetValue,xx=Phaser.Utils.Objects.IsPlainObject;class Cx extends(hc(Zl)){constructor(t,e,i,s,r,n,a,o){xx(e)?(e=(o=e).x,i=o.y,s=o.width,r=o.height,n=o.barColor,a=o.value):xx(s)?(s=(o=s).width,r=o.height,n=o.barColor,a=o.value):xx(n)&&(n=(o=n).barColor,a=o.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===a&&(a=0),super(t,e,i,s,r,o),this.type="rexLineProgress",this.bootProgressBase(o),this.addShape((new ju).setName("trackFill")).addShape((new ju).setName("bar")).addShape((new ju).setName("trackStroke")),this.setTrackColor(bx(o,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(bx(o,"trackStrokeThickness",2),bx(o,"trackStrokeColor",void 0)),this.setSkewX(bx(o,"skewX",0)),this.setRTL(bx(o,"rtl",!1)),this.setValue(a)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var kx={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&yx(s,0,0,e,i,t);var r,n,a=this.getShape("bar");(a.fillStyle(this.barColor),a.isFilled)&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),yx(a,r,0,n,i,t));var o=this.getShape("trackStroke");o.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),o.isStroked&&yx(o,0,0,e,i,t)}};Object.assign(Cx.prototype,kx);class Sx extends Cx{constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("value")||(e.value=0),e.hasOwnProperty("hover.bar")||(e["hover.bar"]=!0),e.hasOwnProperty("easeDuration")||(e.easeDuration=200),e.hasOwnProperty("ease")||(e.ease="Quad"),Z(e,"easeValue.duration",e.easeDuration),Z(e,"easeValue.ease",e.ease),super(t,e),this.type="rexStatesBarRectangleShape",this.barState=!1,e.style=this,e.propertiesMap=wx,this.addStyleManager(e),delete e.style,delete e.propertiesMap}get bar(){return this.barState}set bar(t){t=!!t,this.barState!==t&&(this.barState=t,this.easeValueTo(this.barState?1:0))}}const wx={color:"trackColor",strokeColor:"trackStrokeColor",strokeWidth:"trackStrokeThickness"};Object.assign(Sx.prototype,fx);let _x=class extends In{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Sr(t,e))return t[e];var i=t.parent;return Sr(i,e)?i[e]:void 0}set(t,e,i){return Sr(t,e)?t[e]=i:Sr(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.texture.key}set key(t){this.key!==t&&this.parent.setTexture(t,this.frame)}get frame(){return this.parent.frame.name}set frame(t){this.frame!==t&&this.parent.setFrame(t)}};const Ex=Phaser.GameObjects.NineSlice,Tx=Phaser.Utils.Objects.GetValue;class Ox extends Ex{constructor(t,e){void 0===e&&(e={}),super(t,Tx(e,"x",0),Tx(e,"y",0),Tx(e,"key",null),Tx(e,"frame",null),Tx(e,"width",0),Tx(e,"height",0),Tx(e,"leftWidth",0),Tx(e,"rightWidth",0),Tx(e,"topHeight",0),Tx(e,"bottomHeight",0)),this.type="rexStatesNineSlice";var i=Tx(e,"effects",!0);i&&Or(this,i),this.style=new _x(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Ox.prototype,fx);let Px=class extends In{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Sr(t,e))return t[e];var i=t.parent;return Sr(i,e)?i[e]:void 0}set(t,e,i){return Sr(t,e)?t[e]=i:Sr(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.texture.key}set key(t){this.parent.setTexture(t,this.frame)}get frame(){return this.parent.frame.name}set frame(t){this.parent.setFrame(t)}get scale(){return this.parent.scaleX}set scale(t){this.parent.setScale(t)}};const Mx=Phaser.GameObjects.Image,Dx=Phaser.Utils.Objects.GetValue;class Ax extends Mx{constructor(t,e){void 0===e&&(e={}),super(t,Dx(e,"x",0),Dx(e,"y",0),Dx(e,"key",""),Dx(e,"frame",void 0)),this.type="rexStatesImage";var i=Dx(e,"effects",!0);i&&Or(this,i),this.style=new Px(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Ax.prototype,fx);var Lx=function(t,e,i){return"__BASE"===i?`${t},${e}`:`${i}:${t},${e}`};const Rx=Phaser.Utils.Objects.IsPlainObject,Fx=Phaser.Utils.Objects.GetValue;var Bx=function(t){return"string"==typeof t&&(t=Ix[t]),t};const Ix={scale:0,repeat:1};var jx=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},zx={_beginDraw:gd,_drawImage:gd,_drawTileSprite:gd,_endDraw:gd,setGetFrameNameCallback:function(t){return void 0===t&&(t=Lx),this.getFrameNameCallback=t,this},setBaseTexture:function(t,e,i,s){Array.isArray(e)&&(s=i,i=e,e=void 0),null==e&&(e="__BASE"),"number"==typeof i&&arguments.length>=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=y(i),s=y(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),a=n.width,o=0,h=0,l=i.length;h0?a/o:0,c=n.height,d=0;for(h=0,l=s.length;h0?0:f,x=0;h=0;for(var w=i.length;h0?0:v),v>=1&&f>=1){var _=typeof(m=this.getFrameNameCallback(h,k,e));"string"!==_&&"number"!==_||r.add(m,0,x+n.cutX,C+n.cutY,v,f)}x+=v}C+=f}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,a,o,h=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,u=this.width-h,c=this.height-l,d=u>=0?this.maxFixedPartScaleX:this.width/h,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var g=Math.min(d,p);if(d>g){var f=(d-g)*h;u>=0?u+=f:u=f,d=g}if(p>g){var v=(p-g)*l;c>=0?c+=v:c=v,p=g}}this.columns.scale=d,this.rows.scale=p,e=u>0&&this.columns.stretch>0?u/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,x=this.rows.count;b0&&o>0&&(0===(0===n.stretch&&0===r.stretch||0===this.getStretchMode(C,b)?0:1)?this._drawImage(this.textureKey,s,m,y,a,o):this._drawTileSprite(this.textureKey,s,m,y,a,o)),m+=a;y+=o}this._endDraw()},setStretchMode:function(t){return Rx(t)?(this.stretchMode.edge=Bx(Fx(t,"edge",0)),this.stretchMode.internal=Bx(Fx(t,"internal",0))):(t=Bx(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return jx.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const Nx=Phaser.Utils.Objects.IsPlainObject,Gx=Phaser.Utils.Objects.GetValue;const Xx=Phaser.GameObjects;var Yx=void 0,Wx=function(t,e){if(Yx||(Yx={},Fn(t).events.once("destroy",(function(){for(var t in Yx)Yx[t].destroy();Yx=void 0}))),!Yx.hasOwnProperty(e)){var i=Fn(t).scene.systemScene;(t=new Xx[e](i)).setOrigin(0),Yx[e]=t}return Yx[e]};const $x=Phaser.GameObjects.RenderTexture;class Vx extends(function(t,e){class i extends t{constructor(t,i,s,r,n,a,o,h,l,u){if(Nx(i)?(i=Gx(u=i,"x",0),s=Gx(u,"y",0),r=Gx(u,"width",1),n=Gx(u,"height",1),a=Gx(u,"key",void 0),o=Gx(u,"baseFrame",void 0),h=Gx(u,"columns",void 0),l=Gx(u,"rows",void 0)):Nx(r)?(r=Gx(u=r,"width",1),n=Gx(u,"height",1),a=Gx(u,"key",void 0),o=Gx(u,"baseFrame",void 0),h=Gx(u,"columns",void 0),l=Gx(u,"rows",void 0)):Nx(a)?(a=Gx(u=a,"key",void 0),o=Gx(u,"baseFrame",void 0),h=Gx(u,"columns",void 0),l=Gx(u,"rows",void 0)):Nx(o)?(o=Gx(u=o,"baseFrame",void 0),h=Gx(u,"columns",void 0),l=Gx(u,"rows",void 0)):Array.isArray(o)?(u=l,l=h,h=o,o=Gx(u,"baseFrame",void 0)):Nx(h)&&(h=Gx(u=h,"columns",void 0),l=Gx(u,"rows",void 0)),void 0===o&&(o=Gx(u,"frame",void 0)),void 0===h){var c=Gx(u,"leftWidth",void 0),d=Gx(u,"rightWidth",void 0);void 0!==c&&void 0!==d&&(h=[c,void 0,d])}if(void 0===l){var p=Gx(u,"topHeight",void 0),g=Gx(u,"bottomHeight",void 0);void 0!==p&&void 0!==g&&(l=[p,void 0,g])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(Gx(u,"getFrameNameCallback",void 0)),this.setStretchMode(Gx(u,"stretchMode",0)),this.setPreserveRatio(Gx(u,"preserveRatio",!0));var f=Gx(u,"maxFixedPartScale",1),v=Gx(u,"maxFixedPartScaleX",f),m=Gx(u,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(v,m),this.setBaseTexture(a,o,h,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,zx),i}($x,"rexNinePatch")){}var Hx={_drawImage:function(t,e,i,s,r,n){var a=Wx(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(a,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var a=Wx(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(a,i,s)}};Object.assign(Vx.prototype,Hx);let Ux=class extends In{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Sr(t,e))return t[e];var i=t.parent;return Sr(i,e)?i[e]:void 0}set(t,e,i){return Sr(t,e)?t[e]=i:Sr(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}};const qx=Phaser.Utils.Objects.GetValue;class Kx extends Vx{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=qx(e,"effects",!0);i&&Or(this,i),this.style=new Ux(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Kx.prototype,fx);const Jx=["alpha","tint","flipX","flipY"];var Zx=function(t,e){if(!e)return t;for(var i=0,s=Jx.length;i * @copyright 2018 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */const lC=Phaser.Display.Canvas.CanvasPool;var uC=function(t){var e=lC.create(this),i=e.getContext("2d",{willReadFrequently:!0});t.syncFont(e,i);var s=i.measureText(t.testString);if("actualBoundingBoxAscent"in s){var r=s.actualBoundingBoxAscent,n=s.actualBoundingBoxDescent,a={ascent:r,descent:n,fontSize:r+n};return lC.remove(e),a}var o=Math.ceil(s.width*t.baselineX),h=o,l=2*h;h=h*t.baselineY|0,e.width=o,e.height=l,i.fillStyle="#f00",i.fillRect(0,0,o,l),i.font=t._font,i.textBaseline="alphabetic",i.fillStyle="#000",i.fillText(t.testString,0,h);a={ascent:0,descent:0,fontSize:0};if(!i.getImageData(0,0,o,l))return a.ascent=h,a.descent=h+6,a.fontSize=a.ascent+a.descent,lC.remove(e),a;var u,c,d=i.getImageData(0,0,o,l).data,p=d.length,g=4*o,f=0,v=!1;for(u=0;uh;u--){for(c=0;c0&&this.wrapMode!==Mm&&0===this.wrapWidth}setStyle(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wordWrap")){var s=t.wordWrap;s.hasOwnProperty("width")&&(t.wrap={mode:"word",width:s.width})}if(t&&t.hasOwnProperty("wrap")){var r=t.wrap;if(r.hasOwnProperty("mode")){var n=r.mode;"string"==typeof n&&(r.mode=Rm[n])}else r.hasOwnProperty("width")&&(r.mode=1)}t&&t.rtl&&i&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var a=this.propertyMap;for(var o in a){var h=a[o],l=h[0],u=i?h[1]:this[o],c=h[2];if("wrapCallback"===o||"wrapCallbackScope"===o)this[o]=dC(t,l,u);else{var d=cC(t,l,u);c&&(d=c(d)),this[o]=d}}var p=dC(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var g=dC(t,"fill",null);null!==g&&(this.color=fy(g));var f=dC(t,"metrics",!1);return f?this.metrics={ascent:dC(f,"ascent",0),descent:dC(f,"descent",0),fontSize:dC(f,"fontSize",0)}:!e&&this.metrics||(this.metrics=uC(this)),e?this.parent.updateText():this.parent}syncFont(t,e){e.font=this._font}syncStyle(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"}syncShadow(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)}update(t){return t&&(this._font=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim(),this.metrics=uC(this)),this.parent.updateText(t)}buildFont(){var t=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim();return t!==this._font&&(this._font=t),this}setFont(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=dC(t,"fontFamily","Courier"),this.fontSize=dC(t,"fontSize","16px"),this.fontStyle=dC(t,"fontStyle","")),this.update(!0)}setFontFamily(t){return this.fontFamily=t,this.update(!0)}setFontStyle(t){return this.fontStyle=t,this.update(!0)}setFontSize(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}setTestString(t){return this.testString=t,this.update(!0)}setFixedSize(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}setResolution(t){return this.resolution=t,this.update(!1)}setXOffset(t){return this.xOffset=t,this.update(!1)}setBackgroundColor(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=fy(t,this.parent.canvas,this.parent.context),this.backgroundColor2=fy(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=fy(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}setBackgroundCornerRadius(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}setFill(t){return this.color=fy(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=fy(t,this.parent.canvas,this.parent.context),this.update(!1)}setStroke(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=fy(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}setShadow(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===n&&(n=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=fy(i,this.parent.canvas,this.parent.context),this.shadowBlur=s,this.shadowStroke=r,this.shadowFill=n,this.update(!1)}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}setShadowColor(t){return void 0===t&&(t="#000"),this.shadowColor=fy(t,this.parent.canvas,this.parent.context),this.update(!1)}setShadowBlur(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}setShadowStroke(t){return this.shadowStroke=t,this.update(!1)}setShadowFill(t){return this.shadowFill=t,this.update(!1)}setUnderline(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=fy(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}setUnderlineColor(t){return void 0===t&&(t="#000"),this.underlineColor=fy(t,this.parent.canvas,this.parent.context),this.update(!1)}setUnderlineThickness(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}setUnderlineOffset(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}setStrikethrough(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=fy(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}setStrikethroughColor(t){return void 0===t&&(t="#000"),this.strikethroughColor=fy(t,this.parent.canvas,this.parent.context),this.update(!1)}setStrikethroughThickness(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}setStrikethroughOffset(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}setWrapMode(t){return"string"==typeof t&&(t=Rm[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}setWrapWidth(t){return this.wrapWidth=t,this.update(!1)}setAlign(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}setHAlign(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}setVAlign(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}setMaxLines(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}getTextMetrics(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}setTextMetrics(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=dC(e,"fontFamily",this.fontFamily),this.fontSize=dC(e,"fontSize",this.fontSize),this.fontStyle=dC(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}get lineHeight(){return this.metrics.fontSize+this.parent.lineSpacing}toJSON(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}destroy(){this.parent=void 0}}var gC={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var a=this.defaultStyle;this.clear(),Ty(this,a.backgroundColor,a.backgroundStrokeColor,a.backgroundStrokeLineWidth,a.backgroundCornerRadius,a.backgroundColor2,a.backgroundHorizontalGradient,a.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var o,h,l,u,c,d,p=a.halign,g=a.valign,f=a.lineHeight,v=r.lines,m=v.length,y=a.maxLines;y>0&&m>y?(h=y,l="center"===g?Math.floor((m-h)/2):"bottom"===g?m-h:0):(h=m,l=0),u=l+h;var b=this.rtl,x=b?this.parent.width:void 0;d="center"===g?Math.max((s-h*f)/2,0):"bottom"===g?Math.max(s-h*f-2,0):0,d+=e;for(var C=l;C0){var o=this.defaultStyle.metrics,h=i-o.ascent,l=o.fontSize;this.drawRectangle(e,h,t.width,l,a.bgcolor,a)}if(a.underlineThickness>0&&t.width>0){var u=i+a.underlineOffset-a.underlineThickness/2;this.drawLine(e,u,t.width,a.underlineThickness,a.underlineColor,a)}if(t.isTextPen&&(a.buildFont(),a.syncFont(r,n),a.syncStyle(r,n),this.drawText(e,i,t.text,a)),t.isImagePen&&this.drawImage(e,i,t.prop.img,t.prop.color,a),a.strikethroughThickness>0&&t.width>0){u=i+a.strikethroughOffset-a.strikethroughThickness/2;this.drawLine(e,u,t.width,a.strikethroughThickness,a.strikethroughColor,a)}if(n.restore(),t.hasAreaMarker&&t.width>0){var c,d=t.prop.area;if(d)c={key:d};else{var p=t.prop.url;c={key:`url:${p}`,url:p}}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,c)}},clear(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawRectangle(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;a.fillStyle=r,a.fillRect(t,e,i,s)},drawLine(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;n.syncShadow(a,n.shadowStroke);var o=a.lineCap;a.lineCap="butt",a.strokeStyle=r,a.lineWidth=s,a.beginPath(),a.moveTo(t,e),a.lineTo(t+i,e),a.stroke(),a.lineCap=o},drawText(t,e,i,s){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;s.stroke&&"none"!==s.stroke&&s.strokeThickness>0&&(s.syncShadow(r,s.shadowStroke),r.strokeText(i,t,e)),s.color&&"none"!==s.color&&(s.syncShadow(r,s.shadowFill),r.fillText(i,t,e))},drawImage(t,e,i,s,r){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,s,this.autoRound)}};const fC=Phaser.Utils.Objects.GetValue,vC=Tm,mC=Om;class yC{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=fC(t,"text",""),this.x=fC(t,"x",0),this.y=fC(t,"y",0),this.width=fC(t,"width",0);var e=fC(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=fC(t,"newLineMode",0),this.startIndex=fC(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===mC&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==vC&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===mC&&(t+=1),t}get endIndex(){return this.startIndex+this.rawTextLength}get lastX(){return this.x+this.width}get isTextPen(){return""!==this.text}get isImagePen(){return!!this.prop.img}get hasAreaMarker(){return!!this.prop.area||!!this.prop.url}}const bC=Phaser.Utils.Objects.GetFastValue,xC=Tm,CC=Pm;class kC{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=bC(t,"tagToText",pd),this.tagToTextScope=bC(t,"tagToTextScope",void 0)}destroy(){this.clear(),this.tagToText=void 0,this.tagToTextScope=void 0}clear(){for(var t=0,e=this.lines.length;t=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}getLineEndIndex(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,s=!1;for(e=t;e>=0&&!(s=null!=(i=this.lines[e])&&i.length>0);e--);return s?i[i.length-1].endIndex:0}getLineWidth(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}getMaxLineWidth(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,s=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}getLineWidths(){for(var t=[],e=0,i=this.lines.length;e=t&&h<=e||(a=a.substring(t-o,e-o)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,a,l,u):c+=this.tagToText(a,l,u),u=l,!(h>=e)));d++);return c}get length(){return this.lines.length}set length(t){this.clear()}}var SC={};const wC=Phaser.Geom.Rectangle;var _C=new Da;class EC{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&NC(f)){""!==b?a.push(n.getLine(b,x,LC)):0===C&&r>0&&a.push(n.getLine("",0,LC)),a.push(...jC(f,e,BC,s,0,n));var S=a.pop();b=S.text,x=S.width,n.freeLine(S)," "===b&&(b="",x=0)}else(m=x+v)>h?(a.push(n.getLine(b,x,LC)),b=f,x=v,h=s):(b+=f,x=m),C===k-1&&a.push(n.getLine(b,x,l))}return a},zC=function(t,e){var i;switch(e){case FC:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==XC&&i0&&t>e&&(t=e),t}get linesWidth(){return Math.ceil(this.penManager.getMaxLineWidth())}get linesHeight(){var t=this.displayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}get imageManager(){return this.parent.imageManager}get rtl(){return this.parent.style.rtl}newPenManager(){return new kC({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}get tmpPenManager(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}getPlainText(t,e,i){var s;if(null==t)s=this.penManager.plainText;else{var r=this.parser.splitText(t,1);s="";for(var n=0,a=r.length;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return qk(this.sizerChildren,null),im.call(this,t),this}},Jk={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)qk(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},eS={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,o=this.sizerChildren,h=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=cp.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,qk(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)qk(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},sS=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const rS=Phaser.Utils.Objects.IsPlainObject,nS=Phaser.Utils.Objects.GetValue;class aS extends Xv{constructor(t,e,i,s,r,n,a,o,h,l){rS(e)?(e=nS(l=e,"x",0),i=nS(l,"y",0),s=nS(l,"width",void 0),r=nS(l,"height",void 0),n=nS(l,"column",l.col||0),a=nS(l,"row",0),o=nS(l,"columnProportions",0),h=nS(l,"rowProportions",0)):rS(s)?(s=nS(l=s,"width",void 0),r=nS(l,"height",void 0),n=nS(l,"column",l.col||0),a=nS(l,"row",0),o=nS(l,"columnProportions",0),h=nS(l,"rowProportions",0)):rS(n)?(n=nS(l=n,"column",l.col||0),a=nS(l,"row",0),o=nS(l,"columnProportions",0),h=nS(l,"rowProportions",0)):rS(o)&&(o=nS(l=o,"columnProportions",0),h=nS(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(nS(l,"createCellContainerCallback")),this.setIndentLeft(nS(l,"space.indentLeftOdd",0),nS(l,"space.indentLeftEven",0)),this.setIndentTop(nS(l,"space.indentTopOdd",0),nS(l,"space.indentTopEven",0)),this.resetGrid(n,a,o,h,nS(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=iS.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=sS.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(aS.prototype,eS);const oS=Phaser.Utils.Objects.GetValue;const hS=Phaser.Math.Percent;var lS=function(t,e,i){var s;return t.y===e.y?s=hS(i.x,t.x,e.x):t.x===e.x&&(s=hS(i.y,t.y,e.y)),s},uS=function(t,e,i){var s,r;this.enable&&(cS.x=e,cS.y=i,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint()),this.value=lS(s,r,cS))},cS={},dS=function(t,e,i){if(this.enable&&t.isDown){var s,r;pS.x=t.worldX,pS.y=t.worldY,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint());var n=lS(s,r,pS);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-n)<.1?this.value=n:this.easeValueTo(n)}},pS={},gS=function(t,e){void 0===e&&(e=fS);var i=this.childrenMap.thumb,s=i.x,r=i.y;return Id(i,this.innerLeft,this.innerTop,this.innerWidth,this.innerHeight,t),e.x=i.x,e.y=i.y,i.x=s,i.y=r,e},fS={};const vS=Phaser.Display.Align.LEFT_CENTER,mS=Phaser.Display.Align.TOP_CENTER;var yS={};const bS=Phaser.Display.Align.RIGHT_CENTER,xS=Phaser.Display.Align.BOTTOM_CENTER;var CS={};const kS=Phaser.Math.Linear;var SS={};const wS=Phaser.Display.Align.LEFT_CENTER,_S=Phaser.Display.Align.TOP_CENTER,ES=Phaser.Display.Align.RIGHT_CENTER,TS=Phaser.Display.Align.BOTTOM_CENTER;const OS=Phaser.Utils.Objects.GetValue,PS=Phaser.Utils.Objects.IsPlainObject,MS=Phaser.Math.Clamp,DS=Phaser.Math.Snap.To;class AS extends(oc(fm)){constructor(t,e){super(t,e),this.type="rexSlider",this.bootProgressBase(e),this.reverseAxis=OS(e,"reverseAxis",!1);var i=OS(e,"background",void 0),s=OS(e,"track",void 0),r=OS(e,"indicator",void 0),n=OS(e,"thumb",void 0);if(i&&(PS(i)&&(i=Zx(t,i)),this.addBackground(i)),s&&(PS(s)&&(s=Zx(t,s)),this.add(s,{proportion:1,expand:!0,minWidth:0===this.orientation?0:void 0,minHeight:1===this.orientation?0:void 0})),r&&(PS(r)&&(r=Zx(t,r)),this.pin(r)),n){PS(n)&&(n=Zx(t,n)),this.pin(n);var a=OS(e,"thumbOffsetX",0),o=OS(e,"thumbOffsetY",0);this.setThumbOffset(a,o)}var h=OS(e,"input",0);switch("string"==typeof h&&(h=LS[h]),h){case 0:n&&(n.setInteractive(),this.scene.input.setDraggable(n),n.on("drag",uS,this).on("dragstart",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("dragend",(function(t){this.eventEmitter.emit("inputend",t)}),this));break;case 1:this.on("pointerdown",dS,this).on("pointermove",dS,this).on("pointerdown",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("pointerup",(function(t){this.eventEmitter.emit("inputend",t)}),this).on("pointerover",(function(t){t.isDown&&this.eventEmitter.emit("inputstart",t)}),this).on("pointerout",(function(t){t.isDown&&this.eventEmitter.emit("inputend",t)}),this).setInteractive()}this.addChildrenMap("background",i),this.addChildrenMap("track",s),this.addChildrenMap("indicator",r),this.addChildrenMap("thumb",n),this.setEnable(OS(e,"enable",void 0));var l=OS(e,"tick",void 0);void 0===l&&(l=OS(e,"gap",void 0)),this.setGap(l),this.setValue(OS(e,"value",0),OS(e,"min",void 0),OS(e,"max",void 0))}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setGap(t,e,i){return t&&void 0!==e&&(t/=i-e),this.gap=t,this}setTick(t,e,i){return this.setGap(t,e,i),this}get tick(){return this.gap}set tick(t){this.gap=t}setThumbOffset(t,e){return this.thumbOffsetX=t,this.thumbOffsetY=e,this}get value(){return this._value}set value(t){void 0!==this.gap&&(t=DS(t,this.gap));var e=this._value;this._value=MS(t,0,1),e!==this._value&&(this.updateThumb(this._value),this.updateIndicator(this._value),this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter))}postLayout(t,e,i){return this.updateThumb(),this.updateIndicator(),super.postLayout(t,e,i),this}}const LS={pan:0,drag:0,click:1,none:-1};var RS={getStartPoint:function(t){if(void 0===t&&(t=yS),this.childrenMap.thumb){var e=0===this.orientation?vS:mS;gS.call(this,e,t)}else 0===this.orientation?(t.x=this.innerLeft+1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerTop+1);return t},getEndPoint:function(t){if(void 0===t&&(t=CS),this.childrenMap.thumb){var e=0===this.orientation?bS:xS;gS.call(this,e,t)}else 0===this.orientation?(t.x=this.innerRight-1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerBottom-1);return t},updateThumb:function(t){var e,i,s=this.childrenMap.thumb;return void 0===s||(void 0===t&&(t=this.value),this.reverseAxis?(e=this.getEndPoint(),i=this.getStartPoint()):(e=this.getStartPoint(),i=this.getEndPoint()),function(t,e,i,s){void 0===s&&(s=SS),s.x=kS(e.x,i.x,t),s.y=kS(e.y,i.y,t)}(t,e,i,s),s.x+=this.thumbOffsetX,s.y+=this.thumbOffsetY,this.resetChildPositionState(s)),this},updateIndicator:function(t){var e=this.childrenMap.indicator;if(void 0===e)return this;void 0===t&&(t=this.value);var i,s,r,n=this.reverseAxis,a=this.childrenMap.thumb;if(a)if(0===this.orientation){var o=Ir(a);if(n){h=a.x-o*a.originX;i=this.right-h}else{var h;i=(h=a.x-o*a.originX)+o-this.left}}else{var l=jr(a);if(n){u=a.y-l*a.originY;s=this.bottom-u}else{var u;s=(u=a.y-l*a.originY)+l-this.top}}else 0===this.orientation?i=this.width*t:s=this.height*t;yp(e,i,s),r=n?0===this.orientation?ES:TS:0===this.orientation?wS:_S,Bd(e,this,r),this.resetChildPositionState(e)}};Object.assign(AS.prototype,RS);const FS=Phaser.Utils.Objects.GetValue;class BS extends fm{constructor(t,e){super(t,e),this.type="rexScrollBar";var i,s=FS(e,"background",void 0),r=FS(e,"buttons",void 0),n=FS(r,"top",FS(r,"left",void 0)),a=FS(r,"bottom",FS(r,"right",void 0)),o=FS(e,"slider",void 0);(s&&this.addBackground(s),n)&&(this.add(n),new bf(n).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?this.scrollStep:-this.scrollStep;this.value+=t}}),this));if(o){var h;if(o.orientation=this.orientation,o.eventEmitter=this,o.value=null,0===this.orientation)h=void 0===FS(o,"width",void 0)?1:0;else h=void 0===FS(o,"height",void 0)?1:0;i=new AS(t,o),t.add.existing(i),this.add(i,{proportion:h})}a&&(this.add(a),new bf(a).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?-this.scrollStep:this.scrollStep;this.value+=t}}),this));var l=[n,a];this.addChildrenMap("background",s),this.addChildrenMap("slider",i),this.addChildrenMap("buttons",l);var u=FS(e,"valuechangeCallback",null);if(null!==u){var c=FS(e,"valuechangeCallbackScope",void 0);this.on("valuechange",u,c)}this.setEnable(FS(e,"enable",void 0)),this.setValue(FS(e,"value",0)),this.setScrollStep(FS(r,"step",.01))}setScrollStep(t){return this.scrollStep=t,this}get enable(){return!!this.childrenMap.slider&&this.childrenMap.slider.enable}set enable(t){this.childrenMap.slider&&this.childrenMap.slider.setEnable(t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get value(){return this.childrenMap.slider?this.childrenMap.slider.value:0}set value(t){this.childrenMap.slider&&(this.childrenMap.slider.value=t)}setValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setValue(t,e,i),this}addValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.addValue(t,e,i),this}getValue(t,e){return this.childrenMap.slider?this.childrenMap.slider.getValue(t,e):0}easeValueTo(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.easeValueTo(t,e,i),this}stopEaseValue(){return this.childrenMap.slider&&this.childrenMap.slider.stopEaseValue(),this}setEaseValueDuration(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueDuration(t),this}setEaseValueFunction(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueFunction(t),this}setGap(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setGap(t,e,i),this}get gap(){if(this.childrenMap.slider)return this.childrenMap.slider.gap}set gap(t){this.childrenMap.slider&&(this.childrenMap.slider.gap=t)}setTick(t,e,i){return this.setGap(t,e,i),this}get tick(){if(this.childrenMap.slider)return this.childrenMap.slider.tick}set tick(t){this.childrenMap.slider&&(this.childrenMap.slider.tick=t)}}class IS extends xg{constructor(t,e){super(e),this.parent=t,this.init()}init(){this.start("IDLE")}next_IDLE(){var t,e=this.parent;return e.dragState.isDown&&(t=0===e.dragThreshold?"DRAG":"DRAGBEGIN"),t}update_IDLE(t,e){this.next()}next_DRAGBEGIN(){var t=this.parent,e=t.dragState;return e.isDown?e.pointer.getDistance()>=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const jS=Phaser.Utils.Objects.GetValue,zS=Phaser.Math.Distance.Between;class NS extends In{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=jS(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(jS(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(jS(t,"enable",!0)),this.holdThreshold=jS(t,"holdThreshold",50),this.pointerOutReleaseEnable=jS(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return Zf(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:zS(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!qg(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!qg(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const GS=Phaser.Utils.Objects.GetValue;class XS{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(GS(t,"value",0)),this.setSpeed(GS(t,"speed",0)),this.setAcceleration(GS(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class YS{constructor(){this.value,this.dir,this.movement=new XS}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const HS={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},US=Phaser.Utils.Objects.GetValue;class qS extends In{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=US(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(US(e,"speed",.1)),this.setEnable(US(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(US(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||qg(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const KS=Phaser.Utils.Objects.GetValue;var JS=function(t,e,i,s){var r,n,a="Y"===(i=i.toUpperCase()),o=2===t.scrollMode,h=t.childrenMap.child,l=`slider${i}`;if(r=o||s.hasOwnProperty(l)?KS(s,l,void 0):KS(s,"slider",void 0)){var u,c,d;!0===r&&(r={}),r.orientation=a?1:0,n=function(t,e){void 0===e&&(e={});var i=lo(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new BS(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r),n.tickLength=KS(r,"tickLength",void 0);var p=KS(r,"position",0);"string"==typeof p&&(p=ZS[p]);var g,f,v=KS(s,`space.slider${i}`,void 0);void 0===v&&void 0===(v=KS(s,"space.slider",void 0))&&(o?v=0:g=KS(s,"space.child",0)),f=void 0===g?"number"==typeof v:"number"==typeof g,a?0===p?(u=2,c=1,d=void 0===g?f?{left:v}:v:{left:KS(g,"right",g)}):(u=0,c=1,d=void 0===g?f?{right:v}:v:{right:KS(g,"left",g)}):0===p?(u=1,c=2,d=void 0===g?f?{top:v}:v:{top:KS(g,"bottom",g)}):(u=1,c=0,d=void 0===g?f?{bottom:v}:v:{bottom:KS(g,"top",g)}),e.add(n,{column:u,row:c,align:"center",padding:d,expand:!0}),t[`hideUnscrollableSlider${i}`]=KS(r,"hideUnscrollableSlider",!1),t[`disableUnscrollableDrag${i}`]=KS(r,"disableUnscrollableDrag",!1),t[`adaptThumb${i}SizeMode`]=KS(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=KS(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`disableUnscrollableDrag${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=KS(s,"scrollDetectionMode");"string"==typeof b&&(b=QS[b]);var x=`scroller${i}`;(m=o||s.hasOwnProperty(x)?KS(s,x,!0):KS(s,"scroller",!0))&&h&&(!0===m&&(m={}),m.orientation=a?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new VS(h,m),h.isRexContainerLite&&h.sendChildToBack(h));var C,k,S,w,_,E=KS(s,o?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);(E&&h&&(void 0!==b&&(E.focus=1===b?2:0),C=new qS(h,E)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,C),o&&!a||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.disableUnscrollableDrag=t[`disableUnscrollableDrag${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",C)),n)&&(o?(k=a?"t":"s",w=`scroll${i}`):(k="t",w="scroll"),n.on("valuechange",(function(e){t[k]=e,t.emit(w,t)})));y&&(o?(S=`childO${i}`,w=`scroll${i}`):(S="childOY",w="scroll"),y.on("valuechange",(function(e){t[S]=e,t.emit(w,t)})));C&&(_=o?`addChildO${i}`:"addChildOY",C.on("scroll",(function(e){t[_](-e,!0)})))};const ZS={right:0,left:1,bottom:0,top:1},QS={gameObject:0,rectBounds:1},tw=Phaser.Utils.Objects.GetValue;var ew=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=tw(e,"width"),a=tw(e,"height");n||(tw(e,"child.expandWidth",!0)||(s[1]=0));a||(tw(e,"child.expandHeight",!0)||(r[1]=0));var o=new aS(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=oS(i,"child"),r=oS(s,"gameObject",void 0);if(r){var n=oS(i,"space.child",0);t.childMargin={};var a=t.childMargin,o={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:a.top=0,a.bottom=0,a.left=0,a.right=0;break;default:a.top=n,a.bottom=n,a.left=n,a.right=n}else switch(t.scrollMode){case 0:a.top=oS(n,"top",0),a.bottom=oS(n,"bottom",0),o.left=oS(n,"left",0),o.right=oS(n,"right",0);break;case 1:a.top=oS(n,"left",0),a.bottom=oS(n,"right",0),o.top=oS(n,"top",0),o.bottom=oS(n,"bottom",0);break;default:a.top=oS(n,"top",0),a.bottom=oS(n,"bottom",0),a.left=oS(n,"left",0),a.right=oS(n,"right",0)}e.add(r,{column:1,row:1,align:oS(s,"align","center"),padding:o,expand:{width:oS(s,"expandWidth",!0),height:oS(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,o,e),t.scrollMode){case 0:JS(t,o,"y",e);break;case 1:JS(t,o,"x",e);break;default:JS(t,o,"y",e),JS(t,o,"x",e)}return o},iw=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}i*="Y"===t?this.scaleY:this.scaleX,s&&s.setBounds(e,i),r&&(r.setEnable(e!==i),r.tickLength&&r.setTick(r.tickLength,e,i))},sw=function(t){switch(this.scrollMode){case 0:case 1:(i=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(i,this.isOverflow),(r=this.childrenMap.scroller)&&this.disableUnscrollableDrag&&r.setEnable(this.isOverflow);break;default:var e=this[`isOverflow${t=t.toUpperCase()}`],i=this.childrenMap[`slider${t}`],s=this[`hideUnscrollableSlider${t}`];i&&s&&this.setChildVisible(i,e);var r=this.childrenMap.scroller,n=this[`disableUnscrollableDrag${t}`];r&&n&&r.setEnable(e)}},rw=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(o=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=o.childrenMap.track,s=o.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&nthis.topTextOY}textOYExeceedBottom(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:s?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}setTextOY(t){return this.textOY=t,this}set t(t){this.textOY=-this.textVisibleHeight*t}get t(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t}setTextOYByPercentage(t){return this.t=t,this}}var Cw=function(t){return t.add.text(0,0,"")};Object.assign(xw.prototype,vw);var kw={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},Sw={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const ww=Phaser.Utils.Objects.GetValue;class _w extends hw{constructor(t,e){void 0===e&&(e={});var i=ww(e,"text",void 0),s=ww(e,"textWidth",void 0),r=ww(e,"textHeight",void 0),n=ww(e,"textCrop",!!i.setCrop),a=ww(e,"textMask",!n),o=ww(e,"content",""),h=new xw(t,{width:s,height:r,text:i,textMask:a,textCrop:n&&!a,content:o,clampTextOY:ww(e,"clampChildOY",!1),alwaysScrollable:ww(e,"alwaysScrollable",!1)});t.add.existing(h),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textObjectHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.textHeight}})}(h),e.scrollMode=0,e.type="rexTextArea",e.child={gameObject:h,expandWidth:void 0===s,expandHeight:void 0===r};var l=ww(e,"space",void 0);l&&(l.child=ww(l,"text",0)),super(t,e),this.addChildrenMap("text",i)}get text(){return this.childrenMap.child.text}get lineHeight(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.textHeight}}Object.assign(_w.prototype,kw,Sw);const Ew=Phaser.Utils.Objects.GetValue;var Tw=function(t,e,i){e=e?y(e):{};var s=Ew(i,"background",Zx),r=Ew(i,"text",Ow),n=Ew(i,"track",Zx),a=Ew(i,"thumb",Zx);s?e.background=s(t,e.background):delete e.background,r?e.text=r(t,e.text):delete e.text;var o=e.slider;!1!==o&&null!==o&&(void 0===o&&(o={}),n?o.track=n(t,o.track):delete o.track,a?o.thumb=a(t,o.thumb):delete o.thumb,e.slider=o);var h=new _w(t,e);return t.add.existing(h),h},Ow=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("key")&&(i="bitmaptext",e.font=e.key)),i){case"bitmaptext":case"bitmap":s=new Fk(t,e);break;case"bbcodetext":case"bbcode":s=new Dk(t,0,0,"",e);break;case"label":s=new jk(t,e);break;case"textarea":s=Tw(t,e);break;default:s=new eC(t,e)}return Jx(s,e),t.add.existing(s),s},Pw=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("leftWidth")?i="nineSlice":(e.hasOwnProperty("color")||e.hasOwnProperty("strokeColor"))&&(i="roundRectangle")),i){case"nineSlice":s=e.hasOwnProperty("stretchMode")?new qx(t,e):new Tx(t,e);break;case"roundRectangle":s=new fx(t,e);break;default:s=new Dx(t,e)}return Jx(s,e),t.add.existing(s),s};const Mw=Phaser.Utils.Objects.GetValue;var Dw=function(t,e,i){e=e?y(e):{};var s=Mw(i,"background",Zx),r=Mw(i,"text",Ow),n=Mw(i,"icon",Pw),a=Mw(i,"action",Pw);return null!==e.background&&s?e.background=s(t,e.background):delete e.background,null!==e.text&&r?e.text=r(t,e.text):delete e.text,null!==e.icon&&n?e.icon=n(t,e.icon):delete e.icon,null!==e.action&&a?e.action=a(t,e.action):delete e.action,e};const Aw=Phaser.Utils.Objects.GetValue;var Lw=function(t,e,i){var s,r,n=Aw(i,"innerBackground",Zx),a=Aw(i,"separator",Zx),o=Aw(i,"title",Ow);null!==e.innerBackground&&n&&(s=n(t,e.innerBackground)),null!==e.separator&&a&&(r=a(t,e.separator)),e=Dw(t,e,i),s?e.innerBackground=s:delete e.innerBackground,r?e.separator=r:delete e.separator,null!==e.title&&o?e.title=o(t,e.title):delete e.title;var h=e.background;return h&&(s?t.children.moveBelow(h,s):r&&t.children.moveBelow(h,r)),e};class Rw extends Kb{constructor(t,e,i){super(t,e=Lw(t,e,i))}}var Fw={start:function(t){return this.easeValueTask||(this.easeValueTask=new ol(this,{eventEmitter:null})),void 0!==t&&(this.duration=t,this.easeValueTask.stop()),this.easeValueTask.isRunning||(this.easeValueTask.restart({key:"value",from:0,to:1,duration:this.duration,ease:this.ease,repeat:-1,delay:this.delay,repeatDelay:this.repeatDelay}),this.setDirty()),this},stop:function(){return this.easeValueTask?(this.easeValueTask.stop(),this.setDirty(),this):this},pause:function(){return this.easeValueTask?(this.easeValueTask.pause(),this.setDirty(),this):this},resume:function(){return this.easeValueTask?(this.easeValueTask.pause(),this.setDirty(),this):this}};const Bw=Phaser.Utils.Objects.GetValue;class Iw extends Zl{constructor(t,e){super(t,Bw(e,"x",0),Bw(e,"y",0),Bw(e,"width",64),Bw(e,"height",64)),this.resetFromConfig(e,!0),this.buildShapes(e),Bw(e,"start",!0)&&this.start()}resetFromConfig(t,e){var i;return void 0===e&&(e=!1),i=e?1e3:this.duration,this.setDuration(Bw(t,"duration",i)),i=e?"Linear":this.ease,this.setEase(Bw(t,"ease",i)),i=e?0:this.delay,this.setDelay(Bw(t,"delay",i)),i=e?0:this.repeatDelay,this.setRepeatDelay(Bw(t,"repeatDelay",i)),i=e?16777215:this.color,this.setColor(Bw(t,"color",i)),i=e?0:this.value,this.setValue(Bw(t,"value",i)),this}buildShapes(){}get centerX(){return this.width/2}get centerY(){return this.height/2}get radius(){return Math.min(this.centerX,this.centerY)}get color(){return this._color}set color(t){this.isColorChanged=this.isColorChanged||this._color!==t,this.dirty=this.dirty||this.isColorChanged,this._color=t,this.setShapesColor(t)}setColor(t){return this.color=t,this}setShapesColor(t){}get value(){return this._value}set value(t){t=Phaser.Math.Clamp(t,0,1),this.dirty=this.dirty||this._value!=t,this._value=t}setValue(t){return this.value=t,this}setDuration(t){return this.duration=t,this}setDelay(t){return this.delay=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return this.ease=t,this}get isRunning(){return!!this.tweenTask&&this.tweenTask.isRunning}}Object.assign(Iw.prototype,Fw);const jw=Phaser.Math.DegToRad,zw=Phaser.Math.Linear,Nw=Phaser.Math.Easing.Expo.In,Gw={right:0,down:1,left:2,up:3};var Xw=function(t,e,i,s,r,n,a,o,h,l,u){var c=Ww(e,0,s,r,n,a,o,h,l,u);t.startAt(c.x,c.y);var d=Ww(i,0,s,r,n,a,o,h,l,u);t.lineTo(d.x,d.y);var p=Ww(i,i,s,r,n,a,o,h,l,u);t.lineTo(p.x,p.y);var g=Ww(0,i,s,r,n,a,o,h,l,u);t.lineTo(g.x,g.y);var f=Ww(0,e,s,r,n,a,o,h,l,u);t.lineTo(f.x,f.y);var v=Ww(e,e,s,r,n,a,o,h,l,u);t.lineTo(v.x,v.y),t.close()},Yw={},Ww=function(t,e,i,s,r,n,a,o,h,l){var u=t*i,c=e*s;return Yw.x=a*u+o*c+r,Yw.y=h*u+l*c+n,Yw},$w={setDirection(t){return"string"==typeof t&&(t=Gw[t]),this.direction=t,this},buildShapes(){for(var t=0;t<3;t++)this.addShape(new Iu)},updateShapes(){var t,e,i,s,r,n;switch(this.direction){case 1:t=this.centerX,e=this.centerY-this.radius;var a=jw(315);i=Math.cos(a),s=Math.sin(a);var o=jw(45);r=Math.cos(o),n=Math.sin(o);break;case 3:t=this.centerX,e=this.centerY+this.radius;a=jw(135);i=Math.cos(a),s=Math.sin(a);o=jw(225);r=Math.cos(o),n=Math.sin(o);break;case 2:t=this.centerX+this.radius,e=this.centerY;a=jw(225);i=Math.cos(a),s=Math.sin(a);o=jw(315);r=Math.cos(o),n=Math.sin(o);break;default:t=this.centerX-this.radius,e=this.centerY;a=jw(45);i=Math.cos(a),s=Math.sin(a);o=jw(135);r=Math.cos(o),n=Math.sin(o)}for(var h=this.radius/7,l=this.getShapes(),u=0,c=l.length;uthis.value)for(var u=0;uthis.value&&(t+=1));for(var r=this.getShapes(),n=0,a=r.length;n0&&(r=!0,void 0===n&&(n=0),void 0===a&&(a=0)),(d=this.getSizerConfig(t)).align=i,d.padding=El(s),Q_(r)?(d.expandWidth=tE(r,"width",!1),d.expandHeight=tE(r,"height",!1)):(d.expandWidth=r,d.expandHeight=r),t.isRexSizer||(d.expandWidth&&(t.minWidth=void 0===n?Ir(t):n),d.expandHeight&&(t.minHeight=void 0===a?jr(t):a)),d.alignOffsetX=o,d.alignOffsetY=h,d.alignOffsetOriginX=u,d.alignOffsetOriginY=c,d.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,p&&this.addChildrenMap(e,t),this}},rE={remove(t,e){var i;if("string"==typeof t){if(i=t,!(t=this.sizerChildren[i]))return this}else{if(this.getParentSizer(t)!==this)return this;i=this.childToKey(t)}return i&&(delete this.sizerChildren[i],this.childrenMap.hasOwnProperty(i)&&delete this.childrenMap[i]),Zd.call(this,t,e),this},removeAll(t){for(var e in this.sizerChildren)this.remove(e,t);return this},clear(t){for(var e in this.sizerChildren)delete this.sizerChildren[e],this.childrenMap.hasOwnProperty(e)&&delete this.childrenMap[e];return im.call(this,t),this}},nE={getChildrenWidth:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var a in r)t=r[a],void 0===(i=this.getChildWidth(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).left+e.right)*this.scaleX,s=Math.max(i,s));return n?void 0:s+(this.space.left+this.space.right)*this.scaleX},getChildrenHeight:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var a in r)t=r[a],void 0===(i=this.getChildHeight(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).top+e.bottom)*this.scaleY,s=Math.max(i,s));return n?void 0:s+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(s.expandWidth){var r=e-(this.space.left+this.space.right)*this.scaleX,n=s.padding;i=r-(n.left+n.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(s.expandHeight){var r=e-(this.space.top+this.space.bottom)*this.scaleY,n=s.padding;i=r-(n.top+n.bottom)*this.scaleY}return i},getChildrenSizers:function(t){void 0===t&&(t=[]);var e,i=this.sizerChildren;for(var s in i)(e=i[s]).isRexSizer&&t.push(e);return t},layoutChildren:function(){var t,e,i,s,r,n,a,o,h,l,u,c,d=this.innerLeft,p=this.innerTop,g=this.innerWidth,f=this.innerHeight,v=this.sizerChildren;for(var m in v)(t=v[m]).rexSizer.hidden||(i=(e=t.rexSizer).padding,ef.call(this,t),l=this.getExpandedChildWidth(t),u=this.getExpandedChildHeight(t),e.aspectRatio>0&&(J_.width=e.aspectRatio,J_.height=1,Z_.width=l,Z_.height=u,l=(c=hl(J_,Z_,"FIT",!0)).width,u=c.height),t.isRexSizer?(t.runLayout(this,l,u),Yv(t,this)):yp(t,l,u),s=d+i.left*this.scaleX,n=g-(i.left+i.right)*this.scaleX,r=p+i.top*this.scaleY,a=f-(i.top+i.bottom)*this.scaleY,void 0===l&&(l=Ir(t)),void 0===u&&(u=jr(t)),o=(e.alignOffsetX+e.alignOffsetOriginX*l)*this.scaleX,h=(e.alignOffsetY+e.alignOffsetOriginY*u)*this.scaleY,sf.call(this,t,s,r,n,a,e.align,o,h))}};Object.assign(nE,sE,rE);const aE=Phaser.Utils.Objects.IsPlainObject,oE=Phaser.Utils.Objects.GetValue;class hE extends Xv{constructor(t,e,i,s,r,n){aE(e)?(e=oE(n=e,"x",0),i=oE(n,"y",0),s=oE(n,"width",void 0),r=oE(n,"height",void 0)):aE(s)&&(s=oE(n=s,"width",void 0),r=oE(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexOverlapSizer",this.sizerChildren={},this.addChildrenMap("items",this.sizerChildren)}childToKey(t){if("string"!=typeof t)return function(t,e){if(Array.isArray(t))return t.indexOf(e);for(var i in t)if(t[i]===e)return i;return null}(this.sizerChildren,t);var e=t;return this.sizerChildren.hasOwnPropery(e)?e:null}}Object.assign(hE.prototype,nE);const lE=fm.prototype.add,uE=fm.prototype.addSpace;var cE=function(t){var e=!t.isRexSpace,i=!e||this.buttonsExpand?1:0;if(0===this.sizerChildren.length)if(e){!this.buttonsExpand&&("right"===this.buttonsAlign||"center"===this.buttonsAlign||"bottom"===this.buttonsAlign)&&uE.call(this),lE.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&uE.call(this),this.hasTailSpace=s}else lE.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;lE.call(this,t,{index:r,proportion:i,expand:!0})}else lE.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},dE={addButton(t){if(Kg(t))for(var e=t,i=0,s=e.length;i=0;i--)fE.call(this,e[i],t);return this}},mE=function(t,e,i){if(t){var s=this.setValueCallback,r=this.setValueCallbackScope;s&&(r?s.call(r,t,e,i):s(t,e,i)),this.fireEvent("button.statechange",t,e,i)}},yE=function(t){var e=this;t._selected=void 0,Object.defineProperty(t,"selected",{get:function(){return t._selected},set:function(i){if(t._selected!==i){var s=t._selected;t._selected=i,mE.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},bE={add(t){return this.buttons.push(t),t._click||(t._click=new of(t,this.clickConfig),t._click.on("click",(function(t,e,i,s){this.fireEvent("button.click",e,i,s)}),this).on("enable",(function(t,e){this.fireEvent("button.enable",e)}),this).on("disable",(function(t,e){this.fireEvent("button.disable",e)}),this).on("over",(function(t,e,i,s){this.fireEvent("button.over",e,i,s)}),this).on("out",(function(t,e,i,s){this.fireEvent("button.out",e,i,s)}),this).on("down",(function(t,e,i,s){this.fireEvent("button.down",e,i,s)}),this).on("up",(function(t,e,i,s){this.fireEvent("button.up",e,i,s)}),this),t.isRexContainerLite&&t.sendChildToBack(t)),this.buttonsType&&(void 0===t.name&&console.error(`${this.parent.constructor.name}: Option button miss value`),yE.call(this,t)),this},addMultiple(t){for(var e=0,i=t.length;e0},setButtonEnable(t,e){var i=this.buttons;if(void 0===t||"boolean"==typeof t){e=t;for(var s=0,r=i.length;so.height/2)){r>(h=LE(o.left,o.centerY,t,e))&&(r=h,s=n);var h,l=i[n+1];if(!l||l.y!==o.y)r>(h=LE(o.right,o.centerY,t,e))&&(r=h,s=n+1)}}return s};const FE=Phaser.Utils.Objects.IsPlainObject,BE=Phaser.Utils.Objects.GetValue,IE=Phaser.Display.Align.CENTER;var jE=function(t,e,i,s){if("\n"===t)return this.addNewLine(),this;var r,n,a,o,h;($d.call(this,t),FE(e))&&(e=BE(h=e,"padding",0),i=BE(h,"key",void 0),s=BE(h,"index",void 0),r=BE(h,"offsetX",0),n=BE(h,"offsetY",0),a=BE(h,"offsetOriginX",0),o=BE(h,"offsetOriginY",0));return void 0===e&&(e=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=0),void 0===o&&(o=0),(h=this.getSizerConfig(t)).align=IE,h.padding=El(e),h.alignOffsetX=r,h.alignOffsetY=n,h.alignOffsetOriginX=a,h.alignOffsetOriginY=o,void 0===s||s>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(s,0,t),void 0!==i&&this.addChildrenMap(i,t),this},zE={add(t,e,i){if(Kg(t))for(var s=t,r=0,n=s.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,im.call(this,t),this}},XE={getChildrenWidth:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=0===this.orientation&&t?this.maxChildWidth:this.rexSizer.resolved?this.wrapResult.width:void 0)?e+(this.space.left+this.space.right)*this.scaleX:void 0);var e},getChildrenHeight:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=1===this.orientation&&t?this.maxChildHeight:this.rexSizer.resolved?this.wrapResult.height:void 0)?e+(this.space.top+this.space.bottom)*this.scaleY:void 0);var e},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;sr&&qE.addNewLine(this)}else for(n=0,a=t.length;n=0;i--)tT.call(this,e[i],t);return this}};const iT=Phaser.Utils.Objects.GetValue;class sT extends HE{constructor(t,e){void 0===e&&(e={});var i=e.space;"number"==typeof i&&(e.space={item:i,line:i}),super(t,e),this.type="rexFixWidthButtons",this.buttonGroup=new EE({parent:this,eventEmitter:iT(e,"eventEmitter",this),groupName:iT(e,"groupName",void 0),clickConfig:iT(e,"click",void 0)}).setButtonsType(e);var s=iT(e,"background",void 0),r=iT(e,"buttons",void 0);this.buttonsAlign=iT(e,"align",void 0),s&&this.addBackground(s),r&&this.addButtons(r),this.addChildrenMap("background",s),this.addChildrenMap("buttons",this.buttonGroup.buttons)}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.buttonGroup.destroy(),this.buttonGroup=void 0)}get buttons(){return this.buttonGroup.buttons}get groupName(){return this.buttonGroup.groupName}set groupName(t){this.buttonGroup.groupName=t}get eventEmitter(){return this.buttonGroup.eventEmitter}}Object.assign(sT.prototype,JE,eT,_E,OE);const rT=aS.prototype.add;var nT={addButton(t,e,i){return rT.call(this,t,e,i,void 0,0,this.buttonsExpand),this.buttonGroup.add(t),this},addButtons(t,e){for(var i=0,s=t;i=0;i--)hT.call(this,e[i],t);return this}};const uT=Phaser.Utils.Objects.GetValue;class cT extends aS{constructor(t,e){void 0===e&&(e={});var i=uT(e,"row",0),s=uT(e,"column",e.col||0),r=uT(e,"createCellContainerCallback"),n=uT(e,"buttons",void 0),a=uT(e,"expand",!0),o=a?1:0;if(r&&(e.createCellContainerCallback=void 0),void 0!==n){i=Math.max(i,n.length);for(var h=0,l=n.length;h=r&&h=i&&hi.length&&(t.prevCursorPosition=null),null!==t.prevCursorPosition&&(r=e.getCharChild(t.prevCursorPosition))&&("\n"===r.text&&r.clearTextSize(),e.emit("cursorout",r,t.prevCursorPosition,e)),null!=s&&(r=e.getCharChild(s))&&("\n"===r.text&&r.copyTextSize(e.lastInsertCursor),function(t){var e,i,s=t.parent,r=s.width,n=s.height,a=t.drawX,o=t.drawY,h=a+t.drawTLX,l=a+t.drawTRX,u=o+t.drawTLY,c=o+t.drawBLY;e=h<0?0-h:l>r?r-l:0,i=u<0?0-u:c>n?n-c:0,s._textOX+=e,s._textOY+=i}(r),e.emit("cursorin",r,s,e)),e.emit("movecursor",s,t.prevCursorPosition,e),t.prevCursorPosition=s}}(this)):(oO(this),hO(this)),this}setNumberInput(){return this.onUpdateCallback=aO,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}}const cO=Phaser.Utils.Objects.GetValue,dO=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var pO=function(){var t=this.scene.input.keyboard;this.textEdit.on("open",(function(){t.on("keydown-UP",this.cursorMoveUp,this).on("keydown-DOWN",this.cursorMoveDown,this)}),this).on("close",(function(){t.off("keydown-UP",this.cursorMoveUp,this).off("keydown-DOWN",this.cursorMoveDown,this)}),this)},gO=function(t){pr(t)||this.setCursorStyle(t).on("cursorin",(function(t){var e=this.cursorStyle,i=lx(t.style,e);Sl(e,i)||(t.styleSave=i,t.modifyStyle(e))}),this).on("cursorout",(function(t){t.styleSave&&(t.modifyStyle(t.styleSave),t.styleSave=void 0)}),this)},fO=function(t){pr(t)||this.setRangeStyle(t).on("rangein",(function(t){var e=this.rangeStyle,i=lx(t.style,e);Sl(e,i)||(t.styleSave=i,t.modifyStyle(e))}),this).on("rangeout",(function(t){t.styleSave&&(t.modifyStyle(t.styleSave),t.styleSave=void 0)}),this)},vO=function(t){pr(t)||this.setFocusStyle(t).on("open",(function(){var t=this.background,e=this.focusStyle,i=lx(t,e);Sl(e,i)||(t.styleSave=i,t.modifyStyle(e))}),this).on("close",(function(){var t=this.background;t.styleSave&&(t.modifyStyle(t.styleSave),t.styleSave=void 0)}),this)};function mO(){}function yO(t,e,i,s,r){let n=0,a=e.length,o=0,h=0;for(;nt.length?i:t})),a.value=t.join(e)}else a.value=t.join(i.slice(o,o+a.count));o+=a.count,a.added||(h+=a.count)}}let l=e[a-1];return a>1&&"string"==typeof l.value&&(l.added||l.removed)&&t.equals("",l.value)&&(e[a-2].value+=l.value,e.pop()),e}mO.prototype={diff(t,e,i={}){let s=i.callback;"function"==typeof i&&(s=i,i={}),this.options=i;let r=this;function n(t){return s?(setTimeout((function(){s(void 0,t)}),0),!0):t}t=this.castInput(t),e=this.castInput(e),t=this.removeEmpty(this.tokenize(t));let a=(e=this.removeEmpty(this.tokenize(e))).length,o=t.length,h=1,l=a+o;i.maxEditLength&&(l=Math.min(l,i.maxEditLength));let u=[{newPos:-1,components:[]}],c=this.extractCommon(u[0],e,t,0);if(u[0].newPos+1>=a&&c+1>=o)return n([{value:this.join(e),count:e.length}]);function d(){for(let s=-1*h;s<=h;s+=2){let h,l=u[s-1],c=u[s+1],d=(c?c.newPos:0)-s;l&&(u[s-1]=void 0);let p=l&&l.newPos+1=a&&d+1>=o)return n(yO(r,h.components,e,t,r.useLongestToken));u[s]=h}else u[s]=void 0}var i;h++}if(s)!function t(){setTimeout((function(){if(h>l)return s();d()||t()}),0)}();else for(;h<=l;){let t=d();if(t)return t}},pushComponent(t,e,i){let s=t[t.length-1];s&&s.added===e&&s.removed===i?t[t.length-1]={count:s.count+1,added:e,removed:i}:t.push({count:1,added:e,removed:i})},extractCommon(t,e,i,s){let r=e.length,n=i.length,a=t.newPos,o=a-s,h=0;for(;a+1t,tokenize:t=>t.split(""),join:t=>t.join("")};const bO=new mO;const xO=/^[a-zA-Z\u{C0}-\u{FF}\u{D8}-\u{F6}\u{F8}-\u{2C6}\u{2C8}-\u{2D7}\u{2DE}-\u{2FF}\u{1E00}-\u{1EFF}]+$/u,CO=/\S/,kO=new mO;kO.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!CO.test(t)&&!CO.test(e)},kO.tokenize=function(t){let e=t.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/);for(let t=0;tvoid 0===i?e:i}=this.options;return"string"==typeof t?t:JSON.stringify(EO(t,null,null,i),i," ")},_O.equals=function(t,e){return mO.prototype.equals.call(_O,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const TO=new mO;TO.tokenize=function(t){return t.slice()},TO.join=TO.removeEmpty=function(t){return t};const OO=Phaser.Utils.Array.Remove;var PO=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),OO(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(h=i,l=e,bO.diff(h,l,u)),r=0,n=0,a=s.length;nr)i+=a;else{if(s!==r)break;i+=Math.min(e.position,a)}}return i},RO={cursorMoveLeft(){if(!this.isOpened)return this;var t=DO(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=DO(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=AO(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=DO(LO(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=AO(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=DO(LO(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const FO=Phaser.Utils.Objects.IsPlainObject;class BO extends jb{constructor(t,e,i,s,r,n){FO(e)?n=e:FO(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(tt(e,"wrap.vAlign")||Z(e,"wrap.vAlign",s=i?"center":"top"),tt(e,"wrap.wrapMode")||Z(e,"wrap.wrapMode","char"),tt(e,"wrap.maxLines")||Z(e,"wrap.maxLines",s=i?1:void 0),i&&Z(e,"wrap.wrapWidth",1/0),tt(e,"wrap.useDefaultTextHeight")||Z(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!tt(e.edit,"inputType")){var s=i?"text":"textarea";Z(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new $o(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var a=n.text;a&&delete n.text;var o=hx(n.background,"focus"),h=hx(n.style,"cursor"),l=hx(n.style,"range");super(t,e,i,s,r,n),this.type="rexCanvasInput",this.contentWidth=void 0,this.contentHeight=void 0,this.lineHeight=void 0,this.linesCount=void 0,this.characterCountOfLines=[],this._text,this.textEdit=function(t,e){var i=cO(e,"edit");return void 0===i&&(i={}),HT(e,i,dO),new uO(t,i)}(this,n),pO.call(this),n.focusStyle&&Object.assign(o,n.focusStyle),vO.call(this,o),n.cursorStyle&&Object.assign(h,n.cursorStyle),gO.call(this,h),n.rangeStyle&&Object.assign(l,n.rangeStyle),pr(l)&&Object.assign(l,h),fO.call(this,l);var u=n.onAddChar;u&&this.on("addchar",u);var c=n.onCursorIn;c&&this.on("cursorin",c);var d=n.onCursorOut;d&&this.on("cursorout",d);var p=!n.onRangeIn&&!n.onRangeOut,g=p?n.onCursorIn:n.onRangeIn;g&&this.on("rangein",g);var f=p?n.onCursorOut:n.onRangeOut;f&&this.on("rangeout",f);var v,m=n.onMoveCursor;m&&this.on("movecursor",m),this.setParseTextCallback(n.parseTextCallback),this.lastInsertCursor=((v=this.createCharChild("|")).text="",v),a||(a=""),this.setText(a)}addChild(t,e){if(super.addChild(t,e),Array.isArray(t))for(var i=t,s=0,r=i.length;s0&&Z(t,"expandTextWidth",!0),h>0&&Z(t,"expandTextHeight",!0),void 0===i&&(i={}),i.hasOwnProperty("icon")||(i.icon=function(t,e){var i=new bc(t,e);return Jx(i,e),i.setOrigin(.5,1),t.add.existing(i),i});var y=!1;i.hasOwnProperty("action")||(i.action=function(t,e){void 0===e&&(e={});var i=new B_(t,e);return Jx(i,e),t.add.existing(i),i},y=!0);var b,x,C=new Rw(r,t,i);C.setMinSize(o,h).setOrigin(.5,1).layout(),r.add.existing(C),kr(C,e),C.vpx=l,C.vpy=u,C.frameDelimiter=c,y&&(b=C.getElement("action"),C.setChildVisible(b,!1)),_c(C),C.emitClick=function(){C.emit("click")},void 0===d&&(d=v.getData("$clickTarget")),null===d||(x="screen"===d.toLowerCase()?f.sys.anyTouchDetector:C.setInteractive()),x&&C.bindEvent(x,"pointerdown",(function(){C.emitClick()})),C.bindEvent(r.input.keyboard,"keydown",(function(t){if(void 0===p&&(p=v.getData("$clickShortcutKeys")),p){var e=p.split("|"),i=j_[t.keyCode];-1!==e.indexOf(i)&&C.emitClick()}}));var k=function(){C.isTyping?C.once("click",k).stop(!0):C.isLastPage?C.complete2Flag||(C.complete2Flag=!0,C.emit("complete2")):C.once("click",k).typeNextPage()},S=function(){C.isPageEnd&&(C.off("click",S),y&&(b.stop(),C.setChildVisible(b,!1)),v.emit("resume.input"))};C._typeNextPage=S,C.on("pageend",(function(){y&&(b.start(),C.setChildVisible(b,!0)),C.once("click",S);let t=v.getData("$fastTyping"),e=v.getData("$autoNextPage");var i;(t||e)&&(i=t?0:v.getData("$autoNextPageDelay"),f.sys.timeline.delayCall(i,C.emitClick)),v.emit("pause.input")})).on("start",(function(){C.off("click",k).once("click",k)}));var w=v.getData("$fastTyping"),_=v.getData("$autoNextPage");C.bindScenePreupdateEvent((function(){let t=v.getData("$fastTyping"),e=v.getData("$autoNextPage");if(t!==w)if(C.isTyping){let e;t?e=v.getData("$fastTypingSpeed"):void 0===e&&(e=C.normalTypingSpeed),C.setTypingSpeed(e)}else t&&C.emitClick();else e===_||t||C.isTyping||e&&C.emitClick();w=t,_=e}));var E=function(t,e){if(void 0===g&&(g=v.getData("$fastTypingShortcutKeys")),g){var i=g.split("|"),s=j_[t.keyCode];-1!==i.indexOf(s)&&v.setData("$fastTyping",e)}};return C.bindEvent(r.input.keyboard,"keydown",(function(t){E(t,!0)})),C.bindEvent(r.input.keyboard,"keyup",(function(t){E(t,!1)})),C}}(N_(e,`styles.${Uo}`,{}),{viewport:i},r);t.addGameObjectManager({name:Uo,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Mo,commands:{typing:Lc,shake:Ec}})}},function(t,e){var{viewport:i}=e,s=Oc(e,`creators.${Vo}`,void 0);if(!1!==s){if(Pc(s)&&(s=void 0),void 0===s){Oc(e,`styles.${Vo}`,{});s=function(t,{viewport:e}={}){return function(t,i){i.hasOwnProperty("scaleMode")||(i.scaleMode=0);var s=new bc(t,i);t.add.existing(s),kr(s,e);var{vpx:r=.5,vpy:n=.5,vpw:a,vph:o,scaleMode:h}=i;if(s.vpx=r,s.vpy=n,h||void 0!==a||void 0!==o){void 0===a&&(a=1),void 0===o&&(o=1);var l=e.width*a,u=e.height*o;s.resize(l,u)}return _c(s),s}}(0,{viewport:i})}t.addGameObjectManager({name:Vo,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Oo,commands:{cross:Tc,shake:Ec}})}},function(t,e){var{viewport:i}=e,s=jT(e,`creators.${Ko}`,void 0);if(!1!==s){var r;if(zT(s)&&(r=s,s=void 0),void 0===s)s=function(t,{viewport:e}={},i){return function(s,{vpw:r,vph:n,width:a=0,height:o=0,vpx:h=.5,vpy:l=.5}={}){void 0!==r&&(a=e.width*r),void 0!==n&&(o=e.height*n);var u=new BT(s,t,i);return u.setMinSize(a,o).setVisible(!1),s.add.existing(u),kr(u,e),u.vpx=h,u.vpy=l,_c(u),u}}(jT(e,`styles.${Ko}`,{}),{viewport:i},r);t.addGameObjectManager({name:Ko,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Mo,commands:{choice:IT,shake:Ec}})}},function(t,e){var{viewport:i}=e,s=YO(e,`creators.${Jo}`,void 0);if(!1!==s){var r;if(WO(s)&&(r=s,s=void 0),void 0===s)s=function(t,{viewport:e}={},i){return function(s,{vpw:r,vph:n,width:a=0,height:o=0,vpx:h=.5,vpy:l=.5}={}){void 0!==r&&(a=e.width*r),void 0!==n&&(o=e.height*n);var u=new GO(s,t,i);return u.setMinSize(a,o).setVisible(!1),s.add.existing(u),kr(u,e),u.vpx=h,u.vpy=l,_c(u),u}}(YO(e,`styles.${Jo}`,{}),{viewport:i},r);t.addGameObjectManager({name:Jo,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Mo,commands:{input:XO,shake:Ec}})}},function(t,e){var{viewport:i}=e,s=q_(e,`creators.${qo}`,void 0);if(!1!==s){var r;if(K_(s)&&(r=s,s=void 0),void 0===s)s=function(t,{viewport:e}={},i){return function(s,{vpw:r,vph:n,width:a=0,height:o=0,vpx:h=1,vpy:l=0,alignLeft:u=!1,alignRight:c=!0,alignTop:d=!0,alignBottom:p=!1,text0:g,text1:f,commandExecutor:v,eventSheetManager:m,eventsheet:y}={}){void 0!==r&&(a=e.width*r),void 0!==n&&(o=e.height*n),void 0===i&&(i={}),i.hasOwnProperty("icon")||(i.icon=function(t,e){var i=new bc(t,e);return Jx(i,e),i.setOrigin(.5,1),t.add.existing(i),i});var b,x,C=new X_(s,t,i);return g&&C.setTitle(g),f&&C.setText(f),b=u?0:c?1:.5,x=d?0:p?1:.5,C.setMinSize(a,o).setOrigin(b,x).layout(),s.add.existing(C),kr(C,e),C.vpx=h,C.vpy=l,_c(C),C}}(q_(e,`styles.${qo}`,{}),{viewport:i},r);t.addGameObjectManager({name:qo,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Mo,commands:{setText:W_,popUp:$_,shake:Ec}})}}];var VO=[function(t){t.addExpression("random",(function(t,e){return void 0===t&&void 0===e?(t=0,e=1):void 0===e&&(e=t,t=0),t+Math.random()*(e-t)}))},function(t){t.addExpression("randomInt",(function(t,e){return Math.floor(t+Math.random()*(e-t+1))}))}],HO={$typingSpeed:100,$autoNextPage:!1,$autoNextPageDelay:500,$fastTyping:!1,$fastTypingSpeed:20,$clickShortcutKeys:"SPACE|ENTER",$fastTypingShortcutKeys:"CTRL",$clickTarget:"screen",$transitionDuration:500,$tintOthers:3355443,$shakeDuration:500,$shakeMagnitude:50},UO=function(t,e){var{defaultVariables:i}=e;for(var s in i=function(t,e){var i=lo(t);for(var s in e)i.hasOwnProperty(s)||(i[s]=e[s]);return i}(i,HO),i)t.setData(s,i[s])};return class extends or{constructor(t,e={}){e.commandExecutor=function(t,e){var{layerDepth:i,rootLayer:s,multipleCamerasEnable:r=!1,viewport:n}=e;void 0===n&&(e.viewport=on(t,t.cameras.main));for(var a=new To(t,{layers:r?No:Go,layerDepth:i,rootLayer:s}),o=0,h=$O.length;oh;u--){for(c=0;c0&&this.wrapMode!==Dm&&0===this.wrapWidth}setStyle(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wordWrap")){var s=t.wordWrap;s.hasOwnProperty("width")&&(t.wrap={mode:"word",width:s.width})}if(t&&t.hasOwnProperty("wrap")){var r=t.wrap;if(r.hasOwnProperty("mode")){var n=r.mode;"string"==typeof n&&(r.mode=Fm[n])}else r.hasOwnProperty("width")&&(r.mode=1)}t&&t.rtl&&i&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var a=this.propertyMap;for(var o in a){var h=a[o],l=h[0],u=i?h[1]:this[o],c=h[2];if("wrapCallback"===o||"wrapCallbackScope"===o)this[o]=pC(t,l,u);else{var d=dC(t,l,u);c&&(d=c(d)),this[o]=d}}var p=pC(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var g=pC(t,"fill",null);null!==g&&(this.color=vy(g));var f=pC(t,"metrics",!1);return f?this.metrics={ascent:pC(f,"ascent",0),descent:pC(f,"descent",0),fontSize:pC(f,"fontSize",0)}:!e&&this.metrics||(this.metrics=cC(this)),e?this.parent.updateText():this.parent}syncFont(t,e){e.font=this._font}syncStyle(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"}syncShadow(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)}update(t){return t&&(this._font=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim(),this.metrics=cC(this)),this.parent.updateText(t)}buildFont(){var t=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim();return t!==this._font&&(this._font=t),this}setFont(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=pC(t,"fontFamily","Courier"),this.fontSize=pC(t,"fontSize","16px"),this.fontStyle=pC(t,"fontStyle","")),this.update(!0)}setFontFamily(t){return this.fontFamily=t,this.update(!0)}setFontStyle(t){return this.fontStyle=t,this.update(!0)}setFontSize(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}setTestString(t){return this.testString=t,this.update(!0)}setFixedSize(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}setResolution(t){return this.resolution=t,this.update(!1)}setXOffset(t){return this.xOffset=t,this.update(!1)}setBackgroundColor(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=vy(t,this.parent.canvas,this.parent.context),this.backgroundColor2=vy(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=vy(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}setBackgroundCornerRadius(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}setFill(t){return this.color=vy(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=vy(t,this.parent.canvas,this.parent.context),this.update(!1)}setStroke(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=vy(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}setShadow(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===n&&(n=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=vy(i,this.parent.canvas,this.parent.context),this.shadowBlur=s,this.shadowStroke=r,this.shadowFill=n,this.update(!1)}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}setShadowColor(t){return void 0===t&&(t="#000"),this.shadowColor=vy(t,this.parent.canvas,this.parent.context),this.update(!1)}setShadowBlur(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}setShadowStroke(t){return this.shadowStroke=t,this.update(!1)}setShadowFill(t){return this.shadowFill=t,this.update(!1)}setUnderline(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=vy(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}setUnderlineColor(t){return void 0===t&&(t="#000"),this.underlineColor=vy(t,this.parent.canvas,this.parent.context),this.update(!1)}setUnderlineThickness(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}setUnderlineOffset(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}setStrikethrough(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=vy(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}setStrikethroughColor(t){return void 0===t&&(t="#000"),this.strikethroughColor=vy(t,this.parent.canvas,this.parent.context),this.update(!1)}setStrikethroughThickness(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}setStrikethroughOffset(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}setWrapMode(t){return"string"==typeof t&&(t=Fm[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}setWrapWidth(t){return this.wrapWidth=t,this.update(!1)}setAlign(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}setHAlign(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}setVAlign(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}setMaxLines(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}getTextMetrics(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}setTextMetrics(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=pC(e,"fontFamily",this.fontFamily),this.fontSize=pC(e,"fontSize",this.fontSize),this.fontStyle=pC(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}get lineHeight(){return this.metrics.fontSize+this.parent.lineSpacing}toJSON(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}destroy(){this.parent=void 0}}var fC={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var a=this.defaultStyle;this.clear(),Oy(this,a.backgroundColor,a.backgroundStrokeColor,a.backgroundStrokeLineWidth,a.backgroundCornerRadius,a.backgroundColor2,a.backgroundHorizontalGradient,a.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var o,h,l,u,c,d,p=a.halign,g=a.valign,f=a.lineHeight,v=r.lines,m=v.length,y=a.maxLines;y>0&&m>y?(h=y,l="center"===g?Math.floor((m-h)/2):"bottom"===g?m-h:0):(h=m,l=0),u=l+h;var b=this.rtl,x=b?this.parent.width:void 0;d="center"===g?Math.max((s-h*f)/2,0):"bottom"===g?Math.max(s-h*f-2,0):0,d+=e;for(var C=l;C0){var o=this.defaultStyle.metrics,h=i-o.ascent,l=o.fontSize;this.drawRectangle(e,h,t.width,l,a.bgcolor,a)}if(a.underlineThickness>0&&t.width>0){var u=i+a.underlineOffset-a.underlineThickness/2;this.drawLine(e,u,t.width,a.underlineThickness,a.underlineColor,a)}if(t.isTextPen&&(a.buildFont(),a.syncFont(r,n),a.syncStyle(r,n),this.drawText(e,i,t.text,a)),t.isImagePen&&this.drawImage(e,i,t.prop.img,t.prop.color,a),a.strikethroughThickness>0&&t.width>0){u=i+a.strikethroughOffset-a.strikethroughThickness/2;this.drawLine(e,u,t.width,a.strikethroughThickness,a.strikethroughColor,a)}if(n.restore(),t.hasAreaMarker&&t.width>0){var c,d=t.prop.area;if(d)c={key:d};else{var p=t.prop.url;c={key:`url:${p}`,url:p}}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,c)}},clear(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawRectangle(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;a.fillStyle=r,a.fillRect(t,e,i,s)},drawLine(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;n.syncShadow(a,n.shadowStroke);var o=a.lineCap;a.lineCap="butt",a.strokeStyle=r,a.lineWidth=s,a.beginPath(),a.moveTo(t,e),a.lineTo(t+i,e),a.stroke(),a.lineCap=o},drawText(t,e,i,s){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;s.stroke&&"none"!==s.stroke&&s.strokeThickness>0&&(s.syncShadow(r,s.shadowStroke),r.strokeText(i,t,e)),s.color&&"none"!==s.color&&(s.syncShadow(r,s.shadowFill),r.fillText(i,t,e))},drawImage(t,e,i,s,r){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,s,this.autoRound)}};const vC=Phaser.Utils.Objects.GetValue,mC=Om,yC=Pm;class bC{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=vC(t,"text",""),this.x=vC(t,"x",0),this.y=vC(t,"y",0),this.width=vC(t,"width",0);var e=vC(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=vC(t,"newLineMode",0),this.startIndex=vC(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===yC&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==mC&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===yC&&(t+=1),t}get endIndex(){return this.startIndex+this.rawTextLength}get lastX(){return this.x+this.width}get isTextPen(){return""!==this.text}get isImagePen(){return!!this.prop.img}get hasAreaMarker(){return!!this.prop.area||!!this.prop.url}}const xC=Phaser.Utils.Objects.GetFastValue,CC=Om,kC=Mm;class SC{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=xC(t,"tagToText",gd),this.tagToTextScope=xC(t,"tagToTextScope",void 0)}destroy(){this.clear(),this.tagToText=void 0,this.tagToTextScope=void 0}clear(){for(var t=0,e=this.lines.length;t=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}getLineEndIndex(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,s=!1;for(e=t;e>=0&&!(s=null!=(i=this.lines[e])&&i.length>0);e--);return s?i[i.length-1].endIndex:0}getLineWidth(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}getMaxLineWidth(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,s=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}getLineWidths(){for(var t=[],e=0,i=this.lines.length;e=t&&h<=e||(a=a.substring(t-o,e-o)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,a,l,u):c+=this.tagToText(a,l,u),u=l,!(h>=e)));d++);return c}get length(){return this.lines.length}set length(t){this.clear()}}var wC={};const _C=Phaser.Geom.Rectangle;var EC=new Da;class TC{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&GC(f)){""!==b?a.push(n.getLine(b,x,RC)):0===C&&r>0&&a.push(n.getLine("",0,RC)),a.push(...zC(f,e,IC,s,0,n));var S=a.pop();b=S.text,x=S.width,n.freeLine(S)," "===b&&(b="",x=0)}else(m=x+v)>h?(a.push(n.getLine(b,x,RC)),b=f,x=v,h=s):(b+=f,x=m),C===k-1&&a.push(n.getLine(b,x,l))}return a},NC=function(t,e){var i;switch(e){case BC:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==YC&&i0&&t>e&&(t=e),t}get linesWidth(){return Math.ceil(this.penManager.getMaxLineWidth())}get linesHeight(){var t=this.displayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}get imageManager(){return this.parent.imageManager}get rtl(){return this.parent.style.rtl}newPenManager(){return new SC({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}get tmpPenManager(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}getPlainText(t,e,i){var s;if(null==t)s=this.penManager.plainText;else{var r=this.parser.splitText(t,1);s="";for(var n=0,a=r.length;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return Kk(this.sizerChildren,null),sm.call(this,t),this}},Zk={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)Kk(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},iS={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,o=this.sizerChildren,h=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=dp.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,Kk(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Kk(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},rS=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const nS=Phaser.Utils.Objects.IsPlainObject,aS=Phaser.Utils.Objects.GetValue;class oS extends Yv{constructor(t,e,i,s,r,n,a,o,h,l){nS(e)?(e=aS(l=e,"x",0),i=aS(l,"y",0),s=aS(l,"width",void 0),r=aS(l,"height",void 0),n=aS(l,"column",l.col||0),a=aS(l,"row",0),o=aS(l,"columnProportions",0),h=aS(l,"rowProportions",0)):nS(s)?(s=aS(l=s,"width",void 0),r=aS(l,"height",void 0),n=aS(l,"column",l.col||0),a=aS(l,"row",0),o=aS(l,"columnProportions",0),h=aS(l,"rowProportions",0)):nS(n)?(n=aS(l=n,"column",l.col||0),a=aS(l,"row",0),o=aS(l,"columnProportions",0),h=aS(l,"rowProportions",0)):nS(o)&&(o=aS(l=o,"columnProportions",0),h=aS(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(aS(l,"createCellContainerCallback")),this.setIndentLeft(aS(l,"space.indentLeftOdd",0),aS(l,"space.indentLeftEven",0)),this.setIndentTop(aS(l,"space.indentTopOdd",0),aS(l,"space.indentTopEven",0)),this.resetGrid(n,a,o,h,aS(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=sS.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=rS.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(oS.prototype,iS);const hS=Phaser.Utils.Objects.GetValue;const lS=Phaser.Math.Percent;var uS=function(t,e,i){var s;return t.y===e.y?s=lS(i.x,t.x,e.x):t.x===e.x&&(s=lS(i.y,t.y,e.y)),s},cS=function(t,e,i){var s,r;this.enable&&(dS.x=e,dS.y=i,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint()),this.value=uS(s,r,dS))},dS={},pS=function(t,e,i){if(this.enable&&t.isDown){var s,r;gS.x=t.worldX,gS.y=t.worldY,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint());var n=uS(s,r,gS);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-n)<.1?this.value=n:this.easeValueTo(n)}},gS={},fS=function(t,e){void 0===e&&(e=vS);var i=this.childrenMap.thumb,s=i.x,r=i.y;return jd(i,this.innerLeft,this.innerTop,this.innerWidth,this.innerHeight,t),e.x=i.x,e.y=i.y,i.x=s,i.y=r,e},vS={};const mS=Phaser.Display.Align.LEFT_CENTER,yS=Phaser.Display.Align.TOP_CENTER;var bS={};const xS=Phaser.Display.Align.RIGHT_CENTER,CS=Phaser.Display.Align.BOTTOM_CENTER;var kS={};const SS=Phaser.Math.Linear;var wS={};const _S=Phaser.Display.Align.LEFT_CENTER,ES=Phaser.Display.Align.TOP_CENTER,TS=Phaser.Display.Align.RIGHT_CENTER,OS=Phaser.Display.Align.BOTTOM_CENTER;const PS=Phaser.Utils.Objects.GetValue,MS=Phaser.Utils.Objects.IsPlainObject,DS=Phaser.Math.Clamp,AS=Phaser.Math.Snap.To;class LS extends(hc(vm)){constructor(t,e){super(t,e),this.type="rexSlider",this.bootProgressBase(e),this.reverseAxis=PS(e,"reverseAxis",!1);var i=PS(e,"background",void 0),s=PS(e,"track",void 0),r=PS(e,"indicator",void 0),n=PS(e,"thumb",void 0);if(i&&(MS(i)&&(i=Qx(t,i)),this.addBackground(i)),s&&(MS(s)&&(s=Qx(t,s)),this.add(s,{proportion:1,expand:!0,minWidth:0===this.orientation?0:void 0,minHeight:1===this.orientation?0:void 0})),r&&(MS(r)&&(r=Qx(t,r)),this.pin(r)),n){MS(n)&&(n=Qx(t,n)),this.pin(n);var a=PS(e,"thumbOffsetX",0),o=PS(e,"thumbOffsetY",0);this.setThumbOffset(a,o)}var h=PS(e,"input",0);switch("string"==typeof h&&(h=RS[h]),h){case 0:n&&(n.setInteractive(),this.scene.input.setDraggable(n),n.on("drag",cS,this).on("dragstart",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("dragend",(function(t){this.eventEmitter.emit("inputend",t)}),this));break;case 1:this.on("pointerdown",pS,this).on("pointermove",pS,this).on("pointerdown",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("pointerup",(function(t){this.eventEmitter.emit("inputend",t)}),this).on("pointerover",(function(t){t.isDown&&this.eventEmitter.emit("inputstart",t)}),this).on("pointerout",(function(t){t.isDown&&this.eventEmitter.emit("inputend",t)}),this).setInteractive()}this.addChildrenMap("background",i),this.addChildrenMap("track",s),this.addChildrenMap("indicator",r),this.addChildrenMap("thumb",n),this.setEnable(PS(e,"enable",void 0));var l=PS(e,"tick",void 0);void 0===l&&(l=PS(e,"gap",void 0)),this.setGap(l),this.setValue(PS(e,"value",0),PS(e,"min",void 0),PS(e,"max",void 0))}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setGap(t,e,i){return t&&void 0!==e&&(t/=i-e),this.gap=t,this}setTick(t,e,i){return this.setGap(t,e,i),this}get tick(){return this.gap}set tick(t){this.gap=t}setThumbOffset(t,e){return this.thumbOffsetX=t,this.thumbOffsetY=e,this}get value(){return this._value}set value(t){void 0!==this.gap&&(t=AS(t,this.gap));var e=this._value;this._value=DS(t,0,1),e!==this._value&&(this.updateThumb(this._value),this.updateIndicator(this._value),this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter))}postLayout(t,e,i){return this.updateThumb(),this.updateIndicator(),super.postLayout(t,e,i),this}}const RS={pan:0,drag:0,click:1,none:-1};var FS={getStartPoint:function(t){if(void 0===t&&(t=bS),this.childrenMap.thumb){var e=0===this.orientation?mS:yS;fS.call(this,e,t)}else 0===this.orientation?(t.x=this.innerLeft+1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerTop+1);return t},getEndPoint:function(t){if(void 0===t&&(t=kS),this.childrenMap.thumb){var e=0===this.orientation?xS:CS;fS.call(this,e,t)}else 0===this.orientation?(t.x=this.innerRight-1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerBottom-1);return t},updateThumb:function(t){var e,i,s=this.childrenMap.thumb;return void 0===s||(void 0===t&&(t=this.value),this.reverseAxis?(e=this.getEndPoint(),i=this.getStartPoint()):(e=this.getStartPoint(),i=this.getEndPoint()),function(t,e,i,s){void 0===s&&(s=wS),s.x=SS(e.x,i.x,t),s.y=SS(e.y,i.y,t)}(t,e,i,s),s.x+=this.thumbOffsetX,s.y+=this.thumbOffsetY,this.resetChildPositionState(s)),this},updateIndicator:function(t){var e=this.childrenMap.indicator;if(void 0===e)return this;void 0===t&&(t=this.value);var i,s,r,n=this.reverseAxis,a=this.childrenMap.thumb;if(a)if(0===this.orientation){var o=Ir(a);if(n){h=a.x-o*a.originX;i=this.right-h}else{var h;i=(h=a.x-o*a.originX)+o-this.left}}else{var l=jr(a);if(n){u=a.y-l*a.originY;s=this.bottom-u}else{var u;s=(u=a.y-l*a.originY)+l-this.top}}else 0===this.orientation?i=this.width*t:s=this.height*t;bp(e,i,s),r=n?0===this.orientation?TS:OS:0===this.orientation?_S:ES,Id(e,this,r),this.resetChildPositionState(e)}};Object.assign(LS.prototype,FS);const BS=Phaser.Utils.Objects.GetValue;class IS extends vm{constructor(t,e){super(t,e),this.type="rexScrollBar";var i,s=BS(e,"background",void 0),r=BS(e,"buttons",void 0),n=BS(r,"top",BS(r,"left",void 0)),a=BS(r,"bottom",BS(r,"right",void 0)),o=BS(e,"slider",void 0);(s&&this.addBackground(s),n)&&(this.add(n),new xf(n).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?this.scrollStep:-this.scrollStep;this.value+=t}}),this));if(o){var h;if(o.orientation=this.orientation,o.eventEmitter=this,o.value=null,0===this.orientation)h=void 0===BS(o,"width",void 0)?1:0;else h=void 0===BS(o,"height",void 0)?1:0;i=new LS(t,o),t.add.existing(i),this.add(i,{proportion:h})}a&&(this.add(a),new xf(a).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?-this.scrollStep:this.scrollStep;this.value+=t}}),this));var l=[n,a];this.addChildrenMap("background",s),this.addChildrenMap("slider",i),this.addChildrenMap("buttons",l);var u=BS(e,"valuechangeCallback",null);if(null!==u){var c=BS(e,"valuechangeCallbackScope",void 0);this.on("valuechange",u,c)}this.setEnable(BS(e,"enable",void 0)),this.setValue(BS(e,"value",0)),this.setScrollStep(BS(r,"step",.01))}setScrollStep(t){return this.scrollStep=t,this}get enable(){return!!this.childrenMap.slider&&this.childrenMap.slider.enable}set enable(t){this.childrenMap.slider&&this.childrenMap.slider.setEnable(t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get value(){return this.childrenMap.slider?this.childrenMap.slider.value:0}set value(t){this.childrenMap.slider&&(this.childrenMap.slider.value=t)}setValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setValue(t,e,i),this}addValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.addValue(t,e,i),this}getValue(t,e){return this.childrenMap.slider?this.childrenMap.slider.getValue(t,e):0}easeValueTo(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.easeValueTo(t,e,i),this}stopEaseValue(){return this.childrenMap.slider&&this.childrenMap.slider.stopEaseValue(),this}setEaseValueDuration(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueDuration(t),this}setEaseValueFunction(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueFunction(t),this}setGap(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setGap(t,e,i),this}get gap(){if(this.childrenMap.slider)return this.childrenMap.slider.gap}set gap(t){this.childrenMap.slider&&(this.childrenMap.slider.gap=t)}setTick(t,e,i){return this.setGap(t,e,i),this}get tick(){if(this.childrenMap.slider)return this.childrenMap.slider.tick}set tick(t){this.childrenMap.slider&&(this.childrenMap.slider.tick=t)}}class jS extends Cg{constructor(t,e){super(e),this.parent=t,this.init()}init(){this.start("IDLE")}next_IDLE(){var t,e=this.parent;return e.dragState.isDown&&(t=0===e.dragThreshold?"DRAG":"DRAGBEGIN"),t}update_IDLE(t,e){this.next()}next_DRAGBEGIN(){var t=this.parent,e=t.dragState;return e.isDown?e.pointer.getDistance()>=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const zS=Phaser.Utils.Objects.GetValue,NS=Phaser.Math.Distance.Between;class GS extends In{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=zS(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(zS(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(zS(t,"enable",!0)),this.holdThreshold=zS(t,"holdThreshold",50),this.pointerOutReleaseEnable=zS(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return Qf(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:NS(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!Kg(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!Kg(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const XS=Phaser.Utils.Objects.GetValue;class YS{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(XS(t,"value",0)),this.setSpeed(XS(t,"speed",0)),this.setAcceleration(XS(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class WS{constructor(){this.value,this.dir,this.movement=new YS}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const US={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},qS=Phaser.Utils.Objects.GetValue;class KS extends In{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=qS(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(qS(e,"speed",.1)),this.setEnable(qS(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(qS(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||Kg(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const JS=Phaser.Utils.Objects.GetValue;var ZS=function(t,e,i,s){var r,n,a="Y"===(i=i.toUpperCase()),o=2===t.scrollMode,h=t.childrenMap.child,l=`slider${i}`;if(r=o||s.hasOwnProperty(l)?JS(s,l,void 0):JS(s,"slider",void 0)){var u,c,d;!0===r&&(r={}),r.orientation=a?1:0,n=function(t,e){void 0===e&&(e={});var i=lo(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new IS(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r),n.tickLength=JS(r,"tickLength",void 0);var p=JS(r,"position",0);"string"==typeof p&&(p=QS[p]);var g,f,v=JS(s,`space.slider${i}`,void 0);void 0===v&&void 0===(v=JS(s,"space.slider",void 0))&&(o?v=0:g=JS(s,"space.child",0)),f=void 0===g?"number"==typeof v:"number"==typeof g,a?0===p?(u=2,c=1,d=void 0===g?f?{left:v}:v:{left:JS(g,"right",g)}):(u=0,c=1,d=void 0===g?f?{right:v}:v:{right:JS(g,"left",g)}):0===p?(u=1,c=2,d=void 0===g?f?{top:v}:v:{top:JS(g,"bottom",g)}):(u=1,c=0,d=void 0===g?f?{bottom:v}:v:{bottom:JS(g,"top",g)}),e.add(n,{column:u,row:c,align:"center",padding:d,expand:!0}),t[`hideUnscrollableSlider${i}`]=JS(r,"hideUnscrollableSlider",!1),t[`disableUnscrollableDrag${i}`]=JS(r,"disableUnscrollableDrag",!1),t[`adaptThumb${i}SizeMode`]=JS(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=JS(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`disableUnscrollableDrag${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=JS(s,"scrollDetectionMode");"string"==typeof b&&(b=tw[b]);var x=`scroller${i}`;(m=o||s.hasOwnProperty(x)?JS(s,x,!0):JS(s,"scroller",!0))&&h&&(!0===m&&(m={}),m.orientation=a?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new HS(h,m),h.isRexContainerLite&&h.sendChildToBack(h));var C,k,S,w,_,E=JS(s,o?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);(E&&h&&(void 0!==b&&(E.focus=1===b?2:0),C=new KS(h,E)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,C),o&&!a||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.disableUnscrollableDrag=t[`disableUnscrollableDrag${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",C)),n)&&(o?(k=a?"t":"s",w=`scroll${i}`):(k="t",w="scroll"),n.on("valuechange",(function(e){t[k]=e,t.emit(w,t)})));y&&(o?(S=`childO${i}`,w=`scroll${i}`):(S="childOY",w="scroll"),y.on("valuechange",(function(e){t[S]=e,t.emit(w,t)})));C&&(_=o?`addChildO${i}`:"addChildOY",C.on("scroll",(function(e){t[_](-e,!0)})))};const QS={right:0,left:1,bottom:0,top:1},tw={gameObject:0,rectBounds:1},ew=Phaser.Utils.Objects.GetValue;var iw=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=ew(e,"width"),a=ew(e,"height");n||(ew(e,"child.expandWidth",!0)||(s[1]=0));a||(ew(e,"child.expandHeight",!0)||(r[1]=0));var o=new oS(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=hS(i,"child"),r=hS(s,"gameObject",void 0);if(r){var n=hS(i,"space.child",0);t.childMargin={};var a=t.childMargin,o={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:a.top=0,a.bottom=0,a.left=0,a.right=0;break;default:a.top=n,a.bottom=n,a.left=n,a.right=n}else switch(t.scrollMode){case 0:a.top=hS(n,"top",0),a.bottom=hS(n,"bottom",0),o.left=hS(n,"left",0),o.right=hS(n,"right",0);break;case 1:a.top=hS(n,"left",0),a.bottom=hS(n,"right",0),o.top=hS(n,"top",0),o.bottom=hS(n,"bottom",0);break;default:a.top=hS(n,"top",0),a.bottom=hS(n,"bottom",0),a.left=hS(n,"left",0),a.right=hS(n,"right",0)}e.add(r,{column:1,row:1,align:hS(s,"align","center"),padding:o,expand:{width:hS(s,"expandWidth",!0),height:hS(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,o,e),t.scrollMode){case 0:ZS(t,o,"y",e);break;case 1:ZS(t,o,"x",e);break;default:ZS(t,o,"y",e),ZS(t,o,"x",e)}return o},sw=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}i*="Y"===t?this.scaleY:this.scaleX,s&&s.setBounds(e,i),r&&(r.setEnable(e!==i),r.tickLength&&r.setTick(r.tickLength,e,i))},rw=function(t){switch(this.scrollMode){case 0:case 1:(i=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(i,this.isOverflow),(r=this.childrenMap.scroller)&&this.disableUnscrollableDrag&&r.setEnable(this.isOverflow);break;default:var e=this[`isOverflow${t=t.toUpperCase()}`],i=this.childrenMap[`slider${t}`],s=this[`hideUnscrollableSlider${t}`];i&&s&&this.setChildVisible(i,e);var r=this.childrenMap.scroller,n=this[`disableUnscrollableDrag${t}`];r&&n&&r.setEnable(e)}},nw=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(o=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=o.childrenMap.track,s=o.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&nthis.topTextOY}textOYExeceedBottom(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:s?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}setTextOY(t){return this.textOY=t,this}set t(t){this.textOY=-this.textVisibleHeight*t}get t(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t}setTextOYByPercentage(t){return this.t=t,this}}var kw=function(t){return t.add.text(0,0,"")};Object.assign(Cw.prototype,mw);var Sw={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},ww={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const _w=Phaser.Utils.Objects.GetValue;class Ew extends lw{constructor(t,e){void 0===e&&(e={});var i=_w(e,"text",void 0),s=_w(e,"textWidth",void 0),r=_w(e,"textHeight",void 0),n=_w(e,"textCrop",!!i.setCrop),a=_w(e,"textMask",!n),o=_w(e,"content",""),h=new Cw(t,{width:s,height:r,text:i,textMask:a,textCrop:n&&!a,content:o,clampTextOY:_w(e,"clampChildOY",!1),alwaysScrollable:_w(e,"alwaysScrollable",!1)});t.add.existing(h),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textObjectHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.textHeight}})}(h),e.scrollMode=0,e.type="rexTextArea",e.child={gameObject:h,expandWidth:void 0===s,expandHeight:void 0===r};var l=_w(e,"space",void 0);l&&(l.child=_w(l,"text",0)),super(t,e),this.addChildrenMap("text",i)}get text(){return this.childrenMap.child.text}get lineHeight(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.textHeight}}Object.assign(Ew.prototype,Sw,ww);const Tw=Phaser.Utils.Objects.GetValue;var Ow=function(t,e,i){e=e?y(e):{};var s=Tw(i,"background",Qx),r=Tw(i,"text",Pw),n=Tw(i,"track",Qx),a=Tw(i,"thumb",Qx);s?e.background=s(t,e.background):delete e.background,r?e.text=r(t,e.text):delete e.text;var o=e.slider;!1!==o&&null!==o&&(void 0===o&&(o={}),n?o.track=n(t,o.track):delete o.track,a?o.thumb=a(t,o.thumb):delete o.thumb,e.slider=o);var h=new Ew(t,e);return t.add.existing(h),h},Pw=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("key")&&(i="bitmaptext",e.font=e.key)),i){case"bitmaptext":case"bitmap":s=new Bk(t,e);break;case"bbcodetext":case"bbcode":s=new Ak(t,0,0,"",e);break;case"label":s=new zk(t,e);break;case"textarea":s=Ow(t,e);break;default:s=new iC(t,e)}return Zx(s,e),t.add.existing(s),s},Mw=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("leftWidth")?i="nineSlice":(e.hasOwnProperty("color")||e.hasOwnProperty("strokeColor"))&&(i="roundRectangle")),i){case"nineSlice":s=e.hasOwnProperty("stretchMode")?new Kx(t,e):new Ox(t,e);break;case"roundRectangle":s=new vx(t,e);break;default:s=new Ax(t,e)}return Zx(s,e),t.add.existing(s),s};const Dw=Phaser.Utils.Objects.GetValue;var Aw=function(t,e,i){e=e?y(e):{};var s=Dw(i,"background",Qx),r=Dw(i,"text",Pw),n=Dw(i,"icon",Mw),a=Dw(i,"action",Mw);return null!==e.background&&s?e.background=s(t,e.background):delete e.background,null!==e.text&&r?e.text=r(t,e.text):delete e.text,null!==e.icon&&n?e.icon=n(t,e.icon):delete e.icon,null!==e.action&&a?e.action=a(t,e.action):delete e.action,e};const Lw=Phaser.Utils.Objects.GetValue;var Rw=function(t,e,i){var s,r,n=Lw(i,"innerBackground",Qx),a=Lw(i,"separator",Qx),o=Lw(i,"title",Pw);null!==e.innerBackground&&n&&(s=n(t,e.innerBackground)),null!==e.separator&&a&&(r=a(t,e.separator)),e=Aw(t,e,i),s?e.innerBackground=s:delete e.innerBackground,r?e.separator=r:delete e.separator,null!==e.title&&o?e.title=o(t,e.title):delete e.title;var h=e.background;return h&&(s?t.children.moveBelow(h,s):r&&t.children.moveBelow(h,r)),e};class Fw extends Jb{constructor(t,e,i){super(t,e=Rw(t,e,i))}}var Bw={start:function(t){return this.easeValueTask||(this.easeValueTask=new ol(this,{eventEmitter:null})),void 0!==t&&(this.duration=t,this.easeValueTask.stop()),this.easeValueTask.isRunning||(this.easeValueTask.restart({key:"value",from:0,to:1,duration:this.duration,ease:this.ease,repeat:-1,delay:this.delay,repeatDelay:this.repeatDelay}),this.setDirty()),this},stop:function(){return this.easeValueTask?(this.easeValueTask.stop(),this.setDirty(),this):this},pause:function(){return this.easeValueTask?(this.easeValueTask.pause(),this.setDirty(),this):this},resume:function(){return this.easeValueTask?(this.easeValueTask.pause(),this.setDirty(),this):this}};const Iw=Phaser.Utils.Objects.GetValue;class jw extends Zl{constructor(t,e){super(t,Iw(e,"x",0),Iw(e,"y",0),Iw(e,"width",64),Iw(e,"height",64)),this.resetFromConfig(e,!0),this.buildShapes(e),Iw(e,"start",!0)&&this.start()}resetFromConfig(t,e){var i;return void 0===e&&(e=!1),i=e?1e3:this.duration,this.setDuration(Iw(t,"duration",i)),i=e?"Linear":this.ease,this.setEase(Iw(t,"ease",i)),i=e?0:this.delay,this.setDelay(Iw(t,"delay",i)),i=e?0:this.repeatDelay,this.setRepeatDelay(Iw(t,"repeatDelay",i)),i=e?16777215:this.color,this.setColor(Iw(t,"color",i)),i=e?0:this.value,this.setValue(Iw(t,"value",i)),this}buildShapes(){}get centerX(){return this.width/2}get centerY(){return this.height/2}get radius(){return Math.min(this.centerX,this.centerY)}get color(){return this._color}set color(t){this.isColorChanged=this.isColorChanged||this._color!==t,this.dirty=this.dirty||this.isColorChanged,this._color=t,this.setShapesColor(t)}setColor(t){return this.color=t,this}setShapesColor(t){}get value(){return this._value}set value(t){t=Phaser.Math.Clamp(t,0,1),this.dirty=this.dirty||this._value!=t,this._value=t}setValue(t){return this.value=t,this}setDuration(t){return this.duration=t,this}setDelay(t){return this.delay=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return this.ease=t,this}get isRunning(){return!!this.tweenTask&&this.tweenTask.isRunning}}Object.assign(jw.prototype,Bw);const zw=Phaser.Math.DegToRad,Nw=Phaser.Math.Linear,Gw=Phaser.Math.Easing.Expo.In,Xw={right:0,down:1,left:2,up:3};var Yw=function(t,e,i,s,r,n,a,o,h,l,u){var c=$w(e,0,s,r,n,a,o,h,l,u);t.startAt(c.x,c.y);var d=$w(i,0,s,r,n,a,o,h,l,u);t.lineTo(d.x,d.y);var p=$w(i,i,s,r,n,a,o,h,l,u);t.lineTo(p.x,p.y);var g=$w(0,i,s,r,n,a,o,h,l,u);t.lineTo(g.x,g.y);var f=$w(0,e,s,r,n,a,o,h,l,u);t.lineTo(f.x,f.y);var v=$w(e,e,s,r,n,a,o,h,l,u);t.lineTo(v.x,v.y),t.close()},Ww={},$w=function(t,e,i,s,r,n,a,o,h,l){var u=t*i,c=e*s;return Ww.x=a*u+o*c+r,Ww.y=h*u+l*c+n,Ww},Vw={setDirection(t){return"string"==typeof t&&(t=Xw[t]),this.direction=t,this},buildShapes(){for(var t=0;t<3;t++)this.addShape(new ju)},updateShapes(){var t,e,i,s,r,n;switch(this.direction){case 1:t=this.centerX,e=this.centerY-this.radius;var a=zw(315);i=Math.cos(a),s=Math.sin(a);var o=zw(45);r=Math.cos(o),n=Math.sin(o);break;case 3:t=this.centerX,e=this.centerY+this.radius;a=zw(135);i=Math.cos(a),s=Math.sin(a);o=zw(225);r=Math.cos(o),n=Math.sin(o);break;case 2:t=this.centerX+this.radius,e=this.centerY;a=zw(225);i=Math.cos(a),s=Math.sin(a);o=zw(315);r=Math.cos(o),n=Math.sin(o);break;default:t=this.centerX-this.radius,e=this.centerY;a=zw(45);i=Math.cos(a),s=Math.sin(a);o=zw(135);r=Math.cos(o),n=Math.sin(o)}for(var h=this.radius/7,l=this.getShapes(),u=0,c=l.length;uthis.value)for(var u=0;uthis.value&&(t+=1));for(var r=this.getShapes(),n=0,a=r.length;n0&&(r=!0,void 0===n&&(n=0),void 0===a&&(a=0)),(d=this.getSizerConfig(t)).align=i,d.padding=El(s),tE(r)?(d.expandWidth=eE(r,"width",!1),d.expandHeight=eE(r,"height",!1)):(d.expandWidth=r,d.expandHeight=r),t.isRexSizer||(d.expandWidth&&(t.minWidth=void 0===n?Ir(t):n),d.expandHeight&&(t.minHeight=void 0===a?jr(t):a)),d.alignOffsetX=o,d.alignOffsetY=h,d.alignOffsetOriginX=u,d.alignOffsetOriginY=c,d.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,p&&this.addChildrenMap(e,t),this}},nE={remove(t,e){var i;if("string"==typeof t){if(i=t,!(t=this.sizerChildren[i]))return this}else{if(this.getParentSizer(t)!==this)return this;i=this.childToKey(t)}return i&&(delete this.sizerChildren[i],this.childrenMap.hasOwnProperty(i)&&delete this.childrenMap[i]),Qd.call(this,t,e),this},removeAll(t){for(var e in this.sizerChildren)this.remove(e,t);return this},clear(t){for(var e in this.sizerChildren)delete this.sizerChildren[e],this.childrenMap.hasOwnProperty(e)&&delete this.childrenMap[e];return sm.call(this,t),this}},aE={getChildrenWidth:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var a in r)t=r[a],void 0===(i=this.getChildWidth(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).left+e.right)*this.scaleX,s=Math.max(i,s));return n?void 0:s+(this.space.left+this.space.right)*this.scaleX},getChildrenHeight:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var a in r)t=r[a],void 0===(i=this.getChildHeight(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).top+e.bottom)*this.scaleY,s=Math.max(i,s));return n?void 0:s+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(s.expandWidth){var r=e-(this.space.left+this.space.right)*this.scaleX,n=s.padding;i=r-(n.left+n.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(s.expandHeight){var r=e-(this.space.top+this.space.bottom)*this.scaleY,n=s.padding;i=r-(n.top+n.bottom)*this.scaleY}return i},getChildrenSizers:function(t){void 0===t&&(t=[]);var e,i=this.sizerChildren;for(var s in i)(e=i[s]).isRexSizer&&t.push(e);return t},layoutChildren:function(){var t,e,i,s,r,n,a,o,h,l,u,c,d=this.innerLeft,p=this.innerTop,g=this.innerWidth,f=this.innerHeight,v=this.sizerChildren;for(var m in v)(t=v[m]).rexSizer.hidden||(i=(e=t.rexSizer).padding,sf.call(this,t),l=this.getExpandedChildWidth(t),u=this.getExpandedChildHeight(t),e.aspectRatio>0&&(Z_.width=e.aspectRatio,Z_.height=1,Q_.width=l,Q_.height=u,l=(c=hl(Z_,Q_,"FIT",!0)).width,u=c.height),t.isRexSizer?(t.runLayout(this,l,u),Wv(t,this)):bp(t,l,u),s=d+i.left*this.scaleX,n=g-(i.left+i.right)*this.scaleX,r=p+i.top*this.scaleY,a=f-(i.top+i.bottom)*this.scaleY,void 0===l&&(l=Ir(t)),void 0===u&&(u=jr(t)),o=(e.alignOffsetX+e.alignOffsetOriginX*l)*this.scaleX,h=(e.alignOffsetY+e.alignOffsetOriginY*u)*this.scaleY,rf.call(this,t,s,r,n,a,e.align,o,h))}};Object.assign(aE,rE,nE);const oE=Phaser.Utils.Objects.IsPlainObject,hE=Phaser.Utils.Objects.GetValue;class lE extends Yv{constructor(t,e,i,s,r,n){oE(e)?(e=hE(n=e,"x",0),i=hE(n,"y",0),s=hE(n,"width",void 0),r=hE(n,"height",void 0)):oE(s)&&(s=hE(n=s,"width",void 0),r=hE(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexOverlapSizer",this.sizerChildren={},this.addChildrenMap("items",this.sizerChildren)}childToKey(t){if("string"!=typeof t)return function(t,e){if(Array.isArray(t))return t.indexOf(e);for(var i in t)if(t[i]===e)return i;return null}(this.sizerChildren,t);var e=t;return this.sizerChildren.hasOwnPropery(e)?e:null}}Object.assign(lE.prototype,aE);const uE=vm.prototype.add,cE=vm.prototype.addSpace;var dE=function(t){var e=!t.isRexSpace,i=!e||this.buttonsExpand?1:0;if(0===this.sizerChildren.length)if(e){!this.buttonsExpand&&("right"===this.buttonsAlign||"center"===this.buttonsAlign||"bottom"===this.buttonsAlign)&&cE.call(this),uE.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&cE.call(this),this.hasTailSpace=s}else uE.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;uE.call(this,t,{index:r,proportion:i,expand:!0})}else uE.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},pE={addButton(t){if(Jg(t))for(var e=t,i=0,s=e.length;i=0;i--)vE.call(this,e[i],t);return this}},yE=function(t,e,i){if(t){var s=this.setValueCallback,r=this.setValueCallbackScope;s&&(r?s.call(r,t,e,i):s(t,e,i)),this.fireEvent("button.statechange",t,e,i)}},bE=function(t){var e=this;t._selected=void 0,Object.defineProperty(t,"selected",{get:function(){return t._selected},set:function(i){if(t._selected!==i){var s=t._selected;t._selected=i,yE.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},xE={add(t){return this.buttons.push(t),t._click||(t._click=new hf(t,this.clickConfig),t._click.on("click",(function(t,e,i,s){this.fireEvent("button.click",e,i,s)}),this).on("enable",(function(t,e){this.fireEvent("button.enable",e)}),this).on("disable",(function(t,e){this.fireEvent("button.disable",e)}),this).on("over",(function(t,e,i,s){this.fireEvent("button.over",e,i,s)}),this).on("out",(function(t,e,i,s){this.fireEvent("button.out",e,i,s)}),this).on("down",(function(t,e,i,s){this.fireEvent("button.down",e,i,s)}),this).on("up",(function(t,e,i,s){this.fireEvent("button.up",e,i,s)}),this),t.isRexContainerLite&&t.sendChildToBack(t)),this.buttonsType&&(void 0===t.name&&console.error(`${this.parent.constructor.name}: Option button miss value`),bE.call(this,t)),this},addMultiple(t){for(var e=0,i=t.length;e0},setButtonEnable(t,e){var i=this.buttons;if(void 0===t||"boolean"==typeof t){e=t;for(var s=0,r=i.length;so.height/2)){r>(h=RE(o.left,o.centerY,t,e))&&(r=h,s=n);var h,l=i[n+1];if(!l||l.y!==o.y)r>(h=RE(o.right,o.centerY,t,e))&&(r=h,s=n+1)}}return s};const BE=Phaser.Utils.Objects.IsPlainObject,IE=Phaser.Utils.Objects.GetValue,jE=Phaser.Display.Align.CENTER;var zE=function(t,e,i,s){if("\n"===t)return this.addNewLine(),this;var r,n,a,o,h;(Vd.call(this,t),BE(e))&&(e=IE(h=e,"padding",0),i=IE(h,"key",void 0),s=IE(h,"index",void 0),r=IE(h,"offsetX",0),n=IE(h,"offsetY",0),a=IE(h,"offsetOriginX",0),o=IE(h,"offsetOriginY",0));return void 0===e&&(e=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=0),void 0===o&&(o=0),(h=this.getSizerConfig(t)).align=jE,h.padding=El(e),h.alignOffsetX=r,h.alignOffsetY=n,h.alignOffsetOriginX=a,h.alignOffsetOriginY=o,void 0===s||s>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(s,0,t),void 0!==i&&this.addChildrenMap(i,t),this},NE={add(t,e,i){if(Jg(t))for(var s=t,r=0,n=s.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,sm.call(this,t),this}},YE={getChildrenWidth:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=0===this.orientation&&t?this.maxChildWidth:this.rexSizer.resolved?this.wrapResult.width:void 0)?e+(this.space.left+this.space.right)*this.scaleX:void 0);var e},getChildrenHeight:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=1===this.orientation&&t?this.maxChildHeight:this.rexSizer.resolved?this.wrapResult.height:void 0)?e+(this.space.top+this.space.bottom)*this.scaleY:void 0);var e},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;sr&&KE.addNewLine(this)}else for(n=0,a=t.length;n=0;i--)eT.call(this,e[i],t);return this}};const sT=Phaser.Utils.Objects.GetValue;class rT extends UE{constructor(t,e){void 0===e&&(e={});var i=e.space;"number"==typeof i&&(e.space={item:i,line:i}),super(t,e),this.type="rexFixWidthButtons",this.buttonGroup=new TE({parent:this,eventEmitter:sT(e,"eventEmitter",this),groupName:sT(e,"groupName",void 0),clickConfig:sT(e,"click",void 0)}).setButtonsType(e);var s=sT(e,"background",void 0),r=sT(e,"buttons",void 0);this.buttonsAlign=sT(e,"align",void 0),s&&this.addBackground(s),r&&this.addButtons(r),this.addChildrenMap("background",s),this.addChildrenMap("buttons",this.buttonGroup.buttons)}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.buttonGroup.destroy(),this.buttonGroup=void 0)}get buttons(){return this.buttonGroup.buttons}get groupName(){return this.buttonGroup.groupName}set groupName(t){this.buttonGroup.groupName=t}get eventEmitter(){return this.buttonGroup.eventEmitter}}Object.assign(rT.prototype,ZE,iT,EE,PE);const nT=oS.prototype.add;var aT={addButton(t,e,i){return nT.call(this,t,e,i,void 0,0,this.buttonsExpand),this.buttonGroup.add(t),this},addButtons(t,e){for(var i=0,s=t;i=0;i--)lT.call(this,e[i],t);return this}};const cT=Phaser.Utils.Objects.GetValue;class dT extends oS{constructor(t,e){void 0===e&&(e={});var i=cT(e,"row",0),s=cT(e,"column",e.col||0),r=cT(e,"createCellContainerCallback"),n=cT(e,"buttons",void 0),a=cT(e,"expand",!0),o=a?1:0;if(r&&(e.createCellContainerCallback=void 0),void 0!==n){i=Math.max(i,n.length);for(var h=0,l=n.length;h=r&&h=i&&hi.length&&(t.prevCursorPosition=null),null!==t.prevCursorPosition&&(r=e.getCharChild(t.prevCursorPosition))&&("\n"===r.text&&r.clearTextSize(),e.emit("cursorout",r,t.prevCursorPosition,e)),null!=s&&(r=e.getCharChild(s))&&("\n"===r.text&&r.copyTextSize(e.lastInsertCursor),function(t){var e,i,s=t.parent,r=s.width,n=s.height,a=t.drawX,o=t.drawY,h=a+t.drawTLX,l=a+t.drawTRX,u=o+t.drawTLY,c=o+t.drawBLY;e=h<0?0-h:l>r?r-l:0,i=u<0?0-u:c>n?n-c:0,s._textOX+=e,s._textOY+=i}(r),e.emit("cursorin",r,s,e)),e.emit("movecursor",s,t.prevCursorPosition,e),t.prevCursorPosition=s}}(this)):(hO(this),lO(this)),this}setNumberInput(){return this.onUpdateCallback=oO,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}}const dO=Phaser.Utils.Objects.GetValue,pO=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var gO=function(){var t=this.scene.input.keyboard;this.textEdit.on("open",(function(){t.on("keydown-UP",this.cursorMoveUp,this).on("keydown-DOWN",this.cursorMoveDown,this)}),this).on("close",(function(){t.off("keydown-UP",this.cursorMoveUp,this).off("keydown-DOWN",this.cursorMoveDown,this)}),this)},fO=function(t){pr(t)||this.setCursorStyle(t).on("cursorin",(function(t){var e=this.cursorStyle,i=ux(t.style,e);Sl(e,i)||(t.styleSave=i,t.modifyStyle(e))}),this).on("cursorout",(function(t){t.styleSave&&(t.modifyStyle(t.styleSave),t.styleSave=void 0)}),this)},vO=function(t){pr(t)||this.setRangeStyle(t).on("rangein",(function(t){var e=this.rangeStyle,i=ux(t.style,e);Sl(e,i)||(t.styleSave=i,t.modifyStyle(e))}),this).on("rangeout",(function(t){t.styleSave&&(t.modifyStyle(t.styleSave),t.styleSave=void 0)}),this)},mO=function(t){pr(t)||this.setFocusStyle(t).on("open",(function(){var t=this.background,e=this.focusStyle,i=ux(t,e);Sl(e,i)||(t.styleSave=i,t.modifyStyle(e))}),this).on("close",(function(){var t=this.background;t.styleSave&&(t.modifyStyle(t.styleSave),t.styleSave=void 0)}),this)};function yO(){}function bO(t,e,i,s,r){let n=0,a=e.length,o=0,h=0;for(;nt.length?i:t})),a.value=t.join(e)}else a.value=t.join(i.slice(o,o+a.count));o+=a.count,a.added||(h+=a.count)}}let l=e[a-1];return a>1&&"string"==typeof l.value&&(l.added||l.removed)&&t.equals("",l.value)&&(e[a-2].value+=l.value,e.pop()),e}yO.prototype={diff(t,e,i={}){let s=i.callback;"function"==typeof i&&(s=i,i={}),this.options=i;let r=this;function n(t){return s?(setTimeout((function(){s(void 0,t)}),0),!0):t}t=this.castInput(t),e=this.castInput(e),t=this.removeEmpty(this.tokenize(t));let a=(e=this.removeEmpty(this.tokenize(e))).length,o=t.length,h=1,l=a+o;i.maxEditLength&&(l=Math.min(l,i.maxEditLength));let u=[{newPos:-1,components:[]}],c=this.extractCommon(u[0],e,t,0);if(u[0].newPos+1>=a&&c+1>=o)return n([{value:this.join(e),count:e.length}]);function d(){for(let s=-1*h;s<=h;s+=2){let h,l=u[s-1],c=u[s+1],d=(c?c.newPos:0)-s;l&&(u[s-1]=void 0);let p=l&&l.newPos+1=a&&d+1>=o)return n(bO(r,h.components,e,t,r.useLongestToken));u[s]=h}else u[s]=void 0}var i;h++}if(s)!function t(){setTimeout((function(){if(h>l)return s();d()||t()}),0)}();else for(;h<=l;){let t=d();if(t)return t}},pushComponent(t,e,i){let s=t[t.length-1];s&&s.added===e&&s.removed===i?t[t.length-1]={count:s.count+1,added:e,removed:i}:t.push({count:1,added:e,removed:i})},extractCommon(t,e,i,s){let r=e.length,n=i.length,a=t.newPos,o=a-s,h=0;for(;a+1t,tokenize:t=>t.split(""),join:t=>t.join("")};const xO=new yO;const CO=/^[a-zA-Z\u{C0}-\u{FF}\u{D8}-\u{F6}\u{F8}-\u{2C6}\u{2C8}-\u{2D7}\u{2DE}-\u{2FF}\u{1E00}-\u{1EFF}]+$/u,kO=/\S/,SO=new yO;SO.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!kO.test(t)&&!kO.test(e)},SO.tokenize=function(t){let e=t.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/);for(let t=0;tvoid 0===i?e:i}=this.options;return"string"==typeof t?t:JSON.stringify(TO(t,null,null,i),i," ")},EO.equals=function(t,e){return yO.prototype.equals.call(EO,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const OO=new yO;OO.tokenize=function(t){return t.slice()},OO.join=OO.removeEmpty=function(t){return t};const PO=Phaser.Utils.Array.Remove;var MO=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),PO(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(h=i,l=e,xO.diff(h,l,u)),r=0,n=0,a=s.length;nr)i+=a;else{if(s!==r)break;i+=Math.min(e.position,a)}}return i},FO={cursorMoveLeft(){if(!this.isOpened)return this;var t=AO(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=AO(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=LO(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=AO(RO(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=LO(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=AO(RO(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const BO=Phaser.Utils.Objects.IsPlainObject;class IO extends zb{constructor(t,e,i,s,r,n){BO(e)?n=e:BO(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(tt(e,"wrap.vAlign")||Z(e,"wrap.vAlign",s=i?"center":"top"),tt(e,"wrap.wrapMode")||Z(e,"wrap.wrapMode","char"),tt(e,"wrap.maxLines")||Z(e,"wrap.maxLines",s=i?1:void 0),i&&Z(e,"wrap.wrapWidth",1/0),tt(e,"wrap.useDefaultTextHeight")||Z(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!tt(e.edit,"inputType")){var s=i?"text":"textarea";Z(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new $o(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var a=n.text;a&&delete n.text;var o=lx(n.background,"focus"),h=lx(n.style,"cursor"),l=lx(n.style,"range");super(t,e,i,s,r,n),this.type="rexCanvasInput",this.contentWidth=void 0,this.contentHeight=void 0,this.lineHeight=void 0,this.linesCount=void 0,this.characterCountOfLines=[],this._text,this.textEdit=function(t,e){var i=dO(e,"edit");return void 0===i&&(i={}),UT(e,i,pO),new cO(t,i)}(this,n),gO.call(this),n.focusStyle&&Object.assign(o,n.focusStyle),mO.call(this,o),n.cursorStyle&&Object.assign(h,n.cursorStyle),fO.call(this,h),n.rangeStyle&&Object.assign(l,n.rangeStyle),pr(l)&&Object.assign(l,h),vO.call(this,l);var u=n.onAddChar;u&&this.on("addchar",u);var c=n.onCursorIn;c&&this.on("cursorin",c);var d=n.onCursorOut;d&&this.on("cursorout",d);var p=!n.onRangeIn&&!n.onRangeOut,g=p?n.onCursorIn:n.onRangeIn;g&&this.on("rangein",g);var f=p?n.onCursorOut:n.onRangeOut;f&&this.on("rangeout",f);var v,m=n.onMoveCursor;m&&this.on("movecursor",m),this.setParseTextCallback(n.parseTextCallback),this.lastInsertCursor=((v=this.createCharChild("|")).text="",v),a||(a=""),this.setText(a)}addChild(t,e){if(super.addChild(t,e),Array.isArray(t))for(var i=t,s=0,r=i.length;s0&&Z(t,"expandTextWidth",!0),h>0&&Z(t,"expandTextHeight",!0),void 0===i&&(i={}),i.hasOwnProperty("icon")||(i.icon=function(t,e){var i=new xc(t,e);return Zx(i,e),i.setOrigin(.5,1),t.add.existing(i),i});var y=!1;i.hasOwnProperty("action")||(i.action=function(t,e){void 0===e&&(e={});var i=new I_(t,e);return Zx(i,e),t.add.existing(i),i},y=!0);var b,x,C=new Fw(r,t,i);C.setMinSize(o,h).setOrigin(.5,1).layout(),r.add.existing(C),kr(C,e),C.vpx=l,C.vpy=u,C.frameDelimiter=c,y&&(b=C.getElement("action"),C.setChildVisible(b,!1)),Ec(C),C.emitClick=function(){C.emit("click")},void 0===d&&(d=v.getData("$clickTarget")),null===d||(x="screen"===d.toLowerCase()?f.sys.anyTouchDetector:C.setInteractive()),x&&C.bindEvent(x,"pointerdown",(function(){C.emitClick()})),C.bindEvent(r.input.keyboard,"keydown",(function(t){if(void 0===p&&(p=v.getData("$clickShortcutKeys")),p){var e=p.split("|"),i=z_[t.keyCode];-1!==e.indexOf(i)&&C.emitClick()}}));var k=function(){C.isTyping?C.once("click",k).stop(!0):C.isLastPage?C.complete2Flag||(C.complete2Flag=!0,C.emit("complete2")):C.once("click",k).typeNextPage()},S=function(){C.isPageEnd&&(C.off("click",S),y&&(b.stop(),C.setChildVisible(b,!1)),v.emit("resume.input"))};C._typeNextPage=S,C.on("pageend",(function(){y&&(b.start(),C.setChildVisible(b,!0)),C.once("click",S);let t=v.getData("$fastTyping"),e=v.getData("$autoNextPage");var i;(t||e)&&(i=t?0:v.getData("$autoNextPageDelay"),f.sys.timeline.delayCall(i,C.emitClick)),v.emit("pause.input")})).on("start",(function(){C.off("click",k).once("click",k)}));var w=v.getData("$fastTyping"),_=v.getData("$autoNextPage");C.bindScenePreupdateEvent((function(){let t=v.getData("$fastTyping"),e=v.getData("$autoNextPage");if(t!==w)if(C.isTyping){let e;t?e=v.getData("$fastTypingSpeed"):void 0===e&&(e=C.normalTypingSpeed),C.setTypingSpeed(e)}else t&&C.emitClick();else e===_||t||C.isTyping||e&&C.emitClick();w=t,_=e}));var E=function(t,e){if(void 0===g&&(g=v.getData("$fastTypingShortcutKeys")),g){var i=g.split("|"),s=z_[t.keyCode];-1!==i.indexOf(s)&&v.setData("$fastTyping",e)}};return C.bindEvent(r.input.keyboard,"keydown",(function(t){E(t,!0)})),C.bindEvent(r.input.keyboard,"keyup",(function(t){E(t,!1)})),C}}(G_(e,`styles.${Uo}`,{}),{viewport:i},r);t.addGameObjectManager({name:Uo,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Mo,commands:{typing:Rc,shake:Tc}})}},function(t,e){var{viewport:i}=e,s=Pc(e,`creators.${Vo}`,void 0);if(!1!==s){if(Mc(s)&&(s=void 0),void 0===s){Pc(e,`styles.${Vo}`,{});s=function(t,{viewport:e}={}){return function(t,i){i.hasOwnProperty("scaleMode")||(i.scaleMode=0);var s=new xc(t,i);t.add.existing(s),kr(s,e);var{vpx:r=.5,vpy:n=.5,vpw:a,vph:o,scaleMode:h}=i;if(s.vpx=r,s.vpy=n,h||void 0!==a||void 0!==o){void 0===a&&(a=1),void 0===o&&(o=1);var l=e.width*a,u=e.height*o;s.resize(l,u)}return Ec(s),s}}(0,{viewport:i})}t.addGameObjectManager({name:Vo,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Oo,commands:{cross:Oc,shake:Tc}})}},function(t,e){var{viewport:i}=e,s=zT(e,`creators.${Ko}`,void 0);if(!1!==s){var r;if(NT(s)&&(r=s,s=void 0),void 0===s)s=function(t,{viewport:e}={},i){return function(s,{vpw:r,vph:n,width:a=0,height:o=0,vpx:h=.5,vpy:l=.5}={}){void 0!==r&&(a=e.width*r),void 0!==n&&(o=e.height*n);var u=new IT(s,t,i);return u.setMinSize(a,o).setVisible(!1),s.add.existing(u),kr(u,e),u.vpx=h,u.vpy=l,Ec(u),u}}(zT(e,`styles.${Ko}`,{}),{viewport:i},r);t.addGameObjectManager({name:Ko,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Mo,commands:{choice:jT,shake:Tc}})}},function(t,e){var{viewport:i}=e,s=WO(e,`creators.${Jo}`,void 0);if(!1!==s){var r;if($O(s)&&(r=s,s=void 0),void 0===s)s=function(t,{viewport:e}={},i){return function(s,{vpw:r,vph:n,width:a=0,height:o=0,vpx:h=.5,vpy:l=.5}={}){void 0!==r&&(a=e.width*r),void 0!==n&&(o=e.height*n);var u=new XO(s,t,i);return u.setMinSize(a,o).setVisible(!1),s.add.existing(u),kr(u,e),u.vpx=h,u.vpy=l,Ec(u),u}}(WO(e,`styles.${Jo}`,{}),{viewport:i},r);t.addGameObjectManager({name:Jo,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Mo,commands:{input:YO,shake:Tc}})}},function(t,e){var{viewport:i}=e,s=K_(e,`creators.${qo}`,void 0);if(!1!==s){var r;if(J_(s)&&(r=s,s=void 0),void 0===s)s=function(t,{viewport:e}={},i){return function(s,{vpw:r,vph:n,width:a=0,height:o=0,vpx:h=1,vpy:l=0,alignLeft:u=!1,alignRight:c=!0,alignTop:d=!0,alignBottom:p=!1,text0:g,text1:f,commandExecutor:v,eventSheetManager:m,eventsheet:y}={}){void 0!==r&&(a=e.width*r),void 0!==n&&(o=e.height*n),void 0===i&&(i={}),i.hasOwnProperty("icon")||(i.icon=function(t,e){var i=new xc(t,e);return Zx(i,e),i.setOrigin(.5,1),t.add.existing(i),i});var b,x,C=new Y_(s,t,i);return g&&C.setTitle(g),f&&C.setText(f),b=u?0:c?1:.5,x=d?0:p?1:.5,C.setMinSize(a,o).setOrigin(b,x).layout(),s.add.existing(C),kr(C,e),C.vpx=h,C.vpy=l,Ec(C),C}}(K_(e,`styles.${qo}`,{}),{viewport:i},r);t.addGameObjectManager({name:qo,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Mo,commands:{setText:$_,popUp:V_,shake:Tc}})}}];var HO=[function(t){t.addExpression("random",(function(t,e){return void 0===t&&void 0===e?(t=0,e=1):void 0===e&&(e=t,t=0),t+Math.random()*(e-t)}))},function(t){t.addExpression("randomInt",(function(t,e){return Math.floor(t+Math.random()*(e-t+1))}))}],UO={$typingSpeed:100,$autoNextPage:!1,$autoNextPageDelay:500,$fastTyping:!1,$fastTypingSpeed:20,$clickShortcutKeys:"SPACE|ENTER",$fastTypingShortcutKeys:"CTRL",$clickTarget:"screen",$transitionDuration:500,$tintOthers:3355443,$shakeDuration:500,$shakeMagnitude:50},qO=function(t,e){var{defaultVariables:i}=e;for(var s in i=function(t,e){var i=lo(t);for(var s in e)i.hasOwnProperty(s)||(i[s]=e[s]);return i}(i,UO),i)t.setData(s,i[s])};return class extends or{constructor(t,e={}){e.commandExecutor=function(t,e){var{layerDepth:i,rootLayer:s,multipleCamerasEnable:r=!1,viewport:n}=e;void 0===n&&(e.viewport=on(t,t.cameras.main));for(var a=new To(t,{layers:r?No:Go,layerDepth:i,rootLayer:s}),o=0,h=VO.length;o=this._config.preview;if(s)e.postMessage({results:o,workerId:a.WORKER_ID,finished:l});else if(k(this._config.chunk)&&!i){if(this._config.chunk(o,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);o=void 0,this._completeResults=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(o.data),this._completeResults.errors=this._completeResults.errors.concat(o.errors),this._completeResults.meta=o.meta),this._completed||!l||!k(this._config.complete)||o&&o.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),l||o&&o.meta.paused||this._nextChunk(),o}this._halted=!0},this._sendError=function(t){k(this._config.error)?this._config.error(t):s&&this._config.error&&e.postMessage({workerId:a.WORKER_ID,error:t,finished:!1})}}function l(t){var e;(t=t||{}).chunkSize||(t.chunkSize=a.RemoteChunkSize),h.call(this,t),this._nextChunk=i?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(t){this._input=t,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(e=new XMLHttpRequest,this._config.withCredentials&&(e.withCredentials=this._config.withCredentials),i||(e.onload=x(this._chunkLoaded,this),e.onerror=x(this._chunkError,this)),e.open(this._config.downloadRequestBody?"POST":"GET",this._input,!i),this._config.downloadRequestHeaders){var t=this._config.downloadRequestHeaders;for(var s in t)e.setRequestHeader(s,t[s])}if(this._config.chunkSize){var r=this._start+this._config.chunkSize-1;e.setRequestHeader("Range","bytes="+this._start+"-"+r)}try{e.send(this._config.downloadRequestBody)}catch(t){this._chunkError(t.message)}i&&0===e.status&&this._chunkError()}},this._chunkLoaded=function(){4===e.readyState&&(e.status<200||400<=e.status?this._chunkError():(this._start+=this._config.chunkSize?this._config.chunkSize:e.responseText.length,this._finished=!this._config.chunkSize||this._start>=function(t){var e=t.getResponseHeader("Content-Range");return null===e?-1:parseInt(e.substring(e.lastIndexOf("/")+1))}(e),this.parseChunk(e.responseText)))},this._chunkError=function(t){var i=e.statusText||t;this._sendError(new Error(i))}}function u(t){var e,i;(t=t||{}).chunkSize||(t.chunkSize=a.LocalChunkSize),h.call(this,t);var s="undefined"!=typeof FileReader;this.stream=function(t){this._input=t,i=t.slice||t.webkitSlice||t.mozSlice,s?((e=new FileReader).onload=x(this._chunkLoaded,this),e.onerror=x(this._chunkError,this)):e=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount=this._input.size,this.parseChunk(t.target.result)},this._chunkError=function(){this._sendError(e.error)}}function c(t){var e;h.call(this,t=t||{}),this.stream=function(t){return e=t,this._nextChunk()},this._nextChunk=function(){if(!this._finished){var t,i=this._config.chunkSize;return i?(t=e.substring(0,i),e=e.substring(i)):(t=e,e=""),this._finished=!e,this.parseChunk(t)}}}function d(t){h.call(this,t=t||{});var e=[],i=!0,s=!1;this.pause=function(){h.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){h.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(t){this._input=t,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){s&&1===e.length&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),e.length?this.parseChunk(e.shift()):i=!0},this._streamData=x((function(t){try{e.push("string"==typeof t?t:t.toString(this._config.encoding)),i&&(i=!1,this._checkIsFinished(),this.parseChunk(e.shift()))}catch(t){this._streamError(t)}}),this),this._streamError=x((function(t){this._streamCleanUp(),this._sendError(t)}),this),this._streamEnd=x((function(){this._streamCleanUp(),s=!0,this._streamData("")}),this),this._streamCleanUp=x((function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)}),this)}function p(t){var e,i,s,r=Math.pow(2,53),n=-r,o=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,h=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,l=this,u=0,c=0,d=!1,p=!1,v=[],m={data:[],errors:[],meta:{}};if(k(t.step)){var y=t.step;t.step=function(e){if(m=e,S())C();else{if(C(),0===m.data.length)return;u+=e.data.length,t.preview&&u>t.preview?i.abort():(m.data=m.data[0],y(m,l))}}}function x(e){return"greedy"===t.skipEmptyLines?""===e.join("").trim():1===e.length&&0===e[0].length}function C(){return m&&s&&(T("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+a.DefaultDelimiter+"'"),s=!1),t.skipEmptyLines&&(m.data=m.data.filter((function(t){return!x(t)}))),S()&&function(){if(m)if(Array.isArray(m.data[0])){for(var e=0;S()&&e=v.length?"__parsed_extra":v[s]),t.transform&&(a=t.transform(a,n)),a=w(n,a),"__parsed_extra"===n?(r[n]=r[n]||[],r[n].push(a)):r[n]=a}return t.header&&(s>v.length?T("FieldMismatch","TooManyFields","Too many fields: expected "+v.length+" fields but parsed "+s,c+i):s=s.length/2?"\r\n":"\r"}(r,h)),s=!1,t.delimiter)k(t.delimiter)&&(t.delimiter=t.delimiter(r),m.meta.delimiter=t.delimiter);else{var l=function(e,i,s,r,n){var o,h,l,u;n=n||[",","\t","|",";",a.RECORD_SEP,a.UNIT_SEP];for(var c=0;c=o)return H(!0)}else for(z=u,u++;;){if(-1===(z=a.indexOf(e,z+1)))return p||C.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:x.length,index:u}),Y();if(z===f-1)return Y(a.substring(u,z).replace(j,e));if(e!==l||a[z+1]!==l){if(e===l||0===z||a[z-1]!==l){-1!==F&&F=o)return H(!0);break}C.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:x.length,index:u}),z++}}else z++}return Y();function W(t){x.push(t),w=u}function V(t){var e=0;if(-1!==t){var i=a.substring(z+1,t);i&&""===i.trim()&&(e=i.length)}return e}function Y(t){return p||(void 0===t&&(t=a.substring(u)),S.push(t),u=f,W(S),b&&$()),H()}function X(t){u=t,W(S),S=[],I=a.indexOf(s,u)}function H(t){return{data:x,errors:C,meta:{delimiter:i,linebreak:s,aborted:c,truncated:!!t,cursor:w+(d||0)}}}function $(){n(H()),x=[],C=[]}},this.abort=function(){c=!0},this.getCharIndex=function(){return u}}function v(t){var e=t.data,i=r[e.workerId],s=!1;if(e.error)i.userError(e.error,e.file);else if(e.results&&e.results.data){var n={abort:function(){s=!0,m(e.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:y,resume:y};if(k(i.userStep)){for(var a=0;a>16&255},br=function(t){return t>>8&255},xr=function(t){return 255&t};const kr=Phaser.Events.EventEmitter;var Cr=function(t,e,i,s,r,n){return void 0===n?n={}:!0===n&&(n=Sr),"number"!=typeof i&&(i=0,s=0),n.x=r.x+r.width*t+i,n.y=r.y+r.height*e+s,n},Sr={},wr=function(t,e,i,s,r,n,a){if(t.hasOwnProperty("vp"))return t;"function"==typeof i&&(a=i,i=void 0),"function"==typeof r&&(a=r,r=void 0),void 0===i&&(i=.5),void 0===s&&(s=.5),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=Cr),function(t){if(t.events)return t;var e=new kr,i=t.x;Object.defineProperty(t,"x",{get:function(){return i},set:function(s){i!==s&&(i=s,e.emit("update",t))}});var s=t.y;Object.defineProperty(t,"y",{get:function(){return s},set:function(i){s!==i&&(s=i,e.emit("update",t))}});var r=t.width;Object.defineProperty(t,"width",{get:function(){return r},set:function(i){r!==i&&(r=i,e.emit("update",t))}});var n=t.height;Object.defineProperty(t,"height",{get:function(){return n},set:function(i){n!==i&&(n=i,e.emit("update",t))}}),t.events=e}(e);var o=e.events;t.vp=e;var h=function(){a(i,s,r,n,e,t)};o.on("update",h),t.once("destroy",(function(){o.off("update",h),t.vp=void 0})),Object.defineProperty(t,"vpx",{get:function(){return i},set:function(t){i!==t&&(i=t,h())}}),Object.defineProperty(t,"vpy",{get:function(){return s},set:function(t){s!==t&&(s=t,h())}}),Object.defineProperty(t,"vpxOffset",{get:function(){return r},set:function(t){r!==t&&(r=t,h())}}),Object.defineProperty(t,"vpyOffset",{get:function(){return n},set:function(t){n!==t&&(n=t,h())}}),h()},Tr=function(t,e){if(!t)return!1;if(t.hasOwnProperty(e))return!0;for(;t;){if(Object.getOwnPropertyDescriptor(t,e))return!0;t=t.__proto__}return!1},Pr=function(t){return t.preFX?t.preFX:t.postFX?t.postFX:null},Or=function(t,e){t._effectSwitchNames||(t._effectSwitchNames=[],t.clearAllEffects=function(){for(var e=t._effectSwitchNames,i=0,s=e.length;i0&&void 0!==t.setTint},useAlphaFadeEffect(t){return(void 0===this.fadeMode||1===this.fadeMode)&&this.fadeTime>0&&void 0!==t.setAlpha},useRevealEffect(t){return this.fadeMode>=2&&this.fadeMode<=5&&this.fadeTime>0&&(t.preFX||t.postFX)},fadeBob(t,e,i,s){var r=t.gameObject;if(this.useTintFadeEffect(r))void 0!==e&&t.setProperty("tintGray",255*e),t.easeProperty({property:"tintGray",value:Math.floor(255*i),duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s});else if(this.useAlphaFadeEffect(r))void 0!==e&&t.setProperty("alpha",e),t.easeProperty({property:"alpha",value:i,duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s});else if(this.useRevealEffect(r)){var n;switch(Mr(r,"reveal"),this.fadeMode){case 2:n="revealUp";break;case 3:n="revealDown";break;case 4:n="revealLeft";break;case 5:n="revealRight"}void 0===e&&(e=0),r[n]=e,t.easeProperty({property:n,value:i,duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s}),t.getTweenTask(n).once("complete",(function(){r[n]=null}))}else s&&s(r);return this}},zr=function(t){return void 0!==t.displayWidth?t.displayWidth:t.width},Nr=function(t){return void 0!==t.displayHeight?t.displayHeight:t.height};const Gr=Phaser.Geom.Rectangle,Wr=Phaser.Math.Vector2,Vr=Phaser.Math.RotateAround,Yr=Phaser.GameObjects.Container;var Xr=function(t,e){if(void 0===e?e=new Gr:!0===e&&(void 0===Hr&&(Hr=new Gr),e=Hr),t.getBounds&&!(t instanceof Yr))return t.getBounds(e);var i,s,r,n,a,o,h,l;if(t.parentContainer){var u=t.parentContainer.getBoundsTransformMatrix();$r(t,e),u.transformPoint(e.x,e.y,e),i=e.x,s=e.y,Ur(t,e),u.transformPoint(e.x,e.y,e),r=e.x,n=e.y,Kr(t,e),u.transformPoint(e.x,e.y,e),a=e.x,o=e.y,qr(t,e),u.transformPoint(e.x,e.y,e),h=e.x,l=e.y}else $r(t,e),i=e.x,s=e.y,Ur(t,e),r=e.x,n=e.y,Kr(t,e),a=e.x,o=e.y,qr(t,e),h=e.x,l=e.y;return e.x=Math.min(i,r,a,h),e.y=Math.min(s,n,o,l),e.width=Math.max(i,r,a,h)-e.x,e.height=Math.max(s,n,o,l)-e.y,e},Hr=void 0,$r=function(t,e,i){return void 0===e?e=new Wr:!0===e&&(void 0===Zr&&(Zr=new Wr),e=Zr),t.getTopLeft?t.getTopLeft(e):(e.x=t.x-zr(t)*t.originX,e.y=t.y-Nr(t)*t.originY,Qr(t,e,i))},Ur=function(t,e,i){return void 0===e?e=new Wr:!0===e&&(void 0===Zr&&(Zr=new Wr),e=Zr),t.getTopRight?t.getTopRight(e):(e.x=t.x-zr(t)*t.originX+zr(t),e.y=t.y-Nr(t)*t.originY,Qr(t,e,i))},Kr=function(t,e,i){return void 0===e?e=new Wr:!0===e&&(void 0===Zr&&(Zr=new Wr),e=Zr),t.getBottomLeft?t.getBottomLeft(e):(e.x=t.x-zr(t)*t.originX,e.y=t.y-Nr(t)*t.originY+Nr(t),Qr(t,e,i))},qr=function(t,e,i){return void 0===e?e=new Wr:!0===e&&(void 0===Zr&&(Zr=new Wr),e=Zr),t.getBottomRight?t.getBottomRight(e):(e.x=t.x-zr(t)*t.originX+zr(t),e.y=t.y-Nr(t)*t.originY+Nr(t),Qr(t,e,i))},Jr=function(t,e,i){void 0===e?e=new Wr:!0===e&&(void 0===Zr&&(Zr=new Wr),e=Zr);var s=zr(t),r=Nr(t);return e.x=t.x+s*(.5-t.originX),e.y=t.y+r*(.5-t.originY),Qr(t,e,i)},Zr=void 0,Qr=function(t,e,i){(void 0===i&&(i=!1),0!==t.rotation&&Vr(e,t.x,t.y,t.rotation),i&&t.parentContainer)&&t.parentContainer.getBoundsTransformMatrix().transformPoint(e.x,e.y,e);return e};const tn=Phaser.Utils.Objects.GetValue;var en=function(t,e,i){var s,r,n,a,o;if("number"==typeof i?s=i:(s=tn(i,"color"),r=tn(i,"lineWidth"),n=tn(i,"fillColor"),a=tn(i,"fillAlpha",1),o=tn(i,"padding",0)),Array.isArray(t))for(var h=0,l=t.length;h0?-this.delay:0,this.state=this.nowTime>=0?Zn:Jn,this.repeatCounter=0,this}stop(){return this.state=qn,this}update(t,e){this.state!==qn&&this.state!==ta&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=Qn)):(this.nowTime=this.duration,this.state=ta):this.nowTime>=0&&(this.state=Zn))}get t(){var t;switch(this.state){case qn:case Jn:case Qn:t=0;break;case Zn:t=this.nowTime/this.duration;break;case ta:t=1}return Un(t,0,1)}set t(t){(t=Un(t,-1,1))<0?(this.state=Jn,this.nowTime=-this.delay*t):(this.state=Zn,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===qn}get isDelay(){return this.state===Jn}get isCountDown(){return this.state===Zn}get isRunning(){return this.state===Jn||this.state===Zn}get isDone(){return this.state===ta}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}};const qn=0,Jn=1,Zn=2,Qn=3,ta=-1;class ea extends Xn{constructor(t,e){super(t,e),this.timer=new Kn}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const ia=Phaser.Utils.Objects.GetValue,sa=Phaser.Utils.Objects.GetAdvancedValue,ra=Phaser.Tweens.Builders.GetEaseFunction;class na extends ea{resetFromJSON(t){return this.timer.resetFromJSON(ia(t,"timer")),this.setEnable(ia(t,"enable",!0)),this.setTarget(ia(t,"target",this.parent)),this.setDelay(sa(t,"delay",0)),this.setDuration(sa(t,"duration",1e3)),this.setEase(ia(t,"ease","Linear")),this.setRepeat(ia(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=ra(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const aa=Phaser.Sound.BaseSound;var oa=function(t){return t instanceof aa};const ha=Phaser.Utils.Objects.GetValue,la=Phaser.Utils.Objects.GetAdvancedValue,ua=Phaser.Math.Linear;let ca=class extends na{constructor(t,e,i){oa(t)&&(i=e,e=t,t=void 0),e.active=!0,e.scene=t,e.game=e.manager.game,super(e,i),this.volume={},this.resetFromJSON(i)}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(ha(t,"mode",0)),this.setEnable(ha(t,"enable",!0)),this.setVolumeRange(la(t,"volume.start",this.parent.volume),la(t,"volume.end",0)),this}setMode(t){return"string"==typeof t&&(t=da[t]),this.mode=t,this}setVolumeRange(t,e){return this.volume.start=t,this.volume.end=e,this}start(){return this.timer.isRunning||(this.parent.setVolume(this.volume.start),this.timer.setDelay(this.delay).setDuration(this.duration),super.start()),this}updateTarget(t,e){t.volume=ua(this.volume.start,this.volume.end,e.t)}complete(){switch(super.complete(),this.mode){case 1:this.parent.stop();break;case 2:this.parent.stop(),this.parent.destroy()}return this}};const da={stop:1,destroy:2};var pa=function(t,e,i,s,r){oa(t)&&(r=s,s=i,i=e,e=t,t=void 0),void 0===s&&(s=1),void 0===r&&(r=0);var n,a={mode:0,volume:{start:r,end:s},duration:i};return"string"==typeof e&&(e=t.sys.sound.add(e)),e.hasOwnProperty("_fade")?(n=e._fade).stop().resetFromJSON(a):(n=new ca(t,e,a),e._fade=n),n.start(),e.isPlaying||e.setVolume(r).play(),e},ga=function(t,e,i,s){oa(t)&&(s=i,i=e,e=t,t=void 0),void 0===s&&(s=!0);var r,n={mode:s?2:1,volume:{start:e.volume,end:0},duration:i};return e.hasOwnProperty("_fade")?(r=e._fade).stop().resetFromJSON(n):(r=new ca(t,e,n),e._fade=r),r.start(),e.isPlaying||e.play(),e};const fa=Phaser.Utils.Objects.GetValue;var va={setBackgroundMusicLoop(t){return void 0===t&&(t=!0),this.backgroundMusicLoop=t,this},setBackgroundMusicFadeTime(t){return this.backgroundMusicFadeTime=t,this},getBackgroundMusic(){return this.backgroundMusic},setCurrentBackgroundMusic(t){return this.backgroundMusic=t,t&&(t.once("complete",(function(){this.backgroundMusic===t&&(this.backgroundMusic.destroy(),this.backgroundMusic=void 0)}),this).once("destroy",(function(){this.backgroundMusic===t&&(this.backgroundMusic=void 0)}),this),t.isPlaying||t.play()),this},playBackgroundMusic(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;if(this.backgroundMusic&&this.backgroundMusic.key===t)return this;this.stopBackgroundMusic();var i=this.sound.add(t,{loop:fa(e,"loop",this.backgroundMusicLoop),mute:fa(e,"mute",this.backgroundMusicMute),volume:fa(e,"volume",this.backgroundMusicVolume),detune:fa(e,"detune",0),rate:fa(e,"rate",1)});return this.setCurrentBackgroundMusic(i),this.backgroundMusicFadeTime>0&&this.fadeInBackgroundMusic(this.backgroundMusicFadeTime),this},pauseBackgroundMusic(){return this.backgroundMusic&&this.backgroundMusic.pause(),this},resumeBackgroundMusic(){return this.backgroundMusic&&this.backgroundMusic.resume(),this},stopBackgroundMusic(){return this.backgroundMusic&&(this.backgroundMusicFadeTime>0?this.fadeOutBackgroundMusic(this.backgroundMusicFadeTime,!0):(this.backgroundMusic.stop(),this.backgroundMusic.destroy(),this.backgroundMusic=void 0)),this},fadeInBackgroundMusic(t){return this.backgroundMusic&&pa(this.backgroundMusic,t,this.backgroundMusicVolume,0),this},fadeOutBackgroundMusic(t,e){return this.backgroundMusic&&ga(this.backgroundMusic,t,e),this},crossFadeBackgroundMusic(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;var i=this.backgroundMusicFadeTime;return this.backgroundMusicFadeTime=0,this.fadeOutBackgroundMusic(e,!0).playBackgroundMusic(t).fadeInBackgroundMusic(e),this.backgroundMusicFadeTime=i,this},setBackgroundMusicMute(t){return void 0===t&&(t=!0),this.backgroundMusicMute=t,this},setBackgroundMusicVolume(t){return this.backgroundMusicVolume=t,this},setBackgroundMusicRate(t){return this.backgroundMusic&&this.backgroundMusic.setRate(t),this},setBackgroundMusicDetune(t){return this.backgroundMusic&&this.backgroundMusic.setDetune(t),this}};const ma=Phaser.Utils.Objects.GetValue;var ya={setBackgroundMusic2Loop(t){return void 0===t&&(t=!0),this.backgroundMusic2Loop=t,this},setBackgroundMusic2FadeTime(t){return this.backgroundMusic2FadeTime=t,this},getBackgroundMusic2(){return this.backgroundMusic2},setCurrentBackgroundMusic2(t){return this.backgroundMusic2=t,t&&(t.once("complete",(function(){this.backgroundMusic2===t&&(this.backgroundMusic2.destroy(),this.backgroundMusic2=void 0)}),this).once("destroy",(function(){this.backgroundMusic2===t&&(this.backgroundMusic2=void 0)}),this),t.isPlaying||t.play()),this},playBackgroundMusic2(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;if(this.backgroundMusic2&&this.backgroundMusic2.key===t)return this;this.stopBackgroundMusic2();var i=this.sound.add(t,{loop:ma(e,"loop",this.backgroundMusicLoop),mute:ma(e,"mute",this.backgroundMusic2Mute),volume:ma(e,"volume",this.backgroundMusic2Volume),detune:ma(e,"detune",0),rate:ma(e,"rate",1)});return this.setCurrentBackgroundMusic2(i),this.backgroundMusic2FadeTime>0&&this.fadeInBackgroundMusic2(this.backgroundMusic2FadeTime),this},pauseBackgroundMusic2(){return this.backgroundMusic2&&this.backgroundMusic2.pause(),this},resumeBackgroundMusic2(){return this.backgroundMusic2&&this.backgroundMusic2.resume(),this},stopBackgroundMusic2(){return this.backgroundMusic2&&(this.backgroundMusic2FadeTime>0?this.fadeOutBackgroundMusic2(this.backgroundMusic2FadeTime,!0):(this.backgroundMusic2.stop(),this.backgroundMusic2.destroy(),this.backgroundMusic2=void 0)),this},fadeInBackgroundMusic2(t){return this.backgroundMusic2&&pa(this.backgroundMusic2,t,this.backgroundMusic2Volume,0),this},fadeOutBackgroundMusic2(t,e){return this.backgroundMusic2&&ga(this.backgroundMusic2,t,e),this},crossFadeBackgroundMusic2(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;var i=this.backgroundMusic2FadeTime;return this.backgroundMusic2FadeTime=0,this.fadeOutBackgroundMusic2(e,!0).playBackgroundMusic2(t).fadeInBackgroundMusic2(e),this.backgroundMusic2FadeTime=i,this},setBackgroundMusic2Mute(t){return void 0===t&&(t=!0),this.backgroundMusic2Mute=t,this},setBackgroundMusic2Volume(t){return this.backgroundMusic2Volume=t,this},setBackgroundMusic2Rate(t){return this.backgroundMusic2&&this.backgroundMusic2.setRate(t),this},setBackgroundMusic2Detune(t){return this.backgroundMusic2&&this.backgroundMusic2.setDetune(t),this}};const ba=Phaser.Utils.Array.Remove,xa=Phaser.Utils.Objects.GetValue;var ka={getSoundEffects(){return this.soundEffects},getLastSoundEffect(){return this.soundEffects[this.soundEffects.length-1]},playSoundEffect(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;var i=this.sound.add(t,{mute:xa(e,"mute",this.soundEffectsMute),volume:xa(e,"volume",this.soundEffectsVolume),detune:xa(e,"detune",0),rate:xa(e,"rate",1)});return this.soundEffects.push(i),i.once("complete",(function(){i.destroy(),this.sound&&ba(this.soundEffects,i)}),this).once("destroy",(function(){this.sound&&ba(this.soundEffects,i)}),this).play(),this},stopAllSoundEffects(){for(var t=this.soundEffects.length-1;t>=0;t--){var e=this.soundEffects[t];e.stop(),e.destroy()}return this},fadeInSoundEffect(t){var e=this.getLastSoundEffect();return e&&pa(e,t,this.soundEffectsVolume,0),this},fadeOutSoundEffect(t,e){var i=this.getLastSoundEffect();return i&&ga(i,t,e),this},fadeOutAllSoundEffects(t,e){for(var i=this.soundEffects.length-1;i>=0;i--)ga(this.soundEffects[i],t,e);return this},setSoundEffectMute(t,e){if(void 0===t&&(t=!0),void 0===e&&(e=!1),e){var i=this.getLastSoundEffect();i&&i.setMute(t)}else this.soundEffectsMute=t;return this},setSoundEffectVolume(t,e){if(void 0===e&&(e=!1),e){var i=this.getLastSoundEffect();i&&i.setVolume(t)}else this.soundEffectsVolume=t;return this},setSoundEffectDetune(t,e){var i;void 0===e&&(e=!1);for(var s=0,r=(i=e?[this.getLastSoundEffect()]:this.soundEffects).length;s=0;t--){var e=this.soundEffects[t];e.stop(),e.destroy()}return this},fadeInSoundEffect2(t){var e=this.getLastSoundEffect2();return e&&pa(e,t,this.soundEffects2Volume,0),this},fadeOutSoundEffect2(t,e){var i=this.getLastSoundEffect2();return i&&ga(i,t,e),this},fadeOutAllSoundEffects2(t,e){for(var i=this.soundEffects2.length-1;i>=0;i--)ga(this.soundEffects2[i],t,e);return this},setSoundEffect2Mute(t,e){if(void 0===t&&(t=!0),void 0===e&&(e=!1),e){var i=this.getLastSoundEffect2();i&&i.setMute(t)}else this.soundEffects2Mute=t;return this},setSoundEffect2Volume(t,e){if(void 0===e&&(e=!1),e){var i=this.getLastSoundEffect2();i&&i.setVolume(t)}else this.soundEffects2Volume=t;return this},setSoundEffect2Detune(t,e){var i;void 0===e&&(e=!1);for(var s=0,r=(i=e?[this.getLastSoundEffect2()]:this.soundEffects2).length;s=0;t--)this.soundEffects[t].destroy();if(this.soundEffects.length=0,this.soundEffects2.length)for(t=this.soundEffects2.length-1;t>=0;t--)this.soundEffects2[t].destroy();return this.soundEffects2.length=0,this.sound=void 0,this}get backgroundMusicMute(){return this._backgroundMusicMute}set backgroundMusicMute(t){this._backgroundMusicMute=t,this.backgroundMusic&&this.backgroundMusic.setMute(mute)}get backgroundMusicVolume(){return this._backgroundMusicVolume}set backgroundMusicVolume(t){this._backgroundMusicVolume=t,this.backgroundMusic&&this.backgroundMusic.setVolume(t)}get backgroundMusic2Mute(){return this._backgroundMusic2Mute}set backgroundMusic2Mute(t){this._backgroundMusic2Mute=t,this.backgroundMusic2&&this.backgroundMusic2.setMute(mute)}get backgroundMusic2Volume(){return this._backgroundMusic2Volume}set backgroundMusic2Volume(t){this._backgroundMusic2Volume=t,this.backgroundMusic2&&this.backgroundMusic2.setVolume(t)}get soundEffectsMute(){return this._soundEffectsMute}set soundEffectsMute(t){this._soundEffectsMute=t;for(var e=this.soundEffects,i=0,s=e.length;i0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const Ba=Phaser.Utils.Objects.GetValue,Fa=new class extends Ra{allocate(){return this.pop()}free(t){t.onFree(),this.push(t)}freeMultiple(t){for(var e=0,i=t.length;e");this.setDelimiters(e[0],e[1]),this.setTranslateTagNameCallback(Q(t,"translateTagNameCallback")),this.isRunning=!1,this.isPaused=!1,this.skipEventFlag=!1,this.justCompleted=!1,this.lastTagStart=null,this.lastTagEnd=null,this.lastContent=null}shutdown(){this.destroyEventEmitter()}destroy(){this.shutdown()}setMultipleLinesTagEnable(t){return void 0===t&&(t=!0),this.multipleLinesTagEnable=t,this}setDelimiters(t,e){void 0===e&&(e=t[1],t=t[0]),this.delimiterLeft=t,this.delimiterRight=e,t=io(this.delimiterLeft),e=io(this.delimiterRight);var i=this.multipleLinesTagEnable?"gs":"gi";return this.reSplit=RegExp(`${t}(.+?)${e}`,i),this}setTranslateTagNameCallback(t){return this.translateTagNameCallback=t,this}setValueConverter(t){return!0===t?t=Xs:t||(t=ao),this.valueConverter=t,this}setLoopEnable(t){return void 0===t&&(t=!0),this.loopEnable=t,this}setSource(t){return this.source=t,this}resetIndex(t){return void 0===t&&(t=0),this.progressIndex=t,this.reSplit.lastIndex=t,this.lastTagStart=null,this.lastTagEnd=null,this.lastContent=null,this.justCompleted=!1,this.isRunning=!1,this}start(t){return this.setSource(t).restart(),this}restart(){this.resetIndex().next()}next(){if(this.isPaused&&this.onResume(),this.isRunning)return this;if(this.isRunning=!0,this.justCompleted)return this.isRunning=!1,this;0===this.reSplit.lastIndex&&this.onStart();var t=this.source,e=t.length;for(this.reSplit.lastIndex=this.progressIndex;;){var i=this.reSplit.exec(t);if(!i){if(this.progressIndex");this.setDelimiters(e[0],e[1])}setTagExpression(t){return t||(t=lo),this.tagExpression=t,this}setValueExpression(t){return t||(t=lo),this.valueExpression=t,this}setDelimiters(t,e){super.setDelimiters(t,e);var i=`(${this.tagExpression})(=(${this.valueExpression}))?`;if(this.reTag=RegExp(i,"i"),this.tagExpression!==lo||this.valueExpression!==lo){var s=`${this.tagExpression}(=${this.valueExpression})?`,r=`/${this.tagExpression}`;t=io(this.delimiterLeft),e=io(this.delimiterRight);var n=this.multipleLinesTagEnable?"gs":"gi";this.reSplit=RegExp(`${t}((${s})|(${r}))${e}`,n)}return this}onTag(t){var e=t.match(this.reTag),i=e[1],s="/"===i.charAt(0);if(s&&(i=i.substring(1,i.length)),this.translateTagNameCallback&&(i=this.translateTagNameCallback(i)),this.skipEventFlag=!1,s)this.emit(`-${i}`),this.skipEventFlag||this.emit("-",i),this.lastTagEnd=i;else{var r=oo(e[3],this.valueConverter);this.emit(`+${i}`,...r),this.skipEventFlag||this.emit("+",i,...r),this.lastTagStart=i}}}const lo="[^=]+";var uo=[function(t){t.on("+color",(function(e){t.addStyle("color",e),t.skipEvent()})).on("-color",(function(){t.removeStyle("color"),t.skipEvent()}))},function(t){t.on("+bgcolor",(function(e){t.addStyle("background-color",e),t.skipEvent()})).on("-bgcolor",(function(){t.removeStyle("background-color"),t.skipEvent()}))},function(t){t.on("+b",(function(){t.addStyle("font-weight","bold"),t.skipEvent()})).on("-b",(function(){t.removeStyle("font-weight"),t.skipEvent()}))},function(t){t.on("+i",(function(){t.addStyle("font-style","italic"),t.skipEvent()})).on("-i",(function(){t.removeStyle("font-style"),t.skipEvent()}))},function(t){t.on("+size",(function(e){"number"==typeof e&&(e=`${e}px`),t.addStyle("font-size",e),t.skipEvent()})).on("-size",(function(){t.removeStyle("font-size"),t.skipEvent()}))},function(t){t.on("+u",(function(){t.addStyle("text-decoration","underline"),t.skipEvent()})).on("-u",(function(){t.removeStyle("text-decoration"),t.skipEvent()}))},function(t){t.on("+shadow",(function(e){t.addStyle("text-shadow",`1px 1px 3px ${e}`),t.skipEvent()})).on("-shadow",(function(){t.removeStyle("text-shadow"),t.skipEvent()}))},function(t){t.on("+round",(function(e,i){void 0===e&&(e=3),void 0===i&&(i=e),"number"==typeof e&&(e=`${e}px`),"number"==typeof i&&(i=`${i}px`),t.addStyle("display","inline-block"),t.addStyle("border-radius",e),t.addStyle("padding",i),t.skipEvent()})).on("-round",(function(){t.removeStyle("display"),t.removeStyle("border-radius"),t.removeStyle("padding"),t.skipEvent()}))},function(t){t.on("+family",(function(e){t.addStyle("font-family",e),t.skipEvent()})).on("-family",(function(){t.removeStyle("font-family"),t.skipEvent()}))},function(t){t.on("content",(function(e){t.addContent(e),t.skipEvent()})).on("+",(function(){t.addContent(t.lastTagSource),t.skipEvent()})).on("-",(function(){t.addContent(t.lastTagSource),t.skipEvent()}))}],co=function(t){if("object"!=typeof t||null===t)return t;if(Array.isArray(t))t.length=0;else for(var e in t)delete t[e];return t},po=function(t,e){var i=Array.isArray(t);if(void 0===e?e=i?[]:{}:co(e),i){e.length=t.length;for(var s=0,r=t.length;s0&&l.fadeInBackgroundMusic(r),a&&this.wait({bgm:!0},o),this):this},"bgm.cross"({key:t,duration:e=500,wait:i=!1},s,r){var n=this.sys.soundManager;return n&&t?(n.crossFadeBackgroundMusic(t,e),i&&this.wait({bgm:!0},s),this):this},"bgm.stop"(t,e,i){var s=this.sys.soundManager;return s?(s.stopBackgroundMusic(),this):this},"bgm.fadeOut"({duration:t=500,stop:e=!0,wait:i=!1},s){var r=this.sys.soundManager;return r?(r.fadeOutBackgroundMusic2(t,e),i&&this.wait({bgm:!0},s),this):this},"bgm.fadeIn"({duration:t=500},e,i){var s=this.sys.soundManager;return s?(s.fadeInBackgroundMusic(t),this):this},"bgm.pause"(t,e,i){var s=this.sys.soundManager;return s?(s.pauseBackgroundMusic(),this):this},"bgm.resume"(t,e,i){var s=this.sys.soundManager;return s?(s.resumeBackgroundMusic(),this):this},"bgm.mute"(t,e,i){var s=this.sys.soundManager;return s?(s.setBackgroundMusicMute(!0),this):this},"bgm.unmute"(t,e,i){var s=this.sys.soundManager;return s?(s.setBackgroundMusicMute(!1),this):this}},So={"bgm2.set"({volume:t,mute:e,unmute:i}={},s,r){var n=this.sys.soundManager;return n?(void 0!==t&&n.setBackgroundMusic2Volume(t),void 0!==e?n.setBackgroundMusic2Mute(e):void 0!==i&&n.setBackgroundMusic2Mute(!i),this):this},"bgm2.play"({key:t,volume:e,detune:i,rate:s,fadeIn:r=0,loop:n,wait:a=!1}={},o,h){var l=this.sys.soundManager;return l&&t?(void 0!==n&&l.setBackgroundMusic2LoopValue(n),l.playBackgroundMusic2(t),void 0!==e&&l.setBackgroundMusic2Volume(e),void 0!==i&&l.setBackgroundMusic2Detune(i),void 0!==s&&l.setBackgroundMusic2Rate(s),r>0&&l.fadeInBackgroundMusic2(r),a&&this.wait({bgm:!0},o),this):this},"bgm2.cross"({key:t,duration:e=500,wait:i=!1},s,r){var n=this.sys.soundManager;return n&&t?(n.crossFadeBackgroundMusic2(t,e),i&&this.wait({bgm:!0},s),this):this},"bgm2.stop"(t,e,i){var s=this.sys.soundManager;return s?(s.stopBackgroundMusic2(),this):this},"bgm2.fadeOut"({duration:t=500,stop:e=!0,wait:i=!1},s){var r=this.sys.soundManager;return r?(r.fadeOutBackgroundMusic2(t,e),i&&this.wait({bgm:!0},s),this):this},"bgm2.fadeIn"({duration:t=500},e,i){var s=this.sys.soundManager;return s?(s.fadeInBackgroundMusic2(t),this):this},"bgm2.pause"(t,e,i){var s=this.sys.soundManager;return s?(s.pauseBackgroundMusic2(),this):this},"bgm2.resume"(t,e,i){var s=this.sys.soundManager;return s?(s.resumeBackgroundMusic2(),this):this},"bgm2.mute"(t,e,i){var s=this.sys.soundManager;return s?(s.setBackgroundMusic2Mute(!0),this):this},"bgm2.unmute"(t,e,i){var s=this.sys.soundManager;return s?(s.setBackgroundMusic2Mute(!1),this):this}},wo={"se.set"({volume:t,mute:e,unmute:i}={},s,r){var n=this.sys.soundManager;return n?(void 0!==t&&n.setSoundEffectVolume(t),void 0!==e?n.setSoundEffectMute(e):void 0!==i&&n.setSoundEffectMute(!i),this):this},"se.play"({key:t,volume:e,detune:i,rate:s,fadeIn:r=0,wait:n=!1}={},a,o){var h=this.sys.soundManager;return h&&t?(h.playSoundEffect(t),void 0!==e&&h.setSoundEffectVolume(e,!0),void 0!==i&&h.setSoundEffectDetune(i,!0),void 0!==s&&h.setSoundEffectRate(s,!0),r>0&&h.fadeInSoundEffect(r),n&&this.wait({se:!0},a),this):this},"se.stop"(t,e,i){var s=this.sys.soundManager;return s?(s.stopAllSoundEffects(),this):this},"se.fadeOut"({duration:t=500,stop:e=!0,wait:i=!1},s,r){var n=this.sys.soundManager;return n?(n.fadeOutSoundEffect(t,e),i&&this.wait({bgm:!0},s),this):this},"se.mute"(t,e,i){var s=this.sys.soundManager;return s?(s.setSoundEffectMute(!0),this):this},"se.unmute"(t,e,i){var s=this.sys.soundManager;return s?(s.setSoundEffectMute(!1),this):this}},To={"se2.set"({volume:t,mute:e,unmute:i}={},s,r){var n=this.sys.soundManager;return n?(void 0!==t&&n.setSoundEffect2Volume(t),void 0!==e?n.setSoundEffect2Mute(e):void 0!==i&&n.setSoundEffect2Mute(!i),this):this},"se2.play"({key:t,volume:e,detune:i,rate:s,fadeIn:r=0,wait:n=!1}={},a,o){var h=this.sys.soundManager;return h&&t?(h.playSoundEffect2(t),void 0!==e&&h.setSoundEffect2Volume(e,!0),void 0!==i&&h.setSoundEffect2Detune(i,!0),void 0!==s&&h.setSoundEffect2Rate(s,!0),r>0&&h.fadeInSoundEffect2(r),n&&this.wait({se:!0},a),this):this},"se2.stop"(t,e,i){var s=this.sys.soundManager;return s?(s.stopAllSoundEffects2(),this):this},"se2.fadeOut"({duration:t=500,stop:e=!0,wait:i=!1},s,r){var n=this.sys.soundManager;return n?(n.fadeOutSoundEffect2(t,e),i&&this.wait({bgm:!0},s),this):this},"se2.mute"(t,e,i){var s=this.sys.soundManager;return s?(s.setSoundEffect2Mute(!0),this):this},"se2.unmute"(t,e,i){var s=this.sys.soundManager;return s?(s.setSoundEffect2Mute(!1),this):this}},Po={"camera.set"({x:t,y:e,rotate:i,zoom:s,name:r}={},n,a){var o;return(o=r?this.sys.scene.cameras.getCamera(r):this.sys.cameraTarget)?(void 0===t&&void 0===e||o.setScroll(t,e),void 0!==i&&o.setRotation(i),void 0!==s&&o.setZoom(s),this):this},"camera.fadeIn"({duration:t=1e3,red:e,green:i,blue:s,name:r,wait:n=!1}={},a,o){var h;return(h=r?this.sys.scene.cameras.getCamera(r):this.sys.cameraTarget)?(h.fadeIn(t,e,i,s),n&&this.wait({camera:"fadeIn",cameraName:r},a),this):this},"camera.fadeOut"({duration:t=1e3,red:e,green:i,blue:s,name:r,wait:n=!1}={},a,o){var h;return(h=r?this.sys.scene.cameras.getCamera(r):this.sys.cameraTarget)?(h.fadeOut(t,e,i,s),n&&this.wait({camera:"fadeOut",cameraName:r},a),this):this},"camera.flash"({duration:t=1e3,red:e,green:i,blue:s,name:r,wait:n=!1}={},a,o){var h;return(h=r?this.sys.scene.cameras.getCamera(r):this.sys.cameraTarget)?(h.flash(t,e,i,s),n&&this.wait({camera:"flash",cameraName:r},a),this):this},"camera.shake"({duration:t=1e3,intensity:e,name:i,wait:s=!1}={},r,n){var a;return(a=i?this.sys.scene.cameras.getCamera(i):this.sys.cameraTarget)?(a.shake(t,e),s&&this.wait({camera:"shake",cameraName:i},r),this):this},"camera.zoomTo"({duration:t=1e3,zoom:e,name:i,wait:s=!1}={},r,n){var a;return(a=i?this.sys.scene.cameras.getCamera(i):this.sys.cameraTarget)?(a.zoomTo(e,t),s&&this.wait({camera:"zoom",cameraName:i},r),this):this},"camera.rotateTo"({duration:t=1e3,rotate:e,ease:i,name:s,wait:r=!1}={},n,a){var o;return(o=s?this.sys.scene.cameras.getCamera(s):this.sys.cameraTarget)?(o.rotateTo(e,!1,t,i),r&&this.wait({camera:"rotate",cameraName:s},n),this):this},"camera.scrollTo"({duration:t=1e3,x:e,y:i,ease:s,name:r,wait:n=!1}={},a,o){var h;if(!(h=r?this.sys.scene.cameras.getCamera(r):this.sys.cameraTarget))return this;var l=h.scrollX,u=h.scrollY;return h.setScroll(e,i),e+=h.centerX,i+=h.centerY,h.setScroll(l,u),h.pan(e,i,t,s),n&&this.wait({camera:"scroll",cameraName:r},a),this}},Oo=function(t){return!t.hasOwnProperty("logEnable")||t.logEnable},_o={log({text:t="",logType:e="log",showTitle:i=!0,title:s,titleColor:r="green"}={},n,a){return Oo(a)?(i&&(void 0===s&&(s=a.title),t=`[round][bgcolor=${r}]${s}[/bgcolor][/round] ${t}`),this.sys.logger.log(t,e),this):this},"log.disable"({title:t}={},e,i){return t&&(i=e.getTree(t,i.groupName)),i.hasOwnProperty("logEnable")||i.wrapProperty("logEnable"),i.logEnable=!1,this},"log.enable"({title:t}={},e,i){return t&&(i=e.getTree(t,i.groupName)),i.hasOwnProperty("logEnable")?(i.logEnable=!0,this):this},"log.memory"(t,e,i){if(!Oo(i))return this;this.log(t,e,i);var s,r=e.memory,{keys:n}=t;return n?(s={},n.split(",").forEach((function(t){s[t]=r[t]}))):s=r,this.sys.logger.log(s),this}},Eo={addCommand:function(t,e,i){return void 0===i&&(i=this),i&&(e=e.bind(i)),this[t]&&console.warn(`CommandExecutor: method '${t} is existed.`),this[t]=e,this},defaultHandler:function(t,e,i,s){var r=t.split("."),n=r[0];if(this.sys.hasGameObjectMananger(n))e.goType=n,e.id=null;else{if(!this.sys.hasGameObject(void 0,n))return console.warn(`CommandExecutor: '${n}' does not exist`),this;e.goType=void 0,e.id=n}this.bindEventSheetManager(i);var a=r[1],o=!1,h=this.sys.getGameObjectManager(e.goType,e.id);if(h){var l=h.commands[a];if(l){var u=h.getGO(e.id);Array.isArray(u)||(u=[u]);for(var c=0,d=u.length;c0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,a=1/i.zoom,o=r/2,h=n/2,l=r*a,u=n*a;e.x===o&&e.y===h||e.setPosition(o,h),e.width===l&&e.height===u||e.setSize(l,u)}}}const $o=Phaser.GameObjects.Zone;let Uo=class extends $o{constructor(t){super(t,0,0,2,2),this.fullWindow=new Ho(this)}};const Ko="BG",qo="SPRITE",Jo="TEXTBOX",Zo="TITLE",Qo="CHOICE",th="NAMEINPUT";var eh=!1,ih=function(t){eh||(void 0===t&&(t=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return rh(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return nh(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;ich(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ech(t).x,getChildLocalY:t=>ch(t).y};const Oh=Phaser.Math.DegToRad;var _h={updateChildRotation(t){var e=ch(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=ch(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return ch(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return ch(t).rotation=Oh(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=ch(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>ch(t).rotation},Eh={updateChildScale(t){var e=ch(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=ch(t),i=e.parent;return e.scaleX=Th(t.scaleX,i.scaleX),e.scaleY=Th(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=ch(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=ch(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>ch(t).scaleX,getChildLocalScaleY:t=>ch(t).scaleY},Mh={updateChildVisible(t){var e=ch(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=ch(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),ch(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),ch(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=ch(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>ch(t).visible},Dh={updateChildAlpha(t){var e=ch(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=ch(t),i=e.parent;return e.alpha=Th(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return ch(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=ch(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>ch(t).alpha},Lh={updateChildActive(t){var e=ch(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return ch(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),ch(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=ch(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>ch(t).active},Ah={updateChildScrollFactor(t){var e=ch(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},Rh={updateCameraFilter(t){var e=ch(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},Bh={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(t){void 0===t&&(t=!1);var e=this;return this._mask=null,this.setChildMaskVisible(this),this.children.forEach((function(t){t.clearMask&&t.clearMask(!1),t.hasOwnProperty("isRexContainerLite")||e.setChildMaskVisible(t)})),t&&this.mask&&this.mask.destroy(),this}},Fh=function(t){return t.filter((function(t){return!!t.displayList||(!!t.parentContainer||void 0)}))},Ih={setDepth(t,e){if(this.depth=t,!e&&this.children)for(var i=this.getAllChildren(),s=0,r=i.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},jh=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const Nh=Phaser.Utils.Array;var Gh={getChildren(t){if(t)for(var e=0,i=this.children.length;e0?u.pop().setTexture(d,O):r(c,d,O),h&&c.add.existing(P),l){var _=b+C*T+a*C,E=x+S*w+o*S;P.setOrigin(a,o).setPosition(_,E).setScale(f,v).setRotation(m),Il(P,b,x,m)}k.push(P)}return k}(t,e,i,s),a=0,o=n.length;a0&&(a=this.getChildLocalScaleX(s),a/=s.biasScale,this.setChildLocalScale(s,a)),r.biasScale&&(a=this.getChildLocalScaleX(r),a/=r.biasScale,this.setChildLocalScale(r,a));if(e?t.call(e,i,s,r,n):t(i,s,r,n),this.scaleMode)s.biasScale>0&&(a=this.getChildLocalScaleX(s),a*=s.biasScale,this.setChildLocalScale(s,a)),r.biasScale&&(a=this.getChildLocalScaleX(r),a*=r.biasScale,this.setChildLocalScale(r,a))}};Object.assign($l.prototype,Nl);const Kl={fit:1,FIT:1,envelop:2,ENVELOP:2};const ql=Phaser.GameObjects.GetCalcMatrix;const Jl=Phaser.Renderer.Canvas.SetTransform;var Zl={renderWebGL:function(t,e,i,s){e.updateData(),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=ql(e,i,s),a=r.calcMatrix.copyFrom(n.calc),o=e._displayOriginX,h=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e);for(var u,c=e.geom,d=0,p=c.length;d>>16,o=(65280&r)>>>8,h=255&r;t.fillStyle="rgba("+a+","+o+","+h+","+n+")"},uu=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,a=(16711680&r)>>>16,o=(65280&r)>>>8,h=255&r;t.strokeStyle="rgba("+a+","+o+","+h+","+n+")",t.lineWidth=e.lineWidth};const cu=Phaser.Geom.Polygon.Earcut;class du extends ru{constructor(){super(),this.pathData=[],this.pathIndexes=[],this.closePath=!1}updateData(){return this.pathIndexes=cu(this.pathData),super.updateData(),this}webglRender(t,e,i,s,r){this.isFilled&&au(t,e,this,i,s,r),this.isStroked&&hu(t,this,i,s,r)}canvasRender(t,e,i){var s=this.pathData,r=s.length-1,n=s[0]-e,a=s[1]-i;t.beginPath(),t.moveTo(n,a),this.closePath||(r-=2);for(var o=2;o=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const gu=Phaser.Math.DegToRad;var fu=function(t,e,i,s,r,n,a,o,h){a&&n>r?n-=360:!a&&n0,a=0,o=e.length;a0;this.dirty=this.dirty||this._radiusTL!==t||this._convexTL!==e,this._convexTL=e,this._radiusTL=Math.abs(t)}get radiusTR(){return this._radiusTR}set radiusTR(t){var e=t>0;this.dirty=this.dirty||this._radiusTR!==t||this._convexTR!==e,this._convexTR=e,this._radiusTR=Math.abs(t)}get radiusBL(){return this._radiusBL}set radiusBL(t){var e=t>0;this.dirty=this.dirty||this._radiusBL!==t||this._convexBL!==e,this._convexBL=e,this._radiusBL=Math.abs(t)}get radiusBR(){return this._radiusBR}set radiusBR(t){var e=t>0;this.dirty=this.dirty||this._radiusBR!==t||this._convexBR!==e,this._convexBR=e,this._radiusBR=Math.abs(t)}get radius(){return Math.max(this.radiusTL,this.radiusTR,this.radiusBL,this.radiusBR)}set radius(t){"number"==typeof t?(this.radiusTL=t,this.radiusTR=t,this.radiusBL=t,this.radiusBR=t):(this.radiusTL=Wu(t,"tl",0),this.radiusTR=Wu(t,"tr",0),this.radiusBL=Wu(t,"bl",0),this.radiusBR=Wu(t,"br",0))}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}get iterations(){return this._iterations}set iterations(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t}setIterations(t){return this.iterations=t,this}updateData(){var t=this.pathData;t.length=0;var e,i=this.width,s=this.height,r=this.iterations+1;(e=this.radiusTL)>0?this._convexTL?fu(e,e,e,e,180,270,!1,r,t):fu(0,0,e,e,90,0,!0,r,t):pu(0,0,t);(e=this.radiusTR)>0?this._convexTR?fu(i-e,e,e,e,270,360,!1,r,t):fu(i,0,e,e,180,90,!0,r,t):pu(i,0,t);(e=this.radiusBR)>0?this._convexBR?fu(i-e,s-e,e,e,0,90,!1,r,t):fu(i,s,e,e,270,180,!0,r,t):pu(i,s,t);(e=this.radiusBL)>0?this._convexBL?fu(e,s-e,e,e,90,180,!1,r,t):fu(0,s,e,e,360,270,!0,r,t):pu(0,s,t);return t.push(t[0],t[1]),Tu(this.x,this.y,t),super.updateData(),this}};const Yu=Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlpha;const Xu={arc:mu,circle:yu,curve:class extends du{constructor(t){super(),this.setCurve(t),this.setIterations(32)}get curve(){return this._curve}set curve(t){this.dirty=this.dirty||this._curve!==t,this._curve=t}setCurve(t){return this.curve=t,this}get iterations(){return this._iterations}set iterations(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t}setIterations(t){return this.iterations=t,this}updateData(){this.pathData.length=0;for(var t=this.curve.getPoints(this.iterations),e=0,i=t.length;e=0;s--)(a=r[s])instanceof e&&(a.destroy(),xc(r,s));else{s=0;for(var r,n=(r=t.postPipelines).length;s0}(e,yc),delete e.effect}})},function(t){t.addTransitionMode("revealRight",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(kc,0,0)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}}).addTransitionMode("revealLeft",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(kc,1,0)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}}).addTransitionMode("revealDown",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(kc,0,1)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}}).addTransitionMode("revealUp",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(kc,1,1)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}})}];class Sc extends $l{constructor(t,e,i,s,r,n){super(t,e,i,s,r,n);for(var a=0,o=Cc.length;a0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n")}return i},$c=function(t){return null==t?t="":Array.isArray(t)?t=t.join("\n"):"number"==typeof t&&(t=t.toString()),t},Uc={clearText(){return this.sections.length=0,this.pageStartIndexes.length=0,this.lines.length=0,this},appendPage(t){var e=this.totalLinesCount;this.sections.push($c(t));t=this.sections.join("\n");this.lines=Hc(this.parent,t,this.lines);var i,s=this.totalLinesCount-e;i=this.pageLinesCount>0?Math.ceil(s/this.pageLinesCount):1;for(var r=0;r0?t+i:this.totalLinesCount}var s;switch(e>this.totalLinesCount&&(e=this.totalLinesCount),this.textObjectType){case 0:case 2:s=this.lines.slice(t,e).join("\n");break;case 1:var r=this.lines.getLineStartIndex(t),n=this.lines.getLineEndIndex(e-1);((s=this.lines.getSliceTagText(r,n,!0)).match(/\n/g)||[]).length>e-t-1&&(s=s.substring(0,s.length-1))}return s}};Object.assign(Qc,Uc,qc,Zc);const td=Phaser.Utils.Objects.GetValue;Phaser.Math.Clamp;class ed extends Nn{constructor(t,e){super(t,{eventEmitter:!1}),this.textObjectType=Xc(this.parent),this.pageStartIndexes=[],this.lines=Hc(this.parent,""),this.sections=[],this.resetFromJSON(e)}resetFromJSON(t){this.setMaxLines(td(t,"maxLines",void 0)),this.setPageBreak(td(t,"pageBreak","\f\n")),this.setText(td(t,"text","")),this.startLineIndex=td(t,"start",-1),this.endLineIndex=td(t,"end",void 0);var e=td(t,"page");return void 0===e?this.resetIndex():this.setPageIndex(e),this}toJSON(){return{maxLines:this.maxLines,text:this.content,start:this.startLineIndex,end:this.endLineIndex,page:this.pageIndex,pageBreak:this.pageBreak}}shutdown(t){if(!this.isShutdown){switch(this.textObjectType){case 0:case 2:this.lines.length=0;break;case 1:this.lines.destroy()}this.pageStartIndexes.length=0,this.sections.length=0,this.lines=void 0,this.pageStartIndexes=void 0,this.sections=void 0,super.shutdown(t)}}setMaxLines(t){return this.maxLines=t,this}setPageBreak(t){return this.pageBreak=t,this}get pageCount(){return this.pageStartIndexes.length}get lastPageIndex(){return this.pageCount-1}get isFirstPage(){return this.pageIndex<=0}get isLastPage(){return this.pageIndex>=this.pageCount-1}get totalLinesCount(){return this.lines?this.lines.length:0}get pageLinesCount(){if(void 0!==this.maxLines)return this.maxLines;var t;switch(this.textObjectType){case 0:case 1:var e=this.parent.style.maxLines;t=e>0?e:Math.floor(function(t){var e,i,s;switch(Xc(t)){case 0:case 1:e=t.height-t.padding.top-t.padding.bottom,i=t.lineSpacing,s=t.style.metrics.fontSize+t.style.strokeThickness;break;case 2:e=t.height,i=0;var r=t.fontSize/t.fontData.size;s=t.fontData.lineHeight*r}return(e-i)/(s+i)}(this.parent));break;case 2:t=this.totalLinesCount}return t}get isFirstLine(){return this.startLineIndex<=0}get isLastLine(){return this.endLineIndex===this.totalLinesCount}get content(){return this.sections.join(this.pageBreak)}}Object.assign(ed.prototype,Qc);var id={setText(t){this.setTextCallback&&(t=this.setTextCallbackScope?this.setTextCallback.call(this.setTextCallbackScope,t,this.isLastChar,this.insertIndex):this.setTextCallback(t,this.isLastChar,this.insertIndex)),this.textWrapEnable?Jc(this.parent,t):this.parent.setText(t)},appendText(t){var e=this.text.concat($c(t));return this.isTyping?this.setTypingContent(e):this.start(e,void 0,this.textLength),this}},sd=function(t,e){return t.getPlainText&&(e=t.getPlainText(e)),e},rd=function(t,e){for(var i=void 0,s=0;s0)l=nd(n,t,a=(o=i)-u,o);else l="";var c,d=e-u;if(d>0){o=(a=0)+d;this.insertIndex=o,c=nd(n,t,a,o)}else c="",this.insertIndex=0;r=c+l}return this.insertChar=r.charAt(this.insertIndex-1),r},od={start:function(t,e,i,s){return void 0!==t&&this.setTypingContent(t),void 0!==e&&(this.speed=e),void 0===i&&(i=0),this.typingIndex=i+1,0===this.speed?this.stop(!0):(this.setText(""),this.startTimer(s)),this},startFromLine:function(t,e,i,s,r){var n;if(e>0){void 0===s&&(s=0);var a=sd(this.parent,t);n=rd(a,e)+s}return this.start(t,i,n,r)},stop:function(t){if(this.getTimer()&&this.freeTimer(),t){for(;!this.isLastChar;)ad.call(this,this.text,this.typingIndex,this.textLength,this.typeMode),this.emit("typechar",this.insertChar),this.typingIndex++;this.setText(this.text),this.emit("type"),this.emit("complete",this,this.parent)}return this},pause:function(){var t=this.getTimer();return t&&(t.paused=!0),this},resumeTyping:function(){var t=this.getTimer();return t&&(t.paused=!1),this}};Object.assign(od,id);const hd=Phaser.Utils.Objects.GetFastValue,ld=Phaser.Utils.Objects.GetValue;class ud extends Nn{constructor(t,e){super(t,e),this.timer=null,this.resetFromJSON(e)}resetFromJSON(t){this.setTextWrapEnable(ld(t,"wrap",!1)),this.setTypeMode(ld(t,"typeMode",0)),this.setTypingSpeed(ld(t,"speed",333)),this.setTextCallback=hd(t,"setTextCallback",null),this.setTextCallbackScope=hd(t,"setTextCallbackScope",null),this.setTypingContent(hd(t,"text","")),this.typingIndex=hd(t,"typingIndex",0),this.insertIndex=null,this.insertChar=null;var e=hd(t,"elapsed",null);return null!==e&&this.start(void 0,void 0,this.typingIndex,e),this}shutdown(t){this.isShutdown||(this.freeTimer(),super.shutdown(t))}setTypeMode(t){return"string"==typeof t&&(t=cd[t]),this.typeMode=t,this}setTypeSpeed(t){return this.speed=t,this}setTypingSpeed(t){return this.speed=t,this}setTextWrapEnable(t){return void 0===t&&(t=!0),this.textWrapEnable=t,this}set text(t){var e=$c(t);this.textWrapEnable&&(e=function(t,e){switch(Xc(t)){case 0:t.style.syncFont(t.canvas,t.context),e=t.runWordWrap(e);break;case 1:e=t.getText(e,void 0,void 0,!0);break;case 2:e=t.setText(e).getTextBounds().wrappedText}return e}(this.parent,e)),this._text=e}get text(){return this._text}get isTyping(){return null!==this.getTimer()}get isLastChar(){return this.typingIndex===this.textLength}setTypingContent(t){return this.text=t,this.textLength=sd(this.parent,this.text).length,this}onTyping(){var t=ad.call(this,this.text,this.typingIndex,this.textLength,this.typeMode);this.setText(t),this.emit("typechar",this.insertChar),this.emit("type"),this.isLastChar?(this.freeTimer(),this.scene.sys.events.once("preupdate",(function(){this.emit("complete",this,this.parent)}),this)):(this.timer.delay=this.speed,this.typingIndex++)}startTimer(t){var e;return this.timer&&this.freeTimer(),void 0===t?e=0:(this.speed,e=t),this.timer=this.scene.time.addEvent({delay:1e-4,startAt:e,loop:!0,callback:this.onTyping,callbackScope:this}),this}getTimer(){return this.timer}freeTimer(){return this.timer&&(this.timer.remove(),this.timer=null),this}setText(t){this.setTextCallback&&(t=this.setTextCallbackScope?this.setTextCallback.call(this.setTextCallbackScope,t,this.isLastChar,this.insertIndex):this.setTextCallback(t,this.isLastChar,this.insertIndex)),this.textWrapEnable?Jc(this.parent,t):this.parent.setText(t)}}const cd={"left-to-right":0,"right-to-left":1,"middle-to-sides":2,"sides-to-middle":3};Object.assign(ud.prototype,od);const dd=Phaser.Utils.Objects.GetValue;const pd={page:0,line:1};var gd=function(t){return t.hasOwnProperty("rexSizer")||(t.rexSizer={}),t.rexSizer};const fd=Phaser.Display.Align;var vd={center:fd.CENTER,left:fd.LEFT_CENTER,right:fd.RIGHT_CENTER,top:fd.TOP_CENTER,bottom:fd.BOTTOM_CENTER,"left-top":fd.TOP_LEFT,"top-left":fd.TOP_LEFT,"left-center":fd.LEFT_CENTER,"center-left":fd.LEFT_CENTER,"left-bottom":fd.BOTTOM_LEFT,"bottom-left":fd.BOTTOM_LEFT,"center-top":fd.TOP_CENTER,"top-center":fd.TOP_CENTER,"center-center":fd.CENTER,"center-bottom":fd.BOTTOM_CENTER,"bottom-center":fd.BOTTOM_CENTER,"right-top":fd.TOP_RIGHT,"top-right":fd.TOP_RIGHT,"right-center":fd.RIGHT_CENTER,"center-right":fd.RIGHT_CENTER,"right-bottom":fd.BOTTOM_RIGHT,"bottom-right":fd.BOTTOM_RIGHT},md=function(){},yd=new Phaser.GameObjects.Zone({sys:{queueDepthSort:md,events:{once:md}}},0,0,1,1);yd.setOrigin(0);var bd=0,xd=1,kd=2,Cd=4,Sd=6,wd=8,Td=10,Pd=12,Od=function(t){var e=Nr(t);return t.y+e-e*t.originY},_d=function(t){var e=zr(t);return t.x-e*t.originX+.5*e},Ed=function(t,e){var i=Nr(t);return t.y=e-i+i*t.originY,t},Md=function(t,e){var i=zr(t),s=i*t.originX;return t.x=e+s-.5*i,t},Dd=function(t){var e=zr(t);return t.x-e*t.originX},Ld=function(t,e){var i=zr(t);return t.x=e+i*t.originX,t},Ad=function(t){var e=zr(t);return t.x+e-e*t.originX},Rd=function(t,e){var i=zr(t);return t.x=e-i+i*t.originX,t},Bd=function(t,e){var i=Nr(t),s=i*t.originY;return t.y=e+s-.5*i,t},Fd=function(t){var e=Nr(t);return t.y-e*t.originY+.5*e},Id=function(t){var e=Nr(t);return t.y-e*t.originY},jd=function(t,e){var i=Nr(t);return t.y=e+i*t.originY,t},zd=[];zd[11]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Md(t,_d(e)+i),Ed(t,Od(e)+s),t},zd[Td]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Ld(t,Dd(e)-i),Ed(t,Od(e)+s),t},zd[Pd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Rd(t,Ad(e)+i),Ed(t,Od(e)+s),t},zd[Sd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),function(t,e,i){Md(t,e),Bd(t,i)}(t,_d(e)+i,Fd(e)+s),t},zd[Cd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Ld(t,Dd(e)-i),Bd(t,Fd(e)+s),t},zd[wd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Rd(t,Ad(e)+i),Bd(t,Fd(e)+s),t},zd[xd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Md(t,_d(e)+i),jd(t,Id(e)-s),t},zd[bd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Ld(t,Dd(e)-i),jd(t,Id(e)-s),t},zd[kd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Rd(t,Ad(e)+i),jd(t,Id(e)-s),t};var Nd=function(t,e,i,s,r){return zd[i](t,e,s,r)},Gd=function(t,e,i,s,r,n){yd.setPosition(e,i).setSize(s,r),Nd(t,yd,n)};const Wd=Phaser.Utils.Objects.GetValue,Vd=Phaser.GameObjects.Group,Yd=Phaser.GameObjects.Container;var Xd=function(t,e,i){return t.add.text(0,0,"")},Hd=function(t,e){Array.isArray(t)||(t=[t]),void 0===e&&(e=[]);for(var i=0,s=t.length;i=0;e--)this.remove(this.backgroundChildren[e],t);return this}},ap=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const op=/(\S+)\[(\d+)\]/i;const hp=Phaser.Utils.Objects.GetValue;var lp=function(t,e){return void 0===e?t:t[e]},up=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=hp(e,"left",0),t.right=hp(e,"right",0),t.top=hp(e,"top",0),t.bottom=hp(e,"bottom",0)),t},cp={getInnerPadding(t){return lp(this.space,t)},setInnerPadding(t,e){return up(this.space,t,e),this},getOuterPadding(t){return lp(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return up(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),lp(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),up(this.getSizerConfig(t).padding,e,i),this}},dp=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},pp=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},gp=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},fp=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},vp=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},mp=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},yp={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},bp=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var Pg={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Bn(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Og={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=md),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=md),this.transitOutCallback=t,this}},_g={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Eg={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Mg={};Object.assign(Mg,Pg,Og,_g,Eg);const Dg=Phaser.Utils.Objects.GetValue;class Lg extends Nn{constructor(t,e){super(t,e),this.setTransitInTime(Dg(e,"duration.in",200)),this.setTransitOutTime(Dg(e,"duration.out",200)),this.setTransitInCallback(Dg(e,"transitIn")),this.setTransitOutCallback(Dg(e,"transitOut")),this.oneShotMode=Dg(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Tg(this,{eventEmitter:!1,initState:Dg(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Lg.prototype,Mg);const Ag=Phaser.GameObjects.Rectangle;class Rg extends Ag{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Ho(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Bg=Phaser.Utils.Objects.GetValue;class Fg extends Nn{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Bg(t,"hitAreaMode",0)),this.setEnable(Bg(t,"enable",!0)),this.setStopMode(Bg(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Ig[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Ig={default:0,fullWindow:1};const jg=Phaser.Utils.Objects.GetValue;class zg extends Rg{constructor(t,e){super(t,jg(e,"color",0),jg(e,"alpha",.8)),this.touchEventStop=new Fg(this,{hitAreaMode:1})}}var Ng={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Rp(t,e)},scaleDown(t,e){Bp(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,$p(t,e)},fadeOut(t,e){Up(t,e,!1)}},Gg=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,$p(t,e,t.alpha)},Wg=function(t,e){Up(t,e,!1)},Vg=function(t,e,i,s,r){return!!t&&(!(s&&!s(t,e,i))&&(!!Xr(t,!0).contains(e,i)&&!(r&&!r(t,e,i))))};const Yg=Phaser.Utils.Objects.GetValue;let Xg=class extends Lg{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Hg.popUp),null==e.transitOut&&(e.transitOut=Hg.scaleDown),e.destroy=Yg(e,"destroy",!0),super(t,e);var i=Yg(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new zg(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Yg(i,"transitIn",Gg)),this.setCoverTransitOutCallback(Yg(i,"transitOut",Wg)));var s=Yg(e,"touchOutsideClose",!1),r=Yg(e,"duration.hold",-1),n=Yg(e,"timeOutClose",r>=0),a=Yg(e,"anyTouchClose",!1);Yg(e,"manualClose",!1)&&(s=!1,a=!1,n=!1),a&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),a?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Yg(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Vg(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=Hg[t]),t){case Hg.popUp:t=Ng.popUp;break;case Hg.fadeIn:t=Ng.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Hg[t]),t){case Hg.scaleDown:t=Ng.scaleDown;break;case Hg.fadeOut:t=Ng.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Hg={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var $g=function(t){return t&&"function"==typeof t},Ug={modal(t,e){return $g(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new Xg(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},Kg=function(t,e,i,s,r){$g(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},qg={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),bo(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return Kg.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return Kg.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return Kg.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return Kg.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return Kg.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return Kg.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return Kg.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return Kg.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return Kg.call(this,"shutdown",t,e,i,s),this}},Jg=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=Zg),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},Zg={},Qg=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,a=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return a?Vg(t,e.x,e.y,i,s):!!(r=Jg(e,n,!0))&&Vg(t,r.x,r.y,i,s);for(var o=t.scene.input.manager,h=o.pointersTotal,l=o.pointers,u=0;u=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const df={press:0,pointerdown:0,release:1,pointerup:1};var pf={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new cf(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},gf=function(t,e,i,s,r){if(e)return!(i&&!i(t,e))&&(!!ff(t,e)&&!(s&&!s(t,e)));void 0===r&&(r=!1);for(var n=t.scene.input.manager,a=n.pointersTotal,o=n.pointers,h=0;h0)return vf.length=0,!0;return vf.length=0,!1},vf=[];const mf=Phaser.Utils.Objects.GetValue;class yf extends Nn{constructor(t,e){super(t,e),this._enable=void 0;var i=mf(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(mf(t,"enable",!0)),this.setMode(mf(t,"mode",1)),this.setClickInterval(mf(t,"clickInterval",100)),this.setDragThreshold(mf(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=bf[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?gf:Qg)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const bf={press:0,pointerdown:0,release:1,pointerup:1};var xf={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new yf(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class kf extends wg{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Cf=Phaser.Utils.Objects.GetValue;class Sf extends Nn{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new kf,this.parent.setInteractive(Cf(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Cf(t,"enable",!0)),this.setCooldown(Cf(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var wf={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&Qg(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Sf(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Sf(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Tf={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Pf=function(t,e,i,s){if("parent"===t){for(var r,n=0,a=e.length;n0),this.onDragStart()))}onPointerUp(t){this.enable&&((!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Wf,this.onDragEnd()))}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Vf&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Wf,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Yf,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&Qg(t,s,e,i)}}const Wf=0,Vf=1,Yf="IDLE",Xf=Phaser.Utils.Objects.GetValue,Hf=Phaser.Math.Distance.Between;class $f extends Gf{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=Uf},eventEmitter:!1};this.setRecongizedStateObject(new wg(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Xf(t,"time",250)),this.setTapInterval(Xf(t,"tapInterval",200)),this.setDragThreshold(Xf(t,"threshold",9)),this.setTapOffset(Xf(t,"tapOffset",10));var e=Xf(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Xf(t,"maxTaps",void 0)),this.setMinTaps(Xf(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case Uf:this.state=Kf;break;case Kf:var t=this.lastPointer;Hf(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=qf,this.state=Kf);break;case qf:this.state=Kf}}onDragEnd(){this.state===Kf&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=qf))}onDrag(){this.state!==Uf&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Uf)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Kf){var i=this.lastPointer;if(i.isDown)t-i.downTime>this.holdTime&&(this.state=Uf);else t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=qf:this.state=Uf)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===qf&&(this.state=Uf)}get isTapped(){return this.state===qf}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const Uf="IDLE",Kf="BEGIN",qf="RECOGNIZED",Jf=Phaser.Utils.Objects.GetValue;class Zf extends Gf{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=Qf},eventEmitter:!1};this.setRecongizedStateObject(new wg(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Jf(t,"threshold",9)),this.setHoldTime(Jf(t,"time",251)),this}onDragStart(){this.state=tv,0===this.holdTime&&(this.state=ev)}onDragEnd(){this.state=Qf}onDrag(){this.state!==Qf&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Qf)}preUpdate(t,e){this.isRunning&&this.enable&&(this.state===tv&&t-this.pointer.downTime>=this.holdTime&&(this.state=ev))}get isPressed(){return this.state===ev}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const Qf="IDLE",tv="BEGIN",ev="RECOGNIZED";Phaser.Utils.Objects.GetValue;var iv=function(t){return jn(t).loop.delta};const sv=Phaser.Math.Distance.Between,rv=Phaser.Math.Angle.Between;var nv={getDt:function(){return iv(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return sv(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return rv(e.x,e.y,t.x,t.y)}},av={"up&down":0,"left&right":1,"4dir":2,"8dir":3},ov={};const hv=Phaser.Utils.Objects.GetValue,lv=Phaser.Math.RadToDeg;class uv extends Gf{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=cv},eventEmitter:!1};this.setRecongizedStateObject(new wg(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(hv(t,"threshold",10)),this.setVelocityThreshold(hv(t,"velocityThreshold",1e3)),this.setDirectionMode(hv(t,"dir","8dir")),this}onDragStart(){this.state=dv}onDragEnd(){this.state=cv}onDrag(){this.state===dv&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=pv))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===pv&&(this.state=cv)}get isSwiped(){return this.state===pv}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=av[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=ov),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(lv(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(uv.prototype,nv);const cv="IDLE",dv="BEGIN",pv="RECOGNIZED",gv=Phaser.Utils.Objects.GetValue,fv=Phaser.Utils.Array.SpliceOne,vv=Phaser.Math.Distance.Between,mv=Phaser.Math.Angle.Between;class yv{constructor(t,e){var i=Bn(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(gv(e,"inputConfig",void 0)),this.setEventEmitter(gv(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(gv(t,"enable",!0)),this.bounds=gv(t,"bounds",void 0),this.tracerState=xv,this.pointers.length=0,co(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,co(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&(2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t)))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case xv:this.tracerState=kv,this.onDrag1Start();break;case kv:this.tracerState=Cv,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],fv(this.pointers,e),this.tracerState){case kv:this.tracerState=xv,this.onDrag1End();break;case Cv:this.tracerState=kv,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case kv:this.onDrag1();break;case Cv:this.onDrag2()}}}dragCancel(){return this.tracerState===Cv&&this.onDrag2End(),this.pointers.length=0,co(this.movedState),this.tracerState=xv,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Cv)return 0;var t=this.pointers[0],e=this.pointers[1];return vv(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Cv)return 0;var t=this.pointers[0],e=this.pointers[1];return mv(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;bv.x=e.x-i.x,bv.y=e.y-i.y}else bv.x=0,bv.y=0;return bv}get centerX(){if(this.tracerState!==Cv)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Cv)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Cv)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Cv)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Sv,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&Qg(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&Qg(t,s,e,i)}}Object.assign(yv.prototype,ur);var bv={};const xv=0,kv=1,Cv=2,Sv="IDLE";Phaser.Utils.Objects.GetValue;const wv=Phaser.Math.RotateAround;var Tv=function(t,e,i,s){return wv(t,e,i,s),t.rotation+=s,t},Pv={};const Ov=Phaser.Utils.Objects.GetValue,_v=Phaser.Math.Angle.WrapDegrees,Ev=Phaser.Math.Angle.ShortestBetween,Mv=Phaser.Math.RadToDeg,Dv=Phaser.Math.DegToRad;var Lv={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Pv),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,a=r.y,o=this.rotation;if(Array.isArray(t))for(var h=t,l=0,u=h.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=_v(Mv(this.angleBetween));this.angle=Ev(this.prevAngle,t),this.prevAngle=t,this.state=Bv}break;case Bv:t=_v(Mv(this.angleBetween));this.angle=Ev(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Bv}get rotation(){return Dv(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Lv);const Av="IDLE",Rv="BEGIN",Bv="RECOGNIZED",Fv=Phaser.Utils.Objects.GetValue;var Iv=function(t){var e=Fv(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new $f(this,e),this._tap.on("tap",(function(t,e,s){Of(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Of(i.eventEmitter,`${i.eventNamePrefix}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const jv=Phaser.Utils.Objects.GetValue;var zv=function(t){var e=jv(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new Zf(this,e),this._press.on("pressstart",(function(t,e,s){Of(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this).on("pressend",(function(t,e,s){Of(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Nv=Phaser.Utils.Objects.GetValue;var Gv=function(t){var e=Nv(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new uv(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Of(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Of(i.eventEmitter,`${i.eventNamePrefix}swipe`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Wv=Phaser.Utils.Objects.GetValue;var Vv=function(t,e){return t.setInteractive(),Wv(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Wv(e,"targets",[t]),targetMode:Wv(e,"targetMode","parent"),eventEmitter:Wv(e,"eventEmitter",t),eventNamePrefix:Wv(e,"inputEventPrefix","child.")},Ef.call(t,e),Lf.call(t,e),Bf.call(t,e),zf.call(t,e),Iv.call(t,e),zv.call(t,e),Gv.call(t,e),t},Yv={getSizerConfig:function(t){return void 0===t&&(t=this),gd(t)},getChildPrevState:function(t){var e=gd(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=un(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,a,o=t.scene;if("number"==typeof e)i=e;else{i=Wd(e,"color"),s=Wd(e,"lineWidth");var h=Wd(e,"name",!1);h&&(r=Wd(h,"createTextCallback",Xd),n=Wd(h,"createTextCallbackScope",void 0),"string"==typeof(a=Wd(h,"align","left-top"))&&(a=vd[a]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new Vd(o),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}var u,c,d=this.getAllShownChildren([this]);Hd(d,d);for(var p=0,g=d.length;p(h=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(r=h,s=n)}var h;o=i[i.length-1];return r>(h=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(r=h,s=n+1),s};const Qv=Phaser.Utils.Objects.IsPlainObject,tm=Phaser.Utils.Objects.GetValue,em=Phaser.Display.Align.CENTER,im={min:0,full:-1};var sm=function(t,e,i,s,r,n,a,o,h,l){var u,c,d,p;Kd.call(this,t);var g=t.isRexSpace,f=typeof e;if(null===e)return this;if("number"===f);else if("string"===f)e=im[e];else if(Qv(e)){var v;e=tm(v=e,"proportion",void 0),i=tm(v,"align",em),s=tm(v,"padding",0),r=tm(v,"expand",!1),n=tm(v,"key",void 0),a=tm(v,"index",void 0),t.isRexSizer||(o=tm(v,"minWidth",void 0),h=tm(v,"minHeight",void 0)),l=tm(v,"fitRatio",0),u=tm(v,"offsetX",0),c=tm(v,"offsetY",0),d=tm(v,"offsetOriginX",0),p=tm(v,"offsetOriginY",0)}return"string"==typeof i&&(i=vd[i]),void 0===e&&(e=g?1:0),void 0===i&&(i=em),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===o&&(g?o=0:t.isRexSizer||(o=t._minWidth)),void 0===h&&(g?h=0:t.isRexSizer||(h=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=zr(t)/Nr(t)),void 0===u&&(u=0),void 0===c&&(c=0),void 0===d&&(d=0),void 0===p&&(p=0),(v=this.getSizerConfig(t)).proportion=e,v.align=i,v.padding=El(s),v.expand=r,v.fitRatio=0===e?l:0,v.alignOffsetX=u,v.alignOffsetY=c,v.alignOffsetOriginX=d,v.alignOffsetOriginY=p,void 0===a||a>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(a,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===o?zr(t):o:t.minHeight=void 0===h?Nr(t):h),r&&(0===this.orientation?t.minHeight=h:t.minWidth=o)),void 0!==n&&this.addChildrenMap(n,t),this},rm={add:sm,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),sm.call(this,new Jv(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,o){return Qv(i)&&(i.index=t),sm.call(this,e,i,s,r,n,a,t,o),this},insertAtPosition(t,e,i,s,r,n,a,o,h){var l=Zv.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,o,h),this}};const nm=al.prototype.clear;var am=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),nm.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,am.call(this,t),this}},lm={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=vd[e]),this.getSizerConfig(t).align=e,this}},um={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},cm={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},dm={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},pm={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,o=this.sizerChildren,h=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,u=0,c=o.length;u0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?h=!0:n=0)):n=0,h||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,a+=n)));else for(u=0,c=o.length;u0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?h=!0:n=0)):n=0,h||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,a+=n)))}return h?void 0:a+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,a=s.padding;i=n-(a.left+a.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,a=s.padding;i=n-(a.top+a.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Cp(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,bp.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,o,h,l,u,c,d=this.sizerChildren,p=this.innerLeft,g=this.innerTop,f=this.innerWidth,v=this.innerHeight,m=p,y=g,b=this.startChildIndex,x=0,k=d.length;x0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=fp.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||pp.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&Kv.call(this,t,void 0),gp.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||vp.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&Kv.call(this,void 0,t),mp.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],a=n&&n.isRexSpace;return"center"===t?a||this.insertSpace(r+1):a&&this.remove(n,!0),this}};Object.assign(pm,rm,hm,lm,um,cm,dm);var gm=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},fm={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},vm=function(t){return"string"==typeof t&&(t=fm[t]),t};const mm=Phaser.Utils.Objects.IsPlainObject,ym=Phaser.Utils.Objects.GetValue;class bm extends Hv{constructor(t,e,i,s,r,n,a){mm(e)?(e=ym(a=e,"x",0),i=ym(a,"y",0),s=ym(a,"width",void 0),r=ym(a,"height",void 0),n=ym(a,"orientation",0)):mm(s)?(s=ym(a=s,"width",void 0),r=ym(a,"height",void 0),n=ym(a,"orientation",0)):mm(n)&&(n=ym(a=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,a),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(ym(a,"space.item",0)),this.setStartChildIndex(ym(a,"startChildIndex",0)),this.setRTL(ym(a,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=vm(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=gm.call(this)),this._childrenProportion}}Object.assign(bm.prototype,pm);var xm=function(t,e,i){if(t){var s=null==e,r=null==i;return s&&r||(s||(t.displayWidth=e),r||(t.displayHeight=i),s&&(t.scaleX=t.scaleY),r&&(t.scaleY=t.scaleX)),t}},km=function(t,e){var i;return t||0===t||(t=""),void 0===e&&(e=!0),Array.isArray(t)&&(t=t.join("\n")),(i=e?`${this.text}\n${t}`:`${this.text}${t}`)!=this.text&&this.setText(i),this},Cm={appendText:km,resetDisplayContent:function(t){void 0===t?t={}:"string"==typeof t&&(t={text:t});var e=t.text||"";this.setText(e);var i=this.childrenMap.icon;if(i){t.icon?this.show(i):this.hide(i);var s=t.iconSize;s&&(this.setChildDisplaySize(i,s,s),void 0!==this.iconWidth&&this.setIconSize(s)),!0!==t.icon&&this.setIconTexture(t.icon,t.iconFrame)}var r=this.childrenMap.action;if(r){t.action?this.show(r):this.hide(r);var n=t.actionSize;n&&(this.setChildDisplaySize(r,n,n),void 0!==this.actionWidth&&this.setActionSize(n)),!0!==t.action&&this.setActionTexture(t.action,t.actionFrame)}return this}};class Sm extends bm{get text(){var t=this.childrenMap.text;return t?t.text:""}set text(t){var e=this.childrenMap.text;e&&e.setText(t)}setText(t){return this.text=t,this}setIconTexture(t,e){var i=this.childrenMap.icon;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.iconWidth&&void 0!==this.iconHeight&&(xm(i,this.iconWidth,this.iconHeight),this.resetChildScaleState(i)),this):this}setTexture(t,e){return this.setIconTexture(t,e),this}setIconSize(t,e){return void 0===e&&(e=t),this.iconWidth=t,this.iconHeight=e,this}get texture(){var t=this.childrenMap.icon;if(t)return t.texture}get frame(){var t=this.childrenMap.icon;if(t)return t.frame}setActionTexture(t,e){var i=this.childrenMap.action;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.actionWidth&&void 0!==this.actionHeight&&(xm(i,this.actionWidth,this.actionHeight),this.resetChildScaleState(i)),this):this}get actionTexture(){var t=this.childrenMap.action;if(t)return t.texture}get actionFrame(){var t=this.childrenMap.action;if(t)return t.frame}setActionSize(t,e){return void 0===e&&(e=t),this.actionWidth=t,this.actionHeight=e,this}preLayout(){var t=this.childrenMap.icon;t&&void 0!==this.iconWidth&&void 0!==this.iconHeight&&xm(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&xm(e,this.actionWidth,this.actionHeight),super.preLayout()}postLayout(t,e,i){var s=this.childrenMap.iconMask;s&&(s.setPosition(),this.resetChildPositionState(s));var r=this.childrenMap.actionMask;return r&&(r.setPosition(),this.resetChildPositionState(r)),super.postLayout(t,e,i),this}resize(t,e){super.resize(t,e);var i=this.childrenMap.iconMask;i&&i.resize();var s=this.childrenMap.actionMask;return s&&s.resize(),this}}Object.assign(Sm.prototype,Cm);var wm=function(t,e,i,s){var r=new Dl(e,i,s);if(t&&!t.isRexSizer){var n=r.createGeometryMask();t.setMask(n),this.once("destroy",(function(){t.setMask(),n.destroy()}))}return this.pin(r),r};const Tm=Phaser.Utils.Objects.GetValue;const Pm=Phaser.Utils.Objects.GetValue;var Om=/^[\x00-\x7F]+$/,_m=function(t){return Om.test(t)},Em=function(t,e){for(var i=[],s=t.split("\n"),r=e.style,n=r.wordWrapWidth,a=r.hasOwnProperty("wrapMode")?r.wrapMode:3,o=e.context,h=0,l=s.length;h0&&r.push(h.join("")),r},Dm=0,Lm=1,Am=2,Rm=0,Bm=1,Fm=2,Im=/(?:\r\n|\r|\n)/;const jm={none:Rm,word:Bm,char:Fm,character:Fm,mix:3};var zm=function(t,e){switch(Xc(t)){case 0:switch("string"==typeof e&&(e=jm[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=Em;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=jm[e]||0),t.style.wrapMode=e}};const Nm=Phaser.Renderer.WebGL.Utils;var Gm={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,a=r.height,o=Nm.getTintAppendFloatAlpha,h=t.pipelines.set(e.pipeline,e),l=h.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),h.batchTexture(e,r.glTexture,n,a,e.x,e.y,n/e.resolution,a/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,a,o(e.tintTopLeft,i.alpha*e._alphaTL),o(e.tintTopRight,i.alpha*e._alphaTR),o(e.tintBottomLeft,i.alpha*e._alphaBL),o(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const Wm=Phaser.Display.Color;var Vm={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,a,o,h,l){var u=this.scene.sys.textures.getFrame(t,e);if(!u)return this;var c=u.cutWidth,d=u.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=d),void 0===a&&(a=0),void 0===o&&(o=0),void 0===h&&(h=c),void 0===l&&(l=d);var p=u.cutX+a,g=u.cutY+o;return this.context.drawImage(u.source.image,p,g,h,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new Wm);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var a=i;i=a.red,s=a.green,r=a.blue,n=a.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var o=this.context.createImageData(1,1);return o.data[0]=i,o.data[1]=s,o.data[2]=r,o.data[3]=n,this.context.putImageData(o,t,e),this.dirty=!0,this}},Ym=function(t,e,i,s,r,n,a){var o,h=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===a&&(a=e.height);var u=(o=h.exists(i)?h.get(i):h.createCanvas(i,n,a)).getSourceImage();u.width!==n&&(u.width=n),u.height!==a&&(u.height=a);var c=u.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,a),c.drawImage(e,s,r,n,a),l.gl&&o&&l.canvasToTexture(u,o.source[0].glTexture,!0,0)},Xm={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,Ym(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};ih();const Hm=Phaser.Display.Canvas.CanvasPool,$m=Phaser.GameObjects.GameObject,Um=Phaser.Utils.String.UUID;let Km=class extends $m{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=Hm.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=Um(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){Hm.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}};const qm=Phaser.GameObjects.Components;Phaser.Class.mixin(Km,[qm.Alpha,qm.BlendMode,qm.Crop,qm.Depth,qm.Flip,qm.GetBounds,qm.Mask,qm.Origin,qm.Pipeline,qm.PostPipeline,qm.ScrollFactor,qm.Tint,qm.Transform,qm.Visible,Gm,Vm,Xm]);let Jm=class{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}};Object.assign(Jm.prototype,su);var Zm={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const Qm=Phaser.Math.RotateAround;var ty;const ey=Phaser.Geom.Rectangle;var iy,sy=function(t){void 0===iy&&(iy=new ey);var e=t.drawTLX,i=t.drawTLY;return iy.setTo(e,i,t.drawTRX-e,t.drawBLY-i),iy};const ry=Phaser.Math.RotateAround;var ny,ay=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===ny&&(ny={}),s=ny),s.x=e,s.y=i,0!==t.rotation&&ry(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const oy=Phaser.GameObjects.Components.TransformMatrix;var hy,ly,uy={},cy=function(t,e,i,s,r){var n=ay(e,i,s,!0),a=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=uy);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===hy&&(hy=new oy,ly=new oy),t.parentContainer?t.getWorldTransformMatrix(hy,ly):hy.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),hy.transformPoint(r,n,s),s}(t,n.x,n.y,r);return a},dy=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,a=e.drawCenterY+s;return cy(t,e,n,a,r)},py={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===ty&&(ty={}),s=ty),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&Qm(s,0,0,-i.rotation),s}(t,e,this,!0);return sy(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return dy(this.parent,this,t,e,i)}};Object.assign(py,Zm);const gy=Phaser.Math.DegToRad,fy=Phaser.Math.RadToDeg,vy=Phaser.Utils.Objects.GetValue;class my extends Jm{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return fy(this._rotation)}set angle(t){this.rotation=gy(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=vy(t,"width",void 0),i=vy(t,"height",void 0),s=vy(t,"scaleX",void 0),r=vy(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(my.prototype,py);const yy=Phaser.Utils.String.Pad;var by=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${yy(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},xy=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const ky=Phaser.Utils.Objects.GetValue;let Cy=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=ky(t,"x",0),i=ky(t,"y",0));var s=this.cornerRadius;s.tl=Sy(ky(t,"tl",void 0),e,i),s.tr=Sy(ky(t,"tr",void 0),e,i),s.bl=Sy(ky(t,"bl",void 0),e,i),s.br=Sy(ky(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){wy(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){wy(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){wy(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){wy(this.cornerRadius.br,t)}};var Sy=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Ty(t),t},wy=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=ky(e,"x",0),t.y=ky(e,"y",0)),Ty(t)},Ty=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const Py=Phaser.Math.DegToRad;var Oy=function(t){return!t.hasOwnProperty("convex")||t.convex},_y=function(t){return t.x>0&&t.y>0},Ey=function(t,e,i,s,r,n,a,o,h){if(o&&a>n?a-=360:!o&&a=p?1:s/p,v=r>=g?1:r/g,m=d.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),o=m.tl,_y(o)?(h=o.x*f,l=o.y*v,Oy(o)?Ey(t,h,l,h,l,180,270,!1,a):Ey(t,0,0,h,l,90,0,!0,a),u=0,c=l):(t.lineTo(0,0),u=0,c=0),o=m.tr,_y(o)?(h=o.x*f,l=o.y*v,Oy(o)?Ey(t,s-h,l,h,l,270,360,!1,a):Ey(t,s,0,h,l,180,90,!0,a)):t.lineTo(s,0),o=m.br,_y(o)?(h=o.x*f,l=o.y*v,Oy(o)?Ey(t,s-h,r-l,h,l,0,90,!1,a):Ey(t,s,r,h,l,270,180,!0,a)):t.lineTo(s,r),o=m.bl,_y(o)?(h=o.x*f,l=o.y*v,Oy(o)?Ey(t,h,r-l,h,l,90,180,!1,a):Ey(t,0,r,h,l,360,270,!0,a)):t.lineTo(0,r),t.lineTo(u,c),t.closePath(),t.restore()}(e,i,s,r,n,a,d),null!=o){var p;if(null!=u)(p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,o),p.addColorStop(1,u),o=p;e.fillStyle=o,e.fill()}null!=h&&l>0&&(e.strokeStyle=h,e.lineWidth=l,e.stroke())},Dy=function(t,e,i,s,r,n,a,o){if(null!=e||null!=i){var h=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var u=s/2;h=Math.max(1,h-s),l=Math.max(1,l-s),My(t.canvas,t.context,u,u,h,l,r,e,i,s,n,a,o)}};const Ly=Phaser.Utils.Objects.GetValue;class Ay extends my{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(Ly(e,"color",null),Ly(e,"color2",null),Ly(e,"horizontalGradient",!0)),this.setStroke(Ly(e,"stroke",null),Ly(e,"strokeThickness",2)),this.setCornerRadius(Ly(e,"cornerRadius",0),Ly(e,"cornerIteration",null))}set color(t){t=by(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=by(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=by(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,xy("color2",t,this),xy("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,xy("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,xy("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){Dy(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Ry=Phaser.Utils.Objects.GetValue;class By extends my{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(Ry(e,"color",null),Ry(e,"color2",null),Ry(e,"horizontalGradient",!0)),this.setStroke(Ry(e,"stroke",null),Ry(e,"strokeThickness",2))}set color(t){t=by(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=by(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=by(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,Ry(t,"color2",null),Ry(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Ry(t,"strokeThickness",2))}renderContent(){var t=this.parent.padding,e=t.left,i=t.top,s=this.parent.width-t.left-t.right,r=this.parent.height-t.top-t.bottom,n=this.context;if(null!=this.color){var a,o;if(null!=this.color2)(o=this.horizontalGradient?n.createLinearGradient(0,0,s,0):n.createLinearGradient(0,0,0,r)).addColorStop(0,this.color),o.addColorStop(1,this.color2),a=o;else a=this.color;n.fillStyle=a,n.fillRect(e,i,s,r)}null!=this.stroke&&this.strokeThickness>0&&(n.strokeStyle=this.stroke,n.lineWidth=this.strokeThickness,n.strokeRect(e,i,s,r))}}const Fy=Phaser.Utils.Objects.GetValue;let Iy=class t{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(Fy(t,"bold",!1)),this.setItalic(Fy(t,"italic",!1)),this.setFontSize(Fy(t,"fontSize","16px")),this.setFontFamily(Fy(t,"fontFamily","Courier")),this.setColor(Fy(t,"color","#fff")),this.setStrokeStyle(Fy(t,"stroke",null),Fy(t,"strokeThickness",0)),this.setShadow(Fy(t,"shadowColor",null),Fy(t,"shadowOffsetX",0),Fy(t,"shadowOffsetY",0),Fy(t,"shadowBlur",0)),this.setOffset(Fy(t,"offsetX",0),Fy(t,"offsetY",0)),this.setSpace(Fy(t,"leftSpace",0),Fy(t,"rightSpace",0)),this.setAlign(Fy(t,"align",void 0)),this.setBackgroundColor(Fy(t,"backgroundColor",null)),this.setBackgroundHeight(Fy(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Fy(t,"backgroundBottomY",void 0)),this.setBackgroundLeftX(Fy(t,"backgroundLeftX",0)),this.setBackgroundRightX(Fy(t,"backgroundRightX",0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(xy("stroke",t,this),xy("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(xy("shadowOffsetX",t,this),xy("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),t.hasOwnProperty("backgroundLeftX")&&this.setBackgroundLeftX(t.backgroundLeftX),t.hasOwnProperty("backgroundRightX")&&this.setBackgroundRightX(t.backgroundRightX),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new t(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=by(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=by(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=by(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=by(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setBackgroundLeftX(t){return this.backgroundLeftX=t,this}setBackgroundRightX(t){return this.backgroundRightX=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}};const jy=Phaser.Utils.Array.Remove;const zy=Phaser.Utils.Array.Remove;const Ny="text",Gy="image",Wy="drawer",Vy="space",Yy="command";var Xy=function(t){return t.type===Ny&&"\n"===t.text},Hy=function(t){return t.type===Ny&&"\f"===t.text},$y=function(t){return t.type===Ny};class Uy extends my{constructor(t,e,i){super(t,Ny),this.updateTextFlag=!1,this.style=new Iy(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX+e.backgroundLeftX,s=i,r=this.drawTRX+e.backgroundRightX-i+1;if(r>0){var n=e.backgroundBottomY;null==n&&(n=this.drawBLY);var a=e.backgroundHeight;null==a&&(a=n-this.drawTLY);var o=n-a;t.fillRect(s,o,r,a)}}var h=e.hasFill,l=e.hasStroke;(h||l)&&(e.syncFont(t).syncStyle(t),l&&(e.syncShadow(t),t.strokeText(this.text,0,0)),h&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var Ky=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const qy=Phaser.Display.Canvas.CanvasPool;var Jy=function(t,e,i,s,r,n,a,o){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===o&&(o=!1),o&&(i=Math.round(i),s=Math.round(s));var h=e.getContext("2d",{willReadFrequently:!0});if(a){var l=qy.create(null,r,n,Phaser.CANVAS,!0),u=l.getContext("2d",{willReadFrequently:!0});u.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),u.globalCompositeOperation="source-in",u.fillStyle=a,u.fillRect(0,0,r,n),h.drawImage(l,0,0,r,n,i,s,r,n),qy.remove(l)}else h.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)};Phaser.Display.Canvas.CanvasPool;class Zy extends my{constructor(t,e,i){super(t,Gy),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){Jy(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class Qy extends my{constructor(t,e,i,s){super(t,Wy),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class tb extends my{constructor(t,e){super(t,Vy),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class eb extends Jm{constructor(t,e,i,s,r){super(t,Yy),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}var ib=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const sb={none:0,word:1,char:2,character:2,mix:3};var rb=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,a=!r&&!n,o=t.length,h=e,l=s.word,u=0,c=!1;h0&&!o){var h=this.fixedHeight-s;if(i>0)n=h/i;else n=(l=hb.call(this)).height,a=l.ascent,i=Math.floor((h-a)/n)}else{var l;n=(l=hb.call(this)).height,a=l.ascent}}else if(this.fixedHeight>0){if(void 0===(i=ub(t,"maxLines"))){h=this.fixedHeight-s;i=Math.floor(h/n)}}else i=ub(t,"maxLines",0);void 0===a&&(a=n);var u=0===i,c=ub(t,"wrapMode");void 0===c&&(c=ub(t,"charWrap",!1)?"char":"word");"string"==typeof c&&(c=sb[c]);var d=ub(t,"wrapWidth",void 0);void 0===d&&(this.fixedWidth>0?d=this.fixedWidth-r:(d=1/0,c=0));for(var p=ub(t,"letterSpacing",0),g=ub(t,"hAlign",0),f=ub(t,"vAlign",0),v=ub(t,"justifyPercentage",.25),m=ib({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:g,vAlign:f,justifyPercentage:v,ascent:a,lineHeight:n,wrapWidth:d,wrapMode:c}),y=this.children,b=0,x=y.length;b0&&(E.push({children:M,width:D}),L=Math.max(L,D)),m.start+=_.length,m.isLastPage=!A&&m.start===O,m.maxLineWidth=L,m.linesHeight=E.length*n;var N=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,G=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;!function(t,e,i){for(var s,r,n=t.hAlign,a=t.vAlign,o=t.justifyPercentage,h=t.lines,l=0,u=h.length;l0?(a=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=pb(t,"maxLines",void 0))){var a=this.fixedWidth-r;i=Math.floor(a/n)+1}}else i=pb(t,"maxLines",0);var o=0===i,h=pb(t,"fixedCharacterHeight",void 0);if(void 0===h){var l=pb(t,"charPerLine",void 0);if(void 0!==l){var u=this.fixedHeight-s;h=Math.floor(u/l)}}var c=pb(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var d=pb(t,"letterSpacing",0),p=pb(t,"rtl",!0),g=pb(t,"hAlign",p?2:0),f=pb(t,"vAlign",0),v=ib({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:d,maxLines:i,hAlign:g,vAlign:f,lineWidth:n,fixedCharacterHeight:h,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(_.push({children:E,height:M}),D=Math.max(D,M)),v.start+=O.length,v.isLastPage=v.start===P,v.maxLineHeight=D,v.linesWidth=_.length*n;var I=this.fixedWidth>0?this.fixedWidth:v.linesWidth+r,j=this.fixedHeight>0?this.fixedHeight:v.maxLineHeight+s;!function(t,e,i){var s,r,n=t.hAlign,a=t.vAlign,o=t.rtl,h=t.lines,l=t.lineWidth,u=t.linesWidth;switch(n){case 1:case"center":s=(e-u)/2;break;case 2:case"right":s=e-u;break;default:s=0}o&&(s+=l);for(var c=0,d=h.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,a=i.bottom;return up(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||a!=i.bottom,this},getPadding:function(t){return lp(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),jy(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return zy(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(Ny);return null===i?i=new Uy(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),dy(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;ri&&(r=Math.floor(i));for(var n={},a=$b(t,r,e,i,n),o=0;o<=Yb&&0!==a;o++){if((r+=a)<0){r=0;break}a=$b(t,r,e,i,n)}return o===Yb&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),Ub(t,e,i),t},Hb=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},$b=function(t,e,i,s,r){var n,a=Hb(t,e,r),o=Hb(t,e+1,r);if(void 0!==s)if(a.height<=s&&o.height>s)n=0;else{if(a.height>s)return-1;n=Math.floor(s-a.height)}if(a.width<=i&&o.width>i)return 0;if(a.width>i)return-1;var h=Math.floor(i-a.width);return void 0===n?h:Math.min(h,n)},Ub=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const Kb=Phaser.Utils.Objects.GetValue;var qb=function(t,e){"number"==typeof e&&(e={minWidth:e});var i=Kb(e,"minWidth",0),s=Kb(e,"minHeight",0),r=Kb(e,"fitHeight",!1);return t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return Xb(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),Xb(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t}),t};const Jb=Phaser.Utils.Objects.GetValue,Zb=[function(t){var e=this.scene,i=Tm(t,"orientation",0);this.setOrientation(i);var s=Tm(t,"icon",void 0),r=Tm(t,"iconMask",void 0),n=Tm(t,"innerBackground",void 0),a=Tm(t,"title",void 0),o=Tm(t,"separator",void 0),h=Tm(t,"text",void 0),l=Tm(t,"action",void 0),u=Tm(t,"actionMask",void 0);if(s){var c=Tm(t,"align.icon","center");m=0===this.orientation?{right:Tm(t,"space.icon",0),top:Tm(t,"space.iconTop",0),bottom:Tm(t,"space.iconBottom",0),left:Tm(t,"space.iconLeft",0)}:{bottom:Tm(t,"space.icon",0),left:Tm(t,"space.iconLeft",0),right:Tm(t,"space.iconRight",0),top:Tm(t,"space.iconTop",0)};var d=Tm(t,"squareFitIcon",!1)?1:0;if(this.add(s,{proportion:0,align:c,padding:m,fitRatio:d}),r&&(r=wm.call(this,s,s,1)),!d){var p=Tm(t,"iconSize",void 0);this.setIconSize(Tm(t,"iconWidth",p),Tm(t,"iconHeight",p))}}var g=new bm(e,{orientation:1});n&&g.addBackground(n);var f=Tm(t,"space.separator",0);if(a){c=Tm(t,"align.title","left");var v=Tm(t,"expandTitleWidth",!1);y=Tm(t,"expandTitleHeight",!1)?1:0,b=v,m={bottom:!o&&h?Tm(t,"space.title",f):0,left:Tm(t,"space.titleLeft",0),right:Tm(t,"space.titleRight",0)},g.add(a,{proportion:y,expand:b,align:c,padding:m})}if(o){var m={top:a?f:0,bottom:h?f:0,left:Tm(t,"space.separatorLeft",0),right:Tm(t,"space.separatorRight",0)};g.add(o,{expand:!0,padding:m})}if(h){c=Tm(t,"align.text","left");var y,b,x=Tm(t,"expandTextWidth",!1);y=Tm(t,"expandTextHeight",!1)?1:0,b=x,m={left:Tm(t,"space.textLeft",0),right:Tm(t,"space.textRight",0)},g.add(h,{proportion:y,expand:b,align:c,padding:m})}m=void 0;if(l&&(m={right:Tm(t,"space.text",0)}),this.add(g,{proportion:1,padding:m}),l){c=Tm(t,"align.action","center");m=0===this.orientation?{top:Tm(t,"space.actionTop",0),bottom:Tm(t,"space.actionBottom",0),right:Tm(t,"space.actionRight",0)}:{left:Tm(t,"space.actionLeft",0),right:Tm(t,"space.actionRight",0),bottom:Tm(t,"space.actionBottom",0)};d=Tm(t,"squareFitAction",!1)?1:0;if(this.add(l,{proportion:0,align:c,padding:m,fitRatio:d}),u&&(u=wm.call(this,l,l,1)),!d){var k=Tm(t,"actionSize");this.setActionSize(Tm(t,"actionWidth",k),Tm(t,"actionHeight",k))}}this.addChildrenMap("icon",s),this.addChildrenMap("iconMask",r),this.addChildrenMap("innerSizer",g),this.addChildrenMap("innerBackground",n),this.addChildrenMap("title",a),this.addChildrenMap("separator",o),this.addChildrenMap("text",h),this.addChildrenMap("action",l),this.addChildrenMap("actionMask",u)},function(t){this.setOrientation(1),this.setRTL(!1);var e=this.scene,i=Pm(t,"title",void 0),s=Pm(t,"separator",void 0),r=Pm(t,"innerBackground",void 0),n=Pm(t,"icon",void 0),a=Pm(t,"iconMask",void 0),o=Pm(t,"text",void 0),h=Pm(t,"action",void 0),l=Pm(t,"actionMask",void 0);if(i){var u=Pm(t,"align.title","left"),c=Pm(t,"expandTitleWidth",!1);y=Pm(t,"expandTitleHeight",!1)?1:0,b=c,p={bottom:Pm(t,"space.title",0),left:Pm(t,"space.titleLeft",0),right:Pm(t,"space.titleRight",0)},this.add(i,{proportion:y,expand:b,align:u,padding:p})}if(s){var d=Pm(t,"space.separator",0),p={top:i?d:0,bottom:o?d:0,left:Pm(t,"space.separatorLeft",0),right:Pm(t,"space.separatorRight",0)};this.add(s,{proportion:0,expand:!0,padding:p})}var g=Pm(t,"orientation",0),f=new bm(e,{orientation:g,rtl:Pm(t,"rtl",!1),space:{left:Pm(t,"space.innerLeft",0),right:Pm(t,"space.innerRight",0),top:Pm(t,"space.innerTop",0),bottom:Pm(t,"space.innerBottom",0)}});if(r&&f.addBackground(r),this.add(f,{proportion:1,expand:!0}),n){u=Pm(t,"align.icon","center");p=0===f.orientation?{right:Pm(t,"space.icon",0),top:Pm(t,"space.iconTop",0),bottom:Pm(t,"space.iconBottom",0),left:Pm(t,"space.iconLeft",0)}:{bottom:Pm(t,"space.icon",0),left:Pm(t,"space.iconLeft",0),right:Pm(t,"space.iconRight",0),top:Pm(t,"space.iconTop",0)};var v=Pm(t,"squareFitIcon",!1)?1:0;if(f.add(n,{proportion:0,align:u,padding:p,fitRatio:v}),a&&(a=wm.call(this,n,n,1)),!v){var m=Pm(t,"iconSize",void 0);this.setIconSize(Pm(t,"iconWidth",m),Pm(t,"iconHeight",m))}}if(o){u=Pm(t,"align.text","left");var y,b,x=Pm(t,"space.text",0),k=Pm(t,"expandTextWidth",!1),C=Pm(t,"expandTextHeight",!1);0===f.orientation?(y=k?1:0,h&&(p={right:x}),b=C):(y=C?1:0,h&&(p={bottom:x}),b=k),f.add(o,{proportion:y,expand:b,align:u,padding:p})}if(h){u=Pm(t,"align.action","center");p=0===f.orientation?{top:Pm(t,"space.actionTop",0),bottom:Pm(t,"space.actionBottom",0),right:Pm(t,"space.actionRight",0)}:{left:Pm(t,"space.actionLeft",0),right:Pm(t,"space.actionRight",0),bottom:Pm(t,"space.actionBottom",0)};v=Pm(t,"squareFitAction",!1)?1:0;if(f.add(h,{proportion:0,align:u,padding:p,fitRatio:v}),l&&(l=wm.call(this,h,h,1)),!v){var S=Pm(t,"actionSize");this.setActionSize(Pm(t,"actionWidth",S),Pm(t,"actionHeight",S))}}this.addChildrenMap("title",i),this.addChildrenMap("separator",s),this.addChildrenMap("innerSizer",f),this.addChildrenMap("innerBackground",r),this.addChildrenMap("icon",n),this.addChildrenMap("iconMask",a),this.addChildrenMap("text",o),this.addChildrenMap("action",h),this.addChildrenMap("actionMask",l)}];class Qb extends Sm{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexTitleLabel";var i=Jb(e,"background",void 0);i&&this.addBackground(i);var s=Jb(e,"title",void 0),r=Jb(e,"text",void 0);if(s){var n=Jb(e,"wrapTitle",!1),a=Jb(e,"adjustTitleFontSize",!1);n?(!0===n&&(n="word"),zm(s,n),e.expandTitleWidth=!0,Vb(s)):a&&(e.expandTextWidth=!0,e.expandTextHeight=!0,qb(s,{fitHeight:!0}))}if(r){var o=Jb(e,"wrapText",!1),h=Jb(e,"adjustTextFontSize",!1);o?(!0===o&&(o="word"),zm(r,o),e.expandTextWidth=!0,Vb(r)):h&&(e.expandTextWidth=!0,e.expandTextHeight=!0,qb(r,{fitHeight:!0}))}var l=Jb(e,"layoutMode",0);(Zb[l]||Zb[0]).call(this,e),this.addChildrenMap("background",e.background)}get title(){var t=this.childrenMap.title;return t?t.title:""}set title(t){var e=this.childrenMap.title;e&&e.setText(t)}setTitle(t){return this.title=t,this}resetDisplayContent(t){void 0===t?t={}:"string"==typeof t&&(t={text:t}),super.resetDisplayContent(t);var e=this.childrenMap.title;return e&&(void 0===t.title||(t.title?(this.show(e),this.setTitle(t.title)):this.hide(e))),this}}class tx extends(function(t,e){void 0===e&&(e="rexTextBox");return class extends t{constructor(t,i){super(t,i),this.type=e,this.isRunning=!1,this._isPageEnd=!1;var s=this.childrenMap.text,r=dd(i,"expandTextWidth",!1),n=dd(i,"expandTextHeight",!1);if(r||n){var a=Xc(s);switch(a){case 0:case 1:if(s.resize=function(t,e){var i=r?t:0,a=n?e:0;s.setFixedSize(i,a),i>0&&s.setWordWrapWidth(i)},1===a){var o=s.style;0===o.wrapMode&&(o.wrapMode=1)}}r&&(s._minWidth=0),n&&(s._minHeight=0)}this.setTypingMode(dd(i,"typingMode","page")),this.page=new ed(s,dd(i,"page",void 0)),this.typing=new ud(s,dd(i,"typing",i.type)),this.typing.on("complete",this.onTypingComplete,this).on("type",this.onType,this).on("typechar",this.onTypeChar,this),this.textWidthSave=s.width,this.textHeightSave=s.height}setTypingMode(t){return"string"==typeof t&&(t=pd[t]),this.typingMode=t,this}start(t,e){return void 0!==e&&this.setTypingSpeed(e),this.isRunning=!0,this.page.setText(t),this.emit("start"),0===this.typingMode?this.typeNextPage():this.typeNextLine(),this}more(t,e){if(void 0!==e&&this.setTypingSpeed(e),!this.isRunning){if(this.isRunning=!0,this.page.appendText(t),this.emit("start"),0===this.typingMode){this._isPageEnd=!1;var i=this.page.getPage(),s=this.typing.textLength;this.typing.start(i,void 0,s)}return this}this.page.appendText(t),this.typing.appendText(t)}typeNextPage(){if(!this.isRunning)return this;if(this.isLastPage)this.emit("complete");else{this._isPageEnd=!1;var t=this.page.getNextPage();this.typing.start(t)}return this}typeNextLine(){if(!this.isRunning)return this;if(this.isLastLine)this.isRunning=!1,this.emit("pageend"),this.emit("complete");else{var t,e=this.page.getPageOfNextLine();t=this.isFirstLine?0:this.page.pageLinesCount-1,this.typing.startFromLine(e,t)}}pause(){return this.isRunning?(this.isTyping&&(this.typing.pause(),this.emit("pause")),this):this}resume(){return this.isRunning?(this.isTyping||(this.emit("resume"),this.typing.resume()),this):this}stop(t){return this.isRunning?(this.typing.stop(t),this):this}showLastPage(){return this.isRunning?(this.typing.stop(),0===this.typingMode?this.page.showLastPage():this.page.showLastLine(),this.emit("type"),this.onTypingComplete(),this):this}setTypeSpeed(t){return this.typing.setTypingSpeed(t),this}setTypingSpeed(t){return this.typing.setTypingSpeed(t),this}get isTyping(){return this.typing.isTyping}get isPageEnd(){return this._isPageEnd}get isLastPage(){return this.page.isLastPage}get isFirstPage(){return this.page.isFirstPage}get pageCount(){return this.page.pageCount}get pageIndex(){return this.page.pageIndex}get isLastLine(){return this.page.isLastLine}get isFirstLine(){return this.page.isFirstLine}get lineCound(){return this.page.totalLinesCount}get startLineIndex(){return this.page.startLineIndex}get endLineIndex(){return this.page.endLineIndex}get typingSpeed(){return this.typing.speed}onType(){var t=this.childrenMap.text;this.textWidthSave===t.width&&this.textHeightSave===t.height||(this.textWidthSave=t.width,this.textHeightSave=t.height,this.getTopmostSizer().layout()),this.emit("type")}onTypeChar(t){this.emit("typechar",t)}onTypingComplete(){if(0===this.typingMode){this._isPageEnd=!0;var t=this.isLastPage;this.isRunning=!t,this.emit("pageend"),t&&this.emit("complete")}else this.typeNextLine()}}}(Qb)){constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("layoutMode")||(e.layoutMode=1),super(t,e)}}const ex=Phaser.GameObjects.GetCalcMatrix;const ix=Phaser.Renderer.Canvas.SetTransform;var sx={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=ex(e,i,s),a=r.calcMatrix.copyFrom(n.calc),o=e._displayOriginX,h=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&au(r,a,e,l,o,h),e.isStroked&&hu(r,e,l,o,h),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(ix(t,r,e,i,s)){var n=e._displayOriginX,a=e._displayOriginY,o=e.pathData,h=o.length-1,l=o[0]-n,u=o[1]-a;r.beginPath(),r.moveTo(l,u),e.closePath||(h-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(nx.prototype,sx);var ax=function(t){return t.x>0&&t.y>0};const ox=Phaser.Utils.Objects.IsPlainObject,hx=Phaser.Utils.Objects.GetValue,lx=Phaser.Geom.Polygon.Earcut;class ux extends nx{constructor(t,e,i,s,r,n,a,o){var h,l,u,c;if(ox(e)){var d=e;e=d.x,i=d.y,s=d.width,r=d.height,n=d.radius,a=d.color,o=d.alpha,h=d.strokeColor,l=d.strokeAlpha,u=d.strokeWidth,c=d.shape}void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=s),void 0===n&&(n=0),void 0===c&&(c=0);var p=new Cy;if(super(t,"rexRoundRectangleShape",p),this.setShapeType(c),0===this.shapeType){var g=hx(n,"radius",n);p.setTo(0,0,s,r,g)}else{g={x:s/2,y:r/2};p.setTo(0,0,s,r,g)}this.setIteration(hx(n,"iteration",void 0)),this.setPosition(e,i),this.setFillStyle(a,o),void 0===u&&(u=2),this.setStrokeStyle(u,h,l),this.updateDisplayOrigin(),this.dirty=!0}updateData(){var t=this.geom,e=this.pathData;e.length=0;var i,s=t.width,r=t.height,n=t.cornerRadius,a=this.iteration+1;if(i=n.tl,ax(i))if(i.convex){var o=i.x,h=i.y;fu(o,h,i.x,i.y,180,270,!1,a,e)}else{fu(o=0,h=0,i.x,i.y,90,0,!0,a,e)}else pu(0,0,e);if(i=n.tr,ax(i))if(i.convex){o=s-i.x,h=i.y;fu(o,h,i.x,i.y,270,360,!1,a,e)}else{fu(o=s,h=0,i.x,i.y,180,90,!0,a,e)}else pu(s,0,e);if(i=n.br,ax(i))if(i.convex){o=s-i.x,h=r-i.y;fu(o,h,i.x,i.y,0,90,!1,a,e)}else{fu(o=s,h=r,i.x,i.y,270,180,!0,a,e)}else pu(s,r,e);if(i=n.bl,ax(i))if(i.convex){o=i.x,h=r-i.y;fu(o,h,i.x,i.y,90,180,!1,a,e)}else{fu(o=0,h=r,i.x,i.y,360,270,!0,a,e)}else pu(0,r,e);return e.push(e[0],e[1]),this.pathIndexes=lx(e),this}setShapeType(t){return"string"==typeof t&&(t=cx[t]),this.shapeType=t,this}setSize(t,e){return void 0===e&&(e=t),this.geom.width===t&&this.geom.height===e||(this.geom.setSize(t,e),1===this.shapeType&&this.setRadius({x:t/2,y:e/2}),this.updateDisplayOrigin(),this.dirty=!0,super.setSize(t,e)),this}get radius(){return this.geom.radius}set radius(t){this.geom.setRadius(t),this.updateDisplayOrigin(),this.dirty=!0}get radiusTL(){return this.geom.radiusTL}set radiusTL(t){this.geom.radiusTL=t,this.dirty=!0}get radiusTR(){return this.geom.radiusTR}set radiusTR(t){this.geom.radiusTR=t,this.dirty=!0}get radiusBL(){return this.geom.radiusBL}set radiusBL(t){this.geom.radiusBL=t,this.dirty=!0}get radiusBR(){return this.geom.radiusBR}set radiusBR(t){this.geom.radiusBR=t,this.dirty=!0}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setRadiusTL(t){return void 0===t&&(t=0),this.radiusTL=t,this}setRadiusTR(t){return void 0===t&&(t=0),this.radiusTR=t,this}setRadiusBL(t){return void 0===t&&(t=0),this.radiusBL=t,this}setRadiusBR(t){return void 0===t&&(t=0),this.radiusBR=t,this}get cornerRadius(){return this.geom.cornerRadius}set cornerRadius(t){this.radius=t}setCornerRadius(t){return this.setRadius(t)}get iteration(){return this._iteration}set iteration(t){void 0!==this._iteration?this._iteration!==t&&(this._iteration=t,this.dirty=!0):this._iteration=t}setIteration(t){return void 0===t&&(t=6),this.iteration=t,this}}const cx={rectangle:0,circle:1};var dx=function(t,e,i,s){if(void 0===i&&(i="."),void 0===s&&(s={}),!t)return s;if(e in t)return Object.assign(s,t[e]);for(var r in e+=i,t)r.startsWith(e)&&(s[r.replace(e,"")]=t[r]);return s},px=function(t,e,i){if(void 0===i&&(i={}),Array.isArray(e))for(var s=0,r=e.length;s=0?t.startAt(a+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(a+n,i):t.startAt(a,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(a,i),t.close(),t};const Cx=Phaser.Utils.Objects.GetValue,Sx=Phaser.Utils.Objects.IsPlainObject;class wx extends(cc(eu)){constructor(t,e,i,s,r,n,a,o){Sx(e)?(e=(o=e).x,i=o.y,s=o.width,r=o.height,n=o.barColor,a=o.value):Sx(s)?(s=(o=s).width,r=o.height,n=o.barColor,a=o.value):Sx(n)&&(n=(o=n).barColor,a=o.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===a&&(a=0),super(t,e,i,s,r,o),this.type="rexLineProgress",this.bootProgressBase(o),this.addShape((new Nu).setName("trackFill")).addShape((new Nu).setName("bar")).addShape((new Nu).setName("trackStroke")),this.setTrackColor(Cx(o,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(Cx(o,"trackStrokeThickness",2),Cx(o,"trackStrokeColor",void 0)),this.setSkewX(Cx(o,"skewX",0)),this.setRTL(Cx(o,"rtl",!1)),this.setValue(a)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var Tx={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&kx(s,0,0,e,i,t);var r,n,a=this.getShape("bar");(a.fillStyle(this.barColor),a.isFilled)&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),kx(a,r,0,n,i,t));var o=this.getShape("trackStroke");o.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),o.isStroked&&kx(o,0,0,e,i,t)}};Object.assign(wx.prototype,Tx);class Px extends wx{constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("value")||(e.value=0),e.hasOwnProperty("hover.bar")||(e["hover.bar"]=!0),e.hasOwnProperty("easeDuration")||(e.easeDuration=200),e.hasOwnProperty("ease")||(e.ease="Quad"),Z(e,"easeValue.duration",e.easeDuration),Z(e,"easeValue.ease",e.ease),super(t,e),this.type="rexStatesBarRectangleShape",this.barState=!1,e.style=this,e.propertiesMap=Ox,this.addStyleManager(e),delete e.style,delete e.propertiesMap}get bar(){return this.barState}set bar(t){t=!!t,this.barState!==t&&(this.barState=t,this.easeValueTo(this.barState?1:0))}}const Ox={color:"trackColor",strokeColor:"trackStrokeColor",strokeWidth:"trackStrokeThickness"};Object.assign(Px.prototype,yx);let _x=class extends Nn{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Tr(t,e))return t[e];var i=t.parent;return Tr(i,e)?i[e]:void 0}set(t,e,i){return Tr(t,e)?t[e]=i:Tr(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.texture.key}set key(t){this.key!==t&&this.parent.setTexture(t,this.frame)}get frame(){return this.parent.frame.name}set frame(t){this.frame!==t&&this.parent.setFrame(t)}};const Ex=Phaser.GameObjects.NineSlice,Mx=Phaser.Utils.Objects.GetValue;class Dx extends Ex{constructor(t,e){void 0===e&&(e={}),super(t,Mx(e,"x",0),Mx(e,"y",0),Mx(e,"key",null),Mx(e,"frame",null),Mx(e,"width",0),Mx(e,"height",0),Mx(e,"leftWidth",0),Mx(e,"rightWidth",0),Mx(e,"topHeight",0),Mx(e,"bottomHeight",0)),this.type="rexStatesNineSlice";var i=Mx(e,"effects",!0);i&&Mr(this,i),this.style=new _x(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Dx.prototype,yx);let Lx=class extends Nn{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Tr(t,e))return t[e];var i=t.parent;return Tr(i,e)?i[e]:void 0}set(t,e,i){return Tr(t,e)?t[e]=i:Tr(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.texture.key}set key(t){this.parent.setTexture(t,this.frame)}get frame(){return this.parent.frame.name}set frame(t){this.parent.setFrame(t)}get scale(){return this.parent.scaleX}set scale(t){this.parent.setScale(t)}};const Ax=Phaser.GameObjects.Image,Rx=Phaser.Utils.Objects.GetValue;class Bx extends Ax{constructor(t,e){void 0===e&&(e={}),super(t,Rx(e,"x",0),Rx(e,"y",0),Rx(e,"key",""),Rx(e,"frame",void 0)),this.type="rexStatesImage";var i=Rx(e,"effects",!0);i&&Mr(this,i),this.style=new Lx(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Bx.prototype,yx);var Fx=function(t,e,i){return"__BASE"===i?`${t},${e}`:`${i}:${t},${e}`};const Ix=Phaser.Utils.Objects.IsPlainObject,jx=Phaser.Utils.Objects.GetValue;var zx=function(t){return"string"==typeof t&&(t=Nx[t]),t};const Nx={scale:0,repeat:1};var Gx=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},Wx={_beginDraw:md,_drawImage:md,_drawTileSprite:md,_endDraw:md,setGetFrameNameCallback:function(t){return void 0===t&&(t=Fx),this.getFrameNameCallback=t,this},setBaseTexture:function(t,e,i,s){Array.isArray(e)&&(s=i,i=e,e=void 0),null==e&&(e="__BASE"),"number"==typeof i&&arguments.length>=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=y(i),s=y(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),a=n.width,o=0,h=0,l=i.length;h0?a/o:0,c=n.height,d=0;for(h=0,l=s.length;h0?0:f,x=0;h=0;for(var w=i.length;h0?0:v),v>=1&&f>=1){var T=typeof(m=this.getFrameNameCallback(h,C,e));"string"!==T&&"number"!==T||r.add(m,0,x+n.cutX,k+n.cutY,v,f)}x+=v}k+=f}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,a,o,h=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,u=this.width-h,c=this.height-l,d=u>=0?this.maxFixedPartScaleX:this.width/h,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var g=Math.min(d,p);if(d>g){var f=(d-g)*h;u>=0?u+=f:u=f,d=g}if(p>g){var v=(p-g)*l;c>=0?c+=v:c=v,p=g}}this.columns.scale=d,this.rows.scale=p,e=u>0&&this.columns.stretch>0?u/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,x=this.rows.count;b0&&o>0&&(0===(0===n.stretch&&0===r.stretch||0===this.getStretchMode(k,b)?0:1)?this._drawImage(this.textureKey,s,m,y,a,o):this._drawTileSprite(this.textureKey,s,m,y,a,o)),m+=a;y+=o}this._endDraw()},setStretchMode:function(t){return Ix(t)?(this.stretchMode.edge=zx(jx(t,"edge",0)),this.stretchMode.internal=zx(jx(t,"internal",0))):(t=zx(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Gx.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const Vx=Phaser.Utils.Objects.IsPlainObject,Yx=Phaser.Utils.Objects.GetValue;const Xx=Phaser.GameObjects;var Hx=void 0,$x=function(t,e){if(Hx||(Hx={},jn(t).events.once("destroy",(function(){for(var t in Hx)Hx[t].destroy();Hx=void 0}))),!Hx.hasOwnProperty(e)){var i=jn(t).scene.systemScene;(t=new Xx[e](i)).setOrigin(0),Hx[e]=t}return Hx[e]};const Ux=Phaser.GameObjects.RenderTexture;class Kx extends(function(t,e){class i extends t{constructor(t,i,s,r,n,a,o,h,l,u){if(Vx(i)?(i=Yx(u=i,"x",0),s=Yx(u,"y",0),r=Yx(u,"width",1),n=Yx(u,"height",1),a=Yx(u,"key",void 0),o=Yx(u,"baseFrame",void 0),h=Yx(u,"columns",void 0),l=Yx(u,"rows",void 0)):Vx(r)?(r=Yx(u=r,"width",1),n=Yx(u,"height",1),a=Yx(u,"key",void 0),o=Yx(u,"baseFrame",void 0),h=Yx(u,"columns",void 0),l=Yx(u,"rows",void 0)):Vx(a)?(a=Yx(u=a,"key",void 0),o=Yx(u,"baseFrame",void 0),h=Yx(u,"columns",void 0),l=Yx(u,"rows",void 0)):Vx(o)?(o=Yx(u=o,"baseFrame",void 0),h=Yx(u,"columns",void 0),l=Yx(u,"rows",void 0)):Array.isArray(o)?(u=l,l=h,h=o,o=Yx(u,"baseFrame",void 0)):Vx(h)&&(h=Yx(u=h,"columns",void 0),l=Yx(u,"rows",void 0)),void 0===o&&(o=Yx(u,"frame",void 0)),void 0===h){var c=Yx(u,"leftWidth",void 0),d=Yx(u,"rightWidth",void 0);void 0!==c&&void 0!==d&&(h=[c,void 0,d])}if(void 0===l){var p=Yx(u,"topHeight",void 0),g=Yx(u,"bottomHeight",void 0);void 0!==p&&void 0!==g&&(l=[p,void 0,g])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(Yx(u,"getFrameNameCallback",void 0)),this.setStretchMode(Yx(u,"stretchMode",0)),this.setPreserveRatio(Yx(u,"preserveRatio",!0));var f=Yx(u,"maxFixedPartScale",1),v=Yx(u,"maxFixedPartScaleX",f),m=Yx(u,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(v,m),this.setBaseTexture(a,o,h,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,Wx),i}(Ux,"rexNinePatch")){}var qx={_drawImage:function(t,e,i,s,r,n){var a=$x(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(a,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var a=$x(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(a,i,s)}};Object.assign(Kx.prototype,qx);let Jx=class extends Nn{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Tr(t,e))return t[e];var i=t.parent;return Tr(i,e)?i[e]:void 0}set(t,e,i){return Tr(t,e)?t[e]=i:Tr(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}};const Zx=Phaser.Utils.Objects.GetValue;class Qx extends Kx{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=Zx(e,"effects",!0);i&&Mr(this,i),this.style=new Jx(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Qx.prototype,yx);const tk=["alpha","tint","flipX","flipY"];var ek=function(t,e){if(!e)return t;for(var i=0,s=tk.length;i=this._config.preview;if(s)e.postMessage({results:o,workerId:a.WORKER_ID,finished:l});else if(k(this._config.chunk)&&!i){if(this._config.chunk(o,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);o=void 0,this._completeResults=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(o.data),this._completeResults.errors=this._completeResults.errors.concat(o.errors),this._completeResults.meta=o.meta),this._completed||!l||!k(this._config.complete)||o&&o.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),l||o&&o.meta.paused||this._nextChunk(),o}this._halted=!0},this._sendError=function(t){k(this._config.error)?this._config.error(t):s&&this._config.error&&e.postMessage({workerId:a.WORKER_ID,error:t,finished:!1})}}function l(t){var e;(t=t||{}).chunkSize||(t.chunkSize=a.RemoteChunkSize),h.call(this,t),this._nextChunk=i?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(t){this._input=t,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(e=new XMLHttpRequest,this._config.withCredentials&&(e.withCredentials=this._config.withCredentials),i||(e.onload=x(this._chunkLoaded,this),e.onerror=x(this._chunkError,this)),e.open(this._config.downloadRequestBody?"POST":"GET",this._input,!i),this._config.downloadRequestHeaders){var t=this._config.downloadRequestHeaders;for(var s in t)e.setRequestHeader(s,t[s])}if(this._config.chunkSize){var r=this._start+this._config.chunkSize-1;e.setRequestHeader("Range","bytes="+this._start+"-"+r)}try{e.send(this._config.downloadRequestBody)}catch(t){this._chunkError(t.message)}i&&0===e.status&&this._chunkError()}},this._chunkLoaded=function(){4===e.readyState&&(e.status<200||400<=e.status?this._chunkError():(this._start+=this._config.chunkSize?this._config.chunkSize:e.responseText.length,this._finished=!this._config.chunkSize||this._start>=function(t){var e=t.getResponseHeader("Content-Range");return null===e?-1:parseInt(e.substring(e.lastIndexOf("/")+1))}(e),this.parseChunk(e.responseText)))},this._chunkError=function(t){var i=e.statusText||t;this._sendError(new Error(i))}}function u(t){var e,i;(t=t||{}).chunkSize||(t.chunkSize=a.LocalChunkSize),h.call(this,t);var s="undefined"!=typeof FileReader;this.stream=function(t){this._input=t,i=t.slice||t.webkitSlice||t.mozSlice,s?((e=new FileReader).onload=x(this._chunkLoaded,this),e.onerror=x(this._chunkError,this)):e=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount=this._input.size,this.parseChunk(t.target.result)},this._chunkError=function(){this._sendError(e.error)}}function c(t){var e;h.call(this,t=t||{}),this.stream=function(t){return e=t,this._nextChunk()},this._nextChunk=function(){if(!this._finished){var t,i=this._config.chunkSize;return i?(t=e.substring(0,i),e=e.substring(i)):(t=e,e=""),this._finished=!e,this.parseChunk(t)}}}function d(t){h.call(this,t=t||{});var e=[],i=!0,s=!1;this.pause=function(){h.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){h.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(t){this._input=t,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){s&&1===e.length&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),e.length?this.parseChunk(e.shift()):i=!0},this._streamData=x((function(t){try{e.push("string"==typeof t?t:t.toString(this._config.encoding)),i&&(i=!1,this._checkIsFinished(),this.parseChunk(e.shift()))}catch(t){this._streamError(t)}}),this),this._streamError=x((function(t){this._streamCleanUp(),this._sendError(t)}),this),this._streamEnd=x((function(){this._streamCleanUp(),s=!0,this._streamData("")}),this),this._streamCleanUp=x((function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)}),this)}function p(t){var e,i,s,r=Math.pow(2,53),n=-r,o=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,h=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,l=this,u=0,c=0,d=!1,p=!1,v=[],m={data:[],errors:[],meta:{}};if(k(t.step)){var y=t.step;t.step=function(e){if(m=e,S())C();else{if(C(),0===m.data.length)return;u+=e.data.length,t.preview&&u>t.preview?i.abort():(m.data=m.data[0],y(m,l))}}}function x(e){return"greedy"===t.skipEmptyLines?""===e.join("").trim():1===e.length&&0===e[0].length}function C(){return m&&s&&(T("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+a.DefaultDelimiter+"'"),s=!1),t.skipEmptyLines&&(m.data=m.data.filter((function(t){return!x(t)}))),S()&&function(){if(m)if(Array.isArray(m.data[0])){for(var e=0;S()&&e=v.length?"__parsed_extra":v[s]),t.transform&&(a=t.transform(a,n)),a=w(n,a),"__parsed_extra"===n?(r[n]=r[n]||[],r[n].push(a)):r[n]=a}return t.header&&(s>v.length?T("FieldMismatch","TooManyFields","Too many fields: expected "+v.length+" fields but parsed "+s,c+i):s=s.length/2?"\r\n":"\r"}(r,h)),s=!1,t.delimiter)k(t.delimiter)&&(t.delimiter=t.delimiter(r),m.meta.delimiter=t.delimiter);else{var l=function(e,i,s,r,n){var o,h,l,u;n=n||[",","\t","|",";",a.RECORD_SEP,a.UNIT_SEP];for(var c=0;c=o)return H(!0)}else for(z=u,u++;;){if(-1===(z=a.indexOf(e,z+1)))return p||C.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:x.length,index:u}),Y();if(z===f-1)return Y(a.substring(u,z).replace(j,e));if(e!==l||a[z+1]!==l){if(e===l||0===z||a[z-1]!==l){-1!==F&&F=o)return H(!0);break}C.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:x.length,index:u}),z++}}else z++}return Y();function W(t){x.push(t),w=u}function V(t){var e=0;if(-1!==t){var i=a.substring(z+1,t);i&&""===i.trim()&&(e=i.length)}return e}function Y(t){return p||(void 0===t&&(t=a.substring(u)),S.push(t),u=f,W(S),b&&$()),H()}function X(t){u=t,W(S),S=[],I=a.indexOf(s,u)}function H(t){return{data:x,errors:C,meta:{delimiter:i,linebreak:s,aborted:c,truncated:!!t,cursor:w+(d||0)}}}function $(){n(H()),x=[],C=[]}},this.abort=function(){c=!0},this.getCharIndex=function(){return u}}function v(t){var e=t.data,i=r[e.workerId],s=!1;if(e.error)i.userError(e.error,e.file);else if(e.results&&e.results.data){var n={abort:function(){s=!0,m(e.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:y,resume:y};if(k(i.userStep)){for(var a=0;a>16&255},br=function(t){return t>>8&255},xr=function(t){return 255&t};const kr=Phaser.Events.EventEmitter;var Cr=function(t,e,i,s,r,n){return void 0===n?n={}:!0===n&&(n=Sr),"number"!=typeof i&&(i=0,s=0),n.x=r.x+r.width*t+i,n.y=r.y+r.height*e+s,n},Sr={},wr=function(t,e,i,s,r,n,a){if(t.hasOwnProperty("vp"))return t;"function"==typeof i&&(a=i,i=void 0),"function"==typeof r&&(a=r,r=void 0),void 0===i&&(i=.5),void 0===s&&(s=.5),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=Cr),function(t){if(t.events)return t;var e=new kr,i=t.x;Object.defineProperty(t,"x",{get:function(){return i},set:function(s){i!==s&&(i=s,e.emit("update",t))}});var s=t.y;Object.defineProperty(t,"y",{get:function(){return s},set:function(i){s!==i&&(s=i,e.emit("update",t))}});var r=t.width;Object.defineProperty(t,"width",{get:function(){return r},set:function(i){r!==i&&(r=i,e.emit("update",t))}});var n=t.height;Object.defineProperty(t,"height",{get:function(){return n},set:function(i){n!==i&&(n=i,e.emit("update",t))}}),t.events=e}(e);var o=e.events;t.vp=e;var h=function(){a(i,s,r,n,e,t)};o.on("update",h),t.once("destroy",(function(){o.off("update",h),t.vp=void 0})),Object.defineProperty(t,"vpx",{get:function(){return i},set:function(t){i!==t&&(i=t,h())}}),Object.defineProperty(t,"vpy",{get:function(){return s},set:function(t){s!==t&&(s=t,h())}}),Object.defineProperty(t,"vpxOffset",{get:function(){return r},set:function(t){r!==t&&(r=t,h())}}),Object.defineProperty(t,"vpyOffset",{get:function(){return n},set:function(t){n!==t&&(n=t,h())}}),h()},Tr=function(t,e){if(!t)return!1;if(t.hasOwnProperty(e))return!0;for(;t;){if(Object.getOwnPropertyDescriptor(t,e))return!0;t=t.__proto__}return!1},Pr=function(t){return t.preFX?t.preFX:t.postFX?t.postFX:null},Or=function(t,e){t._effectSwitchNames||(t._effectSwitchNames=[],t.clearAllEffects=function(){for(var e=t._effectSwitchNames,i=0,s=e.length;i0&&void 0!==t.setTint},useAlphaFadeEffect(t){return(void 0===this.fadeMode||1===this.fadeMode)&&this.fadeTime>0&&void 0!==t.setAlpha},useRevealEffect(t){return this.fadeMode>=2&&this.fadeMode<=5&&this.fadeTime>0&&(t.preFX||t.postFX)},fadeBob(t,e,i,s){var r=t.gameObject;if(this.useTintFadeEffect(r))void 0!==e&&t.setProperty("tintGray",255*e),t.easeProperty({property:"tintGray",value:Math.floor(255*i),duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s});else if(this.useAlphaFadeEffect(r))void 0!==e&&t.setProperty("alpha",e),t.easeProperty({property:"alpha",value:i,duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s});else if(this.useRevealEffect(r)){var n;switch(Mr(r,"reveal"),this.fadeMode){case 2:n="revealUp";break;case 3:n="revealDown";break;case 4:n="revealLeft";break;case 5:n="revealRight"}void 0===e&&(e=0),r[n]=e,t.easeProperty({property:n,value:i,duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s}),t.getTweenTask(n).once("complete",(function(){r[n]=null}))}else s&&s(r);return this}},zr=function(t){return void 0!==t.displayWidth?t.displayWidth:t.width},Nr=function(t){return void 0!==t.displayHeight?t.displayHeight:t.height};const Gr=Phaser.Geom.Rectangle,Wr=Phaser.Math.Vector2,Vr=Phaser.Math.RotateAround,Yr=Phaser.GameObjects.Container;var Xr=function(t,e){if(void 0===e?e=new Gr:!0===e&&(void 0===Hr&&(Hr=new Gr),e=Hr),t.getBounds&&!(t instanceof Yr))return t.getBounds(e);var i,s,r,n,a,o,h,l;if(t.parentContainer){var u=t.parentContainer.getBoundsTransformMatrix();$r(t,e),u.transformPoint(e.x,e.y,e),i=e.x,s=e.y,Ur(t,e),u.transformPoint(e.x,e.y,e),r=e.x,n=e.y,Kr(t,e),u.transformPoint(e.x,e.y,e),a=e.x,o=e.y,qr(t,e),u.transformPoint(e.x,e.y,e),h=e.x,l=e.y}else $r(t,e),i=e.x,s=e.y,Ur(t,e),r=e.x,n=e.y,Kr(t,e),a=e.x,o=e.y,qr(t,e),h=e.x,l=e.y;return e.x=Math.min(i,r,a,h),e.y=Math.min(s,n,o,l),e.width=Math.max(i,r,a,h)-e.x,e.height=Math.max(s,n,o,l)-e.y,e},Hr=void 0,$r=function(t,e,i){return void 0===e?e=new Wr:!0===e&&(void 0===Zr&&(Zr=new Wr),e=Zr),t.getTopLeft?t.getTopLeft(e):(e.x=t.x-zr(t)*t.originX,e.y=t.y-Nr(t)*t.originY,Qr(t,e,i))},Ur=function(t,e,i){return void 0===e?e=new Wr:!0===e&&(void 0===Zr&&(Zr=new Wr),e=Zr),t.getTopRight?t.getTopRight(e):(e.x=t.x-zr(t)*t.originX+zr(t),e.y=t.y-Nr(t)*t.originY,Qr(t,e,i))},Kr=function(t,e,i){return void 0===e?e=new Wr:!0===e&&(void 0===Zr&&(Zr=new Wr),e=Zr),t.getBottomLeft?t.getBottomLeft(e):(e.x=t.x-zr(t)*t.originX,e.y=t.y-Nr(t)*t.originY+Nr(t),Qr(t,e,i))},qr=function(t,e,i){return void 0===e?e=new Wr:!0===e&&(void 0===Zr&&(Zr=new Wr),e=Zr),t.getBottomRight?t.getBottomRight(e):(e.x=t.x-zr(t)*t.originX+zr(t),e.y=t.y-Nr(t)*t.originY+Nr(t),Qr(t,e,i))},Jr=function(t,e,i){void 0===e?e=new Wr:!0===e&&(void 0===Zr&&(Zr=new Wr),e=Zr);var s=zr(t),r=Nr(t);return e.x=t.x+s*(.5-t.originX),e.y=t.y+r*(.5-t.originY),Qr(t,e,i)},Zr=void 0,Qr=function(t,e,i){(void 0===i&&(i=!1),0!==t.rotation&&Vr(e,t.x,t.y,t.rotation),i&&t.parentContainer)&&t.parentContainer.getBoundsTransformMatrix().transformPoint(e.x,e.y,e);return e};const tn=Phaser.Utils.Objects.GetValue;var en=function(t,e,i){var s,r,n,a,o;if("number"==typeof i?s=i:(s=tn(i,"color"),r=tn(i,"lineWidth"),n=tn(i,"fillColor"),a=tn(i,"fillAlpha",1),o=tn(i,"padding",0)),Array.isArray(t))for(var h=0,l=t.length;h0?-this.delay:0,this.state=this.nowTime>=0?Zn:Jn,this.repeatCounter=0,this}stop(){return this.state=qn,this}update(t,e){this.state!==qn&&this.state!==ta&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=Qn)):(this.nowTime=this.duration,this.state=ta):this.nowTime>=0&&(this.state=Zn))}get t(){var t;switch(this.state){case qn:case Jn:case Qn:t=0;break;case Zn:t=this.nowTime/this.duration;break;case ta:t=1}return Un(t,0,1)}set t(t){(t=Un(t,-1,1))<0?(this.state=Jn,this.nowTime=-this.delay*t):(this.state=Zn,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===qn}get isDelay(){return this.state===Jn}get isCountDown(){return this.state===Zn}get isRunning(){return this.state===Jn||this.state===Zn}get isDone(){return this.state===ta}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}};const qn=0,Jn=1,Zn=2,Qn=3,ta=-1;class ea extends Xn{constructor(t,e){super(t,e),this.timer=new Kn}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const ia=Phaser.Utils.Objects.GetValue,sa=Phaser.Utils.Objects.GetAdvancedValue,ra=Phaser.Tweens.Builders.GetEaseFunction;class na extends ea{resetFromJSON(t){return this.timer.resetFromJSON(ia(t,"timer")),this.setEnable(ia(t,"enable",!0)),this.setTarget(ia(t,"target",this.parent)),this.setDelay(sa(t,"delay",0)),this.setDuration(sa(t,"duration",1e3)),this.setEase(ia(t,"ease","Linear")),this.setRepeat(ia(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=ra(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const aa=Phaser.Sound.BaseSound;var oa=function(t){return t instanceof aa};const ha=Phaser.Utils.Objects.GetValue,la=Phaser.Utils.Objects.GetAdvancedValue,ua=Phaser.Math.Linear;let ca=class extends na{constructor(t,e,i){oa(t)&&(i=e,e=t,t=void 0),e.active=!0,e.scene=t,e.game=e.manager.game,super(e,i),this.volume={},this.resetFromJSON(i)}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(ha(t,"mode",0)),this.setEnable(ha(t,"enable",!0)),this.setVolumeRange(la(t,"volume.start",this.parent.volume),la(t,"volume.end",0)),this}setMode(t){return"string"==typeof t&&(t=da[t]),this.mode=t,this}setVolumeRange(t,e){return this.volume.start=t,this.volume.end=e,this}start(){return this.timer.isRunning||(this.parent.setVolume(this.volume.start),this.timer.setDelay(this.delay).setDuration(this.duration),super.start()),this}updateTarget(t,e){t.volume=ua(this.volume.start,this.volume.end,e.t)}complete(){switch(super.complete(),this.mode){case 1:this.parent.stop();break;case 2:this.parent.stop(),this.parent.destroy()}return this}};const da={stop:1,destroy:2};var pa=function(t,e,i,s,r){oa(t)&&(r=s,s=i,i=e,e=t,t=void 0),void 0===s&&(s=1),void 0===r&&(r=0);var n,a={mode:0,volume:{start:r,end:s},duration:i};return"string"==typeof e&&(e=t.sys.sound.add(e)),e.hasOwnProperty("_fade")?(n=e._fade).stop().resetFromJSON(a):(n=new ca(t,e,a),e._fade=n),n.start(),e.isPlaying||e.setVolume(r).play(),e},ga=function(t,e,i,s){oa(t)&&(s=i,i=e,e=t,t=void 0),void 0===s&&(s=!0);var r,n={mode:s?2:1,volume:{start:e.volume,end:0},duration:i};return e.hasOwnProperty("_fade")?(r=e._fade).stop().resetFromJSON(n):(r=new ca(t,e,n),e._fade=r),r.start(),e.isPlaying||e.play(),e};const fa=Phaser.Utils.Objects.GetValue;var va={setBackgroundMusicLoop(t){return void 0===t&&(t=!0),this.backgroundMusicLoop=t,this},setBackgroundMusicFadeTime(t){return this.backgroundMusicFadeTime=t,this},getBackgroundMusic(){return this.backgroundMusic},setCurrentBackgroundMusic(t){return this.backgroundMusic=t,t&&(t.once("complete",(function(){this.backgroundMusic===t&&(this.backgroundMusic.destroy(),this.backgroundMusic=void 0)}),this).once("destroy",(function(){this.backgroundMusic===t&&(this.backgroundMusic=void 0)}),this),t.isPlaying||t.play()),this},playBackgroundMusic(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;if(this.backgroundMusic&&this.backgroundMusic.key===t)return this;this.stopBackgroundMusic();var i=this.sound.add(t,{loop:fa(e,"loop",this.backgroundMusicLoop),mute:fa(e,"mute",this.backgroundMusicMute),volume:fa(e,"volume",this.backgroundMusicVolume),detune:fa(e,"detune",0),rate:fa(e,"rate",1)});return this.setCurrentBackgroundMusic(i),this.backgroundMusicFadeTime>0&&this.fadeInBackgroundMusic(this.backgroundMusicFadeTime),this},pauseBackgroundMusic(){return this.backgroundMusic&&this.backgroundMusic.pause(),this},resumeBackgroundMusic(){return this.backgroundMusic&&this.backgroundMusic.resume(),this},stopBackgroundMusic(){return this.backgroundMusic&&(this.backgroundMusicFadeTime>0?this.fadeOutBackgroundMusic(this.backgroundMusicFadeTime,!0):(this.backgroundMusic.stop(),this.backgroundMusic.destroy(),this.backgroundMusic=void 0)),this},fadeInBackgroundMusic(t){return this.backgroundMusic&&pa(this.backgroundMusic,t,this.backgroundMusicVolume,0),this},fadeOutBackgroundMusic(t,e){return this.backgroundMusic&&ga(this.backgroundMusic,t,e),this},crossFadeBackgroundMusic(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;var i=this.backgroundMusicFadeTime;return this.backgroundMusicFadeTime=0,this.fadeOutBackgroundMusic(e,!0).playBackgroundMusic(t).fadeInBackgroundMusic(e),this.backgroundMusicFadeTime=i,this},setBackgroundMusicMute(t){return void 0===t&&(t=!0),this.backgroundMusicMute=t,this},setBackgroundMusicVolume(t){return this.backgroundMusicVolume=t,this},setBackgroundMusicRate(t){return this.backgroundMusic&&this.backgroundMusic.setRate(t),this},setBackgroundMusicDetune(t){return this.backgroundMusic&&this.backgroundMusic.setDetune(t),this}};const ma=Phaser.Utils.Objects.GetValue;var ya={setBackgroundMusic2Loop(t){return void 0===t&&(t=!0),this.backgroundMusic2Loop=t,this},setBackgroundMusic2FadeTime(t){return this.backgroundMusic2FadeTime=t,this},getBackgroundMusic2(){return this.backgroundMusic2},setCurrentBackgroundMusic2(t){return this.backgroundMusic2=t,t&&(t.once("complete",(function(){this.backgroundMusic2===t&&(this.backgroundMusic2.destroy(),this.backgroundMusic2=void 0)}),this).once("destroy",(function(){this.backgroundMusic2===t&&(this.backgroundMusic2=void 0)}),this),t.isPlaying||t.play()),this},playBackgroundMusic2(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;if(this.backgroundMusic2&&this.backgroundMusic2.key===t)return this;this.stopBackgroundMusic2();var i=this.sound.add(t,{loop:ma(e,"loop",this.backgroundMusicLoop),mute:ma(e,"mute",this.backgroundMusic2Mute),volume:ma(e,"volume",this.backgroundMusic2Volume),detune:ma(e,"detune",0),rate:ma(e,"rate",1)});return this.setCurrentBackgroundMusic2(i),this.backgroundMusic2FadeTime>0&&this.fadeInBackgroundMusic2(this.backgroundMusic2FadeTime),this},pauseBackgroundMusic2(){return this.backgroundMusic2&&this.backgroundMusic2.pause(),this},resumeBackgroundMusic2(){return this.backgroundMusic2&&this.backgroundMusic2.resume(),this},stopBackgroundMusic2(){return this.backgroundMusic2&&(this.backgroundMusic2FadeTime>0?this.fadeOutBackgroundMusic2(this.backgroundMusic2FadeTime,!0):(this.backgroundMusic2.stop(),this.backgroundMusic2.destroy(),this.backgroundMusic2=void 0)),this},fadeInBackgroundMusic2(t){return this.backgroundMusic2&&pa(this.backgroundMusic2,t,this.backgroundMusic2Volume,0),this},fadeOutBackgroundMusic2(t,e){return this.backgroundMusic2&&ga(this.backgroundMusic2,t,e),this},crossFadeBackgroundMusic2(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;var i=this.backgroundMusic2FadeTime;return this.backgroundMusic2FadeTime=0,this.fadeOutBackgroundMusic2(e,!0).playBackgroundMusic2(t).fadeInBackgroundMusic2(e),this.backgroundMusic2FadeTime=i,this},setBackgroundMusic2Mute(t){return void 0===t&&(t=!0),this.backgroundMusic2Mute=t,this},setBackgroundMusic2Volume(t){return this.backgroundMusic2Volume=t,this},setBackgroundMusic2Rate(t){return this.backgroundMusic2&&this.backgroundMusic2.setRate(t),this},setBackgroundMusic2Detune(t){return this.backgroundMusic2&&this.backgroundMusic2.setDetune(t),this}};const ba=Phaser.Utils.Array.Remove,xa=Phaser.Utils.Objects.GetValue;var ka={getSoundEffects(){return this.soundEffects},getLastSoundEffect(){return this.soundEffects[this.soundEffects.length-1]},playSoundEffect(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;var i=this.sound.add(t,{mute:xa(e,"mute",this.soundEffectsMute),volume:xa(e,"volume",this.soundEffectsVolume),detune:xa(e,"detune",0),rate:xa(e,"rate",1)});return this.soundEffects.push(i),i.once("complete",(function(){i.destroy(),this.sound&&ba(this.soundEffects,i)}),this).once("destroy",(function(){this.sound&&ba(this.soundEffects,i)}),this).play(),this},stopAllSoundEffects(){for(var t=this.soundEffects.length-1;t>=0;t--){var e=this.soundEffects[t];e.stop(),e.destroy()}return this},fadeInSoundEffect(t){var e=this.getLastSoundEffect();return e&&pa(e,t,this.soundEffectsVolume,0),this},fadeOutSoundEffect(t,e){var i=this.getLastSoundEffect();return i&&ga(i,t,e),this},fadeOutAllSoundEffects(t,e){for(var i=this.soundEffects.length-1;i>=0;i--)ga(this.soundEffects[i],t,e);return this},setSoundEffectMute(t,e){if(void 0===t&&(t=!0),void 0===e&&(e=!1),e){var i=this.getLastSoundEffect();i&&i.setMute(t)}else this.soundEffectsMute=t;return this},setSoundEffectVolume(t,e){if(void 0===e&&(e=!1),e){var i=this.getLastSoundEffect();i&&i.setVolume(t)}else this.soundEffectsVolume=t;return this},setSoundEffectDetune(t,e){var i;void 0===e&&(e=!1);for(var s=0,r=(i=e?[this.getLastSoundEffect()]:this.soundEffects).length;s=0;t--){var e=this.soundEffects[t];e.stop(),e.destroy()}return this},fadeInSoundEffect2(t){var e=this.getLastSoundEffect2();return e&&pa(e,t,this.soundEffects2Volume,0),this},fadeOutSoundEffect2(t,e){var i=this.getLastSoundEffect2();return i&&ga(i,t,e),this},fadeOutAllSoundEffects2(t,e){for(var i=this.soundEffects2.length-1;i>=0;i--)ga(this.soundEffects2[i],t,e);return this},setSoundEffect2Mute(t,e){if(void 0===t&&(t=!0),void 0===e&&(e=!1),e){var i=this.getLastSoundEffect2();i&&i.setMute(t)}else this.soundEffects2Mute=t;return this},setSoundEffect2Volume(t,e){if(void 0===e&&(e=!1),e){var i=this.getLastSoundEffect2();i&&i.setVolume(t)}else this.soundEffects2Volume=t;return this},setSoundEffect2Detune(t,e){var i;void 0===e&&(e=!1);for(var s=0,r=(i=e?[this.getLastSoundEffect2()]:this.soundEffects2).length;s=0;t--)this.soundEffects[t].destroy();if(this.soundEffects.length=0,this.soundEffects2.length)for(t=this.soundEffects2.length-1;t>=0;t--)this.soundEffects2[t].destroy();return this.soundEffects2.length=0,this.sound=void 0,this}get backgroundMusicMute(){return this._backgroundMusicMute}set backgroundMusicMute(t){this._backgroundMusicMute=t,this.backgroundMusic&&this.backgroundMusic.setMute(mute)}get backgroundMusicVolume(){return this._backgroundMusicVolume}set backgroundMusicVolume(t){this._backgroundMusicVolume=t,this.backgroundMusic&&this.backgroundMusic.setVolume(t)}get backgroundMusic2Mute(){return this._backgroundMusic2Mute}set backgroundMusic2Mute(t){this._backgroundMusic2Mute=t,this.backgroundMusic2&&this.backgroundMusic2.setMute(mute)}get backgroundMusic2Volume(){return this._backgroundMusic2Volume}set backgroundMusic2Volume(t){this._backgroundMusic2Volume=t,this.backgroundMusic2&&this.backgroundMusic2.setVolume(t)}get soundEffectsMute(){return this._soundEffectsMute}set soundEffectsMute(t){this._soundEffectsMute=t;for(var e=this.soundEffects,i=0,s=e.length;i0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const Ba=Phaser.Utils.Objects.GetValue,Fa=new class extends Ra{allocate(){return this.pop()}free(t){t.onFree(),this.push(t)}freeMultiple(t){for(var e=0,i=t.length;e");this.setDelimiters(e[0],e[1]),this.setTranslateTagNameCallback(Q(t,"translateTagNameCallback")),this.isRunning=!1,this.isPaused=!1,this.skipEventFlag=!1,this.justCompleted=!1,this.lastTagStart=null,this.lastTagEnd=null,this.lastContent=null}shutdown(){this.destroyEventEmitter()}destroy(){this.shutdown()}setMultipleLinesTagEnable(t){return void 0===t&&(t=!0),this.multipleLinesTagEnable=t,this}setDelimiters(t,e){void 0===e&&(e=t[1],t=t[0]),this.delimiterLeft=t,this.delimiterRight=e,t=io(this.delimiterLeft),e=io(this.delimiterRight);var i=this.multipleLinesTagEnable?"gs":"gi";return this.reSplit=RegExp(`${t}(.+?)${e}`,i),this}setTranslateTagNameCallback(t){return this.translateTagNameCallback=t,this}setValueConverter(t){return!0===t?t=Xs:t||(t=ao),this.valueConverter=t,this}setLoopEnable(t){return void 0===t&&(t=!0),this.loopEnable=t,this}setSource(t){return this.source=t,this}resetIndex(t){return void 0===t&&(t=0),this.progressIndex=t,this.reSplit.lastIndex=t,this.lastTagStart=null,this.lastTagEnd=null,this.lastContent=null,this.justCompleted=!1,this.isRunning=!1,this}start(t){return this.setSource(t).restart(),this}restart(){this.resetIndex().next()}next(){if(this.isPaused&&this.onResume(),this.isRunning)return this;if(this.isRunning=!0,this.justCompleted)return this.isRunning=!1,this;0===this.reSplit.lastIndex&&this.onStart();var t=this.source,e=t.length;for(this.reSplit.lastIndex=this.progressIndex;;){var i=this.reSplit.exec(t);if(!i){if(this.progressIndex");this.setDelimiters(e[0],e[1])}setTagExpression(t){return t||(t=lo),this.tagExpression=t,this}setValueExpression(t){return t||(t=lo),this.valueExpression=t,this}setDelimiters(t,e){super.setDelimiters(t,e);var i=`(${this.tagExpression})(=(${this.valueExpression}))?`;if(this.reTag=RegExp(i,"i"),this.tagExpression!==lo||this.valueExpression!==lo){var s=`${this.tagExpression}(=${this.valueExpression})?`,r=`/${this.tagExpression}`;t=io(this.delimiterLeft),e=io(this.delimiterRight);var n=this.multipleLinesTagEnable?"gs":"gi";this.reSplit=RegExp(`${t}((${s})|(${r}))${e}`,n)}return this}onTag(t){var e=t.match(this.reTag),i=e[1],s="/"===i.charAt(0);if(s&&(i=i.substring(1,i.length)),this.translateTagNameCallback&&(i=this.translateTagNameCallback(i)),this.skipEventFlag=!1,s)this.emit(`-${i}`),this.skipEventFlag||this.emit("-",i),this.lastTagEnd=i;else{var r=oo(e[3],this.valueConverter);this.emit(`+${i}`,...r),this.skipEventFlag||this.emit("+",i,...r),this.lastTagStart=i}}}const lo="[^=]+";var uo=[function(t){t.on("+color",(function(e){t.addStyle("color",e),t.skipEvent()})).on("-color",(function(){t.removeStyle("color"),t.skipEvent()}))},function(t){t.on("+bgcolor",(function(e){t.addStyle("background-color",e),t.skipEvent()})).on("-bgcolor",(function(){t.removeStyle("background-color"),t.skipEvent()}))},function(t){t.on("+b",(function(){t.addStyle("font-weight","bold"),t.skipEvent()})).on("-b",(function(){t.removeStyle("font-weight"),t.skipEvent()}))},function(t){t.on("+i",(function(){t.addStyle("font-style","italic"),t.skipEvent()})).on("-i",(function(){t.removeStyle("font-style"),t.skipEvent()}))},function(t){t.on("+size",(function(e){"number"==typeof e&&(e=`${e}px`),t.addStyle("font-size",e),t.skipEvent()})).on("-size",(function(){t.removeStyle("font-size"),t.skipEvent()}))},function(t){t.on("+u",(function(){t.addStyle("text-decoration","underline"),t.skipEvent()})).on("-u",(function(){t.removeStyle("text-decoration"),t.skipEvent()}))},function(t){t.on("+shadow",(function(e){t.addStyle("text-shadow",`1px 1px 3px ${e}`),t.skipEvent()})).on("-shadow",(function(){t.removeStyle("text-shadow"),t.skipEvent()}))},function(t){t.on("+round",(function(e,i){void 0===e&&(e=3),void 0===i&&(i=e),"number"==typeof e&&(e=`${e}px`),"number"==typeof i&&(i=`${i}px`),t.addStyle("display","inline-block"),t.addStyle("border-radius",e),t.addStyle("padding",i),t.skipEvent()})).on("-round",(function(){t.removeStyle("display"),t.removeStyle("border-radius"),t.removeStyle("padding"),t.skipEvent()}))},function(t){t.on("+family",(function(e){t.addStyle("font-family",e),t.skipEvent()})).on("-family",(function(){t.removeStyle("font-family"),t.skipEvent()}))},function(t){t.on("content",(function(e){t.addContent(e),t.skipEvent()})).on("+",(function(){t.addContent(t.lastTagSource),t.skipEvent()})).on("-",(function(){t.addContent(t.lastTagSource),t.skipEvent()}))}],co=function(t){if("object"!=typeof t||null===t)return t;if(Array.isArray(t))t.length=0;else for(var e in t)delete t[e];return t},po=function(t,e){var i=Array.isArray(t);if(void 0===e?e=i?[]:{}:co(e),i){e.length=t.length;for(var s=0,r=t.length;s0&&l.fadeInBackgroundMusic(r),a&&this.wait({bgm:!0},o),this):this},"bgm.cross"({key:t,duration:e=500,wait:i=!1},s,r){var n=this.sys.soundManager;return n&&t?(n.crossFadeBackgroundMusic(t,e),i&&this.wait({bgm:!0},s),this):this},"bgm.stop"(t,e,i){var s=this.sys.soundManager;return s?(s.stopBackgroundMusic(),this):this},"bgm.fadeOut"({duration:t=500,stop:e=!0,wait:i=!1},s){var r=this.sys.soundManager;return r?(r.fadeOutBackgroundMusic2(t,e),i&&this.wait({bgm:!0},s),this):this},"bgm.fadeIn"({duration:t=500},e,i){var s=this.sys.soundManager;return s?(s.fadeInBackgroundMusic(t),this):this},"bgm.pause"(t,e,i){var s=this.sys.soundManager;return s?(s.pauseBackgroundMusic(),this):this},"bgm.resume"(t,e,i){var s=this.sys.soundManager;return s?(s.resumeBackgroundMusic(),this):this},"bgm.mute"(t,e,i){var s=this.sys.soundManager;return s?(s.setBackgroundMusicMute(!0),this):this},"bgm.unmute"(t,e,i){var s=this.sys.soundManager;return s?(s.setBackgroundMusicMute(!1),this):this}},So={"bgm2.set"({volume:t,mute:e,unmute:i}={},s,r){var n=this.sys.soundManager;return n?(void 0!==t&&n.setBackgroundMusic2Volume(t),void 0!==e?n.setBackgroundMusic2Mute(e):void 0!==i&&n.setBackgroundMusic2Mute(!i),this):this},"bgm2.play"({key:t,volume:e,detune:i,rate:s,fadeIn:r=0,loop:n,wait:a=!1}={},o,h){var l=this.sys.soundManager;return l&&t?(void 0!==n&&l.setBackgroundMusic2LoopValue(n),l.playBackgroundMusic2(t),void 0!==e&&l.setBackgroundMusic2Volume(e),void 0!==i&&l.setBackgroundMusic2Detune(i),void 0!==s&&l.setBackgroundMusic2Rate(s),r>0&&l.fadeInBackgroundMusic2(r),a&&this.wait({bgm:!0},o),this):this},"bgm2.cross"({key:t,duration:e=500,wait:i=!1},s,r){var n=this.sys.soundManager;return n&&t?(n.crossFadeBackgroundMusic2(t,e),i&&this.wait({bgm:!0},s),this):this},"bgm2.stop"(t,e,i){var s=this.sys.soundManager;return s?(s.stopBackgroundMusic2(),this):this},"bgm2.fadeOut"({duration:t=500,stop:e=!0,wait:i=!1},s){var r=this.sys.soundManager;return r?(r.fadeOutBackgroundMusic2(t,e),i&&this.wait({bgm:!0},s),this):this},"bgm2.fadeIn"({duration:t=500},e,i){var s=this.sys.soundManager;return s?(s.fadeInBackgroundMusic2(t),this):this},"bgm2.pause"(t,e,i){var s=this.sys.soundManager;return s?(s.pauseBackgroundMusic2(),this):this},"bgm2.resume"(t,e,i){var s=this.sys.soundManager;return s?(s.resumeBackgroundMusic2(),this):this},"bgm2.mute"(t,e,i){var s=this.sys.soundManager;return s?(s.setBackgroundMusic2Mute(!0),this):this},"bgm2.unmute"(t,e,i){var s=this.sys.soundManager;return s?(s.setBackgroundMusic2Mute(!1),this):this}},wo={"se.set"({volume:t,mute:e,unmute:i}={},s,r){var n=this.sys.soundManager;return n?(void 0!==t&&n.setSoundEffectVolume(t),void 0!==e?n.setSoundEffectMute(e):void 0!==i&&n.setSoundEffectMute(!i),this):this},"se.play"({key:t,volume:e,detune:i,rate:s,fadeIn:r=0,wait:n=!1}={},a,o){var h=this.sys.soundManager;return h&&t?(h.playSoundEffect(t),void 0!==e&&h.setSoundEffectVolume(e,!0),void 0!==i&&h.setSoundEffectDetune(i,!0),void 0!==s&&h.setSoundEffectRate(s,!0),r>0&&h.fadeInSoundEffect(r),n&&this.wait({se:!0},a),this):this},"se.stop"(t,e,i){var s=this.sys.soundManager;return s?(s.stopAllSoundEffects(),this):this},"se.fadeOut"({duration:t=500,stop:e=!0,wait:i=!1},s,r){var n=this.sys.soundManager;return n?(n.fadeOutSoundEffect(t,e),i&&this.wait({bgm:!0},s),this):this},"se.mute"(t,e,i){var s=this.sys.soundManager;return s?(s.setSoundEffectMute(!0),this):this},"se.unmute"(t,e,i){var s=this.sys.soundManager;return s?(s.setSoundEffectMute(!1),this):this}},To={"se2.set"({volume:t,mute:e,unmute:i}={},s,r){var n=this.sys.soundManager;return n?(void 0!==t&&n.setSoundEffect2Volume(t),void 0!==e?n.setSoundEffect2Mute(e):void 0!==i&&n.setSoundEffect2Mute(!i),this):this},"se2.play"({key:t,volume:e,detune:i,rate:s,fadeIn:r=0,wait:n=!1}={},a,o){var h=this.sys.soundManager;return h&&t?(h.playSoundEffect2(t),void 0!==e&&h.setSoundEffect2Volume(e,!0),void 0!==i&&h.setSoundEffect2Detune(i,!0),void 0!==s&&h.setSoundEffect2Rate(s,!0),r>0&&h.fadeInSoundEffect2(r),n&&this.wait({se:!0},a),this):this},"se2.stop"(t,e,i){var s=this.sys.soundManager;return s?(s.stopAllSoundEffects2(),this):this},"se2.fadeOut"({duration:t=500,stop:e=!0,wait:i=!1},s,r){var n=this.sys.soundManager;return n?(n.fadeOutSoundEffect2(t,e),i&&this.wait({bgm:!0},s),this):this},"se2.mute"(t,e,i){var s=this.sys.soundManager;return s?(s.setSoundEffect2Mute(!0),this):this},"se2.unmute"(t,e,i){var s=this.sys.soundManager;return s?(s.setSoundEffect2Mute(!1),this):this}},Po={"camera.set"({x:t,y:e,rotate:i,zoom:s,name:r}={},n,a){var o;return(o=r?this.sys.scene.cameras.getCamera(r):this.sys.cameraTarget)?(void 0===t&&void 0===e||o.setScroll(t,e),void 0!==i&&o.setRotation(i),void 0!==s&&o.setZoom(s),this):this},"camera.fadeIn"({duration:t=1e3,red:e,green:i,blue:s,name:r,wait:n=!1}={},a,o){var h;return(h=r?this.sys.scene.cameras.getCamera(r):this.sys.cameraTarget)?(h.fadeIn(t,e,i,s),n&&this.wait({camera:"fadeIn",cameraName:r},a),this):this},"camera.fadeOut"({duration:t=1e3,red:e,green:i,blue:s,name:r,wait:n=!1}={},a,o){var h;return(h=r?this.sys.scene.cameras.getCamera(r):this.sys.cameraTarget)?(h.fadeOut(t,e,i,s),n&&this.wait({camera:"fadeOut",cameraName:r},a),this):this},"camera.flash"({duration:t=1e3,red:e,green:i,blue:s,name:r,wait:n=!1}={},a,o){var h;return(h=r?this.sys.scene.cameras.getCamera(r):this.sys.cameraTarget)?(h.flash(t,e,i,s),n&&this.wait({camera:"flash",cameraName:r},a),this):this},"camera.shake"({duration:t=1e3,intensity:e,name:i,wait:s=!1}={},r,n){var a;return(a=i?this.sys.scene.cameras.getCamera(i):this.sys.cameraTarget)?(a.shake(t,e),s&&this.wait({camera:"shake",cameraName:i},r),this):this},"camera.zoomTo"({duration:t=1e3,zoom:e,name:i,wait:s=!1}={},r,n){var a;return(a=i?this.sys.scene.cameras.getCamera(i):this.sys.cameraTarget)?(a.zoomTo(e,t),s&&this.wait({camera:"zoom",cameraName:i},r),this):this},"camera.rotateTo"({duration:t=1e3,rotate:e,ease:i,name:s,wait:r=!1}={},n,a){var o;return(o=s?this.sys.scene.cameras.getCamera(s):this.sys.cameraTarget)?(o.rotateTo(e,!1,t,i),r&&this.wait({camera:"rotate",cameraName:s},n),this):this},"camera.scrollTo"({duration:t=1e3,x:e,y:i,ease:s,name:r,wait:n=!1}={},a,o){var h;if(!(h=r?this.sys.scene.cameras.getCamera(r):this.sys.cameraTarget))return this;var l=h.scrollX,u=h.scrollY;return h.setScroll(e,i),e+=h.centerX,i+=h.centerY,h.setScroll(l,u),h.pan(e,i,t,s),n&&this.wait({camera:"scroll",cameraName:r},a),this}},Oo=function(t){return!t.hasOwnProperty("logEnable")||t.logEnable},_o={log({text:t="",logType:e="log",showTitle:i=!0,title:s,titleColor:r="green"}={},n,a){return Oo(a)?(i&&(void 0===s&&(s=a.title),t=`[round][bgcolor=${r}]${s}[/bgcolor][/round] ${t}`),this.sys.logger.log(t,e),this):this},"log.disable"({title:t}={},e,i){return t&&(i=e.getTree(t,i.groupName)),i.hasOwnProperty("logEnable")||i.wrapProperty("logEnable"),i.logEnable=!1,this},"log.enable"({title:t}={},e,i){return t&&(i=e.getTree(t,i.groupName)),i.hasOwnProperty("logEnable")?(i.logEnable=!0,this):this},"log.memory"(t,e,i){if(!Oo(i))return this;this.log(t,e,i);var s,r=e.memory,{keys:n}=t;return n?(s={},n.split(",").forEach((function(t){s[t]=r[t]}))):s=r,this.sys.logger.log(s),this}},Eo={addCommand:function(t,e,i){return void 0===i&&(i=this),i&&(e=e.bind(i)),this[t]&&console.warn(`CommandExecutor: method '${t} is existed.`),this[t]=e,this},defaultHandler:function(t,e,i,s){var r=t.split("."),n=r[0];if(this.sys.hasGameObjectMananger(n))e.goType=n,e.id=null;else{if(!this.sys.hasGameObject(void 0,n))return console.warn(`CommandExecutor: '${n}' does not exist`),this;e.goType=void 0,e.id=n}this.bindEventSheetManager(i);var a=r[1],o=!1,h=this.sys.getGameObjectManager(e.goType,e.id);if(h){var l=h.commands[a];if(l){var u=h.getGO(e.id);Array.isArray(u)||(u=[u]);for(var c=0,d=u.length;c0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,a=1/i.zoom,o=r/2,h=n/2,l=r*a,u=n*a;e.x===o&&e.y===h||e.setPosition(o,h),e.width===l&&e.height===u||e.setSize(l,u)}}}const $o=Phaser.GameObjects.Zone;let Uo=class extends $o{constructor(t){super(t,0,0,2,2),this.fullWindow=new Ho(this)}};const Ko="BG",qo="SPRITE",Jo="TEXTBOX",Zo="TITLE",Qo="CHOICE",th="NAMEINPUT";var eh=!1,ih=function(t){eh||(void 0===t&&(t=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return rh(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return nh(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;ich(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ech(t).x,getChildLocalY:t=>ch(t).y};const Oh=Phaser.Math.DegToRad;var _h={updateChildRotation(t){var e=ch(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=ch(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return ch(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return ch(t).rotation=Oh(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=ch(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>ch(t).rotation},Eh={updateChildScale(t){var e=ch(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=ch(t),i=e.parent;return e.scaleX=Th(t.scaleX,i.scaleX),e.scaleY=Th(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=ch(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=ch(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>ch(t).scaleX,getChildLocalScaleY:t=>ch(t).scaleY},Mh={updateChildVisible(t){var e=ch(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=ch(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),ch(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),ch(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=ch(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>ch(t).visible},Dh={updateChildAlpha(t){var e=ch(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=ch(t),i=e.parent;return e.alpha=Th(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return ch(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=ch(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>ch(t).alpha},Lh={updateChildActive(t){var e=ch(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return ch(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),ch(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=ch(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>ch(t).active},Ah={updateChildScrollFactor(t){var e=ch(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},Rh={updateCameraFilter(t){var e=ch(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},Bh={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(t){void 0===t&&(t=!1);var e=this;return this._mask=null,this.setChildMaskVisible(this),this.children.forEach((function(t){t.clearMask&&t.clearMask(!1),t.hasOwnProperty("isRexContainerLite")||e.setChildMaskVisible(t)})),t&&this.mask&&this.mask.destroy(),this}},Fh=function(t){return t.filter((function(t){return!!t.displayList||(!!t.parentContainer||void 0)}))},Ih={setDepth(t,e){if(this.depth=t,!e&&this.children)for(var i=this.getAllChildren(),s=0,r=i.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},jh=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const Nh=Phaser.Utils.Array;var Gh={getChildren(t){if(t)for(var e=0,i=this.children.length;e0?u.pop().setTexture(d,O):r(c,d,O),h&&c.add.existing(P),l){var _=b+C*T+a*C,E=x+S*w+o*S;P.setOrigin(a,o).setPosition(_,E).setScale(f,v).setRotation(m),Il(P,b,x,m)}k.push(P)}return k}(t,e,i,s),a=0,o=n.length;a0&&(a=this.getChildLocalScaleX(s),a/=s.biasScale,this.setChildLocalScale(s,a)),r.biasScale&&(a=this.getChildLocalScaleX(r),a/=r.biasScale,this.setChildLocalScale(r,a));if(e?t.call(e,i,s,r,n):t(i,s,r,n),this.scaleMode)s.biasScale>0&&(a=this.getChildLocalScaleX(s),a*=s.biasScale,this.setChildLocalScale(s,a)),r.biasScale&&(a=this.getChildLocalScaleX(r),a*=r.biasScale,this.setChildLocalScale(r,a))}};Object.assign($l.prototype,Nl);const Kl={fit:1,FIT:1,envelop:2,ENVELOP:2};const ql=Phaser.GameObjects.GetCalcMatrix;const Jl=Phaser.Renderer.Canvas.SetTransform;var Zl={renderWebGL:function(t,e,i,s){e.updateData(),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=ql(e,i,s),a=r.calcMatrix.copyFrom(n.calc),o=e._displayOriginX,h=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e);for(var u,c=e.geom,d=0,p=c.length;d>>16,o=(65280&r)>>>8,h=255&r;t.fillStyle="rgba("+a+","+o+","+h+","+n+")"},uu=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,a=(16711680&r)>>>16,o=(65280&r)>>>8,h=255&r;t.strokeStyle="rgba("+a+","+o+","+h+","+n+")",t.lineWidth=e.lineWidth};const cu=Phaser.Geom.Polygon.Earcut;class du extends ru{constructor(){super(),this.pathData=[],this.pathIndexes=[],this.closePath=!1}updateData(){return this.pathIndexes=cu(this.pathData),super.updateData(),this}webglRender(t,e,i,s,r){this.isFilled&&au(t,e,this,i,s,r),this.isStroked&&hu(t,this,i,s,r)}canvasRender(t,e,i){var s=this.pathData,r=s.length-1,n=s[0]-e,a=s[1]-i;t.beginPath(),t.moveTo(n,a),this.closePath||(r-=2);for(var o=2;o=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const gu=Phaser.Math.DegToRad;var fu=function(t,e,i,s,r,n,a,o,h){a&&n>r?n-=360:!a&&n0,a=0,o=e.length;a0;this.dirty=this.dirty||this._radiusTL!==t||this._convexTL!==e,this._convexTL=e,this._radiusTL=Math.abs(t)}get radiusTR(){return this._radiusTR}set radiusTR(t){var e=t>0;this.dirty=this.dirty||this._radiusTR!==t||this._convexTR!==e,this._convexTR=e,this._radiusTR=Math.abs(t)}get radiusBL(){return this._radiusBL}set radiusBL(t){var e=t>0;this.dirty=this.dirty||this._radiusBL!==t||this._convexBL!==e,this._convexBL=e,this._radiusBL=Math.abs(t)}get radiusBR(){return this._radiusBR}set radiusBR(t){var e=t>0;this.dirty=this.dirty||this._radiusBR!==t||this._convexBR!==e,this._convexBR=e,this._radiusBR=Math.abs(t)}get radius(){return Math.max(this.radiusTL,this.radiusTR,this.radiusBL,this.radiusBR)}set radius(t){"number"==typeof t?(this.radiusTL=t,this.radiusTR=t,this.radiusBL=t,this.radiusBR=t):(this.radiusTL=Vu(t,"tl",0),this.radiusTR=Vu(t,"tr",0),this.radiusBL=Vu(t,"bl",0),this.radiusBR=Vu(t,"br",0))}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}get iterations(){return this._iterations}set iterations(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t}setIterations(t){return this.iterations=t,this}updateData(){var t=this.pathData;t.length=0;var e,i=this.width,s=this.height,r=this.iterations+1;(e=this.radiusTL)>0?this._convexTL?fu(e,e,e,e,180,270,!1,r,t):fu(0,0,e,e,90,0,!0,r,t):pu(0,0,t);(e=this.radiusTR)>0?this._convexTR?fu(i-e,e,e,e,270,360,!1,r,t):fu(i,0,e,e,180,90,!0,r,t):pu(i,0,t);(e=this.radiusBR)>0?this._convexBR?fu(i-e,s-e,e,e,0,90,!1,r,t):fu(i,s,e,e,270,180,!0,r,t):pu(i,s,t);(e=this.radiusBL)>0?this._convexBL?fu(e,s-e,e,e,90,180,!1,r,t):fu(0,s,e,e,360,270,!0,r,t):pu(0,s,t);return t.push(t[0],t[1]),Pu(this.x,this.y,t),super.updateData(),this}};const Xu=Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlpha;const Hu={arc:mu,circle:yu,curve:class extends du{constructor(t){super(),this.setCurve(t),this.setIterations(32)}get curve(){return this._curve}set curve(t){this.dirty=this.dirty||this._curve!==t,this._curve=t}setCurve(t){return this.curve=t,this}get iterations(){return this._iterations}set iterations(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t}setIterations(t){return this.iterations=t,this}updateData(){this.pathData.length=0;for(var t=this.curve.getPoints(this.iterations),e=0,i=t.length;e=0;s--)(a=r[s])instanceof e&&(a.destroy(),kc(r,s));else{s=0;for(var r,n=(r=t.postPipelines).length;s0}(e,bc),delete e.effect}})},function(t){t.addTransitionMode("revealRight",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(Cc,0,0)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}}).addTransitionMode("revealLeft",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(Cc,1,0)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}}).addTransitionMode("revealDown",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(Cc,0,1)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}}).addTransitionMode("revealUp",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(Cc,1,1)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}})}];class wc extends $l{constructor(t,e,i,s,r,n){super(t,e,i,s,r,n);for(var a=0,o=Sc.length;a0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n")}return i},Uc=function(t){return null==t?t="":Array.isArray(t)?t=t.join("\n"):"number"==typeof t&&(t=t.toString()),t},Kc={clearText(){return this.sections.length=0,this.pageStartIndexes.length=0,this.lines.length=0,this},appendPage(t){var e=this.totalLinesCount;this.sections.push(Uc(t));t=this.sections.join("\n");this.lines=$c(this.parent,t,this.lines);var i,s=this.totalLinesCount-e;i=this.pageLinesCount>0?Math.ceil(s/this.pageLinesCount):1;for(var r=0;r0?t+i:this.totalLinesCount}var s;switch(e>this.totalLinesCount&&(e=this.totalLinesCount),this.textObjectType){case 0:case 2:s=this.lines.slice(t,e).join("\n");break;case 1:var r=this.lines.getLineStartIndex(t),n=this.lines.getLineEndIndex(e-1);((s=this.lines.getSliceTagText(r,n,!0)).match(/\n/g)||[]).length>e-t-1&&(s=s.substring(0,s.length-1))}return s}};Object.assign(td,Kc,Jc,Qc);const ed=Phaser.Utils.Objects.GetValue;Phaser.Math.Clamp;class id extends Nn{constructor(t,e){super(t,{eventEmitter:!1}),this.textObjectType=Hc(this.parent),this.pageStartIndexes=[],this.lines=$c(this.parent,""),this.sections=[],this.resetFromJSON(e)}resetFromJSON(t){this.setMaxLines(ed(t,"maxLines",void 0)),this.setPageBreak(ed(t,"pageBreak","\f\n")),this.setText(ed(t,"text","")),this.startLineIndex=ed(t,"start",-1),this.endLineIndex=ed(t,"end",void 0);var e=ed(t,"page");return void 0===e?this.resetIndex():this.setPageIndex(e),this}toJSON(){return{maxLines:this.maxLines,text:this.content,start:this.startLineIndex,end:this.endLineIndex,page:this.pageIndex,pageBreak:this.pageBreak}}shutdown(t){if(!this.isShutdown){switch(this.textObjectType){case 0:case 2:this.lines.length=0;break;case 1:this.lines.destroy()}this.pageStartIndexes.length=0,this.sections.length=0,this.lines=void 0,this.pageStartIndexes=void 0,this.sections=void 0,super.shutdown(t)}}setMaxLines(t){return this.maxLines=t,this}setPageBreak(t){return this.pageBreak=t,this}get pageCount(){return this.pageStartIndexes.length}get lastPageIndex(){return this.pageCount-1}get isFirstPage(){return this.pageIndex<=0}get isLastPage(){return this.pageIndex>=this.pageCount-1}get totalLinesCount(){return this.lines?this.lines.length:0}get pageLinesCount(){if(void 0!==this.maxLines)return this.maxLines;var t;switch(this.textObjectType){case 0:case 1:var e=this.parent.style.maxLines;t=e>0?e:Math.floor(function(t){var e,i,s;switch(Hc(t)){case 0:case 1:e=t.height-t.padding.top-t.padding.bottom,i=t.lineSpacing,s=t.style.metrics.fontSize+t.style.strokeThickness;break;case 2:e=t.height,i=0;var r=t.fontSize/t.fontData.size;s=t.fontData.lineHeight*r}return(e-i)/(s+i)}(this.parent));break;case 2:t=this.totalLinesCount}return t}get isFirstLine(){return this.startLineIndex<=0}get isLastLine(){return this.endLineIndex===this.totalLinesCount}get content(){return this.sections.join(this.pageBreak)}}Object.assign(id.prototype,td);var sd={setText(t){this.setTextCallback&&(t=this.setTextCallbackScope?this.setTextCallback.call(this.setTextCallbackScope,t,this.isLastChar,this.insertIndex):this.setTextCallback(t,this.isLastChar,this.insertIndex)),this.textWrapEnable?Zc(this.parent,t):this.parent.setText(t)},appendText(t){var e=this.text.concat(Uc(t));return this.isTyping?this.setTypingContent(e):this.start(e,void 0,this.textLength),this}},rd=function(t,e){return t.getPlainText&&(e=t.getPlainText(e)),e},nd=function(t,e){for(var i=void 0,s=0;s0)l=ad(n,t,a=(o=i)-u,o);else l="";var c,d=e-u;if(d>0){o=(a=0)+d;this.insertIndex=o,c=ad(n,t,a,o)}else c="",this.insertIndex=0;r=c+l}return this.insertChar=r.charAt(this.insertIndex-1),r},hd={start:function(t,e,i,s){return void 0!==t&&this.setTypingContent(t),void 0!==e&&(this.speed=e),void 0===i&&(i=0),this.typingIndex=i+1,0===this.speed?this.stop(!0):(this.setText(""),this.startTimer(s)),this},startFromLine:function(t,e,i,s,r){var n;if(e>0){void 0===s&&(s=0);var a=rd(this.parent,t);n=nd(a,e)+s}return this.start(t,i,n,r)},stop:function(t){if(this.getTimer()&&this.freeTimer(),t){for(;!this.isLastChar;)od.call(this,this.text,this.typingIndex,this.textLength,this.typeMode),this.emit("typechar",this.insertChar),this.typingIndex++;this.setText(this.text),this.emit("type"),this.emit("complete",this,this.parent)}return this},pause:function(){var t=this.getTimer();return t&&(t.paused=!0),this},resumeTyping:function(){var t=this.getTimer();return t&&(t.paused=!1),this}};Object.assign(hd,sd);const ld=Phaser.Utils.Objects.GetFastValue,ud=Phaser.Utils.Objects.GetValue;class cd extends Nn{constructor(t,e){super(t,e),this.timer=null,this.resetFromJSON(e)}resetFromJSON(t){this.setTextWrapEnable(ud(t,"wrap",!1)),this.setTypeMode(ud(t,"typeMode",0)),this.setTypingSpeed(ud(t,"speed",333)),this.setTextCallback=ld(t,"setTextCallback",null),this.setTextCallbackScope=ld(t,"setTextCallbackScope",null),this.setTypingContent(ld(t,"text","")),this.typingIndex=ld(t,"typingIndex",0),this.insertIndex=null,this.insertChar=null;var e=ld(t,"elapsed",null);return null!==e&&this.start(void 0,void 0,this.typingIndex,e),this}shutdown(t){this.isShutdown||(this.freeTimer(),super.shutdown(t))}setTypeMode(t){return"string"==typeof t&&(t=dd[t]),this.typeMode=t,this}setTypeSpeed(t){return this.speed=t,this}setTypingSpeed(t){return this.speed=t,this}setTextWrapEnable(t){return void 0===t&&(t=!0),this.textWrapEnable=t,this}set text(t){var e=Uc(t);this.textWrapEnable&&(e=function(t,e){switch(Hc(t)){case 0:t.style.syncFont(t.canvas,t.context),e=t.runWordWrap(e);break;case 1:e=t.getText(e,void 0,void 0,!0);break;case 2:e=t.setText(e).getTextBounds().wrappedText}return e}(this.parent,e)),this._text=e}get text(){return this._text}get isTyping(){return null!==this.getTimer()}get isLastChar(){return this.typingIndex===this.textLength}setTypingContent(t){return this.text=t,this.textLength=rd(this.parent,this.text).length,this}onTyping(){var t=od.call(this,this.text,this.typingIndex,this.textLength,this.typeMode);this.setText(t),this.emit("typechar",this.insertChar),this.emit("type"),this.isLastChar?(this.freeTimer(),this.scene.sys.events.once("preupdate",(function(){this.emit("complete",this,this.parent)}),this)):(this.timer.delay=this.speed,this.typingIndex++)}startTimer(t){var e;return this.timer&&this.freeTimer(),void 0===t?e=0:(this.speed,e=t),this.timer=this.scene.time.addEvent({delay:1e-4,startAt:e,loop:!0,callback:this.onTyping,callbackScope:this}),this}getTimer(){return this.timer}freeTimer(){return this.timer&&(this.timer.remove(),this.timer=null),this}setText(t){this.setTextCallback&&(t=this.setTextCallbackScope?this.setTextCallback.call(this.setTextCallbackScope,t,this.isLastChar,this.insertIndex):this.setTextCallback(t,this.isLastChar,this.insertIndex)),this.textWrapEnable?Zc(this.parent,t):this.parent.setText(t)}}const dd={"left-to-right":0,"right-to-left":1,"middle-to-sides":2,"sides-to-middle":3};Object.assign(cd.prototype,hd);const pd=Phaser.Utils.Objects.GetValue;const gd={page:0,line:1};var fd=function(t){return t.hasOwnProperty("rexSizer")||(t.rexSizer={}),t.rexSizer};const vd=Phaser.Display.Align;var md={center:vd.CENTER,left:vd.LEFT_CENTER,right:vd.RIGHT_CENTER,top:vd.TOP_CENTER,bottom:vd.BOTTOM_CENTER,"left-top":vd.TOP_LEFT,"top-left":vd.TOP_LEFT,"left-center":vd.LEFT_CENTER,"center-left":vd.LEFT_CENTER,"left-bottom":vd.BOTTOM_LEFT,"bottom-left":vd.BOTTOM_LEFT,"center-top":vd.TOP_CENTER,"top-center":vd.TOP_CENTER,"center-center":vd.CENTER,"center-bottom":vd.BOTTOM_CENTER,"bottom-center":vd.BOTTOM_CENTER,"right-top":vd.TOP_RIGHT,"top-right":vd.TOP_RIGHT,"right-center":vd.RIGHT_CENTER,"center-right":vd.RIGHT_CENTER,"right-bottom":vd.BOTTOM_RIGHT,"bottom-right":vd.BOTTOM_RIGHT},yd=function(){},bd=new Phaser.GameObjects.Zone({sys:{queueDepthSort:yd,events:{once:yd}}},0,0,1,1);bd.setOrigin(0);var xd=0,kd=1,Cd=2,Sd=4,wd=6,Td=8,Pd=10,Od=12,_d=function(t){var e=Nr(t);return t.y+e-e*t.originY},Ed=function(t){var e=zr(t);return t.x-e*t.originX+.5*e},Md=function(t,e){var i=Nr(t);return t.y=e-i+i*t.originY,t},Dd=function(t,e){var i=zr(t),s=i*t.originX;return t.x=e+s-.5*i,t},Ld=function(t){var e=zr(t);return t.x-e*t.originX},Ad=function(t,e){var i=zr(t);return t.x=e+i*t.originX,t},Rd=function(t){var e=zr(t);return t.x+e-e*t.originX},Bd=function(t,e){var i=zr(t);return t.x=e-i+i*t.originX,t},Fd=function(t,e){var i=Nr(t),s=i*t.originY;return t.y=e+s-.5*i,t},Id=function(t){var e=Nr(t);return t.y-e*t.originY+.5*e},jd=function(t){var e=Nr(t);return t.y-e*t.originY},zd=function(t,e){var i=Nr(t);return t.y=e+i*t.originY,t},Nd=[];Nd[11]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Dd(t,Ed(e)+i),Md(t,_d(e)+s),t},Nd[Pd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Ad(t,Ld(e)-i),Md(t,_d(e)+s),t},Nd[Od]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Bd(t,Rd(e)+i),Md(t,_d(e)+s),t},Nd[wd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),function(t,e,i){Dd(t,e),Fd(t,i)}(t,Ed(e)+i,Id(e)+s),t},Nd[Sd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Ad(t,Ld(e)-i),Fd(t,Id(e)+s),t},Nd[Td]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Bd(t,Rd(e)+i),Fd(t,Id(e)+s),t},Nd[kd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Dd(t,Ed(e)+i),zd(t,jd(e)-s),t},Nd[xd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Ad(t,Ld(e)-i),zd(t,jd(e)-s),t},Nd[Cd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Bd(t,Rd(e)+i),zd(t,jd(e)-s),t};var Gd=function(t,e,i,s,r){return Nd[i](t,e,s,r)},Wd=function(t,e,i,s,r,n){bd.setPosition(e,i).setSize(s,r),Gd(t,bd,n)};const Vd=Phaser.Utils.Objects.GetValue,Yd=Phaser.GameObjects.Group,Xd=Phaser.GameObjects.Container;var Hd=function(t,e,i){return t.add.text(0,0,"")},$d=function(t,e){Array.isArray(t)||(t=[t]),void 0===e&&(e=[]);for(var i=0,s=t.length;i=0;e--)this.remove(this.backgroundChildren[e],t);return this}},op=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const hp=/(\S+)\[(\d+)\]/i;const lp=Phaser.Utils.Objects.GetValue;var up=function(t,e){return void 0===e?t:t[e]},cp=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=lp(e,"left",0),t.right=lp(e,"right",0),t.top=lp(e,"top",0),t.bottom=lp(e,"bottom",0)),t},dp={getInnerPadding(t){return up(this.space,t)},setInnerPadding(t,e){return cp(this.space,t,e),this},getOuterPadding(t){return up(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return cp(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),up(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),cp(this.getSizerConfig(t).padding,e,i),this}},pp=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},gp=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},fp=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},vp=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},mp=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},yp=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},bp={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},xp=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var Og={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Bn(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},_g={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=yd),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=yd),this.transitOutCallback=t,this}},Eg={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Mg={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Dg={};Object.assign(Dg,Og,_g,Eg,Mg);const Lg=Phaser.Utils.Objects.GetValue;class Ag extends Nn{constructor(t,e){super(t,e),this.setTransitInTime(Lg(e,"duration.in",200)),this.setTransitOutTime(Lg(e,"duration.out",200)),this.setTransitInCallback(Lg(e,"transitIn")),this.setTransitOutCallback(Lg(e,"transitOut")),this.oneShotMode=Lg(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Pg(this,{eventEmitter:!1,initState:Lg(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Ag.prototype,Dg);const Rg=Phaser.GameObjects.Rectangle;class Bg extends Rg{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Ho(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Fg=Phaser.Utils.Objects.GetValue;class Ig extends Nn{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Fg(t,"hitAreaMode",0)),this.setEnable(Fg(t,"enable",!0)),this.setStopMode(Fg(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=jg[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var jg={default:0,fullWindow:1};const zg=Phaser.Utils.Objects.GetValue;class Ng extends Bg{constructor(t,e){super(t,zg(e,"color",0),zg(e,"alpha",.8)),this.touchEventStop=new Ig(this,{hitAreaMode:1})}}var Gg={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Bp(t,e)},scaleDown(t,e){Fp(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Up(t,e)},fadeOut(t,e){Kp(t,e,!1)}},Wg=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Up(t,e,t.alpha)},Vg=function(t,e){Kp(t,e,!1)},Yg=function(t,e,i,s,r){return!!t&&(!(s&&!s(t,e,i))&&(!!Xr(t,!0).contains(e,i)&&!(r&&!r(t,e,i))))};const Xg=Phaser.Utils.Objects.GetValue;let Hg=class extends Ag{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=$g.popUp),null==e.transitOut&&(e.transitOut=$g.scaleDown),e.destroy=Xg(e,"destroy",!0),super(t,e);var i=Xg(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Ng(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Xg(i,"transitIn",Wg)),this.setCoverTransitOutCallback(Xg(i,"transitOut",Vg)));var s=Xg(e,"touchOutsideClose",!1),r=Xg(e,"duration.hold",-1),n=Xg(e,"timeOutClose",r>=0),a=Xg(e,"anyTouchClose",!1);Xg(e,"manualClose",!1)&&(s=!1,a=!1,n=!1),a&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),a?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Xg(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Yg(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=$g[t]),t){case $g.popUp:t=Gg.popUp;break;case $g.fadeIn:t=Gg.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=$g[t]),t){case $g.scaleDown:t=Gg.scaleDown;break;case $g.fadeOut:t=Gg.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const $g={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Ug=function(t){return t&&"function"==typeof t},Kg={modal(t,e){return Ug(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new Hg(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},qg=function(t,e,i,s,r){Ug(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},Jg={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),bo(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return qg.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return qg.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return qg.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return qg.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return qg.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return qg.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return qg.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return qg.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return qg.call(this,"shutdown",t,e,i,s),this}},Zg=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=Qg),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},Qg={},tf=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,a=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return a?Yg(t,e.x,e.y,i,s):!!(r=Zg(e,n,!0))&&Yg(t,r.x,r.y,i,s);for(var o=t.scene.input.manager,h=o.pointersTotal,l=o.pointers,u=0;u=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const pf={press:0,pointerdown:0,release:1,pointerup:1};var gf={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new df(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},ff=function(t,e,i,s,r){if(e)return!(i&&!i(t,e))&&(!!vf(t,e)&&!(s&&!s(t,e)));void 0===r&&(r=!1);for(var n=t.scene.input.manager,a=n.pointersTotal,o=n.pointers,h=0;h0)return mf.length=0,!0;return mf.length=0,!1},mf=[];const yf=Phaser.Utils.Objects.GetValue;class bf extends Nn{constructor(t,e){super(t,e),this._enable=void 0;var i=yf(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(yf(t,"enable",!0)),this.setMode(yf(t,"mode",1)),this.setClickInterval(yf(t,"clickInterval",100)),this.setDragThreshold(yf(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=xf[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?ff:tf)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const xf={press:0,pointerdown:0,release:1,pointerup:1};var kf={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new bf(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Cf extends Tg{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Sf=Phaser.Utils.Objects.GetValue;class wf extends Nn{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Cf,this.parent.setInteractive(Sf(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Sf(t,"enable",!0)),this.setCooldown(Sf(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Tf={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&tf(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new wf(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new wf(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Pf={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Of=function(t,e,i,s){if("parent"===t){for(var r,n=0,a=e.length;n0),this.onDragStart()))}onPointerUp(t){this.enable&&((!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Vf,this.onDragEnd()))}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Yf&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Vf,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Xf,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&tf(t,s,e,i)}}const Vf=0,Yf=1,Xf="IDLE",Hf=Phaser.Utils.Objects.GetValue,$f=Phaser.Math.Distance.Between;class Uf extends Wf{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=Kf},eventEmitter:!1};this.setRecongizedStateObject(new Tg(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Hf(t,"time",250)),this.setTapInterval(Hf(t,"tapInterval",200)),this.setDragThreshold(Hf(t,"threshold",9)),this.setTapOffset(Hf(t,"tapOffset",10));var e=Hf(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Hf(t,"maxTaps",void 0)),this.setMinTaps(Hf(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case Kf:this.state=qf;break;case qf:var t=this.lastPointer;$f(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=Jf,this.state=qf);break;case Jf:this.state=qf}}onDragEnd(){this.state===qf&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=Jf))}onDrag(){this.state!==Kf&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Kf)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===qf){var i=this.lastPointer;if(i.isDown)t-i.downTime>this.holdTime&&(this.state=Kf);else t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=Jf:this.state=Kf)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Jf&&(this.state=Kf)}get isTapped(){return this.state===Jf}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const Kf="IDLE",qf="BEGIN",Jf="RECOGNIZED",Zf=Phaser.Utils.Objects.GetValue;class Qf extends Wf{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=tv},eventEmitter:!1};this.setRecongizedStateObject(new Tg(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Zf(t,"threshold",9)),this.setHoldTime(Zf(t,"time",251)),this}onDragStart(){this.state=ev,0===this.holdTime&&(this.state=iv)}onDragEnd(){this.state=tv}onDrag(){this.state!==tv&&this.pointer.getDistance()>this.dragThreshold&&(this.state=tv)}preUpdate(t,e){this.isRunning&&this.enable&&(this.state===ev&&t-this.pointer.downTime>=this.holdTime&&(this.state=iv))}get isPressed(){return this.state===iv}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const tv="IDLE",ev="BEGIN",iv="RECOGNIZED";Phaser.Utils.Objects.GetValue;var sv=function(t){return jn(t).loop.delta};const rv=Phaser.Math.Distance.Between,nv=Phaser.Math.Angle.Between;var av={getDt:function(){return sv(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return rv(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return nv(e.x,e.y,t.x,t.y)}},ov={"up&down":0,"left&right":1,"4dir":2,"8dir":3},hv={};const lv=Phaser.Utils.Objects.GetValue,uv=Phaser.Math.RadToDeg;class cv extends Wf{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=dv},eventEmitter:!1};this.setRecongizedStateObject(new Tg(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(lv(t,"threshold",10)),this.setVelocityThreshold(lv(t,"velocityThreshold",1e3)),this.setDirectionMode(lv(t,"dir","8dir")),this}onDragStart(){this.state=pv}onDragEnd(){this.state=dv}onDrag(){this.state===pv&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=gv))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===gv&&(this.state=dv)}get isSwiped(){return this.state===gv}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=ov[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=hv),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(uv(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(cv.prototype,av);const dv="IDLE",pv="BEGIN",gv="RECOGNIZED",fv=Phaser.Utils.Objects.GetValue,vv=Phaser.Utils.Array.SpliceOne,mv=Phaser.Math.Distance.Between,yv=Phaser.Math.Angle.Between;class bv{constructor(t,e){var i=Bn(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(fv(e,"inputConfig",void 0)),this.setEventEmitter(fv(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(fv(t,"enable",!0)),this.bounds=fv(t,"bounds",void 0),this.tracerState=kv,this.pointers.length=0,co(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,co(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&(2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t)))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case kv:this.tracerState=Cv,this.onDrag1Start();break;case Cv:this.tracerState=Sv,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],vv(this.pointers,e),this.tracerState){case Cv:this.tracerState=kv,this.onDrag1End();break;case Sv:this.tracerState=Cv,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case Cv:this.onDrag1();break;case Sv:this.onDrag2()}}}dragCancel(){return this.tracerState===Sv&&this.onDrag2End(),this.pointers.length=0,co(this.movedState),this.tracerState=kv,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Sv)return 0;var t=this.pointers[0],e=this.pointers[1];return mv(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Sv)return 0;var t=this.pointers[0],e=this.pointers[1];return yv(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;xv.x=e.x-i.x,xv.y=e.y-i.y}else xv.x=0,xv.y=0;return xv}get centerX(){if(this.tracerState!==Sv)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Sv)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Sv)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Sv)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=wv,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&tf(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&tf(t,s,e,i)}}Object.assign(bv.prototype,ur);var xv={};const kv=0,Cv=1,Sv=2,wv="IDLE";Phaser.Utils.Objects.GetValue;const Tv=Phaser.Math.RotateAround;var Pv=function(t,e,i,s){return Tv(t,e,i,s),t.rotation+=s,t},Ov={};const _v=Phaser.Utils.Objects.GetValue,Ev=Phaser.Math.Angle.WrapDegrees,Mv=Phaser.Math.Angle.ShortestBetween,Dv=Phaser.Math.RadToDeg,Lv=Phaser.Math.DegToRad;var Av={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Ov),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,a=r.y,o=this.rotation;if(Array.isArray(t))for(var h=t,l=0,u=h.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Ev(Dv(this.angleBetween));this.angle=Mv(this.prevAngle,t),this.prevAngle=t,this.state=Fv}break;case Fv:t=Ev(Dv(this.angleBetween));this.angle=Mv(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Fv}get rotation(){return Lv(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Av);const Rv="IDLE",Bv="BEGIN",Fv="RECOGNIZED",Iv=Phaser.Utils.Objects.GetValue;var jv=function(t){var e=Iv(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new Uf(this,e),this._tap.on("tap",(function(t,e,s){_f(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),_f(i.eventEmitter,`${i.eventNamePrefix}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const zv=Phaser.Utils.Objects.GetValue;var Nv=function(t){var e=zv(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new Qf(this,e),this._press.on("pressstart",(function(t,e,s){_f(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this).on("pressend",(function(t,e,s){_f(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Gv=Phaser.Utils.Objects.GetValue;var Wv=function(t){var e=Gv(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new cv(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";_f(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),_f(i.eventEmitter,`${i.eventNamePrefix}swipe`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Vv=Phaser.Utils.Objects.GetValue;var Yv=function(t,e){return t.setInteractive(),Vv(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Vv(e,"targets",[t]),targetMode:Vv(e,"targetMode","parent"),eventEmitter:Vv(e,"eventEmitter",t),eventNamePrefix:Vv(e,"inputEventPrefix","child.")},Mf.call(t,e),Af.call(t,e),Ff.call(t,e),Nf.call(t,e),jv.call(t,e),Nv.call(t,e),Wv.call(t,e),t},Xv={getSizerConfig:function(t){return void 0===t&&(t=this),fd(t)},getChildPrevState:function(t){var e=fd(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=un(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,a,o=t.scene;if("number"==typeof e)i=e;else{i=Vd(e,"color"),s=Vd(e,"lineWidth");var h=Vd(e,"name",!1);h&&(r=Vd(h,"createTextCallback",Hd),n=Vd(h,"createTextCallbackScope",void 0),"string"==typeof(a=Vd(h,"align","left-top"))&&(a=md[a]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new Yd(o),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}var u,c,d=this.getAllShownChildren([this]);$d(d,d);for(var p=0,g=d.length;p(h=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(r=h,s=n)}var h;o=i[i.length-1];return r>(h=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(r=h,s=n+1),s};const tm=Phaser.Utils.Objects.IsPlainObject,em=Phaser.Utils.Objects.GetValue,im=Phaser.Display.Align.CENTER,sm={min:0,full:-1};var rm=function(t,e,i,s,r,n,a,o,h,l){var u,c,d,p;qd.call(this,t);var g=t.isRexSpace,f=typeof e;if(null===e)return this;if("number"===f);else if("string"===f)e=sm[e];else if(tm(e)){var v;e=em(v=e,"proportion",void 0),i=em(v,"align",im),s=em(v,"padding",0),r=em(v,"expand",!1),n=em(v,"key",void 0),a=em(v,"index",void 0),t.isRexSizer||(o=em(v,"minWidth",void 0),h=em(v,"minHeight",void 0)),l=em(v,"fitRatio",0),u=em(v,"offsetX",0),c=em(v,"offsetY",0),d=em(v,"offsetOriginX",0),p=em(v,"offsetOriginY",0)}return"string"==typeof i&&(i=md[i]),void 0===e&&(e=g?1:0),void 0===i&&(i=im),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===o&&(g?o=0:t.isRexSizer||(o=t._minWidth)),void 0===h&&(g?h=0:t.isRexSizer||(h=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=zr(t)/Nr(t)),void 0===u&&(u=0),void 0===c&&(c=0),void 0===d&&(d=0),void 0===p&&(p=0),(v=this.getSizerConfig(t)).proportion=e,v.align=i,v.padding=El(s),v.expand=r,v.fitRatio=0===e?l:0,v.alignOffsetX=u,v.alignOffsetY=c,v.alignOffsetOriginX=d,v.alignOffsetOriginY=p,void 0===a||a>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(a,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===o?zr(t):o:t.minHeight=void 0===h?Nr(t):h),r&&(0===this.orientation?t.minHeight=h:t.minWidth=o)),void 0!==n&&this.addChildrenMap(n,t),this},nm={add:rm,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),rm.call(this,new Zv(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,o){return tm(i)&&(i.index=t),rm.call(this,e,i,s,r,n,a,t,o),this},insertAtPosition(t,e,i,s,r,n,a,o,h){var l=Qv.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,o,h),this}};const am=al.prototype.clear;var om=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),am.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,om.call(this,t),this}},um={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=md[e]),this.getSizerConfig(t).align=e,this}},cm={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},dm={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},pm={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},gm={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,o=this.sizerChildren,h=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,u=0,c=o.length;u0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?h=!0:n=0)):n=0,h||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,a+=n)));else for(u=0,c=o.length;u0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?h=!0:n=0)):n=0,h||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,a+=n)))}return h?void 0:a+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,a=s.padding;i=n-(a.left+a.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,a=s.padding;i=n-(a.top+a.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Sp(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,xp.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,o,h,l,u,c,d=this.sizerChildren,p=this.innerLeft,g=this.innerTop,f=this.innerWidth,v=this.innerHeight,m=p,y=g,b=this.startChildIndex,x=0,k=d.length;x0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=vp.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||gp.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&qv.call(this,t,void 0),fp.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||mp.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&qv.call(this,void 0,t),yp.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],a=n&&n.isRexSpace;return"center"===t?a||this.insertSpace(r+1):a&&this.remove(n,!0),this}};Object.assign(gm,nm,lm,um,cm,dm,pm);var fm=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},vm={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},mm=function(t){return"string"==typeof t&&(t=vm[t]),t};const ym=Phaser.Utils.Objects.IsPlainObject,bm=Phaser.Utils.Objects.GetValue;class xm extends $v{constructor(t,e,i,s,r,n,a){ym(e)?(e=bm(a=e,"x",0),i=bm(a,"y",0),s=bm(a,"width",void 0),r=bm(a,"height",void 0),n=bm(a,"orientation",0)):ym(s)?(s=bm(a=s,"width",void 0),r=bm(a,"height",void 0),n=bm(a,"orientation",0)):ym(n)&&(n=bm(a=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,a),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(bm(a,"space.item",0)),this.setStartChildIndex(bm(a,"startChildIndex",0)),this.setRTL(bm(a,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=mm(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=fm.call(this)),this._childrenProportion}}Object.assign(xm.prototype,gm);var km=function(t,e,i){if(t){var s=null==e,r=null==i;return s&&r||(s||(t.displayWidth=e),r||(t.displayHeight=i),s&&(t.scaleX=t.scaleY),r&&(t.scaleY=t.scaleX)),t}},Cm=function(t,e){var i;return t||0===t||(t=""),void 0===e&&(e=!0),Array.isArray(t)&&(t=t.join("\n")),(i=e?`${this.text}\n${t}`:`${this.text}${t}`)!=this.text&&this.setText(i),this},Sm={appendText:Cm,resetDisplayContent:function(t){void 0===t?t={}:"string"==typeof t&&(t={text:t});var e=t.text||"";this.setText(e);var i=this.childrenMap.icon;if(i){t.icon?this.show(i):this.hide(i);var s=t.iconSize;s&&(this.setChildDisplaySize(i,s,s),void 0!==this.iconWidth&&this.setIconSize(s)),!0!==t.icon&&this.setIconTexture(t.icon,t.iconFrame)}var r=this.childrenMap.action;if(r){t.action?this.show(r):this.hide(r);var n=t.actionSize;n&&(this.setChildDisplaySize(r,n,n),void 0!==this.actionWidth&&this.setActionSize(n)),!0!==t.action&&this.setActionTexture(t.action,t.actionFrame)}return this}};class wm extends xm{get text(){var t=this.childrenMap.text;return t?t.text:""}set text(t){var e=this.childrenMap.text;e&&e.setText(t)}setText(t){return this.text=t,this}setIconTexture(t,e){var i=this.childrenMap.icon;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.iconWidth&&void 0!==this.iconHeight&&(km(i,this.iconWidth,this.iconHeight),this.resetChildScaleState(i)),this):this}setTexture(t,e){return this.setIconTexture(t,e),this}setIconSize(t,e){return void 0===e&&(e=t),this.iconWidth=t,this.iconHeight=e,this}get texture(){var t=this.childrenMap.icon;if(t)return t.texture}get frame(){var t=this.childrenMap.icon;if(t)return t.frame}setActionTexture(t,e){var i=this.childrenMap.action;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.actionWidth&&void 0!==this.actionHeight&&(km(i,this.actionWidth,this.actionHeight),this.resetChildScaleState(i)),this):this}get actionTexture(){var t=this.childrenMap.action;if(t)return t.texture}get actionFrame(){var t=this.childrenMap.action;if(t)return t.frame}setActionSize(t,e){return void 0===e&&(e=t),this.actionWidth=t,this.actionHeight=e,this}preLayout(){var t=this.childrenMap.icon;t&&void 0!==this.iconWidth&&void 0!==this.iconHeight&&km(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&km(e,this.actionWidth,this.actionHeight),super.preLayout()}postLayout(t,e,i){var s=this.childrenMap.iconMask;s&&(s.setPosition(),this.resetChildPositionState(s));var r=this.childrenMap.actionMask;return r&&(r.setPosition(),this.resetChildPositionState(r)),super.postLayout(t,e,i),this}resize(t,e){super.resize(t,e);var i=this.childrenMap.iconMask;i&&i.resize();var s=this.childrenMap.actionMask;return s&&s.resize(),this}}Object.assign(wm.prototype,Sm);var Tm=function(t,e,i,s){var r=new Dl(e,i,s);if(t&&!t.isRexSizer){var n=r.createGeometryMask();t.setMask(n),this.once("destroy",(function(){t.setMask(),n.destroy()}))}return this.pin(r),r};const Pm=Phaser.Utils.Objects.GetValue;const Om=Phaser.Utils.Objects.GetValue;var _m=/^[\x00-\x7F]+$/,Em=function(t){return _m.test(t)},Mm=function(t,e){for(var i=[],s=t.split("\n"),r=e.style,n=r.wordWrapWidth,a=r.hasOwnProperty("wrapMode")?r.wrapMode:3,o=e.context,h=0,l=s.length;h0&&r.push(h.join("")),r},Lm=0,Am=1,Rm=2,Bm=0,Fm=1,Im=2,jm=/(?:\r\n|\r|\n)/;const zm={none:Bm,word:Fm,char:Im,character:Im,mix:3};var Nm=function(t,e){switch(Hc(t)){case 0:switch("string"==typeof e&&(e=zm[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=Mm;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=zm[e]||0),t.style.wrapMode=e}};const Gm=Phaser.Renderer.WebGL.Utils;var Wm={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,a=r.height,o=Gm.getTintAppendFloatAlpha,h=t.pipelines.set(e.pipeline,e),l=h.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),h.batchTexture(e,r.glTexture,n,a,e.x,e.y,n/e.resolution,a/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,a,o(e.tintTopLeft,i.alpha*e._alphaTL),o(e.tintTopRight,i.alpha*e._alphaTR),o(e.tintBottomLeft,i.alpha*e._alphaBL),o(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const Vm=Phaser.Display.Color;var Ym={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,a,o,h,l){var u=this.scene.sys.textures.getFrame(t,e);if(!u)return this;var c=u.cutWidth,d=u.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=d),void 0===a&&(a=0),void 0===o&&(o=0),void 0===h&&(h=c),void 0===l&&(l=d);var p=u.cutX+a,g=u.cutY+o;return this.context.drawImage(u.source.image,p,g,h,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new Vm);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var a=i;i=a.red,s=a.green,r=a.blue,n=a.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var o=this.context.createImageData(1,1);return o.data[0]=i,o.data[1]=s,o.data[2]=r,o.data[3]=n,this.context.putImageData(o,t,e),this.dirty=!0,this}},Xm=function(t,e,i,s,r,n,a){var o,h=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===a&&(a=e.height);var u=(o=h.exists(i)?h.get(i):h.createCanvas(i,n,a)).getSourceImage();u.width!==n&&(u.width=n),u.height!==a&&(u.height=a);var c=u.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,a),c.drawImage(e,s,r,n,a),l.gl&&o&&l.canvasToTexture(u,o.source[0].glTexture,!0,0)},Hm={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,Xm(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};ih();const $m=Phaser.Display.Canvas.CanvasPool,Um=Phaser.GameObjects.GameObject,Km=Phaser.Utils.String.UUID;let qm=class extends Um{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=$m.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=Km(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){$m.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}};const Jm=Phaser.GameObjects.Components;Phaser.Class.mixin(qm,[Jm.Alpha,Jm.BlendMode,Jm.Crop,Jm.Depth,Jm.Flip,Jm.GetBounds,Jm.Mask,Jm.Origin,Jm.Pipeline,Jm.PostPipeline,Jm.ScrollFactor,Jm.Tint,Jm.Transform,Jm.Visible,Wm,Ym,Hm]);let Zm=class{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}};Object.assign(Zm.prototype,su);var Qm={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const ty=Phaser.Math.RotateAround;var ey;const iy=Phaser.Geom.Rectangle;var sy,ry=function(t){void 0===sy&&(sy=new iy);var e=t.drawTLX,i=t.drawTLY;return sy.setTo(e,i,t.drawTRX-e,t.drawBLY-i),sy};const ny=Phaser.Math.RotateAround;var ay,oy=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===ay&&(ay={}),s=ay),s.x=e,s.y=i,0!==t.rotation&&ny(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const hy=Phaser.GameObjects.Components.TransformMatrix;var ly,uy,cy={},dy=function(t,e,i,s,r){var n=oy(e,i,s,!0),a=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=cy);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===ly&&(ly=new hy,uy=new hy),t.parentContainer?t.getWorldTransformMatrix(ly,uy):ly.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),ly.transformPoint(r,n,s),s}(t,n.x,n.y,r);return a},py=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,a=e.drawCenterY+s;return dy(t,e,n,a,r)},gy={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===ey&&(ey={}),s=ey),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&ty(s,0,0,-i.rotation),s}(t,e,this,!0);return ry(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return py(this.parent,this,t,e,i)}};Object.assign(gy,Qm);const fy=Phaser.Math.DegToRad,vy=Phaser.Math.RadToDeg,my=Phaser.Utils.Objects.GetValue;class yy extends Zm{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return vy(this._rotation)}set angle(t){this.rotation=fy(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=my(t,"width",void 0),i=my(t,"height",void 0),s=my(t,"scaleX",void 0),r=my(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(yy.prototype,gy);const by=Phaser.Utils.String.Pad;var xy=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${by(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},ky=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Cy=Phaser.Utils.Objects.GetValue;let Sy=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=Cy(t,"x",0),i=Cy(t,"y",0));var s=this.cornerRadius;s.tl=wy(Cy(t,"tl",void 0),e,i),s.tr=wy(Cy(t,"tr",void 0),e,i),s.bl=wy(Cy(t,"bl",void 0),e,i),s.br=wy(Cy(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Ty(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Ty(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Ty(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Ty(this.cornerRadius.br,t)}};var wy=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Py(t),t},Ty=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Cy(e,"x",0),t.y=Cy(e,"y",0)),Py(t)},Py=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const Oy=Phaser.Math.DegToRad;var _y=function(t){return!t.hasOwnProperty("convex")||t.convex},Ey=function(t){return t.x>0&&t.y>0},My=function(t,e,i,s,r,n,a,o,h){if(o&&a>n?a-=360:!o&&a=p?1:s/p,v=r>=g?1:r/g,m=d.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),o=m.tl,Ey(o)?(h=o.x*f,l=o.y*v,_y(o)?My(t,h,l,h,l,180,270,!1,a):My(t,0,0,h,l,90,0,!0,a),u=0,c=l):(t.lineTo(0,0),u=0,c=0),o=m.tr,Ey(o)?(h=o.x*f,l=o.y*v,_y(o)?My(t,s-h,l,h,l,270,360,!1,a):My(t,s,0,h,l,180,90,!0,a)):t.lineTo(s,0),o=m.br,Ey(o)?(h=o.x*f,l=o.y*v,_y(o)?My(t,s-h,r-l,h,l,0,90,!1,a):My(t,s,r,h,l,270,180,!0,a)):t.lineTo(s,r),o=m.bl,Ey(o)?(h=o.x*f,l=o.y*v,_y(o)?My(t,h,r-l,h,l,90,180,!1,a):My(t,0,r,h,l,360,270,!0,a)):t.lineTo(0,r),t.lineTo(u,c),t.closePath(),t.restore()}(e,i,s,r,n,a,d),null!=o){var p;if(null!=u)(p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,o),p.addColorStop(1,u),o=p;e.fillStyle=o,e.fill()}null!=h&&l>0&&(e.strokeStyle=h,e.lineWidth=l,e.stroke())},Ly=function(t,e,i,s,r,n,a,o){if(null!=e||null!=i){var h=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var u=s/2;h=Math.max(1,h-s),l=Math.max(1,l-s),Dy(t.canvas,t.context,u,u,h,l,r,e,i,s,n,a,o)}};const Ay=Phaser.Utils.Objects.GetValue;class Ry extends yy{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(Ay(e,"color",null),Ay(e,"color2",null),Ay(e,"horizontalGradient",!0)),this.setStroke(Ay(e,"stroke",null),Ay(e,"strokeThickness",2)),this.setCornerRadius(Ay(e,"cornerRadius",0),Ay(e,"cornerIteration",null))}set color(t){t=xy(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=xy(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=xy(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,ky("color2",t,this),ky("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,ky("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,ky("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){Ly(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const By=Phaser.Utils.Objects.GetValue;class Fy extends yy{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(By(e,"color",null),By(e,"color2",null),By(e,"horizontalGradient",!0)),this.setStroke(By(e,"stroke",null),By(e,"strokeThickness",2))}set color(t){t=xy(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=xy(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=xy(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,By(t,"color2",null),By(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,By(t,"strokeThickness",2))}renderContent(){var t=this.parent.padding,e=t.left,i=t.top,s=this.parent.width-t.left-t.right,r=this.parent.height-t.top-t.bottom,n=this.context;if(null!=this.color){var a,o;if(null!=this.color2)(o=this.horizontalGradient?n.createLinearGradient(0,0,s,0):n.createLinearGradient(0,0,0,r)).addColorStop(0,this.color),o.addColorStop(1,this.color2),a=o;else a=this.color;n.fillStyle=a,n.fillRect(e,i,s,r)}null!=this.stroke&&this.strokeThickness>0&&(n.strokeStyle=this.stroke,n.lineWidth=this.strokeThickness,n.strokeRect(e,i,s,r))}}const Iy=Phaser.Utils.Objects.GetValue;let jy=class t{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(Iy(t,"bold",!1)),this.setItalic(Iy(t,"italic",!1)),this.setFontSize(Iy(t,"fontSize","16px")),this.setFontFamily(Iy(t,"fontFamily","Courier")),this.setColor(Iy(t,"color","#fff")),this.setStrokeStyle(Iy(t,"stroke",null),Iy(t,"strokeThickness",0)),this.setShadow(Iy(t,"shadowColor",null),Iy(t,"shadowOffsetX",0),Iy(t,"shadowOffsetY",0),Iy(t,"shadowBlur",0)),this.setOffset(Iy(t,"offsetX",0),Iy(t,"offsetY",0)),this.setSpace(Iy(t,"leftSpace",0),Iy(t,"rightSpace",0)),this.setAlign(Iy(t,"align",void 0)),this.setBackgroundColor(Iy(t,"backgroundColor",null)),this.setBackgroundHeight(Iy(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Iy(t,"backgroundBottomY",void 0)),this.setBackgroundLeftX(Iy(t,"backgroundLeftX",0)),this.setBackgroundRightX(Iy(t,"backgroundRightX",0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(ky("stroke",t,this),ky("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(ky("shadowOffsetX",t,this),ky("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),t.hasOwnProperty("backgroundLeftX")&&this.setBackgroundLeftX(t.backgroundLeftX),t.hasOwnProperty("backgroundRightX")&&this.setBackgroundRightX(t.backgroundRightX),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new t(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=xy(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=xy(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=xy(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=xy(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setBackgroundLeftX(t){return this.backgroundLeftX=t,this}setBackgroundRightX(t){return this.backgroundRightX=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}};const zy=Phaser.Utils.Array.Remove;const Ny=Phaser.Utils.Array.Remove;const Gy="text",Wy="image",Vy="drawer",Yy="space",Xy="command";var Hy=function(t){return t.type===Gy&&"\n"===t.text},$y=function(t){return t.type===Gy&&"\f"===t.text},Uy=function(t){return t.type===Gy};class Ky extends yy{constructor(t,e,i){super(t,Gy),this.updateTextFlag=!1,this.style=new jy(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX+e.backgroundLeftX,s=i,r=this.drawTRX+e.backgroundRightX-i+1;if(r>0){var n=e.backgroundBottomY;null==n&&(n=this.drawBLY);var a=e.backgroundHeight;null==a&&(a=n-this.drawTLY);var o=n-a;t.fillRect(s,o,r,a)}}var h=e.hasFill,l=e.hasStroke;(h||l)&&(e.syncFont(t).syncStyle(t),l&&(e.syncShadow(t),t.strokeText(this.text,0,0)),h&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var qy=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const Jy=Phaser.Display.Canvas.CanvasPool;var Zy=function(t,e,i,s,r,n,a,o){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===o&&(o=!1),o&&(i=Math.round(i),s=Math.round(s));var h=e.getContext("2d",{willReadFrequently:!0});if(a){var l=Jy.create(null,r,n,Phaser.CANVAS,!0),u=l.getContext("2d",{willReadFrequently:!0});u.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),u.globalCompositeOperation="source-in",u.fillStyle=a,u.fillRect(0,0,r,n),h.drawImage(l,0,0,r,n,i,s,r,n),Jy.remove(l)}else h.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)};Phaser.Display.Canvas.CanvasPool;class Qy extends yy{constructor(t,e,i){super(t,Wy),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){Zy(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class tb extends yy{constructor(t,e,i,s){super(t,Vy),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class eb extends yy{constructor(t,e){super(t,Yy),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class ib extends Zm{constructor(t,e,i,s,r){super(t,Xy),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}var sb=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const rb={none:0,word:1,char:2,character:2,mix:3};var nb=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,a=!r&&!n,o=t.length,h=e,l=s.word,u=0,c=!1;h0&&!o){var h=this.fixedHeight-s;if(i>0)n=h/i;else n=(l=lb.call(this)).height,a=l.ascent,i=Math.floor((h-a)/n)}else{var l;n=(l=lb.call(this)).height,a=l.ascent}}else if(this.fixedHeight>0){if(void 0===(i=cb(t,"maxLines"))){h=this.fixedHeight-s;i=Math.floor(h/n)}}else i=cb(t,"maxLines",0);void 0===a&&(a=n);var u=0===i,c=cb(t,"wrapMode");void 0===c&&(c=cb(t,"charWrap",!1)?"char":"word");"string"==typeof c&&(c=rb[c]);var d=cb(t,"wrapWidth",void 0);void 0===d&&(this.fixedWidth>0?d=this.fixedWidth-r:(d=1/0,c=0));for(var p=cb(t,"letterSpacing",0),g=cb(t,"hAlign",0),f=cb(t,"vAlign",0),v=cb(t,"justifyPercentage",.25),m=sb({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:g,vAlign:f,justifyPercentage:v,ascent:a,lineHeight:n,wrapWidth:d,wrapMode:c}),y=this.children,b=0,x=y.length;b0&&(E.push({children:M,width:D}),L=Math.max(L,D)),m.start+=_.length,m.isLastPage=!A&&m.start===O,m.maxLineWidth=L,m.linesHeight=E.length*n;var N=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,G=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;!function(t,e,i){for(var s,r,n=t.hAlign,a=t.vAlign,o=t.justifyPercentage,h=t.lines,l=0,u=h.length;l0?(a=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=gb(t,"maxLines",void 0))){var a=this.fixedWidth-r;i=Math.floor(a/n)+1}}else i=gb(t,"maxLines",0);var o=0===i,h=gb(t,"fixedCharacterHeight",void 0);if(void 0===h){var l=gb(t,"charPerLine",void 0);if(void 0!==l){var u=this.fixedHeight-s;h=Math.floor(u/l)}}var c=gb(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var d=gb(t,"letterSpacing",0),p=gb(t,"rtl",!0),g=gb(t,"hAlign",p?2:0),f=gb(t,"vAlign",0),v=sb({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:d,maxLines:i,hAlign:g,vAlign:f,lineWidth:n,fixedCharacterHeight:h,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(_.push({children:E,height:M}),D=Math.max(D,M)),v.start+=O.length,v.isLastPage=v.start===P,v.maxLineHeight=D,v.linesWidth=_.length*n;var I=this.fixedWidth>0?this.fixedWidth:v.linesWidth+r,j=this.fixedHeight>0?this.fixedHeight:v.maxLineHeight+s;!function(t,e,i){var s,r,n=t.hAlign,a=t.vAlign,o=t.rtl,h=t.lines,l=t.lineWidth,u=t.linesWidth;switch(n){case 1:case"center":s=(e-u)/2;break;case 2:case"right":s=e-u;break;default:s=0}o&&(s+=l);for(var c=0,d=h.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,a=i.bottom;return cp(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||a!=i.bottom,this},getPadding:function(t){return up(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),zy(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return Ny(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(Gy);return null===i?i=new Ky(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),py(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;ri&&(r=Math.floor(i));for(var n={},a=Ub(t,r,e,i,n),o=0;o<=Xb&&0!==a;o++){if((r+=a)<0){r=0;break}a=Ub(t,r,e,i,n)}return o===Xb&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),Kb(t,e,i),t},$b=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},Ub=function(t,e,i,s,r){var n,a=$b(t,e,r),o=$b(t,e+1,r);if(void 0!==s)if(a.height<=s&&o.height>s)n=0;else{if(a.height>s)return-1;n=Math.floor(s-a.height)}if(a.width<=i&&o.width>i)return 0;if(a.width>i)return-1;var h=Math.floor(i-a.width);return void 0===n?h:Math.min(h,n)},Kb=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const qb=Phaser.Utils.Objects.GetValue;var Jb=function(t,e){"number"==typeof e&&(e={minWidth:e});var i=qb(e,"minWidth",0),s=qb(e,"minHeight",0),r=qb(e,"fitHeight",!1);return t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return Hb(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),Hb(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t}),t};const Zb=Phaser.Utils.Objects.GetValue,Qb=[function(t){var e=this.scene,i=Pm(t,"orientation",0);this.setOrientation(i);var s=Pm(t,"icon",void 0),r=Pm(t,"iconMask",void 0),n=Pm(t,"innerBackground",void 0),a=Pm(t,"title",void 0),o=Pm(t,"separator",void 0),h=Pm(t,"text",void 0),l=Pm(t,"action",void 0),u=Pm(t,"actionMask",void 0);if(s){var c=Pm(t,"align.icon","center");m=0===this.orientation?{right:Pm(t,"space.icon",0),top:Pm(t,"space.iconTop",0),bottom:Pm(t,"space.iconBottom",0),left:Pm(t,"space.iconLeft",0)}:{bottom:Pm(t,"space.icon",0),left:Pm(t,"space.iconLeft",0),right:Pm(t,"space.iconRight",0),top:Pm(t,"space.iconTop",0)};var d=Pm(t,"squareFitIcon",!1)?1:0;if(this.add(s,{proportion:0,align:c,padding:m,fitRatio:d}),r&&(r=Tm.call(this,s,s,1)),!d){var p=Pm(t,"iconSize",void 0);this.setIconSize(Pm(t,"iconWidth",p),Pm(t,"iconHeight",p))}}var g=new xm(e,{orientation:1});n&&g.addBackground(n);var f=Pm(t,"space.separator",0);if(a){c=Pm(t,"align.title","left");var v=Pm(t,"expandTitleWidth",!1);y=Pm(t,"expandTitleHeight",!1)?1:0,b=v,m={bottom:!o&&h?Pm(t,"space.title",f):0,left:Pm(t,"space.titleLeft",0),right:Pm(t,"space.titleRight",0)},g.add(a,{proportion:y,expand:b,align:c,padding:m})}if(o){var m={top:a?f:0,bottom:h?f:0,left:Pm(t,"space.separatorLeft",0),right:Pm(t,"space.separatorRight",0)};g.add(o,{expand:!0,padding:m})}if(h){c=Pm(t,"align.text","left");var y,b,x=Pm(t,"expandTextWidth",!1);y=Pm(t,"expandTextHeight",!1)?1:0,b=x,m={left:Pm(t,"space.textLeft",0),right:Pm(t,"space.textRight",0)},g.add(h,{proportion:y,expand:b,align:c,padding:m})}m=void 0;if(l&&(m={right:Pm(t,"space.text",0)}),this.add(g,{proportion:1,padding:m}),l){c=Pm(t,"align.action","center");m=0===this.orientation?{top:Pm(t,"space.actionTop",0),bottom:Pm(t,"space.actionBottom",0),right:Pm(t,"space.actionRight",0)}:{left:Pm(t,"space.actionLeft",0),right:Pm(t,"space.actionRight",0),bottom:Pm(t,"space.actionBottom",0)};d=Pm(t,"squareFitAction",!1)?1:0;if(this.add(l,{proportion:0,align:c,padding:m,fitRatio:d}),u&&(u=Tm.call(this,l,l,1)),!d){var k=Pm(t,"actionSize");this.setActionSize(Pm(t,"actionWidth",k),Pm(t,"actionHeight",k))}}this.addChildrenMap("icon",s),this.addChildrenMap("iconMask",r),this.addChildrenMap("innerSizer",g),this.addChildrenMap("innerBackground",n),this.addChildrenMap("title",a),this.addChildrenMap("separator",o),this.addChildrenMap("text",h),this.addChildrenMap("action",l),this.addChildrenMap("actionMask",u)},function(t){this.setOrientation(1),this.setRTL(!1);var e=this.scene,i=Om(t,"title",void 0),s=Om(t,"separator",void 0),r=Om(t,"innerBackground",void 0),n=Om(t,"icon",void 0),a=Om(t,"iconMask",void 0),o=Om(t,"text",void 0),h=Om(t,"action",void 0),l=Om(t,"actionMask",void 0);if(i){var u=Om(t,"align.title","left"),c=Om(t,"expandTitleWidth",!1);y=Om(t,"expandTitleHeight",!1)?1:0,b=c,p={bottom:Om(t,"space.title",0),left:Om(t,"space.titleLeft",0),right:Om(t,"space.titleRight",0)},this.add(i,{proportion:y,expand:b,align:u,padding:p})}if(s){var d=Om(t,"space.separator",0),p={top:i?d:0,bottom:o?d:0,left:Om(t,"space.separatorLeft",0),right:Om(t,"space.separatorRight",0)};this.add(s,{proportion:0,expand:!0,padding:p})}var g=Om(t,"orientation",0),f=new xm(e,{orientation:g,rtl:Om(t,"rtl",!1),space:{left:Om(t,"space.innerLeft",0),right:Om(t,"space.innerRight",0),top:Om(t,"space.innerTop",0),bottom:Om(t,"space.innerBottom",0)}});if(r&&f.addBackground(r),this.add(f,{proportion:1,expand:!0}),n){u=Om(t,"align.icon","center");p=0===f.orientation?{right:Om(t,"space.icon",0),top:Om(t,"space.iconTop",0),bottom:Om(t,"space.iconBottom",0),left:Om(t,"space.iconLeft",0)}:{bottom:Om(t,"space.icon",0),left:Om(t,"space.iconLeft",0),right:Om(t,"space.iconRight",0),top:Om(t,"space.iconTop",0)};var v=Om(t,"squareFitIcon",!1)?1:0;if(f.add(n,{proportion:0,align:u,padding:p,fitRatio:v}),a&&(a=Tm.call(this,n,n,1)),!v){var m=Om(t,"iconSize",void 0);this.setIconSize(Om(t,"iconWidth",m),Om(t,"iconHeight",m))}}if(o){u=Om(t,"align.text","left");var y,b,x=Om(t,"space.text",0),k=Om(t,"expandTextWidth",!1),C=Om(t,"expandTextHeight",!1);0===f.orientation?(y=k?1:0,h&&(p={right:x}),b=C):(y=C?1:0,h&&(p={bottom:x}),b=k),f.add(o,{proportion:y,expand:b,align:u,padding:p})}if(h){u=Om(t,"align.action","center");p=0===f.orientation?{top:Om(t,"space.actionTop",0),bottom:Om(t,"space.actionBottom",0),right:Om(t,"space.actionRight",0)}:{left:Om(t,"space.actionLeft",0),right:Om(t,"space.actionRight",0),bottom:Om(t,"space.actionBottom",0)};v=Om(t,"squareFitAction",!1)?1:0;if(f.add(h,{proportion:0,align:u,padding:p,fitRatio:v}),l&&(l=Tm.call(this,h,h,1)),!v){var S=Om(t,"actionSize");this.setActionSize(Om(t,"actionWidth",S),Om(t,"actionHeight",S))}}this.addChildrenMap("title",i),this.addChildrenMap("separator",s),this.addChildrenMap("innerSizer",f),this.addChildrenMap("innerBackground",r),this.addChildrenMap("icon",n),this.addChildrenMap("iconMask",a),this.addChildrenMap("text",o),this.addChildrenMap("action",h),this.addChildrenMap("actionMask",l)}];class tx extends wm{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexTitleLabel";var i=Zb(e,"background",void 0);i&&this.addBackground(i);var s=Zb(e,"title",void 0),r=Zb(e,"text",void 0);if(s){var n=Zb(e,"wrapTitle",!1),a=Zb(e,"adjustTitleFontSize",!1);n?(!0===n&&(n="word"),Nm(s,n),e.expandTitleWidth=!0,Yb(s)):a&&(e.expandTextWidth=!0,e.expandTextHeight=!0,Jb(s,{fitHeight:!0}))}if(r){var o=Zb(e,"wrapText",!1),h=Zb(e,"adjustTextFontSize",!1);o?(!0===o&&(o="word"),Nm(r,o),e.expandTextWidth=!0,Yb(r)):h&&(e.expandTextWidth=!0,e.expandTextHeight=!0,Jb(r,{fitHeight:!0}))}var l=Zb(e,"layoutMode",0);(Qb[l]||Qb[0]).call(this,e),this.addChildrenMap("background",e.background)}get title(){var t=this.childrenMap.title;return t?t.title:""}set title(t){var e=this.childrenMap.title;e&&e.setText(t)}setTitle(t){return this.title=t,this}resetDisplayContent(t){void 0===t?t={}:"string"==typeof t&&(t={text:t}),super.resetDisplayContent(t);var e=this.childrenMap.title;return e&&(void 0===t.title||(t.title?(this.show(e),this.setTitle(t.title)):this.hide(e))),this}}class ex extends(function(t,e){void 0===e&&(e="rexTextBox");return class extends t{constructor(t,i){super(t,i),this.type=e,this.isRunning=!1,this._isPageEnd=!1;var s=this.childrenMap.text,r=pd(i,"expandTextWidth",!1),n=pd(i,"expandTextHeight",!1);if(r||n){var a=Hc(s);switch(a){case 0:case 1:if(s.resize=function(t,e){var i=r?t:0,a=n?e:0;s.setFixedSize(i,a),i>0&&s.setWordWrapWidth(i)},1===a){var o=s.style;0===o.wrapMode&&(o.wrapMode=1)}}r&&(s._minWidth=0),n&&(s._minHeight=0)}this.setTypingMode(pd(i,"typingMode","page")),this.page=new id(s,pd(i,"page",void 0)),this.typing=new cd(s,pd(i,"typing",i.type)),this.typing.on("complete",this.onTypingComplete,this).on("type",this.onType,this).on("typechar",this.onTypeChar,this),this.textWidthSave=s.width,this.textHeightSave=s.height}setTypingMode(t){return"string"==typeof t&&(t=gd[t]),this.typingMode=t,this}start(t,e){return void 0!==e&&this.setTypingSpeed(e),this.isRunning=!0,this.page.setText(t),this.emit("start"),0===this.typingMode?this.typeNextPage():this.typeNextLine(),this}more(t,e){if(void 0!==e&&this.setTypingSpeed(e),!this.isRunning){if(this.isRunning=!0,this.page.appendText(t),this.emit("start"),0===this.typingMode){this._isPageEnd=!1;var i=this.page.getPage(),s=this.typing.textLength;this.typing.start(i,void 0,s)}return this}this.page.appendText(t),this.typing.appendText(t)}typeNextPage(){if(!this.isRunning)return this;if(this.isLastPage)this.emit("complete");else{this._isPageEnd=!1;var t=this.page.getNextPage();this.typing.start(t)}return this}typeNextLine(){if(!this.isRunning)return this;if(this.isLastLine)this.isRunning=!1,this.emit("pageend"),this.emit("complete");else{var t,e=this.page.getPageOfNextLine();t=this.isFirstLine?0:this.page.pageLinesCount-1,this.typing.startFromLine(e,t)}}pause(){return this.isRunning?(this.isTyping&&(this.typing.pause(),this.emit("pause")),this):this}resume(){return this.isRunning?(this.isTyping||(this.emit("resume"),this.typing.resume()),this):this}stop(t){return this.isRunning?(this.typing.stop(t),this):this}showLastPage(){return this.isRunning?(this.typing.stop(),0===this.typingMode?this.page.showLastPage():this.page.showLastLine(),this.emit("type"),this.onTypingComplete(),this):this}setTypeSpeed(t){return this.typing.setTypingSpeed(t),this}setTypingSpeed(t){return this.typing.setTypingSpeed(t),this}get isTyping(){return this.typing.isTyping}get isPageEnd(){return this._isPageEnd}get isLastPage(){return this.page.isLastPage}get isFirstPage(){return this.page.isFirstPage}get pageCount(){return this.page.pageCount}get pageIndex(){return this.page.pageIndex}get isLastLine(){return this.page.isLastLine}get isFirstLine(){return this.page.isFirstLine}get lineCound(){return this.page.totalLinesCount}get startLineIndex(){return this.page.startLineIndex}get endLineIndex(){return this.page.endLineIndex}get typingSpeed(){return this.typing.speed}onType(){var t=this.childrenMap.text;this.textWidthSave===t.width&&this.textHeightSave===t.height||(this.textWidthSave=t.width,this.textHeightSave=t.height,this.getTopmostSizer().layout()),this.emit("type")}onTypeChar(t){this.emit("typechar",t)}onTypingComplete(){if(0===this.typingMode){this._isPageEnd=!0;var t=this.isLastPage;this.isRunning=!t,this.emit("pageend"),t&&this.emit("complete")}else this.typeNextLine()}}}(tx)){constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("layoutMode")||(e.layoutMode=1),super(t,e)}}const ix=Phaser.GameObjects.GetCalcMatrix;const sx=Phaser.Renderer.Canvas.SetTransform;var rx={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=ix(e,i,s),a=r.calcMatrix.copyFrom(n.calc),o=e._displayOriginX,h=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&au(r,a,e,l,o,h),e.isStroked&&hu(r,e,l,o,h),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(sx(t,r,e,i,s)){var n=e._displayOriginX,a=e._displayOriginY,o=e.pathData,h=o.length-1,l=o[0]-n,u=o[1]-a;r.beginPath(),r.moveTo(l,u),e.closePath||(h-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(ax.prototype,rx);var ox=function(t){return t.x>0&&t.y>0};const hx=Phaser.Utils.Objects.IsPlainObject,lx=Phaser.Utils.Objects.GetValue,ux=Phaser.Geom.Polygon.Earcut;class cx extends ax{constructor(t,e,i,s,r,n,a,o){var h,l,u,c;if(hx(e)){var d=e;e=d.x,i=d.y,s=d.width,r=d.height,n=d.radius,a=d.color,o=d.alpha,h=d.strokeColor,l=d.strokeAlpha,u=d.strokeWidth,c=d.shape}void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=s),void 0===n&&(n=0),void 0===c&&(c=0);var p=new Sy;if(super(t,"rexRoundRectangleShape",p),this.setShapeType(c),0===this.shapeType){var g=lx(n,"radius",n);p.setTo(0,0,s,r,g)}else{g={x:s/2,y:r/2};p.setTo(0,0,s,r,g)}this.setIteration(lx(n,"iteration",void 0)),this.setPosition(e,i),this.setFillStyle(a,o),void 0===u&&(u=2),this.setStrokeStyle(u,h,l),this.updateDisplayOrigin(),this.dirty=!0}updateData(){var t=this.geom,e=this.pathData;e.length=0;var i,s=t.width,r=t.height,n=t.cornerRadius,a=this.iteration+1;if(i=n.tl,ox(i))if(i.convex){var o=i.x,h=i.y;fu(o,h,i.x,i.y,180,270,!1,a,e)}else{fu(o=0,h=0,i.x,i.y,90,0,!0,a,e)}else pu(0,0,e);if(i=n.tr,ox(i))if(i.convex){o=s-i.x,h=i.y;fu(o,h,i.x,i.y,270,360,!1,a,e)}else{fu(o=s,h=0,i.x,i.y,180,90,!0,a,e)}else pu(s,0,e);if(i=n.br,ox(i))if(i.convex){o=s-i.x,h=r-i.y;fu(o,h,i.x,i.y,0,90,!1,a,e)}else{fu(o=s,h=r,i.x,i.y,270,180,!0,a,e)}else pu(s,r,e);if(i=n.bl,ox(i))if(i.convex){o=i.x,h=r-i.y;fu(o,h,i.x,i.y,90,180,!1,a,e)}else{fu(o=0,h=r,i.x,i.y,360,270,!0,a,e)}else pu(0,r,e);return e.push(e[0],e[1]),this.pathIndexes=ux(e),this}setShapeType(t){return"string"==typeof t&&(t=dx[t]),this.shapeType=t,this}setSize(t,e){return void 0===e&&(e=t),this.geom.width===t&&this.geom.height===e||(this.geom.setSize(t,e),1===this.shapeType&&this.setRadius({x:t/2,y:e/2}),this.updateDisplayOrigin(),this.dirty=!0,super.setSize(t,e)),this}get radius(){return this.geom.radius}set radius(t){this.geom.setRadius(t),this.updateDisplayOrigin(),this.dirty=!0}get radiusTL(){return this.geom.radiusTL}set radiusTL(t){this.geom.radiusTL=t,this.dirty=!0}get radiusTR(){return this.geom.radiusTR}set radiusTR(t){this.geom.radiusTR=t,this.dirty=!0}get radiusBL(){return this.geom.radiusBL}set radiusBL(t){this.geom.radiusBL=t,this.dirty=!0}get radiusBR(){return this.geom.radiusBR}set radiusBR(t){this.geom.radiusBR=t,this.dirty=!0}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setRadiusTL(t){return void 0===t&&(t=0),this.radiusTL=t,this}setRadiusTR(t){return void 0===t&&(t=0),this.radiusTR=t,this}setRadiusBL(t){return void 0===t&&(t=0),this.radiusBL=t,this}setRadiusBR(t){return void 0===t&&(t=0),this.radiusBR=t,this}get cornerRadius(){return this.geom.cornerRadius}set cornerRadius(t){this.radius=t}setCornerRadius(t){return this.setRadius(t)}get iteration(){return this._iteration}set iteration(t){void 0!==this._iteration?this._iteration!==t&&(this._iteration=t,this.dirty=!0):this._iteration=t}setIteration(t){return void 0===t&&(t=6),this.iteration=t,this}}const dx={rectangle:0,circle:1};var px=function(t,e,i,s){if(void 0===i&&(i="."),void 0===s&&(s={}),!t)return s;if(e in t)return Object.assign(s,t[e]);for(var r in e+=i,t)r.startsWith(e)&&(s[r.replace(e,"")]=t[r]);return s},gx=function(t,e,i){if(void 0===i&&(i={}),Array.isArray(e))for(var s=0,r=e.length;s=0?t.startAt(a+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(a+n,i):t.startAt(a,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(a,i),t.close(),t};const Sx=Phaser.Utils.Objects.GetValue,wx=Phaser.Utils.Objects.IsPlainObject;class Tx extends(dc(eu)){constructor(t,e,i,s,r,n,a,o){wx(e)?(e=(o=e).x,i=o.y,s=o.width,r=o.height,n=o.barColor,a=o.value):wx(s)?(s=(o=s).width,r=o.height,n=o.barColor,a=o.value):wx(n)&&(n=(o=n).barColor,a=o.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===a&&(a=0),super(t,e,i,s,r,o),this.type="rexLineProgress",this.bootProgressBase(o),this.addShape((new Gu).setName("trackFill")).addShape((new Gu).setName("bar")).addShape((new Gu).setName("trackStroke")),this.setTrackColor(Sx(o,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(Sx(o,"trackStrokeThickness",2),Sx(o,"trackStrokeColor",void 0)),this.setSkewX(Sx(o,"skewX",0)),this.setRTL(Sx(o,"rtl",!1)),this.setValue(a)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var Px={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&Cx(s,0,0,e,i,t);var r,n,a=this.getShape("bar");(a.fillStyle(this.barColor),a.isFilled)&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),Cx(a,r,0,n,i,t));var o=this.getShape("trackStroke");o.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),o.isStroked&&Cx(o,0,0,e,i,t)}};Object.assign(Tx.prototype,Px);class Ox extends Tx{constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("value")||(e.value=0),e.hasOwnProperty("hover.bar")||(e["hover.bar"]=!0),e.hasOwnProperty("easeDuration")||(e.easeDuration=200),e.hasOwnProperty("ease")||(e.ease="Quad"),Z(e,"easeValue.duration",e.easeDuration),Z(e,"easeValue.ease",e.ease),super(t,e),this.type="rexStatesBarRectangleShape",this.barState=!1,e.style=this,e.propertiesMap=_x,this.addStyleManager(e),delete e.style,delete e.propertiesMap}get bar(){return this.barState}set bar(t){t=!!t,this.barState!==t&&(this.barState=t,this.easeValueTo(this.barState?1:0))}}const _x={color:"trackColor",strokeColor:"trackStrokeColor",strokeWidth:"trackStrokeThickness"};Object.assign(Ox.prototype,bx);let Ex=class extends Nn{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Tr(t,e))return t[e];var i=t.parent;return Tr(i,e)?i[e]:void 0}set(t,e,i){return Tr(t,e)?t[e]=i:Tr(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.texture.key}set key(t){this.key!==t&&this.parent.setTexture(t,this.frame)}get frame(){return this.parent.frame.name}set frame(t){this.frame!==t&&this.parent.setFrame(t)}};const Mx=Phaser.GameObjects.NineSlice,Dx=Phaser.Utils.Objects.GetValue;class Lx extends Mx{constructor(t,e){void 0===e&&(e={}),super(t,Dx(e,"x",0),Dx(e,"y",0),Dx(e,"key",null),Dx(e,"frame",null),Dx(e,"width",0),Dx(e,"height",0),Dx(e,"leftWidth",0),Dx(e,"rightWidth",0),Dx(e,"topHeight",0),Dx(e,"bottomHeight",0)),this.type="rexStatesNineSlice";var i=Dx(e,"effects",!0);i&&Mr(this,i),this.style=new Ex(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Lx.prototype,bx);let Ax=class extends Nn{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Tr(t,e))return t[e];var i=t.parent;return Tr(i,e)?i[e]:void 0}set(t,e,i){return Tr(t,e)?t[e]=i:Tr(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.texture.key}set key(t){this.parent.setTexture(t,this.frame)}get frame(){return this.parent.frame.name}set frame(t){this.parent.setFrame(t)}get scale(){return this.parent.scaleX}set scale(t){this.parent.setScale(t)}};const Rx=Phaser.GameObjects.Image,Bx=Phaser.Utils.Objects.GetValue;class Fx extends Rx{constructor(t,e){void 0===e&&(e={}),super(t,Bx(e,"x",0),Bx(e,"y",0),Bx(e,"key",""),Bx(e,"frame",void 0)),this.type="rexStatesImage";var i=Bx(e,"effects",!0);i&&Mr(this,i),this.style=new Ax(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Fx.prototype,bx);var Ix=function(t,e,i){return"__BASE"===i?`${t},${e}`:`${i}:${t},${e}`};const jx=Phaser.Utils.Objects.IsPlainObject,zx=Phaser.Utils.Objects.GetValue;var Nx=function(t){return"string"==typeof t&&(t=Gx[t]),t};const Gx={scale:0,repeat:1};var Wx=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},Vx={_beginDraw:yd,_drawImage:yd,_drawTileSprite:yd,_endDraw:yd,setGetFrameNameCallback:function(t){return void 0===t&&(t=Ix),this.getFrameNameCallback=t,this},setBaseTexture:function(t,e,i,s){Array.isArray(e)&&(s=i,i=e,e=void 0),null==e&&(e="__BASE"),"number"==typeof i&&arguments.length>=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=y(i),s=y(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),a=n.width,o=0,h=0,l=i.length;h0?a/o:0,c=n.height,d=0;for(h=0,l=s.length;h0?0:f,x=0;h=0;for(var w=i.length;h0?0:v),v>=1&&f>=1){var T=typeof(m=this.getFrameNameCallback(h,C,e));"string"!==T&&"number"!==T||r.add(m,0,x+n.cutX,k+n.cutY,v,f)}x+=v}k+=f}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,a,o,h=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,u=this.width-h,c=this.height-l,d=u>=0?this.maxFixedPartScaleX:this.width/h,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var g=Math.min(d,p);if(d>g){var f=(d-g)*h;u>=0?u+=f:u=f,d=g}if(p>g){var v=(p-g)*l;c>=0?c+=v:c=v,p=g}}this.columns.scale=d,this.rows.scale=p,e=u>0&&this.columns.stretch>0?u/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,x=this.rows.count;b0&&o>0&&(0===(0===n.stretch&&0===r.stretch||0===this.getStretchMode(k,b)?0:1)?this._drawImage(this.textureKey,s,m,y,a,o):this._drawTileSprite(this.textureKey,s,m,y,a,o)),m+=a;y+=o}this._endDraw()},setStretchMode:function(t){return jx(t)?(this.stretchMode.edge=Nx(zx(t,"edge",0)),this.stretchMode.internal=Nx(zx(t,"internal",0))):(t=Nx(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Wx.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const Yx=Phaser.Utils.Objects.IsPlainObject,Xx=Phaser.Utils.Objects.GetValue;const Hx=Phaser.GameObjects;var $x=void 0,Ux=function(t,e){if($x||($x={},jn(t).events.once("destroy",(function(){for(var t in $x)$x[t].destroy();$x=void 0}))),!$x.hasOwnProperty(e)){var i=jn(t).scene.systemScene;(t=new Hx[e](i)).setOrigin(0),$x[e]=t}return $x[e]};const Kx=Phaser.GameObjects.RenderTexture;class qx extends(function(t,e){class i extends t{constructor(t,i,s,r,n,a,o,h,l,u){if(Yx(i)?(i=Xx(u=i,"x",0),s=Xx(u,"y",0),r=Xx(u,"width",1),n=Xx(u,"height",1),a=Xx(u,"key",void 0),o=Xx(u,"baseFrame",void 0),h=Xx(u,"columns",void 0),l=Xx(u,"rows",void 0)):Yx(r)?(r=Xx(u=r,"width",1),n=Xx(u,"height",1),a=Xx(u,"key",void 0),o=Xx(u,"baseFrame",void 0),h=Xx(u,"columns",void 0),l=Xx(u,"rows",void 0)):Yx(a)?(a=Xx(u=a,"key",void 0),o=Xx(u,"baseFrame",void 0),h=Xx(u,"columns",void 0),l=Xx(u,"rows",void 0)):Yx(o)?(o=Xx(u=o,"baseFrame",void 0),h=Xx(u,"columns",void 0),l=Xx(u,"rows",void 0)):Array.isArray(o)?(u=l,l=h,h=o,o=Xx(u,"baseFrame",void 0)):Yx(h)&&(h=Xx(u=h,"columns",void 0),l=Xx(u,"rows",void 0)),void 0===o&&(o=Xx(u,"frame",void 0)),void 0===h){var c=Xx(u,"leftWidth",void 0),d=Xx(u,"rightWidth",void 0);void 0!==c&&void 0!==d&&(h=[c,void 0,d])}if(void 0===l){var p=Xx(u,"topHeight",void 0),g=Xx(u,"bottomHeight",void 0);void 0!==p&&void 0!==g&&(l=[p,void 0,g])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(Xx(u,"getFrameNameCallback",void 0)),this.setStretchMode(Xx(u,"stretchMode",0)),this.setPreserveRatio(Xx(u,"preserveRatio",!0));var f=Xx(u,"maxFixedPartScale",1),v=Xx(u,"maxFixedPartScaleX",f),m=Xx(u,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(v,m),this.setBaseTexture(a,o,h,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,Vx),i}(Kx,"rexNinePatch")){}var Jx={_drawImage:function(t,e,i,s,r,n){var a=Ux(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(a,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var a=Ux(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(a,i,s)}};Object.assign(qx.prototype,Jx);let Zx=class extends Nn{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Tr(t,e))return t[e];var i=t.parent;return Tr(i,e)?i[e]:void 0}set(t,e,i){return Tr(t,e)?t[e]=i:Tr(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}};const Qx=Phaser.Utils.Objects.GetValue;class tk extends qx{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=Qx(e,"effects",!0);i&&Mr(this,i),this.style=new Zx(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(tk.prototype,bx);const ek=["alpha","tint","flipX","flipY"];var ik=function(t,e){if(!e)return t;for(var i=0,s=ek.length;i * @copyright 2018 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */const pk=Phaser.Display.Canvas.CanvasPool;var gk=function(t){var e=pk.create(this),i=e.getContext("2d",{willReadFrequently:!0});t.syncFont(e,i);var s=i.measureText(t.testString);if("actualBoundingBoxAscent"in s){var r=s.actualBoundingBoxAscent,n=s.actualBoundingBoxDescent,a={ascent:r,descent:n,fontSize:r+n};return pk.remove(e),a}var o=Math.ceil(s.width*t.baselineX),h=o,l=2*h;h=h*t.baselineY|0,e.width=o,e.height=l,i.fillStyle="#f00",i.fillRect(0,0,o,l),i.font=t._font,i.textBaseline="alphabetic",i.fillStyle="#000",i.fillText(t.testString,0,h);a={ascent:0,descent:0,fontSize:0};if(!i.getImageData(0,0,o,l))return a.ascent=h,a.descent=h+6,a.fontSize=a.ascent+a.descent,pk.remove(e),a;var u,c,d=i.getImageData(0,0,o,l).data,p=d.length,g=4*o,f=0,v=!1;for(u=0;uh;u--){for(c=0;c0&&this.wrapMode!==Rm&&0===this.wrapWidth}setStyle(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wordWrap")){var s=t.wordWrap;s.hasOwnProperty("width")&&(t.wrap={mode:"word",width:s.width})}if(t&&t.hasOwnProperty("wrap")){var r=t.wrap;if(r.hasOwnProperty("mode")){var n=r.mode;"string"==typeof n&&(r.mode=jm[n])}else r.hasOwnProperty("width")&&(r.mode=1)}t&&t.rtl&&i&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var a=this.propertyMap;for(var o in a){var h=a[o],l=h[0],u=i?h[1]:this[o],c=h[2];if("wrapCallback"===o||"wrapCallbackScope"===o)this[o]=vk(t,l,u);else{var d=fk(t,l,u);c&&(d=c(d)),this[o]=d}}var p=vk(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var g=vk(t,"fill",null);null!==g&&(this.color=by(g));var f=vk(t,"metrics",!1);return f?this.metrics={ascent:vk(f,"ascent",0),descent:vk(f,"descent",0),fontSize:vk(f,"fontSize",0)}:!e&&this.metrics||(this.metrics=gk(this)),e?this.parent.updateText():this.parent}syncFont(t,e){e.font=this._font}syncStyle(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"}syncShadow(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)}update(t){return t&&(this._font=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim(),this.metrics=gk(this)),this.parent.updateText(t)}buildFont(){var t=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim();return t!==this._font&&(this._font=t),this}setFont(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=vk(t,"fontFamily","Courier"),this.fontSize=vk(t,"fontSize","16px"),this.fontStyle=vk(t,"fontStyle","")),this.update(!0)}setFontFamily(t){return this.fontFamily=t,this.update(!0)}setFontStyle(t){return this.fontStyle=t,this.update(!0)}setFontSize(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}setTestString(t){return this.testString=t,this.update(!0)}setFixedSize(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}setResolution(t){return this.resolution=t,this.update(!1)}setXOffset(t){return this.xOffset=t,this.update(!1)}setBackgroundColor(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=by(t,this.parent.canvas,this.parent.context),this.backgroundColor2=by(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=by(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}setBackgroundCornerRadius(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}setFill(t){return this.color=by(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=by(t,this.parent.canvas,this.parent.context),this.update(!1)}setStroke(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=by(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}setShadow(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===n&&(n=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=by(i,this.parent.canvas,this.parent.context),this.shadowBlur=s,this.shadowStroke=r,this.shadowFill=n,this.update(!1)}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}setShadowColor(t){return void 0===t&&(t="#000"),this.shadowColor=by(t,this.parent.canvas,this.parent.context),this.update(!1)}setShadowBlur(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}setShadowStroke(t){return this.shadowStroke=t,this.update(!1)}setShadowFill(t){return this.shadowFill=t,this.update(!1)}setUnderline(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=by(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}setUnderlineColor(t){return void 0===t&&(t="#000"),this.underlineColor=by(t,this.parent.canvas,this.parent.context),this.update(!1)}setUnderlineThickness(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}setUnderlineOffset(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}setStrikethrough(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=by(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}setStrikethroughColor(t){return void 0===t&&(t="#000"),this.strikethroughColor=by(t,this.parent.canvas,this.parent.context),this.update(!1)}setStrikethroughThickness(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}setStrikethroughOffset(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}setWrapMode(t){return"string"==typeof t&&(t=jm[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}setWrapWidth(t){return this.wrapWidth=t,this.update(!1)}setAlign(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}setHAlign(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}setVAlign(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}setMaxLines(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}getTextMetrics(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}setTextMetrics(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=vk(e,"fontFamily",this.fontFamily),this.fontSize=vk(e,"fontSize",this.fontSize),this.fontStyle=vk(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}get lineHeight(){return this.metrics.fontSize+this.parent.lineSpacing}toJSON(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}destroy(){this.parent=void 0}}var yk={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var a=this.defaultStyle;this.clear(),Dy(this,a.backgroundColor,a.backgroundStrokeColor,a.backgroundStrokeLineWidth,a.backgroundCornerRadius,a.backgroundColor2,a.backgroundHorizontalGradient,a.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var o,h,l,u,c,d,p=a.halign,g=a.valign,f=a.lineHeight,v=r.lines,m=v.length,y=a.maxLines;y>0&&m>y?(h=y,l="center"===g?Math.floor((m-h)/2):"bottom"===g?m-h:0):(h=m,l=0),u=l+h;var b=this.rtl,x=b?this.parent.width:void 0;d="center"===g?Math.max((s-h*f)/2,0):"bottom"===g?Math.max(s-h*f-2,0):0,d+=e;for(var k=l;k0){var o=this.defaultStyle.metrics,h=i-o.ascent,l=o.fontSize;this.drawRectangle(e,h,t.width,l,a.bgcolor,a)}if(a.underlineThickness>0&&t.width>0){var u=i+a.underlineOffset-a.underlineThickness/2;this.drawLine(e,u,t.width,a.underlineThickness,a.underlineColor,a)}if(t.isTextPen&&(a.buildFont(),a.syncFont(r,n),a.syncStyle(r,n),this.drawText(e,i,t.text,a)),t.isImagePen&&this.drawImage(e,i,t.prop.img,t.prop.color,a),a.strikethroughThickness>0&&t.width>0){u=i+a.strikethroughOffset-a.strikethroughThickness/2;this.drawLine(e,u,t.width,a.strikethroughThickness,a.strikethroughColor,a)}if(n.restore(),t.hasAreaMarker&&t.width>0){var c,d=t.prop.area;if(d)c={key:d};else{var p=t.prop.url;c={key:`url:${p}`,url:p}}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,c)}},clear(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawRectangle(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;a.fillStyle=r,a.fillRect(t,e,i,s)},drawLine(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;n.syncShadow(a,n.shadowStroke);var o=a.lineCap;a.lineCap="butt",a.strokeStyle=r,a.lineWidth=s,a.beginPath(),a.moveTo(t,e),a.lineTo(t+i,e),a.stroke(),a.lineCap=o},drawText(t,e,i,s){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;s.stroke&&"none"!==s.stroke&&s.strokeThickness>0&&(s.syncShadow(r,s.shadowStroke),r.strokeText(i,t,e)),s.color&&"none"!==s.color&&(s.syncShadow(r,s.shadowFill),r.fillText(i,t,e))},drawImage(t,e,i,s,r){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,s,this.autoRound)}};const bk=Phaser.Utils.Objects.GetValue,xk=Dm,kk=Lm;class Ck{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=bk(t,"text",""),this.x=bk(t,"x",0),this.y=bk(t,"y",0),this.width=bk(t,"width",0);var e=bk(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=bk(t,"newLineMode",0),this.startIndex=bk(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===kk&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==xk&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===kk&&(t+=1),t}get endIndex(){return this.startIndex+this.rawTextLength}get lastX(){return this.x+this.width}get isTextPen(){return""!==this.text}get isImagePen(){return!!this.prop.img}get hasAreaMarker(){return!!this.prop.area||!!this.prop.url}}const Sk=Phaser.Utils.Objects.GetFastValue,wk=Dm,Tk=Am;class Pk{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=Sk(t,"tagToText",md),this.tagToTextScope=Sk(t,"tagToTextScope",void 0)}destroy(){this.clear(),this.tagToText=void 0,this.tagToTextScope=void 0}clear(){for(var t=0,e=this.lines.length;t=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}getLineEndIndex(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,s=!1;for(e=t;e>=0&&!(s=null!=(i=this.lines[e])&&i.length>0);e--);return s?i[i.length-1].endIndex:0}getLineWidth(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}getMaxLineWidth(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,s=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}getLineWidths(){for(var t=[],e=0,i=this.lines.length;e=t&&h<=e||(a=a.substring(t-o,e-o)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,a,l,u):c+=this.tagToText(a,l,u),u=l,!(h>=e)));d++);return c}get length(){return this.lines.length}set length(t){this.clear()}}var Ok={};const _k=Phaser.Geom.Rectangle;var Ek=new Ra;class Mk{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&Yk(f)){""!==b?a.push(n.getLine(b,x,Ik)):0===k&&r>0&&a.push(n.getLine("",0,Ik)),a.push(...Wk(f,e,Nk,s,0,n));var S=a.pop();b=S.text,x=S.width,n.freeLine(S)," "===b&&(b="",x=0)}else(m=x+v)>h?(a.push(n.getLine(b,x,Ik)),b=f,x=v,h=s):(b+=f,x=m),k===C-1&&a.push(n.getLine(b,x,l))}return a},Vk=function(t,e){var i;switch(e){case zk:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==Hk&&i0&&t>e&&(t=e),t}get linesWidth(){return Math.ceil(this.penManager.getMaxLineWidth())}get linesHeight(){var t=this.displayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}get imageManager(){return this.parent.imageManager}get rtl(){return this.parent.style.rtl}newPenManager(){return new Pk({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}get tmpPenManager(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}getPlainText(t,e,i){var s;if(null==t)s=this.penManager.plainText;else{var r=this.parser.splitText(t,1);s="";for(var n=0,a=r.length;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return tS(this.sizerChildren,null),am.call(this,t),this}},iS={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)tS(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},aS={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,o=this.sizerChildren,h=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=fp.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,tS(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)tS(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},hS=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const lS=Phaser.Utils.Objects.IsPlainObject,uS=Phaser.Utils.Objects.GetValue;class cS extends Hv{constructor(t,e,i,s,r,n,a,o,h,l){lS(e)?(e=uS(l=e,"x",0),i=uS(l,"y",0),s=uS(l,"width",void 0),r=uS(l,"height",void 0),n=uS(l,"column",l.col||0),a=uS(l,"row",0),o=uS(l,"columnProportions",0),h=uS(l,"rowProportions",0)):lS(s)?(s=uS(l=s,"width",void 0),r=uS(l,"height",void 0),n=uS(l,"column",l.col||0),a=uS(l,"row",0),o=uS(l,"columnProportions",0),h=uS(l,"rowProportions",0)):lS(n)?(n=uS(l=n,"column",l.col||0),a=uS(l,"row",0),o=uS(l,"columnProportions",0),h=uS(l,"rowProportions",0)):lS(o)&&(o=uS(l=o,"columnProportions",0),h=uS(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(uS(l,"createCellContainerCallback")),this.setIndentLeft(uS(l,"space.indentLeftOdd",0),uS(l,"space.indentLeftEven",0)),this.setIndentTop(uS(l,"space.indentTopOdd",0),uS(l,"space.indentTopEven",0)),this.resetGrid(n,a,o,h,uS(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=oS.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=hS.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(cS.prototype,aS);const dS=Phaser.Utils.Objects.GetValue;const pS=Phaser.Math.Percent;var gS=function(t,e,i){var s;return t.y===e.y?s=pS(i.x,t.x,e.x):t.x===e.x&&(s=pS(i.y,t.y,e.y)),s},fS=function(t,e,i){var s,r;this.enable&&(vS.x=e,vS.y=i,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint()),this.value=gS(s,r,vS))},vS={},mS=function(t,e,i){if(this.enable&&t.isDown){var s,r;yS.x=t.worldX,yS.y=t.worldY,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint());var n=gS(s,r,yS);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-n)<.1?this.value=n:this.easeValueTo(n)}},yS={},bS=function(t,e){void 0===e&&(e=xS);var i=this.childrenMap.thumb,s=i.x,r=i.y;return Gd(i,this.innerLeft,this.innerTop,this.innerWidth,this.innerHeight,t),e.x=i.x,e.y=i.y,i.x=s,i.y=r,e},xS={};const kS=Phaser.Display.Align.LEFT_CENTER,CS=Phaser.Display.Align.TOP_CENTER;var SS={};const wS=Phaser.Display.Align.RIGHT_CENTER,TS=Phaser.Display.Align.BOTTOM_CENTER;var PS={};const OS=Phaser.Math.Linear;var _S={};const ES=Phaser.Display.Align.LEFT_CENTER,MS=Phaser.Display.Align.TOP_CENTER,DS=Phaser.Display.Align.RIGHT_CENTER,LS=Phaser.Display.Align.BOTTOM_CENTER;const AS=Phaser.Utils.Objects.GetValue,RS=Phaser.Utils.Objects.IsPlainObject,BS=Phaser.Math.Clamp,FS=Phaser.Math.Snap.To;class IS extends(cc(bm)){constructor(t,e){super(t,e),this.type="rexSlider",this.bootProgressBase(e),this.reverseAxis=AS(e,"reverseAxis",!1);var i=AS(e,"background",void 0),s=AS(e,"track",void 0),r=AS(e,"indicator",void 0),n=AS(e,"thumb",void 0);if(i&&(RS(i)&&(i=ik(t,i)),this.addBackground(i)),s&&(RS(s)&&(s=ik(t,s)),this.add(s,{proportion:1,expand:!0,minWidth:0===this.orientation?0:void 0,minHeight:1===this.orientation?0:void 0})),r&&(RS(r)&&(r=ik(t,r)),this.pin(r)),n){RS(n)&&(n=ik(t,n)),this.pin(n);var a=AS(e,"thumbOffsetX",0),o=AS(e,"thumbOffsetY",0);this.setThumbOffset(a,o)}var h=AS(e,"input",0);switch("string"==typeof h&&(h=jS[h]),h){case 0:n&&(n.setInteractive(),this.scene.input.setDraggable(n),n.on("drag",fS,this).on("dragstart",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("dragend",(function(t){this.eventEmitter.emit("inputend",t)}),this));break;case 1:this.on("pointerdown",mS,this).on("pointermove",mS,this).on("pointerdown",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("pointerup",(function(t){this.eventEmitter.emit("inputend",t)}),this).on("pointerover",(function(t){t.isDown&&this.eventEmitter.emit("inputstart",t)}),this).on("pointerout",(function(t){t.isDown&&this.eventEmitter.emit("inputend",t)}),this).setInteractive()}this.addChildrenMap("background",i),this.addChildrenMap("track",s),this.addChildrenMap("indicator",r),this.addChildrenMap("thumb",n),this.setEnable(AS(e,"enable",void 0));var l=AS(e,"tick",void 0);void 0===l&&(l=AS(e,"gap",void 0)),this.setGap(l),this.setValue(AS(e,"value",0),AS(e,"min",void 0),AS(e,"max",void 0))}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setGap(t,e,i){return t&&void 0!==e&&(t/=i-e),this.gap=t,this}setTick(t,e,i){return this.setGap(t,e,i),this}get tick(){return this.gap}set tick(t){this.gap=t}setThumbOffset(t,e){return this.thumbOffsetX=t,this.thumbOffsetY=e,this}get value(){return this._value}set value(t){void 0!==this.gap&&(t=FS(t,this.gap));var e=this._value;this._value=BS(t,0,1),e!==this._value&&(this.updateThumb(this._value),this.updateIndicator(this._value),this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter))}postLayout(t,e,i){return this.updateThumb(),this.updateIndicator(),super.postLayout(t,e,i),this}}const jS={pan:0,drag:0,click:1,none:-1};var zS={getStartPoint:function(t){if(void 0===t&&(t=SS),this.childrenMap.thumb){var e=0===this.orientation?kS:CS;bS.call(this,e,t)}else 0===this.orientation?(t.x=this.innerLeft+1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerTop+1);return t},getEndPoint:function(t){if(void 0===t&&(t=PS),this.childrenMap.thumb){var e=0===this.orientation?wS:TS;bS.call(this,e,t)}else 0===this.orientation?(t.x=this.innerRight-1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerBottom-1);return t},updateThumb:function(t){var e,i,s=this.childrenMap.thumb;return void 0===s||(void 0===t&&(t=this.value),this.reverseAxis?(e=this.getEndPoint(),i=this.getStartPoint()):(e=this.getStartPoint(),i=this.getEndPoint()),function(t,e,i,s){void 0===s&&(s=_S),s.x=OS(e.x,i.x,t),s.y=OS(e.y,i.y,t)}(t,e,i,s),s.x+=this.thumbOffsetX,s.y+=this.thumbOffsetY,this.resetChildPositionState(s)),this},updateIndicator:function(t){var e=this.childrenMap.indicator;if(void 0===e)return this;void 0===t&&(t=this.value);var i,s,r,n=this.reverseAxis,a=this.childrenMap.thumb;if(a)if(0===this.orientation){var o=zr(a);if(n){h=a.x-o*a.originX;i=this.right-h}else{var h;i=(h=a.x-o*a.originX)+o-this.left}}else{var l=Nr(a);if(n){u=a.y-l*a.originY;s=this.bottom-u}else{var u;s=(u=a.y-l*a.originY)+l-this.top}}else 0===this.orientation?i=this.width*t:s=this.height*t;Cp(e,i,s),r=n?0===this.orientation?DS:LS:0===this.orientation?ES:MS,Nd(e,this,r),this.resetChildPositionState(e)}};Object.assign(IS.prototype,zS);const NS=Phaser.Utils.Objects.GetValue;class GS extends bm{constructor(t,e){super(t,e),this.type="rexScrollBar";var i,s=NS(e,"background",void 0),r=NS(e,"buttons",void 0),n=NS(r,"top",NS(r,"left",void 0)),a=NS(r,"bottom",NS(r,"right",void 0)),o=NS(e,"slider",void 0);(s&&this.addBackground(s),n)&&(this.add(n),new Sf(n).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?this.scrollStep:-this.scrollStep;this.value+=t}}),this));if(o){var h;if(o.orientation=this.orientation,o.eventEmitter=this,o.value=null,0===this.orientation)h=void 0===NS(o,"width",void 0)?1:0;else h=void 0===NS(o,"height",void 0)?1:0;i=new IS(t,o),t.add.existing(i),this.add(i,{proportion:h})}a&&(this.add(a),new Sf(a).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?-this.scrollStep:this.scrollStep;this.value+=t}}),this));var l=[n,a];this.addChildrenMap("background",s),this.addChildrenMap("slider",i),this.addChildrenMap("buttons",l);var u=NS(e,"valuechangeCallback",null);if(null!==u){var c=NS(e,"valuechangeCallbackScope",void 0);this.on("valuechange",u,c)}this.setEnable(NS(e,"enable",void 0)),this.setValue(NS(e,"value",0)),this.setScrollStep(NS(r,"step",.01))}setScrollStep(t){return this.scrollStep=t,this}get enable(){return!!this.childrenMap.slider&&this.childrenMap.slider.enable}set enable(t){this.childrenMap.slider&&this.childrenMap.slider.setEnable(t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get value(){return this.childrenMap.slider?this.childrenMap.slider.value:0}set value(t){this.childrenMap.slider&&(this.childrenMap.slider.value=t)}setValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setValue(t,e,i),this}addValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.addValue(t,e,i),this}getValue(t,e){return this.childrenMap.slider?this.childrenMap.slider.getValue(t,e):0}easeValueTo(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.easeValueTo(t,e,i),this}stopEaseValue(){return this.childrenMap.slider&&this.childrenMap.slider.stopEaseValue(),this}setEaseValueDuration(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueDuration(t),this}setEaseValueFunction(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueFunction(t),this}setGap(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setGap(t,e,i),this}get gap(){if(this.childrenMap.slider)return this.childrenMap.slider.gap}set gap(t){this.childrenMap.slider&&(this.childrenMap.slider.gap=t)}setTick(t,e,i){return this.setGap(t,e,i),this}get tick(){if(this.childrenMap.slider)return this.childrenMap.slider.tick}set tick(t){this.childrenMap.slider&&(this.childrenMap.slider.tick=t)}}class WS extends wg{constructor(t,e){super(e),this.parent=t,this.init()}init(){this.start("IDLE")}next_IDLE(){var t,e=this.parent;return e.dragState.isDown&&(t=0===e.dragThreshold?"DRAG":"DRAGBEGIN"),t}update_IDLE(t,e){this.next()}next_DRAGBEGIN(){var t=this.parent,e=t.dragState;return e.isDown?e.pointer.getDistance()>=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const VS=Phaser.Utils.Objects.GetValue,YS=Phaser.Math.Distance.Between;class XS extends Nn{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=VS(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(VS(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(VS(t,"enable",!0)),this.holdThreshold=VS(t,"holdThreshold",50),this.pointerOutReleaseEnable=VS(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return iv(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:YS(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!Qg(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!Qg(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const HS=Phaser.Utils.Objects.GetValue;class $S{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(HS(t,"value",0)),this.setSpeed(HS(t,"speed",0)),this.setAcceleration(HS(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class US{constructor(){this.value,this.dir,this.movement=new $S}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const ZS={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},QS=Phaser.Utils.Objects.GetValue;class tw extends Nn{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=QS(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(QS(e,"speed",.1)),this.setEnable(QS(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(QS(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||Qg(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const ew=Phaser.Utils.Objects.GetValue;var iw=function(t,e,i,s){var r,n,a="Y"===(i=i.toUpperCase()),o=2===t.scrollMode,h=t.childrenMap.child,l=`slider${i}`;if(r=o||s.hasOwnProperty(l)?ew(s,l,void 0):ew(s,"slider",void 0)){var u,c,d;!0===r&&(r={}),r.orientation=a?1:0,n=function(t,e){void 0===e&&(e={});var i=po(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new GS(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r),n.tickLength=ew(r,"tickLength",void 0);var p=ew(r,"position",0);"string"==typeof p&&(p=sw[p]);var g,f,v=ew(s,`space.slider${i}`,void 0);void 0===v&&void 0===(v=ew(s,"space.slider",void 0))&&(o?v=0:g=ew(s,"space.child",0)),f=void 0===g?"number"==typeof v:"number"==typeof g,a?0===p?(u=2,c=1,d=void 0===g?f?{left:v}:v:{left:ew(g,"right",g)}):(u=0,c=1,d=void 0===g?f?{right:v}:v:{right:ew(g,"left",g)}):0===p?(u=1,c=2,d=void 0===g?f?{top:v}:v:{top:ew(g,"bottom",g)}):(u=1,c=0,d=void 0===g?f?{bottom:v}:v:{bottom:ew(g,"top",g)}),e.add(n,{column:u,row:c,align:"center",padding:d,expand:!0}),t[`hideUnscrollableSlider${i}`]=ew(r,"hideUnscrollableSlider",!1),t[`disableUnscrollableDrag${i}`]=ew(r,"disableUnscrollableDrag",!1),t[`adaptThumb${i}SizeMode`]=ew(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=ew(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`disableUnscrollableDrag${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=ew(s,"scrollDetectionMode");"string"==typeof b&&(b=rw[b]);var x=`scroller${i}`;(m=o||s.hasOwnProperty(x)?ew(s,x,!0):ew(s,"scroller",!0))&&h&&(!0===m&&(m={}),m.orientation=a?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new JS(h,m),h.isRexContainerLite&&h.sendChildToBack(h));var k,C,S,w,T,P=ew(s,o?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);(P&&h&&(void 0!==b&&(P.focus=1===b?2:0),k=new tw(h,P)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,k),o&&!a||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.disableUnscrollableDrag=t[`disableUnscrollableDrag${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",k)),n)&&(o?(C=a?"t":"s",w=`scroll${i}`):(C="t",w="scroll"),n.on("valuechange",(function(e){t[C]=e,t.emit(w,t)})));y&&(o?(S=`childO${i}`,w=`scroll${i}`):(S="childOY",w="scroll"),y.on("valuechange",(function(e){t[S]=e,t.emit(w,t)})));k&&(T=o?`addChildO${i}`:"addChildOY",k.on("scroll",(function(e){t[T](-e,!0)})))};const sw={right:0,left:1,bottom:0,top:1},rw={gameObject:0,rectBounds:1},nw=Phaser.Utils.Objects.GetValue;var aw=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=nw(e,"width"),a=nw(e,"height");n||(nw(e,"child.expandWidth",!0)||(s[1]=0));a||(nw(e,"child.expandHeight",!0)||(r[1]=0));var o=new cS(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=dS(i,"child"),r=dS(s,"gameObject",void 0);if(r){var n=dS(i,"space.child",0);t.childMargin={};var a=t.childMargin,o={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:a.top=0,a.bottom=0,a.left=0,a.right=0;break;default:a.top=n,a.bottom=n,a.left=n,a.right=n}else switch(t.scrollMode){case 0:a.top=dS(n,"top",0),a.bottom=dS(n,"bottom",0),o.left=dS(n,"left",0),o.right=dS(n,"right",0);break;case 1:a.top=dS(n,"left",0),a.bottom=dS(n,"right",0),o.top=dS(n,"top",0),o.bottom=dS(n,"bottom",0);break;default:a.top=dS(n,"top",0),a.bottom=dS(n,"bottom",0),a.left=dS(n,"left",0),a.right=dS(n,"right",0)}e.add(r,{column:1,row:1,align:dS(s,"align","center"),padding:o,expand:{width:dS(s,"expandWidth",!0),height:dS(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,o,e),t.scrollMode){case 0:iw(t,o,"y",e);break;case 1:iw(t,o,"x",e);break;default:iw(t,o,"y",e),iw(t,o,"x",e)}return o},ow=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}i*="Y"===t?this.scaleY:this.scaleX,s&&s.setBounds(e,i),r&&(r.setEnable(e!==i),r.tickLength&&r.setTick(r.tickLength,e,i))},hw=function(t){switch(this.scrollMode){case 0:case 1:(i=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(i,this.isOverflow),(r=this.childrenMap.scroller)&&this.disableUnscrollableDrag&&r.setEnable(this.isOverflow);break;default:var e=this[`isOverflow${t=t.toUpperCase()}`],i=this.childrenMap[`slider${t}`],s=this[`hideUnscrollableSlider${t}`];i&&s&&this.setChildVisible(i,e);var r=this.childrenMap.scroller,n=this[`disableUnscrollableDrag${t}`];r&&n&&r.setEnable(e)}},lw=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(o=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=o.childrenMap.track,s=o.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&nthis.topTextOY}textOYExeceedBottom(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:s?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}setTextOY(t){return this.textOY=t,this}set t(t){this.textOY=-this.textVisibleHeight*t}get t(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t}setTextOYByPercentage(t){return this.t=t,this}}var Pw=function(t){return t.add.text(0,0,"")};Object.assign(Tw.prototype,kw);var Ow={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},_w={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const Ew=Phaser.Utils.Objects.GetValue;class Mw extends pw{constructor(t,e){void 0===e&&(e={});var i=Ew(e,"text",void 0),s=Ew(e,"textWidth",void 0),r=Ew(e,"textHeight",void 0),n=Ew(e,"textCrop",!!i.setCrop),a=Ew(e,"textMask",!n),o=Ew(e,"content",""),h=new Tw(t,{width:s,height:r,text:i,textMask:a,textCrop:n&&!a,content:o,clampTextOY:Ew(e,"clampChildOY",!1),alwaysScrollable:Ew(e,"alwaysScrollable",!1)});t.add.existing(h),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textObjectHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.textHeight}})}(h),e.scrollMode=0,e.type="rexTextArea",e.child={gameObject:h,expandWidth:void 0===s,expandHeight:void 0===r};var l=Ew(e,"space",void 0);l&&(l.child=Ew(l,"text",0)),super(t,e),this.addChildrenMap("text",i)}get text(){return this.childrenMap.child.text}get lineHeight(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.textHeight}}Object.assign(Mw.prototype,Ow,_w);const Dw=Phaser.Utils.Objects.GetValue;var Lw=function(t,e,i){e=e?y(e):{};var s=Dw(i,"background",ik),r=Dw(i,"text",Aw),n=Dw(i,"track",ik),a=Dw(i,"thumb",ik);s?e.background=s(t,e.background):delete e.background,r?e.text=r(t,e.text):delete e.text;var o=e.slider;!1!==o&&null!==o&&(void 0===o&&(o={}),n?o.track=n(t,o.track):delete o.track,a?o.thumb=a(t,o.thumb):delete o.thumb,e.slider=o);var h=new Mw(t,e);return t.add.existing(h),h},Aw=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("key")&&(i="bitmaptext",e.font=e.key)),i){case"bitmaptext":case"bitmap":s=new zC(t,e);break;case"bbcodetext":case"bbcode":s=new BC(t,0,0,"",e);break;case"label":s=new WC(t,e);break;case"textarea":s=Lw(t,e);break;default:s=new nk(t,e)}return ek(s,e),t.add.existing(s),s},Rw=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("leftWidth")?i="nineSlice":(e.hasOwnProperty("color")||e.hasOwnProperty("strokeColor"))&&(i="roundRectangle")),i){case"nineSlice":s=e.hasOwnProperty("stretchMode")?new Qx(t,e):new Dx(t,e);break;case"roundRectangle":s=new bx(t,e);break;default:s=new Bx(t,e)}return ek(s,e),t.add.existing(s),s};const Bw=Phaser.Utils.Objects.GetValue;var Fw=function(t,e,i){e=e?y(e):{};var s=Bw(i,"background",ik),r=Bw(i,"text",Aw),n=Bw(i,"icon",Rw),a=Bw(i,"action",Rw);return null!==e.background&&s?e.background=s(t,e.background):delete e.background,null!==e.text&&r?e.text=r(t,e.text):delete e.text,null!==e.icon&&n?e.icon=n(t,e.icon):delete e.icon,null!==e.action&&a?e.action=a(t,e.action):delete e.action,e};const Iw=Phaser.Utils.Objects.GetValue;var jw=function(t,e,i){var s,r,n=Iw(i,"innerBackground",ik),a=Iw(i,"separator",ik),o=Iw(i,"title",Aw);null!==e.innerBackground&&n&&(s=n(t,e.innerBackground)),null!==e.separator&&a&&(r=a(t,e.separator)),e=Fw(t,e,i),s?e.innerBackground=s:delete e.innerBackground,r?e.separator=r:delete e.separator,null!==e.title&&o?e.title=o(t,e.title):delete e.title;var h=e.background;return h&&(s?t.children.moveBelow(h,s):r&&t.children.moveBelow(h,r)),e};class zw extends tx{constructor(t,e,i){super(t,e=jw(t,e,i))}}var Nw={start:function(t){return this.easeValueTask||(this.easeValueTask=new ul(this,{eventEmitter:null})),void 0!==t&&(this.duration=t,this.easeValueTask.stop()),this.easeValueTask.isRunning||(this.easeValueTask.restart({key:"value",from:0,to:1,duration:this.duration,ease:this.ease,repeat:-1,delay:this.delay,repeatDelay:this.repeatDelay}),this.setDirty()),this},stop:function(){return this.easeValueTask?(this.easeValueTask.stop(),this.setDirty(),this):this},pause:function(){return this.easeValueTask?(this.easeValueTask.pause(),this.setDirty(),this):this},resume:function(){return this.easeValueTask?(this.easeValueTask.pause(),this.setDirty(),this):this}};const Gw=Phaser.Utils.Objects.GetValue;class Ww extends eu{constructor(t,e){super(t,Gw(e,"x",0),Gw(e,"y",0),Gw(e,"width",64),Gw(e,"height",64)),this.resetFromConfig(e,!0),this.buildShapes(e),Gw(e,"start",!0)&&this.start()}resetFromConfig(t,e){var i;return void 0===e&&(e=!1),i=e?1e3:this.duration,this.setDuration(Gw(t,"duration",i)),i=e?"Linear":this.ease,this.setEase(Gw(t,"ease",i)),i=e?0:this.delay,this.setDelay(Gw(t,"delay",i)),i=e?0:this.repeatDelay,this.setRepeatDelay(Gw(t,"repeatDelay",i)),i=e?16777215:this.color,this.setColor(Gw(t,"color",i)),i=e?0:this.value,this.setValue(Gw(t,"value",i)),this}buildShapes(){}get centerX(){return this.width/2}get centerY(){return this.height/2}get radius(){return Math.min(this.centerX,this.centerY)}get color(){return this._color}set color(t){this.isColorChanged=this.isColorChanged||this._color!==t,this.dirty=this.dirty||this.isColorChanged,this._color=t,this.setShapesColor(t)}setColor(t){return this.color=t,this}setShapesColor(t){}get value(){return this._value}set value(t){t=Phaser.Math.Clamp(t,0,1),this.dirty=this.dirty||this._value!=t,this._value=t}setValue(t){return this.value=t,this}setDuration(t){return this.duration=t,this}setDelay(t){return this.delay=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return this.ease=t,this}get isRunning(){return!!this.tweenTask&&this.tweenTask.isRunning}}Object.assign(Ww.prototype,Nw);const Vw=Phaser.Math.DegToRad,Yw=Phaser.Math.Linear,Xw=Phaser.Math.Easing.Expo.In,Hw={right:0,down:1,left:2,up:3};var $w=function(t,e,i,s,r,n,a,o,h,l,u){var c=Kw(e,0,s,r,n,a,o,h,l,u);t.startAt(c.x,c.y);var d=Kw(i,0,s,r,n,a,o,h,l,u);t.lineTo(d.x,d.y);var p=Kw(i,i,s,r,n,a,o,h,l,u);t.lineTo(p.x,p.y);var g=Kw(0,i,s,r,n,a,o,h,l,u);t.lineTo(g.x,g.y);var f=Kw(0,e,s,r,n,a,o,h,l,u);t.lineTo(f.x,f.y);var v=Kw(e,e,s,r,n,a,o,h,l,u);t.lineTo(v.x,v.y),t.close()},Uw={},Kw=function(t,e,i,s,r,n,a,o,h,l){var u=t*i,c=e*s;return Uw.x=a*u+o*c+r,Uw.y=h*u+l*c+n,Uw},qw={setDirection(t){return"string"==typeof t&&(t=Hw[t]),this.direction=t,this},buildShapes(){for(var t=0;t<3;t++)this.addShape(new Nu)},updateShapes(){var t,e,i,s,r,n;switch(this.direction){case 1:t=this.centerX,e=this.centerY-this.radius;var a=Vw(315);i=Math.cos(a),s=Math.sin(a);var o=Vw(45);r=Math.cos(o),n=Math.sin(o);break;case 3:t=this.centerX,e=this.centerY+this.radius;a=Vw(135);i=Math.cos(a),s=Math.sin(a);o=Vw(225);r=Math.cos(o),n=Math.sin(o);break;case 2:t=this.centerX+this.radius,e=this.centerY;a=Vw(225);i=Math.cos(a),s=Math.sin(a);o=Vw(315);r=Math.cos(o),n=Math.sin(o);break;default:t=this.centerX-this.radius,e=this.centerY;a=Vw(45);i=Math.cos(a),s=Math.sin(a);o=Vw(135);r=Math.cos(o),n=Math.sin(o)}for(var h=this.radius/7,l=this.getShapes(),u=0,c=l.length;uthis.value)for(var u=0;uthis.value&&(t+=1));for(var r=this.getShapes(),n=0,a=r.length;n0&&(r=!0,void 0===n&&(n=0),void 0===a&&(a=0)),(d=this.getSizerConfig(t)).align=i,d.padding=El(s),rP(r)?(d.expandWidth=nP(r,"width",!1),d.expandHeight=nP(r,"height",!1)):(d.expandWidth=r,d.expandHeight=r),t.isRexSizer||(d.expandWidth&&(t.minWidth=void 0===n?zr(t):n),d.expandHeight&&(t.minHeight=void 0===a?Nr(t):a)),d.alignOffsetX=o,d.alignOffsetY=h,d.alignOffsetOriginX=u,d.alignOffsetOriginY=c,d.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,p&&this.addChildrenMap(e,t),this}},lP={remove(t,e){var i;if("string"==typeof t){if(i=t,!(t=this.sizerChildren[i]))return this}else{if(this.getParentSizer(t)!==this)return this;i=this.childToKey(t)}return i&&(delete this.sizerChildren[i],this.childrenMap.hasOwnProperty(i)&&delete this.childrenMap[i]),ip.call(this,t,e),this},removeAll(t){for(var e in this.sizerChildren)this.remove(e,t);return this},clear(t){for(var e in this.sizerChildren)delete this.sizerChildren[e],this.childrenMap.hasOwnProperty(e)&&delete this.childrenMap[e];return am.call(this,t),this}},uP={getChildrenWidth:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var a in r)t=r[a],void 0===(i=this.getChildWidth(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).left+e.right)*this.scaleX,s=Math.max(i,s));return n?void 0:s+(this.space.left+this.space.right)*this.scaleX},getChildrenHeight:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var a in r)t=r[a],void 0===(i=this.getChildHeight(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).top+e.bottom)*this.scaleY,s=Math.max(i,s));return n?void 0:s+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(s.expandWidth){var r=e-(this.space.left+this.space.right)*this.scaleX,n=s.padding;i=r-(n.left+n.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(s.expandHeight){var r=e-(this.space.top+this.space.bottom)*this.scaleY,n=s.padding;i=r-(n.top+n.bottom)*this.scaleY}return i},getChildrenSizers:function(t){void 0===t&&(t=[]);var e,i=this.sizerChildren;for(var s in i)(e=i[s]).isRexSizer&&t.push(e);return t},layoutChildren:function(){var t,e,i,s,r,n,a,o,h,l,u,c,d=this.innerLeft,p=this.innerTop,g=this.innerWidth,f=this.innerHeight,v=this.sizerChildren;for(var m in v)(t=v[m]).rexSizer.hidden||(i=(e=t.rexSizer).padding,af.call(this,t),l=this.getExpandedChildWidth(t),u=this.getExpandedChildHeight(t),e.aspectRatio>0&&(iP.width=e.aspectRatio,iP.height=1,sP.width=l,sP.height=u,l=(c=cl(iP,sP,"FIT",!0)).width,u=c.height),t.isRexSizer?(t.runLayout(this,l,u),$v(t,this)):Cp(t,l,u),s=d+i.left*this.scaleX,n=g-(i.left+i.right)*this.scaleX,r=p+i.top*this.scaleY,a=f-(i.top+i.bottom)*this.scaleY,void 0===l&&(l=zr(t)),void 0===u&&(u=Nr(t)),o=(e.alignOffsetX+e.alignOffsetOriginX*l)*this.scaleX,h=(e.alignOffsetY+e.alignOffsetOriginY*u)*this.scaleY,of.call(this,t,s,r,n,a,e.align,o,h))}};Object.assign(uP,hP,lP);const cP=Phaser.Utils.Objects.IsPlainObject,dP=Phaser.Utils.Objects.GetValue;class pP extends Hv{constructor(t,e,i,s,r,n){cP(e)?(e=dP(n=e,"x",0),i=dP(n,"y",0),s=dP(n,"width",void 0),r=dP(n,"height",void 0)):cP(s)&&(s=dP(n=s,"width",void 0),r=dP(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexOverlapSizer",this.sizerChildren={},this.addChildrenMap("items",this.sizerChildren)}childToKey(t){if("string"!=typeof t)return function(t,e){if(Array.isArray(t))return t.indexOf(e);for(var i in t)if(t[i]===e)return i;return null}(this.sizerChildren,t);var e=t;return this.sizerChildren.hasOwnPropery(e)?e:null}}Object.assign(pP.prototype,uP);const gP=bm.prototype.add,fP=bm.prototype.addSpace;var vP=function(t){var e=!t.isRexSpace,i=!e||this.buttonsExpand?1:0;if(0===this.sizerChildren.length)if(e){!this.buttonsExpand&&("right"===this.buttonsAlign||"center"===this.buttonsAlign||"bottom"===this.buttonsAlign)&&fP.call(this),gP.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&fP.call(this),this.hasTailSpace=s}else gP.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;gP.call(this,t,{index:r,proportion:i,expand:!0})}else gP.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},mP={addButton(t){if(tf(t))for(var e=t,i=0,s=e.length;i=0;i--)xP.call(this,e[i],t);return this}},CP=function(t,e,i){if(t){var s=this.setValueCallback,r=this.setValueCallbackScope;s&&(r?s.call(r,t,e,i):s(t,e,i)),this.fireEvent("button.statechange",t,e,i)}},SP=function(t){var e=this;t._selected=void 0,Object.defineProperty(t,"selected",{get:function(){return t._selected},set:function(i){if(t._selected!==i){var s=t._selected;t._selected=i,CP.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},wP={add(t){return this.buttons.push(t),t._click||(t._click=new cf(t,this.clickConfig),t._click.on("click",(function(t,e,i,s){this.fireEvent("button.click",e,i,s)}),this).on("enable",(function(t,e){this.fireEvent("button.enable",e)}),this).on("disable",(function(t,e){this.fireEvent("button.disable",e)}),this).on("over",(function(t,e,i,s){this.fireEvent("button.over",e,i,s)}),this).on("out",(function(t,e,i,s){this.fireEvent("button.out",e,i,s)}),this).on("down",(function(t,e,i,s){this.fireEvent("button.down",e,i,s)}),this).on("up",(function(t,e,i,s){this.fireEvent("button.up",e,i,s)}),this),t.isRexContainerLite&&t.sendChildToBack(t)),this.buttonsType&&(void 0===t.name&&console.error(`${this.parent.constructor.name}: Option button miss value`),SP.call(this,t)),this},addMultiple(t){for(var e=0,i=t.length;e0},setButtonEnable(t,e){var i=this.buttons;if(void 0===t||"boolean"==typeof t){e=t;for(var s=0,r=i.length;so.height/2)){r>(h=jP(o.left,o.centerY,t,e))&&(r=h,s=n);var h,l=i[n+1];if(!l||l.y!==o.y)r>(h=jP(o.right,o.centerY,t,e))&&(r=h,s=n+1)}}return s};const NP=Phaser.Utils.Objects.IsPlainObject,GP=Phaser.Utils.Objects.GetValue,WP=Phaser.Display.Align.CENTER;var VP=function(t,e,i,s){if("\n"===t)return this.addNewLine(),this;var r,n,a,o,h;(Kd.call(this,t),NP(e))&&(e=GP(h=e,"padding",0),i=GP(h,"key",void 0),s=GP(h,"index",void 0),r=GP(h,"offsetX",0),n=GP(h,"offsetY",0),a=GP(h,"offsetOriginX",0),o=GP(h,"offsetOriginY",0));return void 0===e&&(e=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=0),void 0===o&&(o=0),(h=this.getSizerConfig(t)).align=WP,h.padding=El(e),h.alignOffsetX=r,h.alignOffsetY=n,h.alignOffsetOriginX=a,h.alignOffsetOriginY=o,void 0===s||s>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(s,0,t),void 0!==i&&this.addChildrenMap(i,t),this},YP={add(t,e,i){if(tf(t))for(var s=t,r=0,n=s.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,am.call(this,t),this}},$P={getChildrenWidth:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=0===this.orientation&&t?this.maxChildWidth:this.rexSizer.resolved?this.wrapResult.width:void 0)?e+(this.space.left+this.space.right)*this.scaleX:void 0);var e},getChildrenHeight:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=1===this.orientation&&t?this.maxChildHeight:this.rexSizer.resolved?this.wrapResult.height:void 0)?e+(this.space.top+this.space.bottom)*this.scaleY:void 0);var e},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;sr&&tO.addNewLine(this)}else for(n=0,a=t.length;n=0;i--)nO.call(this,e[i],t);return this}};const oO=Phaser.Utils.Objects.GetValue;class hO extends ZP{constructor(t,e){void 0===e&&(e={});var i=e.space;"number"==typeof i&&(e.space={item:i,line:i}),super(t,e),this.type="rexFixWidthButtons",this.buttonGroup=new DP({parent:this,eventEmitter:oO(e,"eventEmitter",this),groupName:oO(e,"groupName",void 0),clickConfig:oO(e,"click",void 0)}).setButtonsType(e);var s=oO(e,"background",void 0),r=oO(e,"buttons",void 0);this.buttonsAlign=oO(e,"align",void 0),s&&this.addBackground(s),r&&this.addButtons(r),this.addChildrenMap("background",s),this.addChildrenMap("buttons",this.buttonGroup.buttons)}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.buttonGroup.destroy(),this.buttonGroup=void 0)}get buttons(){return this.buttonGroup.buttons}get groupName(){return this.buttonGroup.groupName}set groupName(t){this.buttonGroup.groupName=t}get eventEmitter(){return this.buttonGroup.eventEmitter}}Object.assign(hO.prototype,iO,aO,MP,AP);const lO=cS.prototype.add;var uO={addButton(t,e,i){return lO.call(this,t,e,i,void 0,0,this.buttonsExpand),this.buttonGroup.add(t),this},addButtons(t,e){for(var i=0,s=t;i=0;i--)pO.call(this,e[i],t);return this}};const fO=Phaser.Utils.Objects.GetValue;class vO extends cS{constructor(t,e){void 0===e&&(e={});var i=fO(e,"row",0),s=fO(e,"column",e.col||0),r=fO(e,"createCellContainerCallback"),n=fO(e,"buttons",void 0),a=fO(e,"expand",!0),o=a?1:0;if(r&&(e.createCellContainerCallback=void 0),void 0!==n){i=Math.max(i,n.length);for(var h=0,l=n.length;h=r&&h=i&&hi.length&&(t.prevCursorPosition=null),null!==t.prevCursorPosition&&(r=e.getCharChild(t.prevCursorPosition))&&("\n"===r.text&&r.clearTextSize(),e.emit("cursorout",r,t.prevCursorPosition,e)),null!=s&&(r=e.getCharChild(s))&&("\n"===r.text&&r.copyTextSize(e.lastInsertCursor),function(t){var e,i,s=t.parent,r=s.width,n=s.height,a=t.drawX,o=t.drawY,h=a+t.drawTLX,l=a+t.drawTRX,u=o+t.drawTLY,c=o+t.drawBLY;e=h<0?0-h:l>r?r-l:0,i=u<0?0-u:c>n?n-c:0,s._textOX+=e,s._textOY+=i}(r),e.emit("cursorin",r,s,e)),e.emit("movecursor",s,t.prevCursorPosition,e),t.prevCursorPosition=s}}(this)):(d_(this),p_(this)),this}setNumberInput(){return this.onUpdateCallback=c_,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}}const v_=Phaser.Utils.Objects.GetValue,m_=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var y_=function(){var t=this.scene.input.keyboard;this.textEdit.on("open",(function(){t.on("keydown-UP",this.cursorMoveUp,this).on("keydown-DOWN",this.cursorMoveDown,this)}),this).on("close",(function(){t.off("keydown-UP",this.cursorMoveUp,this).off("keydown-DOWN",this.cursorMoveDown,this)}),this)},b_=function(t){fr(t)||this.setCursorStyle(t).on("cursorin",(function(t){var e=this.cursorStyle,i=px(t.style,e);Pl(e,i)||(t.styleSave=i,t.modifyStyle(e))}),this).on("cursorout",(function(t){t.styleSave&&(t.modifyStyle(t.styleSave),t.styleSave=void 0)}),this)},x_=function(t){fr(t)||this.setRangeStyle(t).on("rangein",(function(t){var e=this.rangeStyle,i=px(t.style,e);Pl(e,i)||(t.styleSave=i,t.modifyStyle(e))}),this).on("rangeout",(function(t){t.styleSave&&(t.modifyStyle(t.styleSave),t.styleSave=void 0)}),this)},k_=function(t){fr(t)||this.setFocusStyle(t).on("open",(function(){var t=this.background,e=this.focusStyle,i=px(t,e);Pl(e,i)||(t.styleSave=i,t.modifyStyle(e))}),this).on("close",(function(){var t=this.background;t.styleSave&&(t.modifyStyle(t.styleSave),t.styleSave=void 0)}),this)};function C_(){}function S_(t,e,i,s,r){let n=0,a=e.length,o=0,h=0;for(;nt.length?i:t})),a.value=t.join(e)}else a.value=t.join(i.slice(o,o+a.count));o+=a.count,a.added||(h+=a.count)}}let l=e[a-1];return a>1&&"string"==typeof l.value&&(l.added||l.removed)&&t.equals("",l.value)&&(e[a-2].value+=l.value,e.pop()),e}C_.prototype={diff(t,e,i={}){let s=i.callback;"function"==typeof i&&(s=i,i={}),this.options=i;let r=this;function n(t){return s?(setTimeout((function(){s(void 0,t)}),0),!0):t}t=this.castInput(t),e=this.castInput(e),t=this.removeEmpty(this.tokenize(t));let a=(e=this.removeEmpty(this.tokenize(e))).length,o=t.length,h=1,l=a+o;i.maxEditLength&&(l=Math.min(l,i.maxEditLength));let u=[{newPos:-1,components:[]}],c=this.extractCommon(u[0],e,t,0);if(u[0].newPos+1>=a&&c+1>=o)return n([{value:this.join(e),count:e.length}]);function d(){for(let s=-1*h;s<=h;s+=2){let h,l=u[s-1],c=u[s+1],d=(c?c.newPos:0)-s;l&&(u[s-1]=void 0);let p=l&&l.newPos+1=a&&d+1>=o)return n(S_(r,h.components,e,t,r.useLongestToken));u[s]=h}else u[s]=void 0}var i;h++}if(s)!function t(){setTimeout((function(){if(h>l)return s();d()||t()}),0)}();else for(;h<=l;){let t=d();if(t)return t}},pushComponent(t,e,i){let s=t[t.length-1];s&&s.added===e&&s.removed===i?t[t.length-1]={count:s.count+1,added:e,removed:i}:t.push({count:1,added:e,removed:i})},extractCommon(t,e,i,s){let r=e.length,n=i.length,a=t.newPos,o=a-s,h=0;for(;a+1t,tokenize:t=>t.split(""),join:t=>t.join("")};const w_=new C_;const T_=/^[a-zA-Z\u{C0}-\u{FF}\u{D8}-\u{F6}\u{F8}-\u{2C6}\u{2C8}-\u{2D7}\u{2DE}-\u{2FF}\u{1E00}-\u{1EFF}]+$/u,P_=/\S/,O_=new C_;O_.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!P_.test(t)&&!P_.test(e)},O_.tokenize=function(t){let e=t.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/);for(let t=0;tvoid 0===i?e:i}=this.options;return"string"==typeof t?t:JSON.stringify(D_(t,null,null,i),i," ")},M_.equals=function(t,e){return C_.prototype.equals.call(M_,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const L_=new C_;L_.tokenize=function(t){return t.slice()},L_.join=L_.removeEmpty=function(t){return t};const A_=Phaser.Utils.Array.Remove;var R_=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),A_(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(h=i,l=e,w_.diff(h,l,u)),r=0,n=0,a=s.length;nr)i+=a;else{if(s!==r)break;i+=Math.min(e.position,a)}}return i},z_={cursorMoveLeft(){if(!this.isOpened)return this;var t=F_(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=F_(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=I_(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=F_(j_(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=I_(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=F_(j_(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const N_=Phaser.Utils.Objects.IsPlainObject;class G_ extends Wb{constructor(t,e,i,s,r,n){N_(e)?n=e:N_(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(tt(e,"wrap.vAlign")||Z(e,"wrap.vAlign",s=i?"center":"top"),tt(e,"wrap.wrapMode")||Z(e,"wrap.wrapMode","char"),tt(e,"wrap.maxLines")||Z(e,"wrap.maxLines",s=i?1:void 0),i&&Z(e,"wrap.wrapWidth",1/0),tt(e,"wrap.useDefaultTextHeight")||Z(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!tt(e.edit,"inputType")){var s=i?"text":"textarea";Z(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new Uo(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var a=n.text;a&&delete n.text;var o=dx(n.background,"focus"),h=dx(n.style,"cursor"),l=dx(n.style,"range");super(t,e,i,s,r,n),this.type="rexCanvasInput",this.contentWidth=void 0,this.contentHeight=void 0,this.lineHeight=void 0,this.linesCount=void 0,this.characterCountOfLines=[],this._text,this.textEdit=function(t,e){var i=v_(e,"edit");return void 0===i&&(i={}),ZO(e,i,m_),new f_(t,i)}(this,n),y_.call(this),n.focusStyle&&Object.assign(o,n.focusStyle),k_.call(this,o),n.cursorStyle&&Object.assign(h,n.cursorStyle),b_.call(this,h),n.rangeStyle&&Object.assign(l,n.rangeStyle),fr(l)&&Object.assign(l,h),x_.call(this,l);var u=n.onAddChar;u&&this.on("addchar",u);var c=n.onCursorIn;c&&this.on("cursorin",c);var d=n.onCursorOut;d&&this.on("cursorout",d);var p=!n.onRangeIn&&!n.onRangeOut,g=p?n.onCursorIn:n.onRangeIn;g&&this.on("rangein",g);var f=p?n.onCursorOut:n.onRangeOut;f&&this.on("rangeout",f);var v,m=n.onMoveCursor;m&&this.on("movecursor",m),this.setParseTextCallback(n.parseTextCallback),this.lastInsertCursor=((v=this.createCharChild("|")).text="",v),a||(a=""),this.setText(a)}addChild(t,e){if(super.addChild(t,e),Array.isArray(t))for(var i=t,s=0,r=i.length;s0&&Z(t,"expandTextWidth",!0),h>0&&Z(t,"expandTextHeight",!0),void 0===i&&(i={}),i.hasOwnProperty("icon")||(i.icon=function(t,e){var i=new Sc(t,e);return ek(i,e),i.setOrigin(.5,1),t.add.existing(i),i});var y=!1;i.hasOwnProperty("action")||(i.action=function(t,e){void 0===e&&(e={});var i=new GT(t,e);return ek(i,e),t.add.existing(i),i},y=!0);var b,x,k=new zw(r,t,i);k.setMinSize(o,h).setOrigin(.5,1).layout(),r.add.existing(k),wr(k,e),k.vpx=l,k.vpy=u,k.frameDelimiter=c,y&&(b=k.getElement("action"),k.setChildVisible(b,!1)),Ec(k),k.emitClick=function(){k.emit("click")},void 0===d&&(d=v.getData("$clickTarget")),null===d||(x="screen"===d.toLowerCase()?f.sys.anyTouchDetector:k.setInteractive()),x&&k.bindEvent(x,"pointerdown",(function(){k.emitClick()})),k.bindEvent(r.input.keyboard,"keydown",(function(t){if(void 0===p&&(p=v.getData("$clickShortcutKeys")),p){var e=p.split("|"),i=VT[t.keyCode];-1!==e.indexOf(i)&&k.emitClick()}}));var C=function(){k.isTyping?k.once("click",C).stop(!0):k.isLastPage?k.complete2Flag||(k.complete2Flag=!0,k.emit("complete2")):k.once("click",C).typeNextPage()},S=function(){k.isPageEnd&&(k.off("click",S),y&&(b.stop(),k.setChildVisible(b,!1)),v.emit("resume.input"))};k._typeNextPage=S,k.on("pageend",(function(){y&&(b.start(),k.setChildVisible(b,!0)),k.once("click",S);let t=v.getData("$fastTyping"),e=v.getData("$autoNextPage");var i;(t||e)&&(i=t?0:v.getData("$autoNextPageDelay"),f.sys.timeline.delayCall(i,k.emitClick)),v.emit("pause.input")})).on("start",(function(){k.off("click",C).once("click",C)}));var w=v.getData("$fastTyping"),T=v.getData("$autoNextPage");k.bindScenePreupdateEvent((function(){let t=v.getData("$fastTyping"),e=v.getData("$autoNextPage");if(t!==w)if(k.isTyping){let e;t?e=v.getData("$fastTypingSpeed"):void 0===e&&(e=k.normalTypingSpeed),k.setTypingSpeed(e)}else t&&k.emitClick();else e===T||t||k.isTyping||e&&k.emitClick();w=t,T=e}));var P=function(t,e){if(void 0===g&&(g=v.getData("$fastTypingShortcutKeys")),g){var i=g.split("|"),s=VT[t.keyCode];-1!==i.indexOf(s)&&v.setData("$fastTyping",e)}};return k.bindEvent(r.input.keyboard,"keydown",(function(t){P(t,!0)})),k.bindEvent(r.input.keyboard,"keyup",(function(t){P(t,!1)})),k}}(XT(e,`styles.${Jo}`,{}),{viewport:i},r);t.addGameObjectManager({name:Jo,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Ao,commands:{typing:Ic,shake:Mc}})}},function(t,e){var{viewport:i}=e,s=Lc(e,`creators.${Ko}`,void 0);if(!1!==s){if(Ac(s)&&(s=void 0),void 0===s){Lc(e,`styles.${Ko}`,{});s=function(t,{viewport:e}={}){return function(t,i){i.hasOwnProperty("scaleMode")||(i.scaleMode=0);var s=new Sc(t,i);t.add.existing(s),wr(s,e);var{vpx:r=.5,vpy:n=.5,vpw:a,vph:o,scaleMode:h}=i;if(s.vpx=r,s.vpy=n,h||void 0!==a||void 0!==o){void 0===a&&(a=1),void 0===o&&(o=1);var l=e.width*a,u=e.height*o;s.resize(l,u)}return Ec(s),s}}(0,{viewport:i})}t.addGameObjectManager({name:Ko,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Do,commands:{cross:Dc,shake:Mc}})}},function(t,e){var{viewport:i}=e,s=VO(e,`creators.${Qo}`,void 0);if(!1!==s){var r;if(YO(s)&&(r=s,s=void 0),void 0===s)s=function(t,{viewport:e}={},i){return function(s,{vpw:r,vph:n,width:a=0,height:o=0,vpx:h=.5,vpy:l=.5}={}){void 0!==r&&(a=e.width*r),void 0!==n&&(o=e.height*n);var u=new GO(s,t,i);return u.setMinSize(a,o).setVisible(!1),s.add.existing(u),wr(u,e),u.vpx=h,u.vpy=l,Ec(u),u}}(VO(e,`styles.${Qo}`,{}),{viewport:i},r);t.addGameObjectManager({name:Qo,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Ao,commands:{choice:WO,shake:Mc}})}},function(t,e){var{viewport:i}=e,s=U_(e,`creators.${th}`,void 0);if(!1!==s){var r;if(K_(s)&&(r=s,s=void 0),void 0===s)s=function(t,{viewport:e}={},i){return function(s,{vpw:r,vph:n,width:a=0,height:o=0,vpx:h=.5,vpy:l=.5}={}){void 0!==r&&(a=e.width*r),void 0!==n&&(o=e.height*n);var u=new H_(s,t,i);return u.setMinSize(a,o).setVisible(!1),s.add.existing(u),wr(u,e),u.vpx=h,u.vpy=l,Ec(u),u}}(U_(e,`styles.${th}`,{}),{viewport:i},r);t.addGameObjectManager({name:th,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Ao,commands:{input:$_,shake:Mc}})}},function(t,e){var{viewport:i}=e,s=tP(e,`creators.${Zo}`,void 0);if(!1!==s){var r;if(eP(s)&&(r=s,s=void 0),void 0===s)s=function(t,{viewport:e}={},i){return function(s,{vpw:r,vph:n,width:a=0,height:o=0,vpx:h=1,vpy:l=0,alignLeft:u=!1,alignRight:c=!0,alignTop:d=!0,alignBottom:p=!1,text0:g,text1:f,commandExecutor:v,eventSheetManager:m,eventsheet:y}={}){void 0!==r&&(a=e.width*r),void 0!==n&&(o=e.height*n),void 0===i&&(i={}),i.hasOwnProperty("icon")||(i.icon=function(t,e){var i=new Sc(t,e);return ek(i,e),i.setOrigin(.5,1),t.add.existing(i),i});var b,x,k=new $T(s,t,i);return g&&k.setTitle(g),f&&k.setText(f),b=u?0:c?1:.5,x=d?0:p?1:.5,k.setMinSize(a,o).setOrigin(b,x).layout(),s.add.existing(k),wr(k,e),k.vpx=h,k.vpy=l,Ec(k),k}}(tP(e,`styles.${Zo}`,{}),{viewport:i},r);t.addGameObjectManager({name:Zo,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Ao,commands:{setText:KT,popUp:qT,shake:Mc}})}}];var J_=[function(t){t.addExpression("random",(function(t,e){return void 0===t&&void 0===e?(t=0,e=1):void 0===e&&(e=t,t=0),t+Math.random()*(e-t)}))},function(t){t.addExpression("randomInt",(function(t,e){return Math.floor(t+Math.random()*(e-t+1))}))}],Z_={$typingSpeed:100,$autoNextPage:!1,$autoNextPageDelay:500,$fastTyping:!1,$fastTypingSpeed:20,$clickShortcutKeys:"SPACE|ENTER",$fastTypingShortcutKeys:"CTRL",$clickTarget:"screen",$transitionDuration:500,$tintOthers:3355443,$shakeDuration:500,$shakeMagnitude:50},Q_=function(t,e){var i=po(t);for(var s in e)i.hasOwnProperty(s)||(i[s]=e[s]);return i};class tE extends or{constructor(t,e={}){e.commandExecutor=function(t,e){var{layerDepth:i,rootLayer:s,multipleCamerasEnable:r=!1,viewport:n}=e;void 0===n&&(e.viewport=un(t,t.cameras.main));for(var a=new Mo(t,{layers:r?Vo:Yo,layerDepth:i,rootLayer:s}),o=0,h=q_.length;o0&&void 0!==this._direction?this.previousDirection=this._direction:this.previousDirection=void 0,this._direction=t,this.verticeAngle=90*t,this.dirty=!0,void 0!==this.previousDirection?this.playEaseDirectionation():this.stopEaseDirection())}setDirection(t,e){return void 0!==e&&this.setEaseDuration(e),this.direction=t,this}toggleDirection(t){return this.setDirection(this.direction+2,t),this}get easeDirectionProgress(){return this._easeDirectionProgress}set easeDirectionProgress(t){this._easeDirectionProgress!==t&&(this._easeDirectionProgress=t,this.dirty=!0)}setPadding(t,e,i,s){if("object"==typeof t){var r=t,n=uE(r,"x",null);null!==n?(t=n,i=n):(t=uE(r,"left",0),i=uE(r,"right",t));var a=uE(r,"y",null);null!==a?(e=a,s=a):(e=uE(r,"top",0),s=uE(r,"bottom",e))}else void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=t),void 0===s&&(s=e);return void 0===this.padding&&(this.padding={}),this.dirty=this.dirty||this.padding.left!=t||this.padding.top!=e||this.padding.right!=i||this.padding.bottom!=s,this.padding.left=t,this.padding.top=e,this.padding.right=i,this.padding.bottom=s,this.setRadius(),this}get radius(){return this._radius}set radius(t){this.dirty=this.dirty||this._radius!=t,this._radius=t}setRadius(t){return this.radius=t,this.shapeMode=null==t?0:1,this}get verticeRotation(){return this._verticeRotation}set verticeRotation(t){this.dirty=this.dirty||this._verticeRotation!=t,this._verticeRotation=t}setVerticeRotation(t){return this.verticeRotation=t,this}get verticeAngle(){return pE(this.verticeRotation)}set verticeAngle(t){this.verticeRotation=dE(t)}setVerticeAngle(t){return this.verticeAngle=t,this}}const fE={right:0,down:1,left:2,up:3};var vE=function(t){return"string"==typeof t&&(t=fE[t]),t%=4};Object.assign(gE.prototype,hE,lE);class mE extends sE{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexTweaker.FolderTitle";var i=new gE(t,e.expandedIcon);t.add.existing(i),this.addSpace().add(i,{proportion:0,expand:!1,padding:1,fitRatio:1}),this.addChildrenMap("expandedIcon",i)}setExpandedState(t){void 0===t&&(t=!0);var e=t?"down":"right";return this.childrenMap.expandedIcon.setDirection(e),this}}var yE=function(t,e,i){return ik(t,Q_(e,i))};class bE extends Lg{constructor(t,e){void 0===e&&(e={}),e.destroy=!1,super(t,e)}onOpen(){this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.parent,this),super.onClose()}}var xE={expand(t){if(!0===this.expanded)return this;void 0===t&&(t=this.transitionDuration),this.expanded=!0;var e=this.childrenMap.title,i=this.childrenMap.child;(this.show(i),this.reLayoutEnable)&&(this.reLayoutTarget?this.reLayoutTarget:this.getTopmostSizer()).layout();return e.emit("folder.expand",t,this),i.emit("folder.expand",t,this),this.emit("expand.start",this),this.childTransition.once("open",(function(){this.emit("expand.complete",this)}),this).requestOpen(null,t),this},collapse(t){if(!1===this.expanded)return this;void 0===t&&(t=this.transitionDuration),this.expanded=!1;var e=this.childrenMap.title,i=this.childrenMap.child;return e.emit("folder.collapse",t,this),i.emit("folder.collapse",t,this),this.emit("collapse.start",this),this.childTransition.once("close",(function(){(this.setChildScale(i,1,1).hide(i),this.reLayoutEnable)&&(this.reLayoutTarget?this.reLayoutTarget:this.getTopmostSizer()).layout();this.emit("collapse.complete",this)}),this).requestClose(null,t),this},toggle(t){return this.expanded?this.collapse(t):this.expand(t),this},setExpandedState(t){return this.reLayoutEnable=!1,void 0===t?this.expanded=void 0:t?this.expand(0):this.collapse(0),this.reLayoutEnable=!0,this}},kE=function(t,e){Np.popUp.call(t,e,this.expandDirection)},CE=function(t,e){Np.scaleDown.call(t,e,this.expandDirection)},SE={setTransitionDuration(t){return this.transitionDuration=t,this.childTransition.setTransitInTime(t).setTransitOutTime(t),this},setExpandCallback(t){return void 0===t&&(t=kE.bind(this)),this.childTransition.setTransitInCallback(t),this},setCollapseCallback(t){return void 0===t&&(t=CE.bind(this)),this.childTransition.setTransitOutCallback(t),this}};const wE=Phaser.Utils.Objects.GetValue;let TE=class extends bm{constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("orientation")||(e.orientation=1),super(t,e),this.type="rexFolder",this.reLayoutEnable=!0,this.expanded=void 0,this.expandDirection=1===this.orientation?"y":"x";var i=e.background,s=e.title,r=e.child;i&&this.addBackground(i);var n=wE(e,"space"),a=1===this.orientation?"left":"top",o=wE(e,"align.title",a),h=wE(e,"expand.title",!0);this.add(s,{proportion:0,align:o,expand:h,padding:{left:wE(n,"titleLeft",0),right:wE(n,"titleRight",0),top:wE(n,"titleTop",0),bottom:wE(n,"titleBottom",0)}});var l=wE(e,"toggleByTarget",void 0),u=wE(e,"toggleClickConfig");if(void 0===l&&(l=s),l&&pf.onClick.call(l,(function(){this.toggle()}),this,u),this.childTransition=new bE(r),!wE(e,"customChildOrigin",!1)){var c=this.rtl?1:0;r.setOrigin(c)}o=wE(e,"align.child","left");var d=(h=wE(e,"expand.child",!0))?1:0;this.add(r,{proportion:d,align:o,expand:h,padding:{left:wE(n,"childLeft",0),right:wE(n,"childRight",0),top:wE(n,"childTop",0),bottom:wE(n,"childBottom",0)}}),this.addChildrenMap("title",s),this.addChildrenMap("child",r),this.addChildrenMap("background",i);var p=e.transition;this.setTransitionDuration(wE(p,"duration",200)),this.setExpandCallback(wE(p,"expandCallback",void 0)),this.setCollapseCallback(wE(p,"collapseCallback",void 0)),this.reLayoutTarget=wE(e,"reLayoutTarget",void 0);var g=e.onExpandStart;g&&this.on("expand.start",g);var f=e.onExpandComplete;f&&this.on("expand.complete",f);var v=e.onCollapseStart;v&&this.on("collapse.start",v);var m=e.onCollapseComplete;m&&this.on("collapse.complete",m);var y=wE(e,"expanded",void 0);void 0!==y&&this.setExpandedState(y)}};Object.assign(TE.prototype,xE,SE);var PE={setBindingTarget(t){return this.childrenMap.child.setBindingTarget(t),this}},OE={getMaxInputRowTitleWidth(){return this.childrenMap.child.getMaxInputRowTitleWidth()+this.getInnerPadding("left")},setInputRowTitleWidth(t){return t-=this.getInnerPadding("left"),this.childrenMap.child.setInputRowTitleWidth(t),this}};class _E extends TE{constructor(t,e){void 0===e&&(e={}),e.orientation=1,super(t,e),this.type="rexTweaker.Folder"}setTitle(t){return this.childrenMap.title.setTitle(t),this}}Object.assign(_E.prototype,PE,OE);const EE=Phaser.Utils.Objects.GetValue;const ME=Phaser.Utils.Objects.GetValue;const DE=pP.prototype.add;var LE=function(t,e,i,s,r,n,a,o,h){return t.setVisible(!1),DE.call(this,t,e,i,s,r,n,a,o,h),this},AE={add:LE,addPage:LE};const RE=al.prototype.setChildVisible;var BE={getPage:function(t){return void 0===t?null:this.sizerChildren.hasOwnProperty(t)?this.sizerChildren[t]:null},swapPage:function(t,e){this._previousKey=this._currentKey;var i=this.previousPage;i&&(0===this.swapMode?(RE.call(this,i,!1),this.emit("pageinvisible",i,this._previousKey,this)):i.destroy()),t&&!this.sizerChildren.hasOwnProperty(t)&&this.emit("createpage",t,this),this._currentKey=t;var s=this.currentPage;return s&&(RE.call(this,s,!0),this.emit("pagevisible",s,this._currentKey,this),void 0===e&&(e=this.fadeInDuration),e>0&&s.setAlpha(0).fadeIn(e,1)),this},hasPage:function(t){return this.sizerChildren.hasOwnProperty(t)}};Object.assign(BE,AE);const FE=Phaser.Utils.Objects.GetValue;class IE extends pP{constructor(t,e){super(t,e),this.type="rexPages",this.childrenMap=this.sizerChildren,this._previousKey=void 0,this._currentKey=void 0,this.setSwapMode(FE(e,"swapMode",0)),this.setFadeInDuration(FE(e,"fadeIn",0))}setSwapMode(t){return"string"==typeof t&&(t=jE[t]),this.swapMode=t,this}setFadeInDuration(t){return this.fadeInDuration=t,this}get previousKey(){return this._previousKey}get currentKey(){return this._currentKey}set currentKey(t){this.swapPage(t)}get currentPage(){return this.getPage(this.currentKey)}get previousPage(){return this.getPage(this.previousKey)}get keys(){return Object.keys(this.sizerChildren)}}Object.assign(IE.prototype,BE);const jE={invisible:0,destroy:1};const zE=Phaser.Utils.Objects.IsPlainObject,NE=Phaser.Utils.Objects.GetValue,GE=Phaser.Utils.String.UUID;var WE={swapPage:function(t,e){var i,s;null!=(i="number"==typeof t?t:this.getPageIndex(t))&&(void 0!==e&&(s=this.childrenMap.pages.fadeInDuration,this.childrenMap.pages.fadeInDuration=e),this.childrenMap.tabs.emitButtonClick(i),void 0!==s&&(this.childrenMap.pages.fadeInDuration=s));return this},swapFirstPage:function(t){return this.swapPage(0,t),this},swapLastPage:function(t){var e=this.getElement("tabs.buttons").length-1;return this.swapPage(e,t),this}},VE={removePage(t,e){"number"==typeof t&&(t=this.getPageKey(t));var i=this.childrenMap.tabs,s=i.getByName(t),r=this.childrenMap.pages,n=r.getElement(t);return s&&n?(r.removeChildrenMap(t),i.removeButton(s,e),r.remove(n,e),this):this},removeAllPages(t){for(var e=this.getElement("tabs.buttons"),i=e.length-1;i>=0;i--)this.removePage(e[i].name,t);return this}},YE={top:1,left:3,right:5,bottom:7},XE={top:"bottom",left:"right",right:"left",bottom:"top"},HE={setTabsPadding(t,e){return this.childrenMap.tabs.setOuterPadding(t,e),this},getTabsPadding(t){return this.childrenMap.tabs.getOuterPadding(t)}},$E={getPageKey:function(t){var e=this.getElement("tabs.buttons");if(!(t>=e.length))return e[t].name},getPageIndex:function(t){for(var e=this.getElement("tabs.buttons"),i=0,s=e.length;i0,setInputRowTitleWidth(t){return this}};const uM=Phaser.Utils.Objects.GetValue;class cM extends bm{constructor(t,e){void 0===e&&(e={}),e.orientation="y",super(t,e),this.type="rexTweaker.Wrap";var i=uM(e,"background",void 0),s=uM(e,"title",void 0);i&&this.addBackground(i),s&&this.add(s,{expand:!0,space:{bottom:uM(e,"space.title",0)}});var r=uM(e,"child",void 0);this.add(r,{expand:!0}),this.addChildrenMap("title",s),this.addChildrenMap("child",r)}setTitle(t){var e=this.childrenMap.title;return t.title||t.icon?e.show().setTitle(t):e.hide(),this}}Object.assign(cM.prototype,hM,lM);const dM=Phaser.Utils.Objects.GetValue;const pM=Phaser.Utils.Objects.GetValue;var gM=function(t){return t.hasOwnProperty("geometryMask")?t.geometryMask:t.bitmapMask};const fM=Phaser.Geom.Intersects.RectangleToRectangle,vM=Phaser.Geom.Rectangle.Overlaps;var mM=function(t){if(!t.displayList)return!1;for(;;){var e=t.rexContainer;if(e){if(e.visible){var i=e.parent;if(i){t=i;continue}return!0}return!1}return t.visible}},yM=function(t,e){var i=e.top,s=e.bottom,r=e.left,n=e.right,a=0;return a+=t.contains(r,i)?1:0,a+=t.contains(r,s)?1:0,a+=t.contains(n,i)?1:0,a+=t.contains(n,s)?1:0},bM=function(t,e,i){e.hasOwnProperty("isRexContainerLite")?(e.syncChildrenEnable=!1,t.setChildMaskVisible(e,!0),e.syncChildrenEnable=!0):(e.clearMask&&e.clearMask(),t.setChildMaskVisible(e,!0))},xM=function(t,e,i){e.hasOwnProperty("isRexContainerLite")?(e.syncChildrenEnable=!1,t.setChildMaskVisible(e,!0),e.syncChildrenEnable=!0):(e.setMask&&e.setMask(i),t.setChildMaskVisible(e,!0))},kM=function(t,e,i){e.hasOwnProperty("isRexContainerLite")?(e.syncChildrenEnable=!1,t.setChildMaskVisible(e,!1),e.syncChildrenEnable=!0):(e.clearMask&&e.clearMask(),t.setChildMaskVisible(e,!1))};const CM=Phaser.Utils.Objects.GetValue,SM={update:0,everyTick:1};var wM={setupChildrenMask(t){return!1===t||(this.setMaskUpdateMode(CM(t,"updateMode",0)),this.enableChildrenMask(CM(t,"padding",0)),this.setMaskLayer(CM(t,"layer",void 0)),this.onMaskGameObjectVisible=CM(t,"onVisible"),this.onMaskGameObjectInvisible=CM(t,"onInvisible"),this.maskGameObjectCallbackScope=CM(t,"scope"),this.startMaskUpdate()),this},destroyChildrenMask(){return this.childrenMask?(this.stopMaskUpdate(),this.childrenMask.destroy(),this.childrenMask=void 0,this.onMaskGameObjectVisible=null,this.onMaskGameObjectInvisible=null,this.maskGameObjectCallbackScope=null,this):this},setMaskUpdateMode(t){return"string"==typeof t&&(t=SM[t]),this.maskUpdateMode=t,this},startMaskUpdate(){this.scene.game.events.on("poststep",this.maskChildren,this)},stopMaskUpdate(){this.scene.game.events.off("poststep",this.maskChildren,this)},enableChildrenMask(t){var e=wm.call(this,null,this,0,t);return this.childrenMask=e.createGeometryMask(),this},setMaskChildrenFlag(t){return void 0===t&&(t=!0),this.maskChildrenFlag=t,this},setMaskLayer(t){return this.maskLayer=t,this},maskChildren(){return this.childrenMask&&this.maskChildrenFlag&&0!==this.alpha&&this.visible?(this.privateRenderLayer?this.privateRenderLayer.setMask(this.childrenMask):this.maskLayer?(this.addToLayer(this.maskLayer),this.maskLayer.setMask(this.childrenMask)):function({parent:t,mask:e,children:i,onVisible:s,onInvisible:r,scope:n}){if(e){void 0===i&&(i=t.getAllChildren());for(var a,o,h,l=!!s||!!r,u=t.getBounds(),c=gM(e),d=0,p=i.length;dthis.topChildOY}childOYExeceedBottom(t){return void 0===t&&(t=this.childOY),tthis.leftChildOX}childOXExeceedRight(t){return void 0===t&&(t=this.childOX),tthis.childHeight?t=0:s?t=e:r&&(t=i)),this._childOY!==t&&(this._childOY=t,this.resetChildPosition()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}get childOX(){return this._childOX}set childOX(t){var e=this.leftChildOX,i=this.rightChildOX,s=this.childOXExceedLeft(t),r=this.childOXExeceedRight(t);this.clampChildOX&&(this.childVisibleWidth>this.childWidth?t=0:s?t=e:r&&(t=i)),this._childOX!==t&&(this._childOX=t,this.resetChildPosition()),s&&(this.execeedLeftState||this.emit("execeedleft",this,t,e)),this.execeedLeftState=s,r&&(this.execeedRightState||this.emit("execeedright",this,t,i)),this.execeedRightState=r}setChildOY(t){return this.childOY=t,this}setChildOX(t){return this.childOX=t,this}set t(t){this.childOY=-this.visibleHeight*t}get t(){var t=this.visibleHeight;return 0===t?0:this.childOY/-t}set s(t){this.childOX=-this.visibleWidth*t}get s(){var t=this.visibleWidth;return 0===t?0:this.childOX/-t}setChildOYByPercentage(t){return this.t=t,this}setChildOXByPercentage(t){return this.s=t,this}}Object.assign(EM.prototype,TM);const MM=["top","bottom","centerY","center"],DM=["left","right","centerX","center"];var LM=function(t,e,i){var s,r="Y"===(e=e.toUpperCase()),n=this.childrenMap.child;if(r){if(i)for(var a=0,o=MM.length;a=0?0:Math.abs(l)<=Math.abs(u)?l:u}}else{if(i)for(a=0,o=DM.length;a=0?0:Math.abs(c)<=Math.abs(d)?c:d}}switch(this.scrollMode){case 0:case 1:this.childOY+=s;break;default:this[`childO${e}`]+=s}};const AM=Phaser.Utils.Objects.GetValue;class RM extends pw{constructor(t,e){void 0===e&&(e={});var i=XC(e),s=AM(e,"panel",void 0);void 0===s&&(s={}),s.scrollMode=i,s.clampChildOY=AM(e,"clampChildOY",!1),s.clampChildOX=AM(e,"clampChildOX",!1);var r,n,a=new EM(t,s);switch(t.add.existing(a),i){case 0:r=AM(e,"expand.panel",!0),n=!0;break;case 1:r=!0,n=AM(e,"expand.panel",!0);break;default:r=!0,n=!0}e.type="rexScrollablePanel",e.child={gameObject:a,expandWidth:r,expandHeight:n,align:AM(e,"align.panel","center")};var o=AM(e,"space",void 0);o&&(o.child=AM(o,"panel",0)),super(t,e),this.addChildrenMap("panel",a.child),this.addChildrenMap("panelLayer",a.maskLayer),this.addChildrenMap("mask",a.maskGameObject),this.addChildrenMap("scrollableBlock",a)}setChildrenInteractive(t){return void 0===t&&(t={}),t.hasOwnProperty("eventEmitter")||(t.eventEmitter=this),t.hasOwnProperty("targets")||(t.targets=[this.childrenMap.panel]),Vv(this.childrenMap.child,t),this}}var BM={scrollToChild:function(t,e){if(!this.hasChild(t))return this;switch(this.scrollMode){case 0:LM.call(this,t,"y",e);break;case 1:LM.call(this,t,"x",e);break;default:LM.call(this,t,"y",e),LM.call(this,t,"x",e)}return this}};Object.assign(RM.prototype,BM);var FM={setBindingTarget(t){return this.childrenMap.panel.setBindingTarget(t),this}},IM={getMaxInputRowTitleWidth(){return this.childrenMap.panel.getMaxInputRowTitleWidth()+this.getInnerPadding("left")},setInputRowTitleWidth(t){return t-=this.getInnerPadding("left"),this.childrenMap.panel.setInputRowTitleWidth(t),this}};class jM extends RM{constructor(t,e){super(t,e),this.type="rexTweaker.Scrollable"}setTitle(t){var e=this.childrenMap.header;return t.title||t.icon?e.show().setTitle(t):e.hide(),this}}Object.assign(jM.prototype,FM,IM);const zM=Phaser.Utils.Objects.GetValue;const NM=Phaser.Utils.Objects.GetValue;const GM=Phaser.Utils.Objects.GetValue;var WM={setupBinding(){return this.childrenMap.inputField.on("valuechange",(function(t){this.autoUpdateEnable&&this.setTargetValue(t)}),this),this},setAutoUpdateEnable(t){return void 0===t&&(t=!0),this.autoUpdateEnable=t,this},setBindingTarget(t,e){this.bindingTarget=t,void 0!==e&&this.setBindingTargetKey(e),this.syncTargetValue();var i=this.childrenMap.inputField;return i.onBindTarget&&i.onBindTarget(t,e),this},setBindingTargetKey(t){return this.bindTargetKey=t,this},setValueCallbacks(t){return this.onGetValue=GM(t,"onGetValue"),this.onSetValue=GM(t,"onSetValue"),this},getTargetValue(){if(this.bindingTarget)return null!=this.bindTargetKey?this.bindingTarget[this.bindTargetKey]:this.onGetValue?this.onGetValue(this.bindingTarget):void 0},setTargetValue(t){return this.bindingTarget?null!=this.bindTargetKey?(this.bindingTarget[this.bindTargetKey]=t,this):(this.onSetValue&&this.onSetValue(this.bindingTarget,t),this):this},syncTargetValue(){if(!this.bindingTarget)return this;var t=this.childrenMap.inputField;return t.syncValue&&t.syncValue(this.getTargetValue()),this}},VM={startMonitorTarget(){return this.isMonitoring||(this.isMonitoring=!0,this.scene.events.on("postupdate",this.onMonitorTarget,this)),this},stopMonitorTarget(){return this.isMonitoring?(this.isMonitoring=!1,this.scene.events.off("postupdate",this.onMonitorTarget,this),this):this},onMonitorTarget(){if(this.bindingTarget){var t=this.getTargetValue(),e=this.childrenMap.inputField;e.value!==t&&e.syncValue(t)}}},YM={getMinTitleWidth(){var t=this.childrenMap.title;if(!t||0!==t.orientation)return 0;var e=t.rexSizer.padding;return this.getChildWidth(this.childrenMap.title)+(e.left+e.right)*t.scaleX+this.getInnerPadding("left")},setMinTitleWidth(t){var e=this.childrenMap.title;if(!e||0!==e.orientation)return this;var i=e.rexSizer.padding;return t-=(i.left+i.right)*e.scaleX,e.minWidth=t,this}};const XM=Phaser.Utils.Objects.GetValue;class HM extends bm{constructor(t,e){super(t,e),this.type="rexTweaker.InputRow",this.bindingTarget=void 0,this.bindTargetKey=void 0,this.autoUpdateEnable=!0;var i,s=e.inputTitle,r=e.inputField,n=e.background,a=XM(e,"proportion.title",0),o=XM(e,"space.title",0);i=0===this.orientation?{right:o}:{bottom:o},this.add(s,{proportion:a,expand:!0,padding:i});var h=r.defaultProportion;void 0===h&&(h=e.defaultExpandWidth?1:0);a=XM(e,"proportion.inputField",h);this.add(r,{proportion:a,expand:!0}),n&&this.addBackground(n),this.addChildrenMap("title",s),this.addChildrenMap("inputField",r),this.addChildrenMap("background",n),this.setupBinding()}destroy(t){this.scene&&!this.ignoreDestroy&&(this.stopMonitorTarget(),super.destroy(t))}setTitle(t){return this.childrenMap.title.setTitle(t),this}preLayout(){var t=this.childrenMap.title;t&&(t.minWidth=0),super.preLayout()}}Object.assign(HM.prototype,WM,VM,YM);var $M=function(t,e,i){var s=new sE(t,i);return t.add.existing(s),s},UM=function(t){void 0===t&&(t=bm);return class extends t{get bindingTarget(){return this.getParentSizer().bindingTarget}get bindingKey(){return this.getParentSizer().bindTargetKey}get value(){return this._value}get root(){return this.getParentSizer().getParentSizer().root}onBindTarget(t,e){this.onBindTargetCallback&&this.onBindTargetCallback(this,t,e)}validate(t){return!(!this.syncValueFlag&&this.validateCallback)||this.validateCallback(t,this._value,this.bindingTarget,this.bindingKey)}getFotmatText(t){return t=this.textFormatCallback?this.textFormatCallback(t):t.toString()}set value(t){if(this._value!==t&&(this.validate(t)||(t=this._value),this.filterValueCallback&&(t=this.filterValueCallback(this,t)),this.displayValueCallback&&this.displayValueCallback(this,t),this._value!==t)){var e=this._value;if(this._value=t,!this.syncValueFlag){var i=this.bindingTarget,s=this.bindingKey;this.emit("valuechange",t,e,i,s),this.root.emit("valuechange",t,e,i,s)}}}getValue(){return this.value}setValue(t){return this.value=t,this}syncValue(t){return this.syncValueFlag=!0,this.value=t,this.syncValueFlag=!1,this}setup(t,e){return void 0===e&&(e=!1),(e||t.hasOwnProperty("format"))&&this.setTextFormatCallback(t.format),(e||t.hasOwnProperty("onValidate"))&&this.setValidateCallback(t.onValidate),this.setupCallback&&this.setupCallback(this,t,e),this}setSetupCallback(t){return this.setupCallback=t,this}setFilterValueCallback(t){return this.filterValueCallback=t,this}setDisplayValueCallback(t){return this.displayValueCallback=t,this}setOnBindTargetCallback(t){return this.onBindTargetCallback=t,this}setTextFormatCallback(t){return this.textFormatCallback=t,this}setValidateCallback(t){return this.validateCallback=t,this}}},KM=function(t,e,i){for(var s,r=this.inputHandlers,n=0,a=r.length;n0?0:1,0===n.minWidth&&n.setMinWidth(this.itemWidth)),0===n.minHeight&&n.setMinHeight(this.itemHeight),this.add(n,{proportion:r,expand:!0}));i.onValueChange&&n.childrenMap.inputField.on("valuechange",i.onValueChange);return n.setAutoUpdateEnable(i.autoUpdate),n.setBindingTarget(t,e),i.monitor&&n.startMonitorTarget(),i.key&&this.root.addChildrenMap(i.key,n),this},addButtons:function(t){void 0===t&&(t={});var e=this.scene,i=t.bindingTarget;delete t.bindingTarget;var s=eD(this.styles,"inputRow")||{},r=tD(e,t,s);return this.add(r,{expand:!0}),i&&r.setBindingTarget(i),t.key&&this.root.addChildrenMap(t.key,r),this},addButton:function(t){return void 0===t&&(t={}),t.buttons=[{label:t.label,callback:t.callback}],delete t.label,delete t.callback,this.addButtons(t),this},addSeparator:function(t){void 0===t&&(t={});var e=function(t,e,i){return ik(t,Q_(e,i))}(this.scene,t,iD(this.styles,"separator"));return this.add(e,{expand:!0}),this},addRows:function(t,e,i){return"boolean"==typeof e&&(i=e,e=void 0),void 0===i&&(i=!0),sD(this,y(t),e,i),this},setBindingTarget:function(t){for(var e=this.sizerChildren,i=0,s=e.length;it.hasOwnProperty("view")?"string"===t.view:"string"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.TextInput";var s=e.inputText,r=V_(i,s);t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))}},hD={setText(t){return this.childrenMap.child.setText(t),this},appendText(t){return this.setText(this.text+t),this}},lD={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const uD=Phaser.Utils.Objects.GetValue;class cD extends pw{constructor(t,e){void 0===e&&(e={});var i,s=uD(e,"text");fn(s)?i=s:(void 0===s&&(s={}),s.textArea=!0,i=new G_(t,s),t.add.existing(i)),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textVisibleHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.contentHeight}})}(i);var r=void 0===s.width,n=void 0===s.height;r&&(i.minWidth=0),n&&(i.minHeight=0),e.scrollMode=0,e.type="rexTextAreaInput",e.child={gameObject:i,expandWidth:r,expandHeight:n};var a,o,h=uD(e,"space",void 0);h&&(h.child=uD(h,"text",0)),e.scroller=!1,super(t,e),this.addChildrenMap("text",i),i.on("cursorin",(function(){var t=i.textOY,e=i.contentHeight,s=a!==t,r=o!==e;a=t,o=e,r&&this.resizeController(),(s||r)&&(this.t=i.t)}),this),i.on("textchange",(function(t){this.emit("textchange",t,this)}),this).on("close",(function(){this.emit("close",this.text,this)}),this);var l=uD(e,"content",void 0);l&&this.setText(l)}get text(){return this.childrenMap.child.text}set text(t){t=null==t?"":t.toString(),this.childrenMap.child.text!==t&&this.setText(t)}get lineHeight(){return this.childrenMap.child.lineHeight}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.contentHeight}get readOnly(){return this.childrenMap.child.readOnly}set readOnly(t){this.childrenMap.child.readOnly=t}setReadOnly(t){return this.childrenMap.child.setReadOnly(t),this}get value(){return this.text}set value(t){this.text=t}}Object.assign(cD.prototype,hD,lD);var dD={name:"TextAreaInput",accept:t=>!!t.hasOwnProperty("view")&&"textarea"===t.view,build(t,e){var i=t.scene;this.type="rexTweaker.TextAreaInput";var s=e.inputTextArea;void 0===s&&(s={}),s.hasOwnProperty("text")||(s.text=e.inputText),s.hasOwnProperty("slider")||(s.slider=e.slider);var r=function(t,e,i){void 0===i&&(i=!0),i?e=e?y(e):{}:e||(e={});var s=new cD(t,e);return t.add.existing(s),s}(i,s);t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))},onBindTarget(t){t.childrenMap.inputText.scrollToTop()}},pD={name:"NumberInput",accept:t=>t.hasOwnProperty("view")?"number"===t.view:"number"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.NumberInput";var s=e.inputNumber||e.inputText,r=V_(i,s).setNumberInput();t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly),t.isFloatType=!e.int},filterValue:(t,e)=>t.isFloatType?e:Math.floor(e),displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))}};const gD=Phaser.Utils.Objects.GetValue,fD=Phaser.Math.Linear,vD=Phaser.Math.Snap.Floor;var mD={name:"RangeInput",accept:t=>t.hasOwnProperty("view")?"range"===t.view:"number"==typeof t.value&&t.hasOwnProperty("min")&&t.hasOwnProperty("max"),build(t,e){var i=t.scene;t.type="rexTweaker.RangeInput";var s=e.slider,r=0===t.orientation?"track.height":"track.width",n=gD(s,r),a=function(t,e){var i=new IS(t,e);return t.add.existing(i),i}(i,s),o=e.defaultExpandWidth?2:0,h=gD(e,"proportion.range.slider",o),l=void 0===n;t.add(a,{proportion:h,expand:l,key:"slider"});var u=e.inputNumber||e.inputText,c=V_(i,u).setNumberInput();o=e.defaultExpandWidth?1:0,h=gD(e,"proportion.range.inputText",o);t.add(c,{proportion:h,expand:!0,key:"inputText"}),c.on("close",(function(){t.setValue(c.value)})),a.on("valuechange",(function(){var e=fD(t.minValue,t.maxValue,a.value);t.step&&(e=vD(e,t.step,t.minValue)),t.setValue(e)}))},setup(t,e,i){(i||e.hasOwnProperty("max"))&&function(t,e,i,s){t.minValue=e,t.maxValue=i,t.step=s,t.childrenMap.slider.setGap(s,e,i)}(t,e.min,e.max,e.step),(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.slider.setValue(e,t.minValue,t.maxValue),t.childrenMap.inputText.setText("").setText(t.getFotmatText(e))}},yD=function(t,e){var i=new BP(t,e);return t.add.existing(i),i};const bD=Phaser.Utils.Objects.GetValue;var xD={name:"RangeInput",accept:t=>!!t.hasOwnProperty("view")&&"incdec"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.IncDecInput";var s=bD(e,"incDec")||{},r={text:null,action:null},n=yD(i,{expand:!1}),a=e.defaultExpandWidth?1:0;t.add(n,{proportion:a,expand:!0});var o=e.inputNumber||e.inputText,h=V_(i,o).setNumberInput();h.on("close",(function(){t.setValue(h.value)}));var l=Object.assign(y(r),s.incButton||{}),u=TO(i,l),c=Object.assign(y(r),s.decButton||{}),d=TO(i,c);n.addButton(u),n.addButton(d);var p=s.inputTextIndex||0;n.insert(p,h,{proportion:1,expand:!0}),t.step=1,t.minValue=void 0,t.maxValue=void 0,n.on("button.click",(function(e,i,s,r){var n=t.value;0===i?n+=t.step:n-=t.step,void 0!==t.maxValue&&n>t.maxValue&&(n=t.maxValue),void 0!==t.minValue&&n0&&{height:this.colorComponentsHeight,formatLabel:this.colorComponentsFormatLabelConfig,inputText:this.colorComponentsInputTextConfig,space:this.colorComponentsSpace};var a=new pL(t,{width:s,height:n,background:e,space:this.colorPickerSpace,hPalette:{position:this.colorPickerHPalettePosition},colorComponents:r,value:this.value});return t.add.existing(a),a};const fL=Phaser.Utils.Objects.GetValue;var vL=function(t,e){var i=fL(e,"expandDirection",void 0);"string"==typeof i&&(i=mL[i]);var s,r,n,a,o,h,l,u=(n="alignTargetX",tt(s=e,r="alignTarget")?Q(s,r):n&&tt(s,n)?Q(s,n):a&&tt(s,a)?Q(s,a):o),c=fL(e,"alignTargetY",u),d=fL(e,"alignOffsetX",0),p=fL(e,"alignOffsetY",0),g=fL(e,"alignSide","").includes("right"),f=fL(e,"bounds"),v=0===i,m=!v&&!(1===i),y=g?1:0,b=v||m?0:1;t.setOrigin(y,b),h=g?u.getTopRight().x:u.getTopLeft().x,l=c.getBottomLeft().y,t.setPosition(h+d,l+p);var x=f;x||(x=un(t.scene)),m&&t.getBottomLeft().y>x.bottom&&(l=c.getTopLeft().y,t.setOrigin(0,1).setPosition(h+d,l+p))};const mL={down:0,up:1},yL=Phaser.Utils.Objects.GetValue;class bL extends Lg{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=function(t,e){Rp(t,e,"y","Cubic")}),null==e.transitOut&&(e.transitOut=function(t,e){!function(t,e,i,s,r){void 0===s&&(s="Linear");var n={mode:0};switch(i){case 0:case"x":n.end={x:0};break;case 1:case"y":n.end={y:0};break;default:n.end=0}n.duration=e,n.ease=s,void 0===r?r=new Lp(t,n):r.resetFromJSON(n),r.restart()}(t,e,"y","Linear")}),e.manualClose=!0,e.clickOutsideClose=!0,e.destroy=!0,super(t,e),vL(t,e),t.isRexSizer&&t.layout();var i=yL(e,"touchOutsideClose",!1),s=yL(e,"anyTouchClose",!1);s&&(i=!1),s?this.once("open",this.anyTouchClose,this):i&&this.once("open",this.touchOutsideClose,this),this.requestOpen()}shutdown(t){this.isShutdown||(this.scene.input.off("pointerup",this.touchCloseCallback,this),super.shutdown(t))}touchOutsideClose(){return this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Vg(this.parent,t.worldX,t.worldY)||this.requestClose()}onOpen(){this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.parent,this),super.onClose()}}var xL={openColorPicker:function(){if(!this.colorPicker){var t=gL.call(this).layout(),e=new bL(t,{duration:{in:this.colorPickerEaseInDuration,out:this.colorPickerEaseOutDuration},transitIn:this.colorPickerTransitInCallback,transitOut:this.colorPickerTransitOutCallback,expandDirection:this.colorPickerExpandDirection,alignTargetX:this,alignTargetY:this,bounds:this.colorPickerBounds,touchOutsideClose:!0}).on("open",(function(){t.on("valuechange",(function(t){this.setValue(t)}),this)}),this).on("close",(function(){this.colorPicker=void 0,this.dropDownBehavior=void 0}),this);return this.colorPicker=t,this.dropDownBehavior=e,this.pin(t),this}}};Object.assign(xL,RD);const kL=Phaser.Utils.Objects.GetValue;class CL extends AD{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexColorInput",e.hasOwnProperty("colorPicker")||(e.colorPicker={background:{color:0}});var i=e.colorPicker,s=!1!==i&&null!==i;if(s){var r;this.setColorPickerSize(kL(i,"width",160),kL(i,"height",170));var n=kL(i,"background");r=n?function(t){return ik(t,n)}:kL(i,"createBackgroundCallback"),this.setCreateColorPickerBackgroundCallback(r),this.setColorPickerHPalettePosition(kL(i,"hPalettePosition",0)),this.setColorPickerExpandDirection(kL(i,"expandDirection")),this.setColorPickerEaseInDuration(kL(i,"easeIn",200)),this.setColorPickerEaseOutDuration(kL(i,"easeOut",200)),this.setColorPickerTransitInCallback(kL(i,"transitIn")),this.setColorPickerTransitOutCallback(kL(i,"transitOut")),this.setColorPickerBounds(kL(i,"bounds"));var a=kL(i,"space");void 0===a&&(a={left:10,right:10,top:10,bottom:10,item:8}),this.setColorPickerSpace(a)}var o=e.colorComponents;if(s&&(!1!==o&&null!==o)){this.setColorComponentsHeight(kL(o,"height",30)),this.setColorComponentsFormatLabelConfig(kL(o,"formatLabel"));var h=kL(o,"inputText");h||(h=kL(e,"inputText")),this.setColorComponentsInputTextConfig(h);var l=kL(o,"space");void 0===l&&(l={item:8}),this.setColorComponentsSpace(l)}var u=this.childrenMap.swatch;u&&s&&this.onClick(u,this.openColorPicker,this)}}Object.assign(CL.prototype,xL);var SL={name:"ColorInput",accept:t=>!!t.hasOwnProperty("view")&&"color"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.ColorInput";var s=e.colorInput;void 0===s&&(s={}),s.hasOwnProperty("inputText")||(s.inputText=e.inputText);var r=function(t,e,i){void 0===i&&(i=!0),i?e=e?y(e):{}:e||(e={});var s=new CL(t,e);return t.add.existing(s),s}(i,s);t.add(r,{proportion:1,expand:!0,key:"colorInput"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.colorInput.setValue(e)}},wL={setBoxFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.boxFillColor!==t||this.boxFillAlpha!==e,this.boxFillColor=t,this.boxFillAlpha=e,this},setUncheckedBoxFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.uncheckedBoxFillColor!==t||this.uncheckedBoxFillAlpha!==e,this.uncheckedBoxFillColor=t,this.uncheckedBoxFillAlpha=e,this},setBoxStrokeStyle(t,e,i){return void 0===i&&(i=1),this.dirty=this.dirty||this.boxLineWidth!==t||this.boxStrokeColor!==e||this.boxStrokeAlpha!==i,this.boxLineWidth=t,this.boxStrokeColor=e,this.boxStrokeAlpha=i,this},setUncheckedBoxStrokeStyle(t,e,i){return void 0===i&&(i=1),this.dirty=this.dirty||this.uncheckedBoxLineWidth!==t||this.uncheckedBoxStrokeColor!==e||this.uncheckedBoxStrokeAlpha!==i,this.uncheckedBoxLineWidth=t,this.uncheckedBoxStrokeColor=e,this.uncheckedBoxStrokeAlpha=i,this},setCheckerStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.checkerColor!==t||this.checkAlpha!==e,this.checkerColor=t,this.checkAlpha=e,this},setBoxShape(t){return void 0===t&&(t=!1),this.isCircleShape===t||(this.isCircleShape=t,this.isSizeChanged=!0,this.dirty=!0),this}},TL={setBoxSize(t){return this.dirty=this.dirty||this.boxSize!==t,this.boxSize=t,this},setCheckerSize(t){return this.dirty=this.dirty||this.checkerSize!==t,this.checkerSize=t,this}},PL={buildShapes(){this.addShape((new Vu).setName("box")).addShape((new Nu).setName("checker"))},updateShapes(){var t=this.width/2,e=this.height/2,i=Math.min(t,e),s=2*i,r=t-i,n=e-i,a=this.boxLineWidth,o=Math.max(s/10,2),h=this.getShape("box"),l=this.getShape("checker");if(this.isSizeChanged){var u=s*(1-this.boxSize)/2,c=a/2,d=s*this.boxSize-a;h.setTopLeftPosition(r+c+u,n+c+u).setSize(d,d),this.isCircleShape?h.setRadius(d/2):h.setRadius(0);u=s*(1-this.checkerSize)/2;var p=s*this.checkerSize/4,g=1*p,f=2*p,v=3*p;l.startAt(g,f).lineTo(f,v).lineTo(v,g).offset(r+u,n+u).end()}this.checked?(h.fillStyle(this.boxFillColor,this.boxFillAlpha).lineStyle(a,this.boxStrokeColor,this.boxStrokeAlpha),l.lineStyle(o,this.checkerColor)):(h.fillStyle(this.uncheckedBoxFillColor,this.uncheckedBoxFillAlpha).lineStyle(a,this.uncheckedBoxStrokeColor,this.uncheckedBoxStrokeAlpha),l.lineStyle()),this.checked&&l.setDisplayPathSegment(this.checkerAnimProgress)}},OL={setCheckerAnimationDuration(t){return void 0===t&&(t=0),this.checkerAnimDuration=t,this},playCheckerAnimation(){return void 0===this.checkerAnimProgressTask&&(this.checkerAnimProgressTask=new ul(this,{eventEmitter:null})),this.checkerAnimProgressTask.restart({key:"checkerAnimProgress",from:0,to:1,duration:this.checkerAnimDuration}),this},stopCheckerAnimation(){return void 0===this.checkerAnimProgressTask||this.checkerAnimProgressTask.stop(),this}},_L={};Object.assign(_L,wL,TL,PL,OL);const EL=23730,ML=Phaser.Utils.Objects.GetValue,DL=Phaser.Utils.Objects.IsPlainObject;class LL extends eu{constructor(t,e,i,s,r,n,a){DL(e)?(e=ML(a=e,"x",0),i=ML(a,"y",0),s=ML(a,"width",2),r=ML(a,"height",2),n=ML(a,"color",EL)):DL(n)&&(n=ML(a=n,"color",EL)),super(t,e,i,s,r),this.type="rexCheckbox",void 0===n&&(n=EL),this.setBoxShape(ML(a,"circleBox",!1)),this.setBoxFillStyle(n,ML(a,"boxFillAlpha",1)),this.setUncheckedBoxFillStyle(ML(a,"uncheckedColor",null),ML(a,"uncheckedBoxFillAlpha",1)),this.setBoxStrokeStyle(ML(a,"boxLineWidth",4),ML(a,"boxStrokeColor",n),ML(a,"boxStrokeAlpha",1)),this.setUncheckedBoxStrokeStyle(this.boxLineWidth,ML(a,"uncheckedBoxStrokeColor",this.boxStrokeColor),ML(a,"uncheckedBoxStrokeAlpha",this.boxStrokeAlpha)),this.setCheckerStyle(ML(a,"checkerColor",16777215),ML(a,"checkerAlpha",1)),this.setBoxSize(ML(a,"boxSize",1)),this.setCheckerSize(ML(a,"checkerSize",1)),this.setCheckerAnimationDuration(ML(a,"animationDuration",150)),this.buildShapes();var o=ML(a,"checked");void 0===o&&(o=ML(a,"value",!1)),this.setValue(o)}get value(){return this._value}set value(t){t=!!t,this._value!==t&&(this.dirty=!0,this._value=t,t?this.playCheckerAnimation():this.stopCheckerAnimation(),this.emit("valuechange",t))}setValue(t){return this.value=t,this}toggleValue(){return this.setValue(!this.value),this}get checked(){return this.value}set checked(t){this.value=t}setChecked(t){return void 0===t&&(t=!0),this.setValue(t),this}toggleChecked(){return this.toggleValue(),this}get checkerAnimProgress(){return this._checkerAnimProgress}set checkerAnimProgress(t){this._checkerAnimProgress!==t&&(this._checkerAnimProgress=t,this.dirty=!0)}}Object.assign(LL.prototype,_L);const AL=Phaser.Utils.Objects.GetValue,RL=Phaser.Utils.Objects.IsPlainObject;class BL extends LL{constructor(t,e,i,s,r,n,a){RL(e)?(e=AL(a=e,"x",0),i=AL(a,"y",0),s=AL(a,"width",2),r=AL(a,"height",2),n=AL(a,"color",EL)):RL(n)&&(n=AL(a=n,"color",EL)),super(t,e,i,s,r,n,a),this._click=new cf(this,AL(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(AL(a,"readOnly",!1))}get readOnly(){return!this._click.enable}set readOnly(t){this._click.enable=!t}setReadOnly(t){return void 0===t&&(t=!0),this.readOnly=t,this}}var FL={name:"CheckboxInput",accept:t=>t.hasOwnProperty("view")?"boolean"===t.view:"boolean"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.CheckboxInput";var s=e.checkbox,r=function(t,e){var i=new BL(t,e);return t.add.existing(i),i}(i,s),n=s.size;void 0!==n&&r.setSize(n,n);var a=void 0!==n?0:1;t.add(r,{proportion:0,expand:!1,fitRatio:a,key:"checkbox"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.checkbox.setValue(e)}},IL={setTrackFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.trackFillColor!==t||this.trackFillAlpha!==e,this.trackFillColor=t,this.trackFillAlpha=e,this},setFalseValueTrackFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.falseValueTrackColor!==t||this.uncheckedTrackFillAlpha!==e,this.falseValueTrackColor=t,this.falseValueTrackFillAlpha=e,this},setThumbStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.thumbColor!==t||this.checkAlpha!==e,this.thumbColor=t,this.thumbAlpha=e,this}},jL={setTrackSize(t,e){return this.dirty=this.dirty||this.trackWidth!==t||this.trackHeight!==e,this.trackWidth=t,this.trackHeight=e,this},setTrackRadius(t){return this.dirty=this.dirty||this.trackRadius!==t,this.trackRadius=t,this},setThumbSize(t,e){return void 0===e&&(e=t),this.dirty=this.dirty||this.thumbWidth!==t||this.thumbHeight!==e,this.thumbWidth=t,this.thumbHeight=e,this},setThumbRadius(t){return this.dirty=this.dirty||this.thumbRadius!==t,this.thumbRadius=t,this}},zL={setThumbPosition(t,e){return void 0===e&&(e=1-t),this.thumbLeftX=t,this.thumbRightX=e,this},setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}},NL=function(t,e,i){return(e-t)*i+t};const GL=Phaser.Math.Linear;var WL={buildShapes(){this.addShape((new Vu).setName("track")).addShape((new Vu).setName("thumb"))},updateShapes(){var t=this.width,e=this.height,i=this.value?this.toggleAnimProgress:1-this.toggleAnimProgress,s=this.getShape("track");if(this.isSizeChanged){var r=t*this.trackWidth,n=e*this.trackHeight,a=(t-r)/2,o=(e-n)/2,h=e*this.trackRadius;s.setTopLeftPosition(a,o).setSize(r,n).setRadius(h)}var l,u,c,d=(l=this.falseValueTrackColor,u=this.trackFillColor,c=i,(255&NL(yr(l),yr(u),c))<<16|(255&NL(br(l),br(u),c))<<8|255&NL(xr(l),xr(u),c)),p=GL(this.falseValueTrackFillAlpha,this.trackFillAlpha,i);s.fillStyle(d,p);var g=this.getShape("thumb");if(this.isSizeChanged){var f=t*this.thumbWidth,v=e*this.thumbHeight,m=e*this.thumbRadius;g.setSize(f,v).setRadius(m)}var y=GL(this.thumbLeftX,this.thumbRightX,i)*t;this.rtl&&(y=t-y);var b=e/2;g.setCenterPosition(y,b),g.fillStyle(this.thumbColor,this.thumbAlpha)}},VL={setToggleAnimationDuration(t){return void 0===t&&(t=0),this.toggleAnimDuration=t,this},playToggleAnimation(){return void 0===this.toggleAnimProgressTask&&(this.toggleAnimProgressTask=new ul(this,{eventEmitter:null})),this.toggleAnimProgressTask.restart({key:"toggleAnimProgress",from:0,to:1,duration:this.toggleAnimDuration}),this},stopToggleAnimation(){return void 0===this.toggleAnimProgressTask||this.toggleAnimProgressTask.stop(),this}},YL={};Object.assign(YL,IL,jL,zL,WL,VL);const XL=Phaser.Utils.Objects.GetValue,HL=Phaser.Utils.Objects.IsPlainObject,$L=23730;class UL extends eu{constructor(t,e,i,s,r,n,a){HL(e)?(e=XL(a=e,"x",0),i=XL(a,"y",0),s=XL(a,"width",2),r=XL(a,"height",2),n=XL(a,"color",$L)):HL(n)&&(n=XL(a=n,"color",$L)),super(t,e,i,s,r),this.type="rexToggleSwitch",void 0===n&&(n=$L),this.setTrackFillStyle(n,XL(a,"trackFillAlpha",1)),this.setFalseValueTrackFillStyle(XL(a,"falseValueTrackColor",function(t){var e=.3*yr(t)+.59*br(t)+.11*xr(t);return(255&e)<<16|(255&e)<<8|255&e}(n)),XL(a,"falseValueTrackFillAlpha",1)),this.setThumbStyle(XL(a,"thumbColor",16777215),XL(a,"thumbAlpha",1)),this.setTrackSize(XL(a,"trackWidth",.9),XL(a,"trackHeight",.5)),this.setTrackRadius(XL(a,"trackRadius",.5*this.trackHeight));var o=XL(a,"thumbHeight",void 0),h=XL(a,"thumbWidth",o);void 0===h&&(h=.9*this.trackHeight),this.setThumbSize(h,o),this.setThumbRadius(XL(a,"thumbRadius",.5*this.thumbHeight)),this.setThumbPosition(XL(a,"thumbLeft",.3),XL(a,"thumbRight",void 0)),this.setRTL(XL(a,"rtl",!1)),this.setToggleAnimationDuration(XL(a,"animationDuration",150)),this.buildShapes(),this.setValue(XL(a,"value",!1),0)}get value(){return this._value}set value(t){t=!!t,this._value!==t&&(this.dirty=!0,this._value=t,this.playToggleAnimation(),this.emit("valuechange",t))}setValue(t,e){void 0===e&&(e=this.toggleAnimDuration);var i=this.toggleAnimDuration;return this.toggleAnimDuration=e,this.value=t,this.toggleAnimDuration=i,this}toggleValue(t){return this.setValue(!this.value,t),this}get toggleAnimProgress(){return this._toggleAnimProgress}set toggleAnimProgress(t){this._toggleAnimProgress!==t&&(this._toggleAnimProgress=t,this.dirty=!0)}}Object.assign(UL.prototype,YL);const KL=Phaser.Utils.Objects.GetValue;class qL extends UL{constructor(t,e,i,s,r,n,a){super(t,e,i,s,r,n,a),this._click=new cf(this,KL(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(KL(a,"readOnly",!1))}get readOnly(){return!this._click.enable}set readOnly(t){this._click.enable=!t}setReadOnly(t){return void 0===t&&(t=!0),this.readOnly=t,this}}var JL={name:"ToggleSwitchInput",accept:t=>!!t.hasOwnProperty("view")&&"toggleSwitch"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.ToggleSwitchInput";var s=e.toggleSwitch,r=function(t,e){var i=new qL(t,e);return t.add.existing(i),i}(i,s),n=s.size;void 0!==n&&r.setSize(n,n);var a=void 0!==n?0:1;t.addSpace().add(r,{proportion:0,expand:!1,fitRatio:a,key:"toggleSwitch"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.toggleSwitch.setValue(e)}},ZL={setWrapEnable(t){return void 0===t&&(t=!0),this.listWrapEnable=t,this},setCreateButtonCallback(t){return this.listCreateButtonCallback=t,this},setCreateListBackgroundCallback(t){return this.listCreateBackgroundCallback=t,this},setCreateListSliderTrackCallback(t){return this.listCreateSliderTrackCallback=t,this},setCreateListSliderThumbCallback(t){return this.listCreateSliderThumbCallback=t,this},setListSliderAdaptThumbSizeEnable(t){return void 0===t&&(t=!0),this.listSliderAdaptThumbSizeEnable=t,this},setListScrollerConfig(t){return void 0===t&&(t={}),this.listScrollerConfig=t,this},setListMouseWheelScrollerConfig(t){return this.listMouseWheelScrollerConfig=t,this},setButtonClickCallback(t){return this.listOnButtonClick=t,this},setButtonOverCallback(t){return this.listOnButtonOver=t,this},setButtonOutCallback(t){return this.listOnButtonOut=t,this},setListExpandDirection(t){return"string"==typeof t&&(t=QL[t]),this.listExpandDirection=t,this},setListEaseInDuration(t){return void 0===t&&(t=0),this.listEaseInDuration=t,this},setListEaseOutDuration(t){return void 0===t&&(t=0),this.listEaseOutDuration=t,this},setListTransitInCallback(t){return this.listTransitInCallback=t,this},settListTransitOutCallback(t){return this.listTransitOutCallback=t,this},setListBounds(t){return this.listBounds=t,this},setListWidth(t){return this.listWidth=t,this},setListHeight(t){return this.listHeight=t,this},setListSize(t,e){return this.setListWidth(t).setListHeight(e),this},setListMaxHeight(t){return this.listMaxHeight=t,this},setListAlignmentMode(t){return this.listAlignMode=t,this},setListAlignmentSide(t){return void 0===t&&(t=""),this.listAlignSide=t,this},setListSpace(t){return void 0===t&&(t={}),this.listSpace=t,this},setListDraggable(t){return void 0===t&&(t=!0),this.listDraggable=t,this}};const QL={down:0,up:1},tA=Phaser.Utils.Objects.GetValue;var eA=function(){var t,e=this.scene,i=this.listCreateBackgroundCallback;i&&(t=i.call(this,e),e.add.existing(t));var s=[],r=this.listCreateButtonCallback;if(r)for(var n=this.options,a=0,o=n.length;a0||this.listMaxHeight>0)){s=iA(e,d,this.listWrapEnable);if(this.listMaxHeight>0&&(s.layout(),s.height<=this.listMaxHeight&&(u=s)),!u){0===c&&(c=this.listMaxHeight);var p=sA(e,this.listCreateSliderTrackCallback),g=sA(e,this.listCreateSliderThumbCallback);u=new RM(e,{height:c,scrollMode:0,panel:{child:s,mask:{padding:1}},slider:{track:p,thumb:g,adaptThumbSize:this.listSliderAdaptThumbSizeEnable},scrollDetectionMode:1,scroller:this.listScrollerConfig,mouseWheelScroller:this.listMouseWheelScrollerConfig,space:{panel:tA(this.listSpace,"panel",0)}}),e.add.existing(u)}}else d.height=c,s=iA(e,d,this.listWrapEnable),u=s;return t&&u.addBackground(t,"background"),this.listDraggable&&u.setDraggable(!0),u!==s&&s.on("button.over",(function(t,e,i,s){u.emit("button.over",t,e,i,s)})).on("button.out",(function(t,e,i,s){u.emit("button.out",t,e,i,s)})).on("button.click",(function(t,e,i,s){u.emit("button.click",t,e,i,s)})),u},iA=function(t,e,i){var s;return i?(e.orientation="x",s=new hO(t,e)):(e.orientation="y",s=new BP(t,e)),t.add.existing(s),s},sA=function(t,e,i){var s;return e&&(s=e.call(i,t),t.add.existing(s)),s},rA={focusNextButton(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;void 0===e?t=0:t=(e+1)%this.listPanel.getButtons().length;return this.emitButtonOver(t),this},focusPrevButton(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;if(void 0===e)t=0;else{var i=this.listPanel.getButtons().length;t=(e-1+i)%i}return this.emitButtonOver(t),this}},nA={openListPanel:function(){if(this.listPanel)return this;if(0===this.options.length)return this;var t,e=eA.call(this);e.on("button.over",(function(t,i,s,r){this.currentOverIndex=i,this.listOnButtonOver&&this.listOnButtonOver.call(this,t,i,s,r),this.emit("button.over",this,e,t,i,s,r)}),this).on("button.out",(function(t,i,s,r){this.currentOverIndex===i&&(this.currentOverIndex=void 0),this.listOnButtonOut&&this.listOnButtonOut.call(this,t,i,s,r),this.emit("button.out",this,e,t,i,s,r)}),this),t=this.listAlignMode&&"label"!==this.listAlignMode?this.getElement(this.listAlignMode):this;var i=new bL(e,{duration:{in:this.listEaseInDuration,out:this.listEaseOutDuration},transitIn:this.listTransitInCallback,transitOut:this.listTransitOutCallback,expandDirection:this.listExpandDirection,alignTargetX:t,alignTargetY:this,alignSide:this.listAlignSide,bounds:this.listBounds}).on("open",(function(){e.on("button.click",(function(t,i,s,r){this.listOnButtonClick&&this.listOnButtonClick.call(this,t,i,s,r),this.emit("button.click",this,e,t,i,s,r),this.dropDownBehavior.requestClose()}),this),this.emit("list.open",this,e)}),this).on("close",(function(){this.listPanel=void 0,this.dropDownBehavior=void 0,this.emit("list.close",this)}),this);return e.onClickOutside((function(){i.requestClose()})),this.listPanel=e,this.dropDownBehavior=i,this.pin(e),this},closeListPanel:function(){return this.dropDownBehavior?(this.dropDownBehavior.requestClose(),this.currentOverIndex=void 0,this):this},toggleListPanel:function(){return this.listPanel?this.closeListPanel():this.openListPanel(),this},emitButtonClick:function(t){if(void 0===t&&(t=this.currentOverIndex),void 0===t)return this;var e=this.listPanel,i=e?e.getButton(t):this.options[t];return this.listOnButtonClick&&this.listOnButtonClick.call(this,i,t),this.emit("button.click",this,e,i,t),this},emitButtonOver:function(t){var e=this.listPanel;return e?(e.emitButtonOver(t),this):this}};Object.assign(nA,ZL,rA);const aA=Phaser.Utils.Objects.GetValue;class oA extends GC{constructor(t,e){super(t,e),this.type="rexDropDownList",this.timer=void 0,this.listPanel=void 0,this.currentOverIndex=void 0,this.setOptions(aA(e,"options"));var i=aA(e,"list");this.setWrapEnable(aA(i,"wrap",!1)),this.setCreateButtonCallback(aA(i,"createButtonCallback")),this.setCreateListBackgroundCallback(aA(i,"createBackgroundCallback")),this.setCreateListSliderTrackCallback(aA(i,"createTrackCallback")),this.setCreateListSliderThumbCallback(aA(i,"createThumbCallback")),this.setListSliderAdaptThumbSizeEnable(aA(i,"sliderAdaptThumbSize",!1)),this.setListScrollerConfig(aA(i,"scroller")),this.setListMouseWheelScrollerConfig(aA(i,"mouseWheelScroller")),this.setButtonClickCallback(aA(i,"onButtonClick")),this.setButtonOverCallback(aA(i,"onButtonOver")),this.setButtonOutCallback(aA(i,"onButtonOut")),this.setListExpandDirection(aA(i,"expandDirection")),this.setListEaseInDuration(aA(i,"easeIn",500)),this.setListEaseOutDuration(aA(i,"easeOut",100)),this.setListTransitInCallback(aA(i,"transitIn")),this.settListTransitOutCallback(aA(i,"transitOut")),this.setListMaxHeight(aA(i,"maxHeight",0)),this.setListSize(aA(i,"width"),aA(i,"height",0)),this.setListAlignmentMode(aA(i,"alignParent","text")),this.setListAlignmentSide(aA(i,"alignSide","")),this.setListBounds(aA(i,"bounds")),this.setListSpace(aA(i,"space")),this.setListDraggable(aA(i,"draggable",!1)),this.setValueChangeCallback(aA(e,"setValueCallback"),aA(e,"setValueCallbackScope")),this.setValue(aA(e,"value")),this.onClick(this.toggleListPanel,this)}destroy(t){this.scene&&!this.ignoreDestroy&&(this.listPanel&&(this.listPanel.destroy(t),this.listPanel=void 0),super.destroy(t))}get isOpened(){return!!this.listPanel}setOptions(t){return void 0===t&&(t=[]),this.options=t,this}setValueChangeCallback(t,e){return this.valueChangeCallback=t,this.valueChangeCallbackScope=e,this}setValue(t){return this.value=t,this}get value(){return this._value}set value(t){if(this._value!==t){var e=this._value;this._value=t;var i=this.valueChangeCallback,s=this.valueChangeCallbackScope;i&&(s?i.call(s,this,t,e):i(this,t,e)),this.emit("valuechange",this,t,e)}}}Object.assign(oA.prototype,nA);var hA=function(t,e){e=function(t,e,i){void 0===i&&(i={});var s=(e=e?y(e):{}).label||e.button,r=e.button||e.label;delete e.label,delete e.button;var n=i.label||i.button||i,a=i.button||i.label||i,o=Fw(t,s,n);o.list=e.list||{},o.list.createButtonCallback=function(t,e){var i=TO(t,r,a).resetDisplayContent(e);return e.hasOwnProperty("value")&&(i.value=e.value),i};var h=e.track;h&&(o.list.createTrackCallback=function(t){return ik(t,h)},delete e.track);var l=e.thumb;return l&&(o.list.createThumbCallback=function(t){return ik(t,l)},delete e.thumb),o.list.onButtonOver=function(t,e,i,s){t.setHoverState&&t.setHoverState(!0)},o.list.onButtonOut=function(t,e,i,s){t.setHoverState&&t.setHoverState(!1)},o}(t,e);var i=new oA(t,e);return t.add.existing(i),i},lA=function(t,e){for(var i=0,s=t.length;it.hasOwnProperty("view")?"list"===t.view:t.hasOwnProperty("options"),build(t,e){var i=t.scene;t.type="rexTweaker.ListInput";var s=hA(i,e.list);t.add(s,{proportion:1,expand:!0,key:"list"}),s.on("button.click",(function(e,i,s,r,n,a){t.setValue(s.value)}))},setup(t,e,i){(i||e.hasOwnProperty("options"))&&function(t,e){t.childrenMap.list.setOptions(e)}(t,e.options)},displayValue(t,e){var i=t.childrenMap.list,s=function(t,e){var i=lA(t,e);if(null!=i)return t[i]}(i.options,e);i.resetDisplayContent(s).setMinSize(i.width,i.height).layout().setMinSize(0,0)}};const cA=Phaser.Utils.Objects.GetValue;var dA={name:"ButtonsInput",accept:t=>!!t.hasOwnProperty("view")&&"buttons"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.ButtonsInput";var s=e.button?y(e.button):{},r=cA(s,"expand",!0);r&&(s.align="center"),delete s.expand;var n=yD(i,{expand:r});n.buttonConfig=s,t.add(n,{proportion:1,expand:!0,key:"list"}),n.on("button.click",(function(e,i,s,r){var a=n.options[i];a&&(t._selectedIndex=i,t.setValue(a.value),t._selectedIndex=void 0)}))},setup(t,e,i){(i||e.hasOwnProperty("options"))&&function(t,e){var i=t.childrenMap.list;i.options=e;var s=t.scene,r=i.buttonConfig;i.clearButtons(!0);for(var n=0,a=e.length;n0?r.addScrollable():r).addRows(s,i,!0),r}(t,e,i,s)}}var vA={csv2md:function(t,e={}){"string"==typeof e&&(e={title:e});for(var i,s,r,{title:n}=e,a=lr.parse(t).data,o=!1,h=!1,l=[],u=0,c=a.length;uh;u--){for(c=0;c0&&this.wrapMode!==Bm&&0===this.wrapWidth}setStyle(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wordWrap")){var s=t.wordWrap;s.hasOwnProperty("width")&&(t.wrap={mode:"word",width:s.width})}if(t&&t.hasOwnProperty("wrap")){var r=t.wrap;if(r.hasOwnProperty("mode")){var n=r.mode;"string"==typeof n&&(r.mode=zm[n])}else r.hasOwnProperty("width")&&(r.mode=1)}t&&t.rtl&&i&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var a=this.propertyMap;for(var o in a){var h=a[o],l=h[0],u=i?h[1]:this[o],c=h[2];if("wrapCallback"===o||"wrapCallbackScope"===o)this[o]=mk(t,l,u);else{var d=vk(t,l,u);c&&(d=c(d)),this[o]=d}}var p=mk(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var g=mk(t,"fill",null);null!==g&&(this.color=xy(g));var f=mk(t,"metrics",!1);return f?this.metrics={ascent:mk(f,"ascent",0),descent:mk(f,"descent",0),fontSize:mk(f,"fontSize",0)}:!e&&this.metrics||(this.metrics=fk(this)),e?this.parent.updateText():this.parent}syncFont(t,e){e.font=this._font}syncStyle(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"}syncShadow(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)}update(t){return t&&(this._font=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim(),this.metrics=fk(this)),this.parent.updateText(t)}buildFont(){var t=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim();return t!==this._font&&(this._font=t),this}setFont(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=mk(t,"fontFamily","Courier"),this.fontSize=mk(t,"fontSize","16px"),this.fontStyle=mk(t,"fontStyle","")),this.update(!0)}setFontFamily(t){return this.fontFamily=t,this.update(!0)}setFontStyle(t){return this.fontStyle=t,this.update(!0)}setFontSize(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}setTestString(t){return this.testString=t,this.update(!0)}setFixedSize(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}setResolution(t){return this.resolution=t,this.update(!1)}setXOffset(t){return this.xOffset=t,this.update(!1)}setBackgroundColor(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=xy(t,this.parent.canvas,this.parent.context),this.backgroundColor2=xy(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=xy(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}setBackgroundCornerRadius(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}setFill(t){return this.color=xy(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=xy(t,this.parent.canvas,this.parent.context),this.update(!1)}setStroke(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=xy(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}setShadow(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===n&&(n=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=xy(i,this.parent.canvas,this.parent.context),this.shadowBlur=s,this.shadowStroke=r,this.shadowFill=n,this.update(!1)}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}setShadowColor(t){return void 0===t&&(t="#000"),this.shadowColor=xy(t,this.parent.canvas,this.parent.context),this.update(!1)}setShadowBlur(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}setShadowStroke(t){return this.shadowStroke=t,this.update(!1)}setShadowFill(t){return this.shadowFill=t,this.update(!1)}setUnderline(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=xy(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}setUnderlineColor(t){return void 0===t&&(t="#000"),this.underlineColor=xy(t,this.parent.canvas,this.parent.context),this.update(!1)}setUnderlineThickness(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}setUnderlineOffset(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}setStrikethrough(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=xy(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}setStrikethroughColor(t){return void 0===t&&(t="#000"),this.strikethroughColor=xy(t,this.parent.canvas,this.parent.context),this.update(!1)}setStrikethroughThickness(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}setStrikethroughOffset(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}setWrapMode(t){return"string"==typeof t&&(t=zm[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}setWrapWidth(t){return this.wrapWidth=t,this.update(!1)}setAlign(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}setHAlign(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}setVAlign(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}setMaxLines(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}getTextMetrics(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}setTextMetrics(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=mk(e,"fontFamily",this.fontFamily),this.fontSize=mk(e,"fontSize",this.fontSize),this.fontStyle=mk(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}get lineHeight(){return this.metrics.fontSize+this.parent.lineSpacing}toJSON(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}destroy(){this.parent=void 0}}var bk={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var a=this.defaultStyle;this.clear(),Ly(this,a.backgroundColor,a.backgroundStrokeColor,a.backgroundStrokeLineWidth,a.backgroundCornerRadius,a.backgroundColor2,a.backgroundHorizontalGradient,a.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var o,h,l,u,c,d,p=a.halign,g=a.valign,f=a.lineHeight,v=r.lines,m=v.length,y=a.maxLines;y>0&&m>y?(h=y,l="center"===g?Math.floor((m-h)/2):"bottom"===g?m-h:0):(h=m,l=0),u=l+h;var b=this.rtl,x=b?this.parent.width:void 0;d="center"===g?Math.max((s-h*f)/2,0):"bottom"===g?Math.max(s-h*f-2,0):0,d+=e;for(var k=l;k0){var o=this.defaultStyle.metrics,h=i-o.ascent,l=o.fontSize;this.drawRectangle(e,h,t.width,l,a.bgcolor,a)}if(a.underlineThickness>0&&t.width>0){var u=i+a.underlineOffset-a.underlineThickness/2;this.drawLine(e,u,t.width,a.underlineThickness,a.underlineColor,a)}if(t.isTextPen&&(a.buildFont(),a.syncFont(r,n),a.syncStyle(r,n),this.drawText(e,i,t.text,a)),t.isImagePen&&this.drawImage(e,i,t.prop.img,t.prop.color,a),a.strikethroughThickness>0&&t.width>0){u=i+a.strikethroughOffset-a.strikethroughThickness/2;this.drawLine(e,u,t.width,a.strikethroughThickness,a.strikethroughColor,a)}if(n.restore(),t.hasAreaMarker&&t.width>0){var c,d=t.prop.area;if(d)c={key:d};else{var p=t.prop.url;c={key:`url:${p}`,url:p}}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,c)}},clear(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawRectangle(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;a.fillStyle=r,a.fillRect(t,e,i,s)},drawLine(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;n.syncShadow(a,n.shadowStroke);var o=a.lineCap;a.lineCap="butt",a.strokeStyle=r,a.lineWidth=s,a.beginPath(),a.moveTo(t,e),a.lineTo(t+i,e),a.stroke(),a.lineCap=o},drawText(t,e,i,s){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;s.stroke&&"none"!==s.stroke&&s.strokeThickness>0&&(s.syncShadow(r,s.shadowStroke),r.strokeText(i,t,e)),s.color&&"none"!==s.color&&(s.syncShadow(r,s.shadowFill),r.fillText(i,t,e))},drawImage(t,e,i,s,r){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,s,this.autoRound)}};const xk=Phaser.Utils.Objects.GetValue,kk=Lm,Ck=Am;class Sk{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=xk(t,"text",""),this.x=xk(t,"x",0),this.y=xk(t,"y",0),this.width=xk(t,"width",0);var e=xk(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=xk(t,"newLineMode",0),this.startIndex=xk(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===Ck&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==kk&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===Ck&&(t+=1),t}get endIndex(){return this.startIndex+this.rawTextLength}get lastX(){return this.x+this.width}get isTextPen(){return""!==this.text}get isImagePen(){return!!this.prop.img}get hasAreaMarker(){return!!this.prop.area||!!this.prop.url}}const wk=Phaser.Utils.Objects.GetFastValue,Tk=Lm,Pk=Rm;class Ok{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=wk(t,"tagToText",yd),this.tagToTextScope=wk(t,"tagToTextScope",void 0)}destroy(){this.clear(),this.tagToText=void 0,this.tagToTextScope=void 0}clear(){for(var t=0,e=this.lines.length;t=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}getLineEndIndex(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,s=!1;for(e=t;e>=0&&!(s=null!=(i=this.lines[e])&&i.length>0);e--);return s?i[i.length-1].endIndex:0}getLineWidth(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}getMaxLineWidth(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,s=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}getLineWidths(){for(var t=[],e=0,i=this.lines.length;e=t&&h<=e||(a=a.substring(t-o,e-o)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,a,l,u):c+=this.tagToText(a,l,u),u=l,!(h>=e)));d++);return c}get length(){return this.lines.length}set length(t){this.clear()}}var _k={};const Ek=Phaser.Geom.Rectangle;var Mk=new Ra;class Dk{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&Xk(f)){""!==b?a.push(n.getLine(b,x,jk)):0===k&&r>0&&a.push(n.getLine("",0,jk)),a.push(...Vk(f,e,Gk,s,0,n));var S=a.pop();b=S.text,x=S.width,n.freeLine(S)," "===b&&(b="",x=0)}else(m=x+v)>h?(a.push(n.getLine(b,x,jk)),b=f,x=v,h=s):(b+=f,x=m),k===C-1&&a.push(n.getLine(b,x,l))}return a},Yk=function(t,e){var i;switch(e){case Nk:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==$k&&i0&&t>e&&(t=e),t}get linesWidth(){return Math.ceil(this.penManager.getMaxLineWidth())}get linesHeight(){var t=this.displayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}get imageManager(){return this.parent.imageManager}get rtl(){return this.parent.style.rtl}newPenManager(){return new Ok({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}get tmpPenManager(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}getPlainText(t,e,i){var s;if(null==t)s=this.penManager.plainText;else{var r=this.parser.splitText(t,1);s="";for(var n=0,a=r.length;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return eS(this.sizerChildren,null),om.call(this,t),this}},sS={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)eS(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},oS={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,o=this.sizerChildren,h=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=vp.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,eS(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)eS(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},lS=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const uS=Phaser.Utils.Objects.IsPlainObject,cS=Phaser.Utils.Objects.GetValue;class dS extends $v{constructor(t,e,i,s,r,n,a,o,h,l){uS(e)?(e=cS(l=e,"x",0),i=cS(l,"y",0),s=cS(l,"width",void 0),r=cS(l,"height",void 0),n=cS(l,"column",l.col||0),a=cS(l,"row",0),o=cS(l,"columnProportions",0),h=cS(l,"rowProportions",0)):uS(s)?(s=cS(l=s,"width",void 0),r=cS(l,"height",void 0),n=cS(l,"column",l.col||0),a=cS(l,"row",0),o=cS(l,"columnProportions",0),h=cS(l,"rowProportions",0)):uS(n)?(n=cS(l=n,"column",l.col||0),a=cS(l,"row",0),o=cS(l,"columnProportions",0),h=cS(l,"rowProportions",0)):uS(o)&&(o=cS(l=o,"columnProportions",0),h=cS(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(cS(l,"createCellContainerCallback")),this.setIndentLeft(cS(l,"space.indentLeftOdd",0),cS(l,"space.indentLeftEven",0)),this.setIndentTop(cS(l,"space.indentTopOdd",0),cS(l,"space.indentTopEven",0)),this.resetGrid(n,a,o,h,cS(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=hS.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=lS.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(dS.prototype,oS);const pS=Phaser.Utils.Objects.GetValue;const gS=Phaser.Math.Percent;var fS=function(t,e,i){var s;return t.y===e.y?s=gS(i.x,t.x,e.x):t.x===e.x&&(s=gS(i.y,t.y,e.y)),s},vS=function(t,e,i){var s,r;this.enable&&(mS.x=e,mS.y=i,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint()),this.value=fS(s,r,mS))},mS={},yS=function(t,e,i){if(this.enable&&t.isDown){var s,r;bS.x=t.worldX,bS.y=t.worldY,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint());var n=fS(s,r,bS);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-n)<.1?this.value=n:this.easeValueTo(n)}},bS={},xS=function(t,e){void 0===e&&(e=kS);var i=this.childrenMap.thumb,s=i.x,r=i.y;return Wd(i,this.innerLeft,this.innerTop,this.innerWidth,this.innerHeight,t),e.x=i.x,e.y=i.y,i.x=s,i.y=r,e},kS={};const CS=Phaser.Display.Align.LEFT_CENTER,SS=Phaser.Display.Align.TOP_CENTER;var wS={};const TS=Phaser.Display.Align.RIGHT_CENTER,PS=Phaser.Display.Align.BOTTOM_CENTER;var OS={};const _S=Phaser.Math.Linear;var ES={};const MS=Phaser.Display.Align.LEFT_CENTER,DS=Phaser.Display.Align.TOP_CENTER,LS=Phaser.Display.Align.RIGHT_CENTER,AS=Phaser.Display.Align.BOTTOM_CENTER;const RS=Phaser.Utils.Objects.GetValue,BS=Phaser.Utils.Objects.IsPlainObject,FS=Phaser.Math.Clamp,IS=Phaser.Math.Snap.To;class jS extends(dc(xm)){constructor(t,e){super(t,e),this.type="rexSlider",this.bootProgressBase(e),this.reverseAxis=RS(e,"reverseAxis",!1);var i=RS(e,"background",void 0),s=RS(e,"track",void 0),r=RS(e,"indicator",void 0),n=RS(e,"thumb",void 0);if(i&&(BS(i)&&(i=sk(t,i)),this.addBackground(i)),s&&(BS(s)&&(s=sk(t,s)),this.add(s,{proportion:1,expand:!0,minWidth:0===this.orientation?0:void 0,minHeight:1===this.orientation?0:void 0})),r&&(BS(r)&&(r=sk(t,r)),this.pin(r)),n){BS(n)&&(n=sk(t,n)),this.pin(n);var a=RS(e,"thumbOffsetX",0),o=RS(e,"thumbOffsetY",0);this.setThumbOffset(a,o)}var h=RS(e,"input",0);switch("string"==typeof h&&(h=zS[h]),h){case 0:n&&(n.setInteractive(),this.scene.input.setDraggable(n),n.on("drag",vS,this).on("dragstart",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("dragend",(function(t){this.eventEmitter.emit("inputend",t)}),this));break;case 1:this.on("pointerdown",yS,this).on("pointermove",yS,this).on("pointerdown",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("pointerup",(function(t){this.eventEmitter.emit("inputend",t)}),this).on("pointerover",(function(t){t.isDown&&this.eventEmitter.emit("inputstart",t)}),this).on("pointerout",(function(t){t.isDown&&this.eventEmitter.emit("inputend",t)}),this).setInteractive()}this.addChildrenMap("background",i),this.addChildrenMap("track",s),this.addChildrenMap("indicator",r),this.addChildrenMap("thumb",n),this.setEnable(RS(e,"enable",void 0));var l=RS(e,"tick",void 0);void 0===l&&(l=RS(e,"gap",void 0)),this.setGap(l),this.setValue(RS(e,"value",0),RS(e,"min",void 0),RS(e,"max",void 0))}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setGap(t,e,i){return t&&void 0!==e&&(t/=i-e),this.gap=t,this}setTick(t,e,i){return this.setGap(t,e,i),this}get tick(){return this.gap}set tick(t){this.gap=t}setThumbOffset(t,e){return this.thumbOffsetX=t,this.thumbOffsetY=e,this}get value(){return this._value}set value(t){void 0!==this.gap&&(t=IS(t,this.gap));var e=this._value;this._value=FS(t,0,1),e!==this._value&&(this.updateThumb(this._value),this.updateIndicator(this._value),this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter))}postLayout(t,e,i){return this.updateThumb(),this.updateIndicator(),super.postLayout(t,e,i),this}}const zS={pan:0,drag:0,click:1,none:-1};var NS={getStartPoint:function(t){if(void 0===t&&(t=wS),this.childrenMap.thumb){var e=0===this.orientation?CS:SS;xS.call(this,e,t)}else 0===this.orientation?(t.x=this.innerLeft+1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerTop+1);return t},getEndPoint:function(t){if(void 0===t&&(t=OS),this.childrenMap.thumb){var e=0===this.orientation?TS:PS;xS.call(this,e,t)}else 0===this.orientation?(t.x=this.innerRight-1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerBottom-1);return t},updateThumb:function(t){var e,i,s=this.childrenMap.thumb;return void 0===s||(void 0===t&&(t=this.value),this.reverseAxis?(e=this.getEndPoint(),i=this.getStartPoint()):(e=this.getStartPoint(),i=this.getEndPoint()),function(t,e,i,s){void 0===s&&(s=ES),s.x=_S(e.x,i.x,t),s.y=_S(e.y,i.y,t)}(t,e,i,s),s.x+=this.thumbOffsetX,s.y+=this.thumbOffsetY,this.resetChildPositionState(s)),this},updateIndicator:function(t){var e=this.childrenMap.indicator;if(void 0===e)return this;void 0===t&&(t=this.value);var i,s,r,n=this.reverseAxis,a=this.childrenMap.thumb;if(a)if(0===this.orientation){var o=zr(a);if(n){h=a.x-o*a.originX;i=this.right-h}else{var h;i=(h=a.x-o*a.originX)+o-this.left}}else{var l=Nr(a);if(n){u=a.y-l*a.originY;s=this.bottom-u}else{var u;s=(u=a.y-l*a.originY)+l-this.top}}else 0===this.orientation?i=this.width*t:s=this.height*t;Sp(e,i,s),r=n?0===this.orientation?LS:AS:0===this.orientation?MS:DS,Gd(e,this,r),this.resetChildPositionState(e)}};Object.assign(jS.prototype,NS);const GS=Phaser.Utils.Objects.GetValue;class WS extends xm{constructor(t,e){super(t,e),this.type="rexScrollBar";var i,s=GS(e,"background",void 0),r=GS(e,"buttons",void 0),n=GS(r,"top",GS(r,"left",void 0)),a=GS(r,"bottom",GS(r,"right",void 0)),o=GS(e,"slider",void 0);(s&&this.addBackground(s),n)&&(this.add(n),new wf(n).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?this.scrollStep:-this.scrollStep;this.value+=t}}),this));if(o){var h;if(o.orientation=this.orientation,o.eventEmitter=this,o.value=null,0===this.orientation)h=void 0===GS(o,"width",void 0)?1:0;else h=void 0===GS(o,"height",void 0)?1:0;i=new jS(t,o),t.add.existing(i),this.add(i,{proportion:h})}a&&(this.add(a),new wf(a).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?-this.scrollStep:this.scrollStep;this.value+=t}}),this));var l=[n,a];this.addChildrenMap("background",s),this.addChildrenMap("slider",i),this.addChildrenMap("buttons",l);var u=GS(e,"valuechangeCallback",null);if(null!==u){var c=GS(e,"valuechangeCallbackScope",void 0);this.on("valuechange",u,c)}this.setEnable(GS(e,"enable",void 0)),this.setValue(GS(e,"value",0)),this.setScrollStep(GS(r,"step",.01))}setScrollStep(t){return this.scrollStep=t,this}get enable(){return!!this.childrenMap.slider&&this.childrenMap.slider.enable}set enable(t){this.childrenMap.slider&&this.childrenMap.slider.setEnable(t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get value(){return this.childrenMap.slider?this.childrenMap.slider.value:0}set value(t){this.childrenMap.slider&&(this.childrenMap.slider.value=t)}setValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setValue(t,e,i),this}addValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.addValue(t,e,i),this}getValue(t,e){return this.childrenMap.slider?this.childrenMap.slider.getValue(t,e):0}easeValueTo(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.easeValueTo(t,e,i),this}stopEaseValue(){return this.childrenMap.slider&&this.childrenMap.slider.stopEaseValue(),this}setEaseValueDuration(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueDuration(t),this}setEaseValueFunction(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueFunction(t),this}setGap(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setGap(t,e,i),this}get gap(){if(this.childrenMap.slider)return this.childrenMap.slider.gap}set gap(t){this.childrenMap.slider&&(this.childrenMap.slider.gap=t)}setTick(t,e,i){return this.setGap(t,e,i),this}get tick(){if(this.childrenMap.slider)return this.childrenMap.slider.tick}set tick(t){this.childrenMap.slider&&(this.childrenMap.slider.tick=t)}}class VS extends Tg{constructor(t,e){super(e),this.parent=t,this.init()}init(){this.start("IDLE")}next_IDLE(){var t,e=this.parent;return e.dragState.isDown&&(t=0===e.dragThreshold?"DRAG":"DRAGBEGIN"),t}update_IDLE(t,e){this.next()}next_DRAGBEGIN(){var t=this.parent,e=t.dragState;return e.isDown?e.pointer.getDistance()>=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const YS=Phaser.Utils.Objects.GetValue,XS=Phaser.Math.Distance.Between;class HS extends Nn{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=YS(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(YS(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(YS(t,"enable",!0)),this.holdThreshold=YS(t,"holdThreshold",50),this.pointerOutReleaseEnable=YS(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return sv(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:XS(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!tf(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!tf(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const $S=Phaser.Utils.Objects.GetValue;class US{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue($S(t,"value",0)),this.setSpeed($S(t,"speed",0)),this.setAcceleration($S(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class KS{constructor(){this.value,this.dir,this.movement=new US}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const QS={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},tw=Phaser.Utils.Objects.GetValue;class ew extends Nn{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=tw(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(tw(e,"speed",.1)),this.setEnable(tw(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(tw(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||tf(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const iw=Phaser.Utils.Objects.GetValue;var sw=function(t,e,i,s){var r,n,a="Y"===(i=i.toUpperCase()),o=2===t.scrollMode,h=t.childrenMap.child,l=`slider${i}`;if(r=o||s.hasOwnProperty(l)?iw(s,l,void 0):iw(s,"slider",void 0)){var u,c,d;!0===r&&(r={}),r.orientation=a?1:0,n=function(t,e){void 0===e&&(e={});var i=po(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new WS(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r),n.tickLength=iw(r,"tickLength",void 0);var p=iw(r,"position",0);"string"==typeof p&&(p=rw[p]);var g,f,v=iw(s,`space.slider${i}`,void 0);void 0===v&&void 0===(v=iw(s,"space.slider",void 0))&&(o?v=0:g=iw(s,"space.child",0)),f=void 0===g?"number"==typeof v:"number"==typeof g,a?0===p?(u=2,c=1,d=void 0===g?f?{left:v}:v:{left:iw(g,"right",g)}):(u=0,c=1,d=void 0===g?f?{right:v}:v:{right:iw(g,"left",g)}):0===p?(u=1,c=2,d=void 0===g?f?{top:v}:v:{top:iw(g,"bottom",g)}):(u=1,c=0,d=void 0===g?f?{bottom:v}:v:{bottom:iw(g,"top",g)}),e.add(n,{column:u,row:c,align:"center",padding:d,expand:!0}),t[`hideUnscrollableSlider${i}`]=iw(r,"hideUnscrollableSlider",!1),t[`disableUnscrollableDrag${i}`]=iw(r,"disableUnscrollableDrag",!1),t[`adaptThumb${i}SizeMode`]=iw(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=iw(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`disableUnscrollableDrag${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=iw(s,"scrollDetectionMode");"string"==typeof b&&(b=nw[b]);var x=`scroller${i}`;(m=o||s.hasOwnProperty(x)?iw(s,x,!0):iw(s,"scroller",!0))&&h&&(!0===m&&(m={}),m.orientation=a?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new ZS(h,m),h.isRexContainerLite&&h.sendChildToBack(h));var k,C,S,w,T,P=iw(s,o?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);(P&&h&&(void 0!==b&&(P.focus=1===b?2:0),k=new ew(h,P)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,k),o&&!a||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.disableUnscrollableDrag=t[`disableUnscrollableDrag${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",k)),n)&&(o?(C=a?"t":"s",w=`scroll${i}`):(C="t",w="scroll"),n.on("valuechange",(function(e){t[C]=e,t.emit(w,t)})));y&&(o?(S=`childO${i}`,w=`scroll${i}`):(S="childOY",w="scroll"),y.on("valuechange",(function(e){t[S]=e,t.emit(w,t)})));k&&(T=o?`addChildO${i}`:"addChildOY",k.on("scroll",(function(e){t[T](-e,!0)})))};const rw={right:0,left:1,bottom:0,top:1},nw={gameObject:0,rectBounds:1},aw=Phaser.Utils.Objects.GetValue;var ow=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=aw(e,"width"),a=aw(e,"height");n||(aw(e,"child.expandWidth",!0)||(s[1]=0));a||(aw(e,"child.expandHeight",!0)||(r[1]=0));var o=new dS(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=pS(i,"child"),r=pS(s,"gameObject",void 0);if(r){var n=pS(i,"space.child",0);t.childMargin={};var a=t.childMargin,o={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:a.top=0,a.bottom=0,a.left=0,a.right=0;break;default:a.top=n,a.bottom=n,a.left=n,a.right=n}else switch(t.scrollMode){case 0:a.top=pS(n,"top",0),a.bottom=pS(n,"bottom",0),o.left=pS(n,"left",0),o.right=pS(n,"right",0);break;case 1:a.top=pS(n,"left",0),a.bottom=pS(n,"right",0),o.top=pS(n,"top",0),o.bottom=pS(n,"bottom",0);break;default:a.top=pS(n,"top",0),a.bottom=pS(n,"bottom",0),a.left=pS(n,"left",0),a.right=pS(n,"right",0)}e.add(r,{column:1,row:1,align:pS(s,"align","center"),padding:o,expand:{width:pS(s,"expandWidth",!0),height:pS(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,o,e),t.scrollMode){case 0:sw(t,o,"y",e);break;case 1:sw(t,o,"x",e);break;default:sw(t,o,"y",e),sw(t,o,"x",e)}return o},hw=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}i*="Y"===t?this.scaleY:this.scaleX,s&&s.setBounds(e,i),r&&(r.setEnable(e!==i),r.tickLength&&r.setTick(r.tickLength,e,i))},lw=function(t){switch(this.scrollMode){case 0:case 1:(i=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(i,this.isOverflow),(r=this.childrenMap.scroller)&&this.disableUnscrollableDrag&&r.setEnable(this.isOverflow);break;default:var e=this[`isOverflow${t=t.toUpperCase()}`],i=this.childrenMap[`slider${t}`],s=this[`hideUnscrollableSlider${t}`];i&&s&&this.setChildVisible(i,e);var r=this.childrenMap.scroller,n=this[`disableUnscrollableDrag${t}`];r&&n&&r.setEnable(e)}},uw=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(o=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=o.childrenMap.track,s=o.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&nthis.topTextOY}textOYExeceedBottom(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:s?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}setTextOY(t){return this.textOY=t,this}set t(t){this.textOY=-this.textVisibleHeight*t}get t(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t}setTextOYByPercentage(t){return this.t=t,this}}var Ow=function(t){return t.add.text(0,0,"")};Object.assign(Pw.prototype,Cw);var _w={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},Ew={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const Mw=Phaser.Utils.Objects.GetValue;class Dw extends gw{constructor(t,e){void 0===e&&(e={});var i=Mw(e,"text",void 0),s=Mw(e,"textWidth",void 0),r=Mw(e,"textHeight",void 0),n=Mw(e,"textCrop",!!i.setCrop),a=Mw(e,"textMask",!n),o=Mw(e,"content",""),h=new Pw(t,{width:s,height:r,text:i,textMask:a,textCrop:n&&!a,content:o,clampTextOY:Mw(e,"clampChildOY",!1),alwaysScrollable:Mw(e,"alwaysScrollable",!1)});t.add.existing(h),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textObjectHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.textHeight}})}(h),e.scrollMode=0,e.type="rexTextArea",e.child={gameObject:h,expandWidth:void 0===s,expandHeight:void 0===r};var l=Mw(e,"space",void 0);l&&(l.child=Mw(l,"text",0)),super(t,e),this.addChildrenMap("text",i)}get text(){return this.childrenMap.child.text}get lineHeight(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.textHeight}}Object.assign(Dw.prototype,_w,Ew);const Lw=Phaser.Utils.Objects.GetValue;var Aw=function(t,e,i){e=e?y(e):{};var s=Lw(i,"background",sk),r=Lw(i,"text",Rw),n=Lw(i,"track",sk),a=Lw(i,"thumb",sk);s?e.background=s(t,e.background):delete e.background,r?e.text=r(t,e.text):delete e.text;var o=e.slider;!1!==o&&null!==o&&(void 0===o&&(o={}),n?o.track=n(t,o.track):delete o.track,a?o.thumb=a(t,o.thumb):delete o.thumb,e.slider=o);var h=new Dw(t,e);return t.add.existing(h),h},Rw=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("key")&&(i="bitmaptext",e.font=e.key)),i){case"bitmaptext":case"bitmap":s=new NC(t,e);break;case"bbcodetext":case"bbcode":s=new FC(t,0,0,"",e);break;case"label":s=new VC(t,e);break;case"textarea":s=Aw(t,e);break;default:s=new ak(t,e)}return ik(s,e),t.add.existing(s),s},Bw=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("leftWidth")?i="nineSlice":(e.hasOwnProperty("color")||e.hasOwnProperty("strokeColor"))&&(i="roundRectangle")),i){case"nineSlice":s=e.hasOwnProperty("stretchMode")?new tk(t,e):new Lx(t,e);break;case"roundRectangle":s=new xx(t,e);break;default:s=new Fx(t,e)}return ik(s,e),t.add.existing(s),s};const Fw=Phaser.Utils.Objects.GetValue;var Iw=function(t,e,i){e=e?y(e):{};var s=Fw(i,"background",sk),r=Fw(i,"text",Rw),n=Fw(i,"icon",Bw),a=Fw(i,"action",Bw);return null!==e.background&&s?e.background=s(t,e.background):delete e.background,null!==e.text&&r?e.text=r(t,e.text):delete e.text,null!==e.icon&&n?e.icon=n(t,e.icon):delete e.icon,null!==e.action&&a?e.action=a(t,e.action):delete e.action,e};const jw=Phaser.Utils.Objects.GetValue;var zw=function(t,e,i){var s,r,n=jw(i,"innerBackground",sk),a=jw(i,"separator",sk),o=jw(i,"title",Rw);null!==e.innerBackground&&n&&(s=n(t,e.innerBackground)),null!==e.separator&&a&&(r=a(t,e.separator)),e=Iw(t,e,i),s?e.innerBackground=s:delete e.innerBackground,r?e.separator=r:delete e.separator,null!==e.title&&o?e.title=o(t,e.title):delete e.title;var h=e.background;return h&&(s?t.children.moveBelow(h,s):r&&t.children.moveBelow(h,r)),e};class Nw extends ex{constructor(t,e,i){super(t,e=zw(t,e,i))}}var Gw={start:function(t){return this.easeValueTask||(this.easeValueTask=new ul(this,{eventEmitter:null})),void 0!==t&&(this.duration=t,this.easeValueTask.stop()),this.easeValueTask.isRunning||(this.easeValueTask.restart({key:"value",from:0,to:1,duration:this.duration,ease:this.ease,repeat:-1,delay:this.delay,repeatDelay:this.repeatDelay}),this.setDirty()),this},stop:function(){return this.easeValueTask?(this.easeValueTask.stop(),this.setDirty(),this):this},pause:function(){return this.easeValueTask?(this.easeValueTask.pause(),this.setDirty(),this):this},resume:function(){return this.easeValueTask?(this.easeValueTask.pause(),this.setDirty(),this):this}};const Ww=Phaser.Utils.Objects.GetValue;class Vw extends eu{constructor(t,e){super(t,Ww(e,"x",0),Ww(e,"y",0),Ww(e,"width",64),Ww(e,"height",64)),this.resetFromConfig(e,!0),this.buildShapes(e),Ww(e,"start",!0)&&this.start()}resetFromConfig(t,e){var i;return void 0===e&&(e=!1),i=e?1e3:this.duration,this.setDuration(Ww(t,"duration",i)),i=e?"Linear":this.ease,this.setEase(Ww(t,"ease",i)),i=e?0:this.delay,this.setDelay(Ww(t,"delay",i)),i=e?0:this.repeatDelay,this.setRepeatDelay(Ww(t,"repeatDelay",i)),i=e?16777215:this.color,this.setColor(Ww(t,"color",i)),i=e?0:this.value,this.setValue(Ww(t,"value",i)),this}buildShapes(){}get centerX(){return this.width/2}get centerY(){return this.height/2}get radius(){return Math.min(this.centerX,this.centerY)}get color(){return this._color}set color(t){this.isColorChanged=this.isColorChanged||this._color!==t,this.dirty=this.dirty||this.isColorChanged,this._color=t,this.setShapesColor(t)}setColor(t){return this.color=t,this}setShapesColor(t){}get value(){return this._value}set value(t){t=Phaser.Math.Clamp(t,0,1),this.dirty=this.dirty||this._value!=t,this._value=t}setValue(t){return this.value=t,this}setDuration(t){return this.duration=t,this}setDelay(t){return this.delay=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return this.ease=t,this}get isRunning(){return!!this.tweenTask&&this.tweenTask.isRunning}}Object.assign(Vw.prototype,Gw);const Yw=Phaser.Math.DegToRad,Xw=Phaser.Math.Linear,Hw=Phaser.Math.Easing.Expo.In,$w={right:0,down:1,left:2,up:3};var Uw=function(t,e,i,s,r,n,a,o,h,l,u){var c=qw(e,0,s,r,n,a,o,h,l,u);t.startAt(c.x,c.y);var d=qw(i,0,s,r,n,a,o,h,l,u);t.lineTo(d.x,d.y);var p=qw(i,i,s,r,n,a,o,h,l,u);t.lineTo(p.x,p.y);var g=qw(0,i,s,r,n,a,o,h,l,u);t.lineTo(g.x,g.y);var f=qw(0,e,s,r,n,a,o,h,l,u);t.lineTo(f.x,f.y);var v=qw(e,e,s,r,n,a,o,h,l,u);t.lineTo(v.x,v.y),t.close()},Kw={},qw=function(t,e,i,s,r,n,a,o,h,l){var u=t*i,c=e*s;return Kw.x=a*u+o*c+r,Kw.y=h*u+l*c+n,Kw},Jw={setDirection(t){return"string"==typeof t&&(t=$w[t]),this.direction=t,this},buildShapes(){for(var t=0;t<3;t++)this.addShape(new Gu)},updateShapes(){var t,e,i,s,r,n;switch(this.direction){case 1:t=this.centerX,e=this.centerY-this.radius;var a=Yw(315);i=Math.cos(a),s=Math.sin(a);var o=Yw(45);r=Math.cos(o),n=Math.sin(o);break;case 3:t=this.centerX,e=this.centerY+this.radius;a=Yw(135);i=Math.cos(a),s=Math.sin(a);o=Yw(225);r=Math.cos(o),n=Math.sin(o);break;case 2:t=this.centerX+this.radius,e=this.centerY;a=Yw(225);i=Math.cos(a),s=Math.sin(a);o=Yw(315);r=Math.cos(o),n=Math.sin(o);break;default:t=this.centerX-this.radius,e=this.centerY;a=Yw(45);i=Math.cos(a),s=Math.sin(a);o=Yw(135);r=Math.cos(o),n=Math.sin(o)}for(var h=this.radius/7,l=this.getShapes(),u=0,c=l.length;uthis.value)for(var u=0;uthis.value&&(t+=1));for(var r=this.getShapes(),n=0,a=r.length;n0&&(r=!0,void 0===n&&(n=0),void 0===a&&(a=0)),(d=this.getSizerConfig(t)).align=i,d.padding=El(s),nP(r)?(d.expandWidth=aP(r,"width",!1),d.expandHeight=aP(r,"height",!1)):(d.expandWidth=r,d.expandHeight=r),t.isRexSizer||(d.expandWidth&&(t.minWidth=void 0===n?zr(t):n),d.expandHeight&&(t.minHeight=void 0===a?Nr(t):a)),d.alignOffsetX=o,d.alignOffsetY=h,d.alignOffsetOriginX=u,d.alignOffsetOriginY=c,d.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,p&&this.addChildrenMap(e,t),this}},uP={remove(t,e){var i;if("string"==typeof t){if(i=t,!(t=this.sizerChildren[i]))return this}else{if(this.getParentSizer(t)!==this)return this;i=this.childToKey(t)}return i&&(delete this.sizerChildren[i],this.childrenMap.hasOwnProperty(i)&&delete this.childrenMap[i]),sp.call(this,t,e),this},removeAll(t){for(var e in this.sizerChildren)this.remove(e,t);return this},clear(t){for(var e in this.sizerChildren)delete this.sizerChildren[e],this.childrenMap.hasOwnProperty(e)&&delete this.childrenMap[e];return om.call(this,t),this}},cP={getChildrenWidth:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var a in r)t=r[a],void 0===(i=this.getChildWidth(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).left+e.right)*this.scaleX,s=Math.max(i,s));return n?void 0:s+(this.space.left+this.space.right)*this.scaleX},getChildrenHeight:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var a in r)t=r[a],void 0===(i=this.getChildHeight(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).top+e.bottom)*this.scaleY,s=Math.max(i,s));return n?void 0:s+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(s.expandWidth){var r=e-(this.space.left+this.space.right)*this.scaleX,n=s.padding;i=r-(n.left+n.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(s.expandHeight){var r=e-(this.space.top+this.space.bottom)*this.scaleY,n=s.padding;i=r-(n.top+n.bottom)*this.scaleY}return i},getChildrenSizers:function(t){void 0===t&&(t=[]);var e,i=this.sizerChildren;for(var s in i)(e=i[s]).isRexSizer&&t.push(e);return t},layoutChildren:function(){var t,e,i,s,r,n,a,o,h,l,u,c,d=this.innerLeft,p=this.innerTop,g=this.innerWidth,f=this.innerHeight,v=this.sizerChildren;for(var m in v)(t=v[m]).rexSizer.hidden||(i=(e=t.rexSizer).padding,of.call(this,t),l=this.getExpandedChildWidth(t),u=this.getExpandedChildHeight(t),e.aspectRatio>0&&(sP.width=e.aspectRatio,sP.height=1,rP.width=l,rP.height=u,l=(c=cl(sP,rP,"FIT",!0)).width,u=c.height),t.isRexSizer?(t.runLayout(this,l,u),Uv(t,this)):Sp(t,l,u),s=d+i.left*this.scaleX,n=g-(i.left+i.right)*this.scaleX,r=p+i.top*this.scaleY,a=f-(i.top+i.bottom)*this.scaleY,void 0===l&&(l=zr(t)),void 0===u&&(u=Nr(t)),o=(e.alignOffsetX+e.alignOffsetOriginX*l)*this.scaleX,h=(e.alignOffsetY+e.alignOffsetOriginY*u)*this.scaleY,hf.call(this,t,s,r,n,a,e.align,o,h))}};Object.assign(cP,lP,uP);const dP=Phaser.Utils.Objects.IsPlainObject,pP=Phaser.Utils.Objects.GetValue;class gP extends $v{constructor(t,e,i,s,r,n){dP(e)?(e=pP(n=e,"x",0),i=pP(n,"y",0),s=pP(n,"width",void 0),r=pP(n,"height",void 0)):dP(s)&&(s=pP(n=s,"width",void 0),r=pP(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexOverlapSizer",this.sizerChildren={},this.addChildrenMap("items",this.sizerChildren)}childToKey(t){if("string"!=typeof t)return function(t,e){if(Array.isArray(t))return t.indexOf(e);for(var i in t)if(t[i]===e)return i;return null}(this.sizerChildren,t);var e=t;return this.sizerChildren.hasOwnPropery(e)?e:null}}Object.assign(gP.prototype,cP);const fP=xm.prototype.add,vP=xm.prototype.addSpace;var mP=function(t){var e=!t.isRexSpace,i=!e||this.buttonsExpand?1:0;if(0===this.sizerChildren.length)if(e){!this.buttonsExpand&&("right"===this.buttonsAlign||"center"===this.buttonsAlign||"bottom"===this.buttonsAlign)&&vP.call(this),fP.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&vP.call(this),this.hasTailSpace=s}else fP.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;fP.call(this,t,{index:r,proportion:i,expand:!0})}else fP.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},yP={addButton(t){if(ef(t))for(var e=t,i=0,s=e.length;i=0;i--)kP.call(this,e[i],t);return this}},SP=function(t,e,i){if(t){var s=this.setValueCallback,r=this.setValueCallbackScope;s&&(r?s.call(r,t,e,i):s(t,e,i)),this.fireEvent("button.statechange",t,e,i)}},wP=function(t){var e=this;t._selected=void 0,Object.defineProperty(t,"selected",{get:function(){return t._selected},set:function(i){if(t._selected!==i){var s=t._selected;t._selected=i,SP.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},TP={add(t){return this.buttons.push(t),t._click||(t._click=new df(t,this.clickConfig),t._click.on("click",(function(t,e,i,s){this.fireEvent("button.click",e,i,s)}),this).on("enable",(function(t,e){this.fireEvent("button.enable",e)}),this).on("disable",(function(t,e){this.fireEvent("button.disable",e)}),this).on("over",(function(t,e,i,s){this.fireEvent("button.over",e,i,s)}),this).on("out",(function(t,e,i,s){this.fireEvent("button.out",e,i,s)}),this).on("down",(function(t,e,i,s){this.fireEvent("button.down",e,i,s)}),this).on("up",(function(t,e,i,s){this.fireEvent("button.up",e,i,s)}),this),t.isRexContainerLite&&t.sendChildToBack(t)),this.buttonsType&&(void 0===t.name&&console.error(`${this.parent.constructor.name}: Option button miss value`),wP.call(this,t)),this},addMultiple(t){for(var e=0,i=t.length;e0},setButtonEnable(t,e){var i=this.buttons;if(void 0===t||"boolean"==typeof t){e=t;for(var s=0,r=i.length;so.height/2)){r>(h=zP(o.left,o.centerY,t,e))&&(r=h,s=n);var h,l=i[n+1];if(!l||l.y!==o.y)r>(h=zP(o.right,o.centerY,t,e))&&(r=h,s=n+1)}}return s};const GP=Phaser.Utils.Objects.IsPlainObject,WP=Phaser.Utils.Objects.GetValue,VP=Phaser.Display.Align.CENTER;var YP=function(t,e,i,s){if("\n"===t)return this.addNewLine(),this;var r,n,a,o,h;(qd.call(this,t),GP(e))&&(e=WP(h=e,"padding",0),i=WP(h,"key",void 0),s=WP(h,"index",void 0),r=WP(h,"offsetX",0),n=WP(h,"offsetY",0),a=WP(h,"offsetOriginX",0),o=WP(h,"offsetOriginY",0));return void 0===e&&(e=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=0),void 0===o&&(o=0),(h=this.getSizerConfig(t)).align=VP,h.padding=El(e),h.alignOffsetX=r,h.alignOffsetY=n,h.alignOffsetOriginX=a,h.alignOffsetOriginY=o,void 0===s||s>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(s,0,t),void 0!==i&&this.addChildrenMap(i,t),this},XP={add(t,e,i){if(ef(t))for(var s=t,r=0,n=s.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,om.call(this,t),this}},UP={getChildrenWidth:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=0===this.orientation&&t?this.maxChildWidth:this.rexSizer.resolved?this.wrapResult.width:void 0)?e+(this.space.left+this.space.right)*this.scaleX:void 0);var e},getChildrenHeight:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=1===this.orientation&&t?this.maxChildHeight:this.rexSizer.resolved?this.wrapResult.height:void 0)?e+(this.space.top+this.space.bottom)*this.scaleY:void 0);var e},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;sr&&eO.addNewLine(this)}else for(n=0,a=t.length;n=0;i--)aO.call(this,e[i],t);return this}};const hO=Phaser.Utils.Objects.GetValue;class lO extends QP{constructor(t,e){void 0===e&&(e={});var i=e.space;"number"==typeof i&&(e.space={item:i,line:i}),super(t,e),this.type="rexFixWidthButtons",this.buttonGroup=new LP({parent:this,eventEmitter:hO(e,"eventEmitter",this),groupName:hO(e,"groupName",void 0),clickConfig:hO(e,"click",void 0)}).setButtonsType(e);var s=hO(e,"background",void 0),r=hO(e,"buttons",void 0);this.buttonsAlign=hO(e,"align",void 0),s&&this.addBackground(s),r&&this.addButtons(r),this.addChildrenMap("background",s),this.addChildrenMap("buttons",this.buttonGroup.buttons)}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.buttonGroup.destroy(),this.buttonGroup=void 0)}get buttons(){return this.buttonGroup.buttons}get groupName(){return this.buttonGroup.groupName}set groupName(t){this.buttonGroup.groupName=t}get eventEmitter(){return this.buttonGroup.eventEmitter}}Object.assign(lO.prototype,sO,oO,DP,RP);const uO=dS.prototype.add;var cO={addButton(t,e,i){return uO.call(this,t,e,i,void 0,0,this.buttonsExpand),this.buttonGroup.add(t),this},addButtons(t,e){for(var i=0,s=t;i=0;i--)gO.call(this,e[i],t);return this}};const vO=Phaser.Utils.Objects.GetValue;class mO extends dS{constructor(t,e){void 0===e&&(e={});var i=vO(e,"row",0),s=vO(e,"column",e.col||0),r=vO(e,"createCellContainerCallback"),n=vO(e,"buttons",void 0),a=vO(e,"expand",!0),o=a?1:0;if(r&&(e.createCellContainerCallback=void 0),void 0!==n){i=Math.max(i,n.length);for(var h=0,l=n.length;h=r&&h=i&&hi.length&&(t.prevCursorPosition=null),null!==t.prevCursorPosition&&(r=e.getCharChild(t.prevCursorPosition))&&("\n"===r.text&&r.clearTextSize(),e.emit("cursorout",r,t.prevCursorPosition,e)),null!=s&&(r=e.getCharChild(s))&&("\n"===r.text&&r.copyTextSize(e.lastInsertCursor),function(t){var e,i,s=t.parent,r=s.width,n=s.height,a=t.drawX,o=t.drawY,h=a+t.drawTLX,l=a+t.drawTRX,u=o+t.drawTLY,c=o+t.drawBLY;e=h<0?0-h:l>r?r-l:0,i=u<0?0-u:c>n?n-c:0,s._textOX+=e,s._textOY+=i}(r),e.emit("cursorin",r,s,e)),e.emit("movecursor",s,t.prevCursorPosition,e),t.prevCursorPosition=s}}(this)):(p_(this),g_(this)),this}setNumberInput(){return this.onUpdateCallback=d_,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}}const m_=Phaser.Utils.Objects.GetValue,y_=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var b_=function(){var t=this.scene.input.keyboard;this.textEdit.on("open",(function(){t.on("keydown-UP",this.cursorMoveUp,this).on("keydown-DOWN",this.cursorMoveDown,this)}),this).on("close",(function(){t.off("keydown-UP",this.cursorMoveUp,this).off("keydown-DOWN",this.cursorMoveDown,this)}),this)},x_=function(t){fr(t)||this.setCursorStyle(t).on("cursorin",(function(t){var e=this.cursorStyle,i=gx(t.style,e);Pl(e,i)||(t.styleSave=i,t.modifyStyle(e))}),this).on("cursorout",(function(t){t.styleSave&&(t.modifyStyle(t.styleSave),t.styleSave=void 0)}),this)},k_=function(t){fr(t)||this.setRangeStyle(t).on("rangein",(function(t){var e=this.rangeStyle,i=gx(t.style,e);Pl(e,i)||(t.styleSave=i,t.modifyStyle(e))}),this).on("rangeout",(function(t){t.styleSave&&(t.modifyStyle(t.styleSave),t.styleSave=void 0)}),this)},C_=function(t){fr(t)||this.setFocusStyle(t).on("open",(function(){var t=this.background,e=this.focusStyle,i=gx(t,e);Pl(e,i)||(t.styleSave=i,t.modifyStyle(e))}),this).on("close",(function(){var t=this.background;t.styleSave&&(t.modifyStyle(t.styleSave),t.styleSave=void 0)}),this)};function S_(){}function w_(t,e,i,s,r){let n=0,a=e.length,o=0,h=0;for(;nt.length?i:t})),a.value=t.join(e)}else a.value=t.join(i.slice(o,o+a.count));o+=a.count,a.added||(h+=a.count)}}let l=e[a-1];return a>1&&"string"==typeof l.value&&(l.added||l.removed)&&t.equals("",l.value)&&(e[a-2].value+=l.value,e.pop()),e}S_.prototype={diff(t,e,i={}){let s=i.callback;"function"==typeof i&&(s=i,i={}),this.options=i;let r=this;function n(t){return s?(setTimeout((function(){s(void 0,t)}),0),!0):t}t=this.castInput(t),e=this.castInput(e),t=this.removeEmpty(this.tokenize(t));let a=(e=this.removeEmpty(this.tokenize(e))).length,o=t.length,h=1,l=a+o;i.maxEditLength&&(l=Math.min(l,i.maxEditLength));let u=[{newPos:-1,components:[]}],c=this.extractCommon(u[0],e,t,0);if(u[0].newPos+1>=a&&c+1>=o)return n([{value:this.join(e),count:e.length}]);function d(){for(let s=-1*h;s<=h;s+=2){let h,l=u[s-1],c=u[s+1],d=(c?c.newPos:0)-s;l&&(u[s-1]=void 0);let p=l&&l.newPos+1=a&&d+1>=o)return n(w_(r,h.components,e,t,r.useLongestToken));u[s]=h}else u[s]=void 0}var i;h++}if(s)!function t(){setTimeout((function(){if(h>l)return s();d()||t()}),0)}();else for(;h<=l;){let t=d();if(t)return t}},pushComponent(t,e,i){let s=t[t.length-1];s&&s.added===e&&s.removed===i?t[t.length-1]={count:s.count+1,added:e,removed:i}:t.push({count:1,added:e,removed:i})},extractCommon(t,e,i,s){let r=e.length,n=i.length,a=t.newPos,o=a-s,h=0;for(;a+1t,tokenize:t=>t.split(""),join:t=>t.join("")};const T_=new S_;const P_=/^[a-zA-Z\u{C0}-\u{FF}\u{D8}-\u{F6}\u{F8}-\u{2C6}\u{2C8}-\u{2D7}\u{2DE}-\u{2FF}\u{1E00}-\u{1EFF}]+$/u,O_=/\S/,__=new S_;__.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!O_.test(t)&&!O_.test(e)},__.tokenize=function(t){let e=t.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/);for(let t=0;tvoid 0===i?e:i}=this.options;return"string"==typeof t?t:JSON.stringify(L_(t,null,null,i),i," ")},D_.equals=function(t,e){return S_.prototype.equals.call(D_,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const A_=new S_;A_.tokenize=function(t){return t.slice()},A_.join=A_.removeEmpty=function(t){return t};const R_=Phaser.Utils.Array.Remove;var B_=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),R_(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(h=i,l=e,T_.diff(h,l,u)),r=0,n=0,a=s.length;nr)i+=a;else{if(s!==r)break;i+=Math.min(e.position,a)}}return i},N_={cursorMoveLeft(){if(!this.isOpened)return this;var t=I_(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=I_(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=j_(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=I_(z_(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=j_(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=I_(z_(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const G_=Phaser.Utils.Objects.IsPlainObject;class W_ extends Vb{constructor(t,e,i,s,r,n){G_(e)?n=e:G_(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(tt(e,"wrap.vAlign")||Z(e,"wrap.vAlign",s=i?"center":"top"),tt(e,"wrap.wrapMode")||Z(e,"wrap.wrapMode","char"),tt(e,"wrap.maxLines")||Z(e,"wrap.maxLines",s=i?1:void 0),i&&Z(e,"wrap.wrapWidth",1/0),tt(e,"wrap.useDefaultTextHeight")||Z(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!tt(e.edit,"inputType")){var s=i?"text":"textarea";Z(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new Uo(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var a=n.text;a&&delete n.text;var o=px(n.background,"focus"),h=px(n.style,"cursor"),l=px(n.style,"range");super(t,e,i,s,r,n),this.type="rexCanvasInput",this.contentWidth=void 0,this.contentHeight=void 0,this.lineHeight=void 0,this.linesCount=void 0,this.characterCountOfLines=[],this._text,this.textEdit=function(t,e){var i=m_(e,"edit");return void 0===i&&(i={}),QO(e,i,y_),new v_(t,i)}(this,n),b_.call(this),n.focusStyle&&Object.assign(o,n.focusStyle),C_.call(this,o),n.cursorStyle&&Object.assign(h,n.cursorStyle),x_.call(this,h),n.rangeStyle&&Object.assign(l,n.rangeStyle),fr(l)&&Object.assign(l,h),k_.call(this,l);var u=n.onAddChar;u&&this.on("addchar",u);var c=n.onCursorIn;c&&this.on("cursorin",c);var d=n.onCursorOut;d&&this.on("cursorout",d);var p=!n.onRangeIn&&!n.onRangeOut,g=p?n.onCursorIn:n.onRangeIn;g&&this.on("rangein",g);var f=p?n.onCursorOut:n.onRangeOut;f&&this.on("rangeout",f);var v,m=n.onMoveCursor;m&&this.on("movecursor",m),this.setParseTextCallback(n.parseTextCallback),this.lastInsertCursor=((v=this.createCharChild("|")).text="",v),a||(a=""),this.setText(a)}addChild(t,e){if(super.addChild(t,e),Array.isArray(t))for(var i=t,s=0,r=i.length;s0&&Z(t,"expandTextWidth",!0),h>0&&Z(t,"expandTextHeight",!0),void 0===i&&(i={}),i.hasOwnProperty("icon")||(i.icon=function(t,e){var i=new wc(t,e);return ik(i,e),i.setOrigin(.5,1),t.add.existing(i),i});var y=!1;i.hasOwnProperty("action")||(i.action=function(t,e){void 0===e&&(e={});var i=new WT(t,e);return ik(i,e),t.add.existing(i),i},y=!0);var b,x,k=new Nw(r,t,i);k.setMinSize(o,h).setOrigin(.5,1).layout(),r.add.existing(k),wr(k,e),k.vpx=l,k.vpy=u,k.frameDelimiter=c,y&&(b=k.getElement("action"),k.setChildVisible(b,!1)),Mc(k),k.emitClick=function(){k.emit("click")},void 0===d&&(d=v.getData("$clickTarget")),null===d||(x="screen"===d.toLowerCase()?f.sys.anyTouchDetector:k.setInteractive()),x&&k.bindEvent(x,"pointerdown",(function(){k.emitClick()})),k.bindEvent(r.input.keyboard,"keydown",(function(t){if(void 0===p&&(p=v.getData("$clickShortcutKeys")),p){var e=p.split("|"),i=YT[t.keyCode];-1!==e.indexOf(i)&&k.emitClick()}}));var C=function(){k.isTyping?k.once("click",C).stop(!0):k.isLastPage?k.complete2Flag||(k.complete2Flag=!0,k.emit("complete2")):k.once("click",C).typeNextPage()},S=function(){k.isPageEnd&&(k.off("click",S),y&&(b.stop(),k.setChildVisible(b,!1)),v.emit("resume.input"))};k._typeNextPage=S,k.on("pageend",(function(){y&&(b.start(),k.setChildVisible(b,!0)),k.once("click",S);let t=v.getData("$fastTyping"),e=v.getData("$autoNextPage");var i;(t||e)&&(i=t?0:v.getData("$autoNextPageDelay"),f.sys.timeline.delayCall(i,k.emitClick)),v.emit("pause.input")})).on("start",(function(){k.off("click",C).once("click",C)}));var w=v.getData("$fastTyping"),T=v.getData("$autoNextPage");k.bindScenePreupdateEvent((function(){let t=v.getData("$fastTyping"),e=v.getData("$autoNextPage");if(t!==w)if(k.isTyping){let e;t?e=v.getData("$fastTypingSpeed"):void 0===e&&(e=k.normalTypingSpeed),k.setTypingSpeed(e)}else t&&k.emitClick();else e===T||t||k.isTyping||e&&k.emitClick();w=t,T=e}));var P=function(t,e){if(void 0===g&&(g=v.getData("$fastTypingShortcutKeys")),g){var i=g.split("|"),s=YT[t.keyCode];-1!==i.indexOf(s)&&v.setData("$fastTyping",e)}};return k.bindEvent(r.input.keyboard,"keydown",(function(t){P(t,!0)})),k.bindEvent(r.input.keyboard,"keyup",(function(t){P(t,!1)})),k}}(HT(e,`styles.${Jo}`,{}),{viewport:i},r);t.addGameObjectManager({name:Jo,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Ao,commands:{typing:jc,shake:Dc}})}},function(t,e){var{viewport:i}=e,s=Ac(e,`creators.${Ko}`,void 0);if(!1!==s){if(Rc(s)&&(s=void 0),void 0===s){Ac(e,`styles.${Ko}`,{});s=function(t,{viewport:e}={}){return function(t,i){i.hasOwnProperty("scaleMode")||(i.scaleMode=0);var s=new wc(t,i);t.add.existing(s),wr(s,e);var{vpx:r=.5,vpy:n=.5,vpw:a,vph:o,scaleMode:h}=i;if(s.vpx=r,s.vpy=n,h||void 0!==a||void 0!==o){void 0===a&&(a=1),void 0===o&&(o=1);var l=e.width*a,u=e.height*o;s.resize(l,u)}return Mc(s),s}}(0,{viewport:i})}t.addGameObjectManager({name:Ko,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Do,commands:{cross:Lc,shake:Dc}})}},function(t,e){var{viewport:i}=e,s=YO(e,`creators.${Qo}`,void 0);if(!1!==s){var r;if(XO(s)&&(r=s,s=void 0),void 0===s)s=function(t,{viewport:e}={},i){return function(s,{vpw:r,vph:n,width:a=0,height:o=0,vpx:h=.5,vpy:l=.5}={}){void 0!==r&&(a=e.width*r),void 0!==n&&(o=e.height*n);var u=new WO(s,t,i);return u.setMinSize(a,o).setVisible(!1),s.add.existing(u),wr(u,e),u.vpx=h,u.vpy=l,Mc(u),u}}(YO(e,`styles.${Qo}`,{}),{viewport:i},r);t.addGameObjectManager({name:Qo,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Ao,commands:{choice:VO,shake:Dc}})}},function(t,e){var{viewport:i}=e,s=K_(e,`creators.${th}`,void 0);if(!1!==s){var r;if(q_(s)&&(r=s,s=void 0),void 0===s)s=function(t,{viewport:e}={},i){return function(s,{vpw:r,vph:n,width:a=0,height:o=0,vpx:h=.5,vpy:l=.5}={}){void 0!==r&&(a=e.width*r),void 0!==n&&(o=e.height*n);var u=new $_(s,t,i);return u.setMinSize(a,o).setVisible(!1),s.add.existing(u),wr(u,e),u.vpx=h,u.vpy=l,Mc(u),u}}(K_(e,`styles.${th}`,{}),{viewport:i},r);t.addGameObjectManager({name:th,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Ao,commands:{input:U_,shake:Dc}})}},function(t,e){var{viewport:i}=e,s=eP(e,`creators.${Zo}`,void 0);if(!1!==s){var r;if(iP(s)&&(r=s,s=void 0),void 0===s)s=function(t,{viewport:e}={},i){return function(s,{vpw:r,vph:n,width:a=0,height:o=0,vpx:h=1,vpy:l=0,alignLeft:u=!1,alignRight:c=!0,alignTop:d=!0,alignBottom:p=!1,text0:g,text1:f,commandExecutor:v,eventSheetManager:m,eventsheet:y}={}){void 0!==r&&(a=e.width*r),void 0!==n&&(o=e.height*n),void 0===i&&(i={}),i.hasOwnProperty("icon")||(i.icon=function(t,e){var i=new wc(t,e);return ik(i,e),i.setOrigin(.5,1),t.add.existing(i),i});var b,x,k=new UT(s,t,i);return g&&k.setTitle(g),f&&k.setText(f),b=u?0:c?1:.5,x=d?0:p?1:.5,k.setMinSize(a,o).setOrigin(b,x).layout(),s.add.existing(k),wr(k,e),k.vpx=h,k.vpy=l,Mc(k),k}}(eP(e,`styles.${Zo}`,{}),{viewport:i},r);t.addGameObjectManager({name:Zo,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Ao,commands:{setText:qT,popUp:JT,shake:Dc}})}}];var Z_=[function(t){t.addExpression("random",(function(t,e){return void 0===t&&void 0===e?(t=0,e=1):void 0===e&&(e=t,t=0),t+Math.random()*(e-t)}))},function(t){t.addExpression("randomInt",(function(t,e){return Math.floor(t+Math.random()*(e-t+1))}))}],Q_={$typingSpeed:100,$autoNextPage:!1,$autoNextPageDelay:500,$fastTyping:!1,$fastTypingSpeed:20,$clickShortcutKeys:"SPACE|ENTER",$fastTypingShortcutKeys:"CTRL",$clickTarget:"screen",$transitionDuration:500,$tintOthers:3355443,$shakeDuration:500,$shakeMagnitude:50},tE=function(t,e){var i=po(t);for(var s in e)i.hasOwnProperty(s)||(i[s]=e[s]);return i};class eE extends or{constructor(t,e={}){e.commandExecutor=function(t,e){var{layerDepth:i,rootLayer:s,multipleCamerasEnable:r=!1,viewport:n}=e;void 0===n&&(e.viewport=un(t,t.cameras.main));for(var a=new Mo(t,{layers:r?Vo:Yo,layerDepth:i,rootLayer:s}),o=0,h=J_.length;o0&&void 0!==this._direction?this.previousDirection=this._direction:this.previousDirection=void 0,this._direction=t,this.verticeAngle=90*t,this.dirty=!0,void 0!==this.previousDirection?this.playEaseDirectionation():this.stopEaseDirection())}setDirection(t,e){return void 0!==e&&this.setEaseDuration(e),this.direction=t,this}toggleDirection(t){return this.setDirection(this.direction+2,t),this}get easeDirectionProgress(){return this._easeDirectionProgress}set easeDirectionProgress(t){this._easeDirectionProgress!==t&&(this._easeDirectionProgress=t,this.dirty=!0)}setPadding(t,e,i,s){if("object"==typeof t){var r=t,n=cE(r,"x",null);null!==n?(t=n,i=n):(t=cE(r,"left",0),i=cE(r,"right",t));var a=cE(r,"y",null);null!==a?(e=a,s=a):(e=cE(r,"top",0),s=cE(r,"bottom",e))}else void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=t),void 0===s&&(s=e);return void 0===this.padding&&(this.padding={}),this.dirty=this.dirty||this.padding.left!=t||this.padding.top!=e||this.padding.right!=i||this.padding.bottom!=s,this.padding.left=t,this.padding.top=e,this.padding.right=i,this.padding.bottom=s,this.setRadius(),this}get radius(){return this._radius}set radius(t){this.dirty=this.dirty||this._radius!=t,this._radius=t}setRadius(t){return this.radius=t,this.shapeMode=null==t?0:1,this}get verticeRotation(){return this._verticeRotation}set verticeRotation(t){this.dirty=this.dirty||this._verticeRotation!=t,this._verticeRotation=t}setVerticeRotation(t){return this.verticeRotation=t,this}get verticeAngle(){return gE(this.verticeRotation)}set verticeAngle(t){this.verticeRotation=pE(t)}setVerticeAngle(t){return this.verticeAngle=t,this}}const vE={right:0,down:1,left:2,up:3};var mE=function(t){return"string"==typeof t&&(t=vE[t]),t%=4};Object.assign(fE.prototype,lE,uE);class yE extends rE{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexTweaker.FolderTitle";var i=new fE(t,e.expandedIcon);t.add.existing(i),this.addSpace().add(i,{proportion:0,expand:!1,padding:1,fitRatio:1}),this.addChildrenMap("expandedIcon",i)}setExpandedState(t){void 0===t&&(t=!0);var e=t?"down":"right";return this.childrenMap.expandedIcon.setDirection(e),this}}var bE=function(t,e,i){return sk(t,tE(e,i))};class xE extends Ag{constructor(t,e){void 0===e&&(e={}),e.destroy=!1,super(t,e)}onOpen(){this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.parent,this),super.onClose()}}var kE={expand(t){if(!0===this.expanded)return this;void 0===t&&(t=this.transitionDuration),this.expanded=!0;var e=this.childrenMap.title,i=this.childrenMap.child;(this.show(i),this.reLayoutEnable)&&(this.reLayoutTarget?this.reLayoutTarget:this.getTopmostSizer()).layout();return e.emit("folder.expand",t,this),i.emit("folder.expand",t,this),this.emit("expand.start",this),this.childTransition.once("open",(function(){this.emit("expand.complete",this)}),this).requestOpen(null,t),this},collapse(t){if(!1===this.expanded)return this;void 0===t&&(t=this.transitionDuration),this.expanded=!1;var e=this.childrenMap.title,i=this.childrenMap.child;return e.emit("folder.collapse",t,this),i.emit("folder.collapse",t,this),this.emit("collapse.start",this),this.childTransition.once("close",(function(){(this.setChildScale(i,1,1).hide(i),this.reLayoutEnable)&&(this.reLayoutTarget?this.reLayoutTarget:this.getTopmostSizer()).layout();this.emit("collapse.complete",this)}),this).requestClose(null,t),this},toggle(t){return this.expanded?this.collapse(t):this.expand(t),this},setExpandedState(t){return this.reLayoutEnable=!1,void 0===t?this.expanded=void 0:t?this.expand(0):this.collapse(0),this.reLayoutEnable=!0,this}},CE=function(t,e){Gp.popUp.call(t,e,this.expandDirection)},SE=function(t,e){Gp.scaleDown.call(t,e,this.expandDirection)},wE={setTransitionDuration(t){return this.transitionDuration=t,this.childTransition.setTransitInTime(t).setTransitOutTime(t),this},setExpandCallback(t){return void 0===t&&(t=CE.bind(this)),this.childTransition.setTransitInCallback(t),this},setCollapseCallback(t){return void 0===t&&(t=SE.bind(this)),this.childTransition.setTransitOutCallback(t),this}};const TE=Phaser.Utils.Objects.GetValue;let PE=class extends xm{constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("orientation")||(e.orientation=1),super(t,e),this.type="rexFolder",this.reLayoutEnable=!0,this.expanded=void 0,this.expandDirection=1===this.orientation?"y":"x";var i=e.background,s=e.title,r=e.child;i&&this.addBackground(i);var n=TE(e,"space"),a=1===this.orientation?"left":"top",o=TE(e,"align.title",a),h=TE(e,"expand.title",!0);this.add(s,{proportion:0,align:o,expand:h,padding:{left:TE(n,"titleLeft",0),right:TE(n,"titleRight",0),top:TE(n,"titleTop",0),bottom:TE(n,"titleBottom",0)}});var l=TE(e,"toggleByTarget",void 0),u=TE(e,"toggleClickConfig");if(void 0===l&&(l=s),l&&gf.onClick.call(l,(function(){this.toggle()}),this,u),this.childTransition=new xE(r),!TE(e,"customChildOrigin",!1)){var c=this.rtl?1:0;r.setOrigin(c)}o=TE(e,"align.child","left");var d=(h=TE(e,"expand.child",!0))?1:0;this.add(r,{proportion:d,align:o,expand:h,padding:{left:TE(n,"childLeft",0),right:TE(n,"childRight",0),top:TE(n,"childTop",0),bottom:TE(n,"childBottom",0)}}),this.addChildrenMap("title",s),this.addChildrenMap("child",r),this.addChildrenMap("background",i);var p=e.transition;this.setTransitionDuration(TE(p,"duration",200)),this.setExpandCallback(TE(p,"expandCallback",void 0)),this.setCollapseCallback(TE(p,"collapseCallback",void 0)),this.reLayoutTarget=TE(e,"reLayoutTarget",void 0);var g=e.onExpandStart;g&&this.on("expand.start",g);var f=e.onExpandComplete;f&&this.on("expand.complete",f);var v=e.onCollapseStart;v&&this.on("collapse.start",v);var m=e.onCollapseComplete;m&&this.on("collapse.complete",m);var y=TE(e,"expanded",void 0);void 0!==y&&this.setExpandedState(y)}};Object.assign(PE.prototype,kE,wE);var OE={setBindingTarget(t){return this.childrenMap.child.setBindingTarget(t),this}},_E={getMaxInputRowTitleWidth(){return this.childrenMap.child.getMaxInputRowTitleWidth()+this.getInnerPadding("left")},setInputRowTitleWidth(t){return t-=this.getInnerPadding("left"),this.childrenMap.child.setInputRowTitleWidth(t),this}};class EE extends PE{constructor(t,e){void 0===e&&(e={}),e.orientation=1,super(t,e),this.type="rexTweaker.Folder"}setTitle(t){return this.childrenMap.title.setTitle(t),this}}Object.assign(EE.prototype,OE,_E);const ME=Phaser.Utils.Objects.GetValue;const DE=Phaser.Utils.Objects.GetValue;const LE=gP.prototype.add;var AE=function(t,e,i,s,r,n,a,o,h){return t.setVisible(!1),LE.call(this,t,e,i,s,r,n,a,o,h),this},RE={add:AE,addPage:AE};const BE=al.prototype.setChildVisible;var FE={getPage:function(t){return void 0===t?null:this.sizerChildren.hasOwnProperty(t)?this.sizerChildren[t]:null},swapPage:function(t,e){this._previousKey=this._currentKey;var i=this.previousPage;i&&(0===this.swapMode?(BE.call(this,i,!1),this.emit("pageinvisible",i,this._previousKey,this)):i.destroy()),t&&!this.sizerChildren.hasOwnProperty(t)&&this.emit("createpage",t,this),this._currentKey=t;var s=this.currentPage;return s&&(BE.call(this,s,!0),this.emit("pagevisible",s,this._currentKey,this),void 0===e&&(e=this.fadeInDuration),e>0&&s.setAlpha(0).fadeIn(e,1)),this},hasPage:function(t){return this.sizerChildren.hasOwnProperty(t)}};Object.assign(FE,RE);const IE=Phaser.Utils.Objects.GetValue;class jE extends gP{constructor(t,e){super(t,e),this.type="rexPages",this.childrenMap=this.sizerChildren,this._previousKey=void 0,this._currentKey=void 0,this.setSwapMode(IE(e,"swapMode",0)),this.setFadeInDuration(IE(e,"fadeIn",0))}setSwapMode(t){return"string"==typeof t&&(t=zE[t]),this.swapMode=t,this}setFadeInDuration(t){return this.fadeInDuration=t,this}get previousKey(){return this._previousKey}get currentKey(){return this._currentKey}set currentKey(t){this.swapPage(t)}get currentPage(){return this.getPage(this.currentKey)}get previousPage(){return this.getPage(this.previousKey)}get keys(){return Object.keys(this.sizerChildren)}}Object.assign(jE.prototype,FE);const zE={invisible:0,destroy:1};const NE=Phaser.Utils.Objects.IsPlainObject,GE=Phaser.Utils.Objects.GetValue,WE=Phaser.Utils.String.UUID;var VE={swapPage:function(t,e){var i,s;null!=(i="number"==typeof t?t:this.getPageIndex(t))&&(void 0!==e&&(s=this.childrenMap.pages.fadeInDuration,this.childrenMap.pages.fadeInDuration=e),this.childrenMap.tabs.emitButtonClick(i),void 0!==s&&(this.childrenMap.pages.fadeInDuration=s));return this},swapFirstPage:function(t){return this.swapPage(0,t),this},swapLastPage:function(t){var e=this.getElement("tabs.buttons").length-1;return this.swapPage(e,t),this}},YE={removePage(t,e){"number"==typeof t&&(t=this.getPageKey(t));var i=this.childrenMap.tabs,s=i.getByName(t),r=this.childrenMap.pages,n=r.getElement(t);return s&&n?(r.removeChildrenMap(t),i.removeButton(s,e),r.remove(n,e),this):this},removeAllPages(t){for(var e=this.getElement("tabs.buttons"),i=e.length-1;i>=0;i--)this.removePage(e[i].name,t);return this}},XE={top:1,left:3,right:5,bottom:7},HE={top:"bottom",left:"right",right:"left",bottom:"top"},$E={setTabsPadding(t,e){return this.childrenMap.tabs.setOuterPadding(t,e),this},getTabsPadding(t){return this.childrenMap.tabs.getOuterPadding(t)}},UE={getPageKey:function(t){var e=this.getElement("tabs.buttons");if(!(t>=e.length))return e[t].name},getPageIndex:function(t){for(var e=this.getElement("tabs.buttons"),i=0,s=e.length;i0,setInputRowTitleWidth(t){return this}};const cM=Phaser.Utils.Objects.GetValue;class dM extends xm{constructor(t,e){void 0===e&&(e={}),e.orientation="y",super(t,e),this.type="rexTweaker.Wrap";var i=cM(e,"background",void 0),s=cM(e,"title",void 0);i&&this.addBackground(i),s&&this.add(s,{expand:!0,space:{bottom:cM(e,"space.title",0)}});var r=cM(e,"child",void 0);this.add(r,{expand:!0}),this.addChildrenMap("title",s),this.addChildrenMap("child",r)}setTitle(t){var e=this.childrenMap.title;return t.title||t.icon?e.show().setTitle(t):e.hide(),this}}Object.assign(dM.prototype,lM,uM);const pM=Phaser.Utils.Objects.GetValue;const gM=Phaser.Utils.Objects.GetValue;var fM=function(t){return t.hasOwnProperty("geometryMask")?t.geometryMask:t.bitmapMask};const vM=Phaser.Geom.Intersects.RectangleToRectangle,mM=Phaser.Geom.Rectangle.Overlaps;var yM=function(t){if(!t.displayList)return!1;for(;;){var e=t.rexContainer;if(e){if(e.visible){var i=e.parent;if(i){t=i;continue}return!0}return!1}return t.visible}},bM=function(t,e){var i=e.top,s=e.bottom,r=e.left,n=e.right,a=0;return a+=t.contains(r,i)?1:0,a+=t.contains(r,s)?1:0,a+=t.contains(n,i)?1:0,a+=t.contains(n,s)?1:0},xM=function(t,e,i){e.hasOwnProperty("isRexContainerLite")?(e.syncChildrenEnable=!1,t.setChildMaskVisible(e,!0),e.syncChildrenEnable=!0):(e.clearMask&&e.clearMask(),t.setChildMaskVisible(e,!0))},kM=function(t,e,i){e.hasOwnProperty("isRexContainerLite")?(e.syncChildrenEnable=!1,t.setChildMaskVisible(e,!0),e.syncChildrenEnable=!0):(e.setMask&&e.setMask(i),t.setChildMaskVisible(e,!0))},CM=function(t,e,i){e.hasOwnProperty("isRexContainerLite")?(e.syncChildrenEnable=!1,t.setChildMaskVisible(e,!1),e.syncChildrenEnable=!0):(e.clearMask&&e.clearMask(),t.setChildMaskVisible(e,!1))};const SM=Phaser.Utils.Objects.GetValue,wM={update:0,everyTick:1};var TM={setupChildrenMask(t){return!1===t||(this.setMaskUpdateMode(SM(t,"updateMode",0)),this.enableChildrenMask(SM(t,"padding",0)),this.setMaskLayer(SM(t,"layer",void 0)),this.onMaskGameObjectVisible=SM(t,"onVisible"),this.onMaskGameObjectInvisible=SM(t,"onInvisible"),this.maskGameObjectCallbackScope=SM(t,"scope"),this.startMaskUpdate()),this},destroyChildrenMask(){return this.childrenMask?(this.stopMaskUpdate(),this.childrenMask.destroy(),this.childrenMask=void 0,this.onMaskGameObjectVisible=null,this.onMaskGameObjectInvisible=null,this.maskGameObjectCallbackScope=null,this):this},setMaskUpdateMode(t){return"string"==typeof t&&(t=wM[t]),this.maskUpdateMode=t,this},startMaskUpdate(){this.scene.game.events.on("poststep",this.maskChildren,this)},stopMaskUpdate(){this.scene.game.events.off("poststep",this.maskChildren,this)},enableChildrenMask(t){var e=Tm.call(this,null,this,0,t);return this.childrenMask=e.createGeometryMask(),this},setMaskChildrenFlag(t){return void 0===t&&(t=!0),this.maskChildrenFlag=t,this},setMaskLayer(t){return this.maskLayer=t,this},maskChildren(){return this.childrenMask&&this.maskChildrenFlag&&0!==this.alpha&&this.visible?(this.privateRenderLayer?this.privateRenderLayer.setMask(this.childrenMask):this.maskLayer?(this.addToLayer(this.maskLayer),this.maskLayer.setMask(this.childrenMask)):function({parent:t,mask:e,children:i,onVisible:s,onInvisible:r,scope:n}){if(e){void 0===i&&(i=t.getAllChildren());for(var a,o,h,l=!!s||!!r,u=t.getBounds(),c=fM(e),d=0,p=i.length;dthis.topChildOY}childOYExeceedBottom(t){return void 0===t&&(t=this.childOY),tthis.leftChildOX}childOXExeceedRight(t){return void 0===t&&(t=this.childOX),tthis.childHeight?t=0:s?t=e:r&&(t=i)),this._childOY!==t&&(this._childOY=t,this.resetChildPosition()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}get childOX(){return this._childOX}set childOX(t){var e=this.leftChildOX,i=this.rightChildOX,s=this.childOXExceedLeft(t),r=this.childOXExeceedRight(t);this.clampChildOX&&(this.childVisibleWidth>this.childWidth?t=0:s?t=e:r&&(t=i)),this._childOX!==t&&(this._childOX=t,this.resetChildPosition()),s&&(this.execeedLeftState||this.emit("execeedleft",this,t,e)),this.execeedLeftState=s,r&&(this.execeedRightState||this.emit("execeedright",this,t,i)),this.execeedRightState=r}setChildOY(t){return this.childOY=t,this}setChildOX(t){return this.childOX=t,this}set t(t){this.childOY=-this.visibleHeight*t}get t(){var t=this.visibleHeight;return 0===t?0:this.childOY/-t}set s(t){this.childOX=-this.visibleWidth*t}get s(){var t=this.visibleWidth;return 0===t?0:this.childOX/-t}setChildOYByPercentage(t){return this.t=t,this}setChildOXByPercentage(t){return this.s=t,this}}Object.assign(MM.prototype,PM);const DM=["top","bottom","centerY","center"],LM=["left","right","centerX","center"];var AM=function(t,e,i){var s,r="Y"===(e=e.toUpperCase()),n=this.childrenMap.child;if(r){if(i)for(var a=0,o=DM.length;a=0?0:Math.abs(l)<=Math.abs(u)?l:u}}else{if(i)for(a=0,o=LM.length;a=0?0:Math.abs(c)<=Math.abs(d)?c:d}}switch(this.scrollMode){case 0:case 1:this.childOY+=s;break;default:this[`childO${e}`]+=s}};const RM=Phaser.Utils.Objects.GetValue;class BM extends gw{constructor(t,e){void 0===e&&(e={});var i=HC(e),s=RM(e,"panel",void 0);void 0===s&&(s={}),s.scrollMode=i,s.clampChildOY=RM(e,"clampChildOY",!1),s.clampChildOX=RM(e,"clampChildOX",!1);var r,n,a=new MM(t,s);switch(t.add.existing(a),i){case 0:r=RM(e,"expand.panel",!0),n=!0;break;case 1:r=!0,n=RM(e,"expand.panel",!0);break;default:r=!0,n=!0}e.type="rexScrollablePanel",e.child={gameObject:a,expandWidth:r,expandHeight:n,align:RM(e,"align.panel","center")};var o=RM(e,"space",void 0);o&&(o.child=RM(o,"panel",0)),super(t,e),this.addChildrenMap("panel",a.child),this.addChildrenMap("panelLayer",a.maskLayer),this.addChildrenMap("mask",a.maskGameObject),this.addChildrenMap("scrollableBlock",a)}setChildrenInteractive(t){return void 0===t&&(t={}),t.hasOwnProperty("eventEmitter")||(t.eventEmitter=this),t.hasOwnProperty("targets")||(t.targets=[this.childrenMap.panel]),Yv(this.childrenMap.child,t),this}}var FM={scrollToChild:function(t,e){if(!this.hasChild(t))return this;switch(this.scrollMode){case 0:AM.call(this,t,"y",e);break;case 1:AM.call(this,t,"x",e);break;default:AM.call(this,t,"y",e),AM.call(this,t,"x",e)}return this}};Object.assign(BM.prototype,FM);var IM={setBindingTarget(t){return this.childrenMap.panel.setBindingTarget(t),this}},jM={getMaxInputRowTitleWidth(){return this.childrenMap.panel.getMaxInputRowTitleWidth()+this.getInnerPadding("left")},setInputRowTitleWidth(t){return t-=this.getInnerPadding("left"),this.childrenMap.panel.setInputRowTitleWidth(t),this}};class zM extends BM{constructor(t,e){super(t,e),this.type="rexTweaker.Scrollable"}setTitle(t){var e=this.childrenMap.header;return t.title||t.icon?e.show().setTitle(t):e.hide(),this}}Object.assign(zM.prototype,IM,jM);const NM=Phaser.Utils.Objects.GetValue;const GM=Phaser.Utils.Objects.GetValue;const WM=Phaser.Utils.Objects.GetValue;var VM={setupBinding(){return this.childrenMap.inputField.on("valuechange",(function(t){this.autoUpdateEnable&&this.setTargetValue(t)}),this),this},setAutoUpdateEnable(t){return void 0===t&&(t=!0),this.autoUpdateEnable=t,this},setBindingTarget(t,e){this.bindingTarget=t,void 0!==e&&this.setBindingTargetKey(e),this.syncTargetValue();var i=this.childrenMap.inputField;return i.onBindTarget&&i.onBindTarget(t,e),this},setBindingTargetKey(t){return this.bindTargetKey=t,this},setValueCallbacks(t){return this.onGetValue=WM(t,"onGetValue"),this.onSetValue=WM(t,"onSetValue"),this},getTargetValue(){if(this.bindingTarget)return null!=this.bindTargetKey?this.bindingTarget[this.bindTargetKey]:this.onGetValue?this.onGetValue(this.bindingTarget):void 0},setTargetValue(t){return this.bindingTarget?null!=this.bindTargetKey?(this.bindingTarget[this.bindTargetKey]=t,this):(this.onSetValue&&this.onSetValue(this.bindingTarget,t),this):this},syncTargetValue(){if(!this.bindingTarget)return this;var t=this.childrenMap.inputField;return t.syncValue&&t.syncValue(this.getTargetValue()),this}},YM={startMonitorTarget(){return this.isMonitoring||(this.isMonitoring=!0,this.scene.events.on("postupdate",this.onMonitorTarget,this)),this},stopMonitorTarget(){return this.isMonitoring?(this.isMonitoring=!1,this.scene.events.off("postupdate",this.onMonitorTarget,this),this):this},onMonitorTarget(){if(this.bindingTarget){var t=this.getTargetValue(),e=this.childrenMap.inputField;e.value!==t&&e.syncValue(t)}}},XM={getMinTitleWidth(){var t=this.childrenMap.title;if(!t||0!==t.orientation)return 0;var e=t.rexSizer.padding;return this.getChildWidth(this.childrenMap.title)+(e.left+e.right)*t.scaleX+this.getInnerPadding("left")},setMinTitleWidth(t){var e=this.childrenMap.title;if(!e||0!==e.orientation)return this;var i=e.rexSizer.padding;return t-=(i.left+i.right)*e.scaleX,e.minWidth=t,this}};const HM=Phaser.Utils.Objects.GetValue;class $M extends xm{constructor(t,e){super(t,e),this.type="rexTweaker.InputRow",this.bindingTarget=void 0,this.bindTargetKey=void 0,this.autoUpdateEnable=!0;var i,s=e.inputTitle,r=e.inputField,n=e.background,a=HM(e,"proportion.title",0),o=HM(e,"space.title",0);i=0===this.orientation?{right:o}:{bottom:o},this.add(s,{proportion:a,expand:!0,padding:i});var h=r.defaultProportion;void 0===h&&(h=e.defaultExpandWidth?1:0);a=HM(e,"proportion.inputField",h);this.add(r,{proportion:a,expand:!0}),n&&this.addBackground(n),this.addChildrenMap("title",s),this.addChildrenMap("inputField",r),this.addChildrenMap("background",n),this.setupBinding()}destroy(t){this.scene&&!this.ignoreDestroy&&(this.stopMonitorTarget(),super.destroy(t))}setTitle(t){return this.childrenMap.title.setTitle(t),this}preLayout(){var t=this.childrenMap.title;t&&(t.minWidth=0),super.preLayout()}}Object.assign($M.prototype,VM,YM,XM);var UM=function(t,e,i){var s=new rE(t,i);return t.add.existing(s),s},KM=function(t){void 0===t&&(t=xm);return class extends t{get bindingTarget(){return this.getParentSizer().bindingTarget}get bindingKey(){return this.getParentSizer().bindTargetKey}get value(){return this._value}get root(){return this.getParentSizer().getParentSizer().root}onBindTarget(t,e){this.onBindTargetCallback&&this.onBindTargetCallback(this,t,e)}validate(t){return!(!this.syncValueFlag&&this.validateCallback)||this.validateCallback(t,this._value,this.bindingTarget,this.bindingKey)}getFotmatText(t){return t=this.textFormatCallback?this.textFormatCallback(t):t.toString()}set value(t){if(this._value!==t&&(this.validate(t)||(t=this._value),this.filterValueCallback&&(t=this.filterValueCallback(this,t)),this.displayValueCallback&&this.displayValueCallback(this,t),this._value!==t)){var e=this._value;if(this._value=t,!this.syncValueFlag){var i=this.bindingTarget,s=this.bindingKey;this.emit("valuechange",t,e,i,s),this.root.emit("valuechange",t,e,i,s)}}}getValue(){return this.value}setValue(t){return this.value=t,this}syncValue(t){return this.syncValueFlag=!0,this.value=t,this.syncValueFlag=!1,this}setup(t,e){return void 0===e&&(e=!1),(e||t.hasOwnProperty("format"))&&this.setTextFormatCallback(t.format),(e||t.hasOwnProperty("onValidate"))&&this.setValidateCallback(t.onValidate),this.setupCallback&&this.setupCallback(this,t,e),this}setSetupCallback(t){return this.setupCallback=t,this}setFilterValueCallback(t){return this.filterValueCallback=t,this}setDisplayValueCallback(t){return this.displayValueCallback=t,this}setOnBindTargetCallback(t){return this.onBindTargetCallback=t,this}setTextFormatCallback(t){return this.textFormatCallback=t,this}setValidateCallback(t){return this.validateCallback=t,this}}},qM=function(t,e,i){for(var s,r=this.inputHandlers,n=0,a=r.length;n0?0:1,0===n.minWidth&&n.setMinWidth(this.itemWidth)),0===n.minHeight&&n.setMinHeight(this.itemHeight),this.add(n,{proportion:r,expand:!0}));i.onValueChange&&n.childrenMap.inputField.on("valuechange",i.onValueChange);return n.setAutoUpdateEnable(i.autoUpdate),n.setBindingTarget(t,e),i.monitor&&n.startMonitorTarget(),i.key&&this.root.addChildrenMap(i.key,n),this},addButtons:function(t){void 0===t&&(t={});var e=this.scene,i=t.bindingTarget;delete t.bindingTarget;var s=iD(this.styles,"inputRow")||{},r=eD(e,t,s);return this.add(r,{expand:!0}),i&&r.setBindingTarget(i),t.key&&this.root.addChildrenMap(t.key,r),this},addButton:function(t){return void 0===t&&(t={}),t.buttons=[{label:t.label,callback:t.callback}],delete t.label,delete t.callback,this.addButtons(t),this},addSeparator:function(t){void 0===t&&(t={});var e=function(t,e,i){return sk(t,tE(e,i))}(this.scene,t,sD(this.styles,"separator"));return this.add(e,{expand:!0}),this},addRows:function(t,e,i){return"boolean"==typeof e&&(i=e,e=void 0),void 0===i&&(i=!0),rD(this,y(t),e,i),this},setBindingTarget:function(t){for(var e=this.sizerChildren,i=0,s=e.length;it.hasOwnProperty("view")?"string"===t.view:"string"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.TextInput";var s=e.inputText,r=Y_(i,s);t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))}},lD={setText(t){return this.childrenMap.child.setText(t),this},appendText(t){return this.setText(this.text+t),this}},uD={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const cD=Phaser.Utils.Objects.GetValue;class dD extends gw{constructor(t,e){void 0===e&&(e={});var i,s=cD(e,"text");fn(s)?i=s:(void 0===s&&(s={}),s.textArea=!0,i=new W_(t,s),t.add.existing(i)),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textVisibleHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.contentHeight}})}(i);var r=void 0===s.width,n=void 0===s.height;r&&(i.minWidth=0),n&&(i.minHeight=0),e.scrollMode=0,e.type="rexTextAreaInput",e.child={gameObject:i,expandWidth:r,expandHeight:n};var a,o,h=cD(e,"space",void 0);h&&(h.child=cD(h,"text",0)),e.scroller=!1,super(t,e),this.addChildrenMap("text",i),i.on("cursorin",(function(){var t=i.textOY,e=i.contentHeight,s=a!==t,r=o!==e;a=t,o=e,r&&this.resizeController(),(s||r)&&(this.t=i.t)}),this),i.on("textchange",(function(t){this.emit("textchange",t,this)}),this).on("close",(function(){this.emit("close",this.text,this)}),this);var l=cD(e,"content",void 0);l&&this.setText(l)}get text(){return this.childrenMap.child.text}set text(t){t=null==t?"":t.toString(),this.childrenMap.child.text!==t&&this.setText(t)}get lineHeight(){return this.childrenMap.child.lineHeight}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.contentHeight}get readOnly(){return this.childrenMap.child.readOnly}set readOnly(t){this.childrenMap.child.readOnly=t}setReadOnly(t){return this.childrenMap.child.setReadOnly(t),this}get value(){return this.text}set value(t){this.text=t}}Object.assign(dD.prototype,lD,uD);var pD={name:"TextAreaInput",accept:t=>!!t.hasOwnProperty("view")&&"textarea"===t.view,build(t,e){var i=t.scene;this.type="rexTweaker.TextAreaInput";var s=e.inputTextArea;void 0===s&&(s={}),s.hasOwnProperty("text")||(s.text=e.inputText),s.hasOwnProperty("slider")||(s.slider=e.slider);var r=function(t,e,i){void 0===i&&(i=!0),i?e=e?y(e):{}:e||(e={});var s=new dD(t,e);return t.add.existing(s),s}(i,s);t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))},onBindTarget(t){t.childrenMap.inputText.scrollToTop()}},gD={name:"NumberInput",accept:t=>t.hasOwnProperty("view")?"number"===t.view:"number"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.NumberInput";var s=e.inputNumber||e.inputText,r=Y_(i,s).setNumberInput();t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly),t.isFloatType=!e.int},filterValue:(t,e)=>t.isFloatType?e:Math.floor(e),displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))}};const fD=Phaser.Utils.Objects.GetValue,vD=Phaser.Math.Linear,mD=Phaser.Math.Snap.Floor;var yD={name:"RangeInput",accept:t=>t.hasOwnProperty("view")?"range"===t.view:"number"==typeof t.value&&t.hasOwnProperty("min")&&t.hasOwnProperty("max"),build(t,e){var i=t.scene;t.type="rexTweaker.RangeInput";var s=e.slider,r=0===t.orientation?"track.height":"track.width",n=fD(s,r),a=function(t,e){var i=new jS(t,e);return t.add.existing(i),i}(i,s),o=e.defaultExpandWidth?2:0,h=fD(e,"proportion.range.slider",o),l=void 0===n;t.add(a,{proportion:h,expand:l,key:"slider"});var u=e.inputNumber||e.inputText,c=Y_(i,u).setNumberInput();o=e.defaultExpandWidth?1:0,h=fD(e,"proportion.range.inputText",o);t.add(c,{proportion:h,expand:!0,key:"inputText"}),c.on("close",(function(){t.setValue(c.value)})),a.on("valuechange",(function(){var e=vD(t.minValue,t.maxValue,a.value);t.step&&(e=mD(e,t.step,t.minValue)),t.setValue(e)}))},setup(t,e,i){(i||e.hasOwnProperty("max"))&&function(t,e,i,s){t.minValue=e,t.maxValue=i,t.step=s,t.childrenMap.slider.setGap(s,e,i)}(t,e.min,e.max,e.step),(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.slider.setValue(e,t.minValue,t.maxValue),t.childrenMap.inputText.setText("").setText(t.getFotmatText(e))}},bD=function(t,e){var i=new FP(t,e);return t.add.existing(i),i};const xD=Phaser.Utils.Objects.GetValue;var kD={name:"RangeInput",accept:t=>!!t.hasOwnProperty("view")&&"incdec"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.IncDecInput";var s=xD(e,"incDec")||{},r={text:null,action:null},n=bD(i,{expand:!1}),a=e.defaultExpandWidth?1:0;t.add(n,{proportion:a,expand:!0});var o=e.inputNumber||e.inputText,h=Y_(i,o).setNumberInput();h.on("close",(function(){t.setValue(h.value)}));var l=Object.assign(y(r),s.incButton||{}),u=PO(i,l),c=Object.assign(y(r),s.decButton||{}),d=PO(i,c);n.addButton(u),n.addButton(d);var p=s.inputTextIndex||0;n.insert(p,h,{proportion:1,expand:!0}),t.step=1,t.minValue=void 0,t.maxValue=void 0,n.on("button.click",(function(e,i,s,r){var n=t.value;0===i?n+=t.step:n-=t.step,void 0!==t.maxValue&&n>t.maxValue&&(n=t.maxValue),void 0!==t.minValue&&n0&&{height:this.colorComponentsHeight,formatLabel:this.colorComponentsFormatLabelConfig,inputText:this.colorComponentsInputTextConfig,space:this.colorComponentsSpace};var a=new gL(t,{width:s,height:n,background:e,space:this.colorPickerSpace,hPalette:{position:this.colorPickerHPalettePosition},colorComponents:r,value:this.value});return t.add.existing(a),a};const vL=Phaser.Utils.Objects.GetValue;var mL=function(t,e){var i=vL(e,"expandDirection",void 0);"string"==typeof i&&(i=yL[i]);var s,r,n,a,o,h,l,u=(n="alignTargetX",tt(s=e,r="alignTarget")?Q(s,r):n&&tt(s,n)?Q(s,n):a&&tt(s,a)?Q(s,a):o),c=vL(e,"alignTargetY",u),d=vL(e,"alignOffsetX",0),p=vL(e,"alignOffsetY",0),g=vL(e,"alignSide","").includes("right"),f=vL(e,"bounds"),v=0===i,m=!v&&!(1===i),y=g?1:0,b=v||m?0:1;t.setOrigin(y,b),h=g?u.getTopRight().x:u.getTopLeft().x,l=c.getBottomLeft().y,t.setPosition(h+d,l+p);var x=f;x||(x=un(t.scene)),m&&t.getBottomLeft().y>x.bottom&&(l=c.getTopLeft().y,t.setOrigin(0,1).setPosition(h+d,l+p))};const yL={down:0,up:1},bL=Phaser.Utils.Objects.GetValue;class xL extends Ag{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=function(t,e){Bp(t,e,"y","Cubic")}),null==e.transitOut&&(e.transitOut=function(t,e){!function(t,e,i,s,r){void 0===s&&(s="Linear");var n={mode:0};switch(i){case 0:case"x":n.end={x:0};break;case 1:case"y":n.end={y:0};break;default:n.end=0}n.duration=e,n.ease=s,void 0===r?r=new Ap(t,n):r.resetFromJSON(n),r.restart()}(t,e,"y","Linear")}),e.manualClose=!0,e.clickOutsideClose=!0,e.destroy=!0,super(t,e),mL(t,e),t.isRexSizer&&t.layout();var i=bL(e,"touchOutsideClose",!1),s=bL(e,"anyTouchClose",!1);s&&(i=!1),s?this.once("open",this.anyTouchClose,this):i&&this.once("open",this.touchOutsideClose,this),this.requestOpen()}shutdown(t){this.isShutdown||(this.scene.input.off("pointerup",this.touchCloseCallback,this),super.shutdown(t))}touchOutsideClose(){return this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Yg(this.parent,t.worldX,t.worldY)||this.requestClose()}onOpen(){this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.parent,this),super.onClose()}}var kL={openColorPicker:function(){if(!this.colorPicker){var t=fL.call(this).layout(),e=new xL(t,{duration:{in:this.colorPickerEaseInDuration,out:this.colorPickerEaseOutDuration},transitIn:this.colorPickerTransitInCallback,transitOut:this.colorPickerTransitOutCallback,expandDirection:this.colorPickerExpandDirection,alignTargetX:this,alignTargetY:this,bounds:this.colorPickerBounds,touchOutsideClose:!0}).on("open",(function(){t.on("valuechange",(function(t){this.setValue(t)}),this)}),this).on("close",(function(){this.colorPicker=void 0,this.dropDownBehavior=void 0}),this);return this.colorPicker=t,this.dropDownBehavior=e,this.pin(t),this}}};Object.assign(kL,BD);const CL=Phaser.Utils.Objects.GetValue;class SL extends RD{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexColorInput",e.hasOwnProperty("colorPicker")||(e.colorPicker={background:{color:0}});var i=e.colorPicker,s=!1!==i&&null!==i;if(s){var r;this.setColorPickerSize(CL(i,"width",160),CL(i,"height",170));var n=CL(i,"background");r=n?function(t){return sk(t,n)}:CL(i,"createBackgroundCallback"),this.setCreateColorPickerBackgroundCallback(r),this.setColorPickerHPalettePosition(CL(i,"hPalettePosition",0)),this.setColorPickerExpandDirection(CL(i,"expandDirection")),this.setColorPickerEaseInDuration(CL(i,"easeIn",200)),this.setColorPickerEaseOutDuration(CL(i,"easeOut",200)),this.setColorPickerTransitInCallback(CL(i,"transitIn")),this.setColorPickerTransitOutCallback(CL(i,"transitOut")),this.setColorPickerBounds(CL(i,"bounds"));var a=CL(i,"space");void 0===a&&(a={left:10,right:10,top:10,bottom:10,item:8}),this.setColorPickerSpace(a)}var o=e.colorComponents;if(s&&(!1!==o&&null!==o)){this.setColorComponentsHeight(CL(o,"height",30)),this.setColorComponentsFormatLabelConfig(CL(o,"formatLabel"));var h=CL(o,"inputText");h||(h=CL(e,"inputText")),this.setColorComponentsInputTextConfig(h);var l=CL(o,"space");void 0===l&&(l={item:8}),this.setColorComponentsSpace(l)}var u=this.childrenMap.swatch;u&&s&&this.onClick(u,this.openColorPicker,this)}}Object.assign(SL.prototype,kL);var wL={name:"ColorInput",accept:t=>!!t.hasOwnProperty("view")&&"color"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.ColorInput";var s=e.colorInput;void 0===s&&(s={}),s.hasOwnProperty("inputText")||(s.inputText=e.inputText);var r=function(t,e,i){void 0===i&&(i=!0),i?e=e?y(e):{}:e||(e={});var s=new SL(t,e);return t.add.existing(s),s}(i,s);t.add(r,{proportion:1,expand:!0,key:"colorInput"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.colorInput.setValue(e)}},TL={setBoxFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.boxFillColor!==t||this.boxFillAlpha!==e,this.boxFillColor=t,this.boxFillAlpha=e,this},setUncheckedBoxFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.uncheckedBoxFillColor!==t||this.uncheckedBoxFillAlpha!==e,this.uncheckedBoxFillColor=t,this.uncheckedBoxFillAlpha=e,this},setBoxStrokeStyle(t,e,i){return void 0===i&&(i=1),this.dirty=this.dirty||this.boxLineWidth!==t||this.boxStrokeColor!==e||this.boxStrokeAlpha!==i,this.boxLineWidth=t,this.boxStrokeColor=e,this.boxStrokeAlpha=i,this},setUncheckedBoxStrokeStyle(t,e,i){return void 0===i&&(i=1),this.dirty=this.dirty||this.uncheckedBoxLineWidth!==t||this.uncheckedBoxStrokeColor!==e||this.uncheckedBoxStrokeAlpha!==i,this.uncheckedBoxLineWidth=t,this.uncheckedBoxStrokeColor=e,this.uncheckedBoxStrokeAlpha=i,this},setCheckerStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.checkerColor!==t||this.checkAlpha!==e,this.checkerColor=t,this.checkAlpha=e,this},setBoxShape(t){return void 0===t&&(t=!1),this.isCircleShape===t||(this.isCircleShape=t,this.isSizeChanged=!0,this.dirty=!0),this}},PL={setBoxSize(t){return this.dirty=this.dirty||this.boxSize!==t,this.boxSize=t,this},setCheckerSize(t){return this.dirty=this.dirty||this.checkerSize!==t,this.checkerSize=t,this}},OL={buildShapes(){this.addShape((new Yu).setName("box")).addShape((new Gu).setName("checker"))},updateShapes(){var t=this.width/2,e=this.height/2,i=Math.min(t,e),s=2*i,r=t-i,n=e-i,a=this.boxLineWidth,o=Math.max(s/10,2),h=this.getShape("box"),l=this.getShape("checker");if(this.isSizeChanged){var u=s*(1-this.boxSize)/2,c=a/2,d=s*this.boxSize-a;h.setTopLeftPosition(r+c+u,n+c+u).setSize(d,d),this.isCircleShape?h.setRadius(d/2):h.setRadius(0);u=s*(1-this.checkerSize)/2;var p=s*this.checkerSize/4,g=1*p,f=2*p,v=3*p;l.startAt(g,f).lineTo(f,v).lineTo(v,g).offset(r+u,n+u).end()}this.checked?(h.fillStyle(this.boxFillColor,this.boxFillAlpha).lineStyle(a,this.boxStrokeColor,this.boxStrokeAlpha),l.lineStyle(o,this.checkerColor)):(h.fillStyle(this.uncheckedBoxFillColor,this.uncheckedBoxFillAlpha).lineStyle(a,this.uncheckedBoxStrokeColor,this.uncheckedBoxStrokeAlpha),l.lineStyle()),this.checked&&l.setDisplayPathSegment(this.checkerAnimProgress)}},_L={setCheckerAnimationDuration(t){return void 0===t&&(t=0),this.checkerAnimDuration=t,this},playCheckerAnimation(){return void 0===this.checkerAnimProgressTask&&(this.checkerAnimProgressTask=new ul(this,{eventEmitter:null})),this.checkerAnimProgressTask.restart({key:"checkerAnimProgress",from:0,to:1,duration:this.checkerAnimDuration}),this},stopCheckerAnimation(){return void 0===this.checkerAnimProgressTask||this.checkerAnimProgressTask.stop(),this}},EL={};Object.assign(EL,TL,PL,OL,_L);const ML=23730,DL=Phaser.Utils.Objects.GetValue,LL=Phaser.Utils.Objects.IsPlainObject;class AL extends eu{constructor(t,e,i,s,r,n,a){LL(e)?(e=DL(a=e,"x",0),i=DL(a,"y",0),s=DL(a,"width",2),r=DL(a,"height",2),n=DL(a,"color",ML)):LL(n)&&(n=DL(a=n,"color",ML)),super(t,e,i,s,r),this.type="rexCheckbox",void 0===n&&(n=ML),this.setBoxShape(DL(a,"circleBox",!1)),this.setBoxFillStyle(n,DL(a,"boxFillAlpha",1)),this.setUncheckedBoxFillStyle(DL(a,"uncheckedColor",null),DL(a,"uncheckedBoxFillAlpha",1)),this.setBoxStrokeStyle(DL(a,"boxLineWidth",4),DL(a,"boxStrokeColor",n),DL(a,"boxStrokeAlpha",1)),this.setUncheckedBoxStrokeStyle(this.boxLineWidth,DL(a,"uncheckedBoxStrokeColor",this.boxStrokeColor),DL(a,"uncheckedBoxStrokeAlpha",this.boxStrokeAlpha)),this.setCheckerStyle(DL(a,"checkerColor",16777215),DL(a,"checkerAlpha",1)),this.setBoxSize(DL(a,"boxSize",1)),this.setCheckerSize(DL(a,"checkerSize",1)),this.setCheckerAnimationDuration(DL(a,"animationDuration",150)),this.buildShapes();var o=DL(a,"checked");void 0===o&&(o=DL(a,"value",!1)),this.setValue(o)}get value(){return this._value}set value(t){t=!!t,this._value!==t&&(this.dirty=!0,this._value=t,t?this.playCheckerAnimation():this.stopCheckerAnimation(),this.emit("valuechange",t))}setValue(t){return this.value=t,this}toggleValue(){return this.setValue(!this.value),this}get checked(){return this.value}set checked(t){this.value=t}setChecked(t){return void 0===t&&(t=!0),this.setValue(t),this}toggleChecked(){return this.toggleValue(),this}get checkerAnimProgress(){return this._checkerAnimProgress}set checkerAnimProgress(t){this._checkerAnimProgress!==t&&(this._checkerAnimProgress=t,this.dirty=!0)}}Object.assign(AL.prototype,EL);const RL=Phaser.Utils.Objects.GetValue,BL=Phaser.Utils.Objects.IsPlainObject;class FL extends AL{constructor(t,e,i,s,r,n,a){BL(e)?(e=RL(a=e,"x",0),i=RL(a,"y",0),s=RL(a,"width",2),r=RL(a,"height",2),n=RL(a,"color",ML)):BL(n)&&(n=RL(a=n,"color",ML)),super(t,e,i,s,r,n,a),this._click=new df(this,RL(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(RL(a,"readOnly",!1))}get readOnly(){return!this._click.enable}set readOnly(t){this._click.enable=!t}setReadOnly(t){return void 0===t&&(t=!0),this.readOnly=t,this}}var IL={name:"CheckboxInput",accept:t=>t.hasOwnProperty("view")?"boolean"===t.view:"boolean"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.CheckboxInput";var s=e.checkbox,r=function(t,e){var i=new FL(t,e);return t.add.existing(i),i}(i,s),n=s.size;void 0!==n&&r.setSize(n,n);var a=void 0!==n?0:1;t.add(r,{proportion:0,expand:!1,fitRatio:a,key:"checkbox"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.checkbox.setValue(e)}},jL={setTrackFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.trackFillColor!==t||this.trackFillAlpha!==e,this.trackFillColor=t,this.trackFillAlpha=e,this},setFalseValueTrackFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.falseValueTrackColor!==t||this.uncheckedTrackFillAlpha!==e,this.falseValueTrackColor=t,this.falseValueTrackFillAlpha=e,this},setThumbStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.thumbColor!==t||this.checkAlpha!==e,this.thumbColor=t,this.thumbAlpha=e,this}},zL={setTrackSize(t,e){return this.dirty=this.dirty||this.trackWidth!==t||this.trackHeight!==e,this.trackWidth=t,this.trackHeight=e,this},setTrackRadius(t){return this.dirty=this.dirty||this.trackRadius!==t,this.trackRadius=t,this},setThumbSize(t,e){return void 0===e&&(e=t),this.dirty=this.dirty||this.thumbWidth!==t||this.thumbHeight!==e,this.thumbWidth=t,this.thumbHeight=e,this},setThumbRadius(t){return this.dirty=this.dirty||this.thumbRadius!==t,this.thumbRadius=t,this}},NL={setThumbPosition(t,e){return void 0===e&&(e=1-t),this.thumbLeftX=t,this.thumbRightX=e,this},setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}},GL=function(t,e,i){return(e-t)*i+t};const WL=Phaser.Math.Linear;var VL={buildShapes(){this.addShape((new Yu).setName("track")).addShape((new Yu).setName("thumb"))},updateShapes(){var t=this.width,e=this.height,i=this.value?this.toggleAnimProgress:1-this.toggleAnimProgress,s=this.getShape("track");if(this.isSizeChanged){var r=t*this.trackWidth,n=e*this.trackHeight,a=(t-r)/2,o=(e-n)/2,h=e*this.trackRadius;s.setTopLeftPosition(a,o).setSize(r,n).setRadius(h)}var l,u,c,d=(l=this.falseValueTrackColor,u=this.trackFillColor,c=i,(255&GL(yr(l),yr(u),c))<<16|(255&GL(br(l),br(u),c))<<8|255&GL(xr(l),xr(u),c)),p=WL(this.falseValueTrackFillAlpha,this.trackFillAlpha,i);s.fillStyle(d,p);var g=this.getShape("thumb");if(this.isSizeChanged){var f=t*this.thumbWidth,v=e*this.thumbHeight,m=e*this.thumbRadius;g.setSize(f,v).setRadius(m)}var y=WL(this.thumbLeftX,this.thumbRightX,i)*t;this.rtl&&(y=t-y);var b=e/2;g.setCenterPosition(y,b),g.fillStyle(this.thumbColor,this.thumbAlpha)}},YL={setToggleAnimationDuration(t){return void 0===t&&(t=0),this.toggleAnimDuration=t,this},playToggleAnimation(){return void 0===this.toggleAnimProgressTask&&(this.toggleAnimProgressTask=new ul(this,{eventEmitter:null})),this.toggleAnimProgressTask.restart({key:"toggleAnimProgress",from:0,to:1,duration:this.toggleAnimDuration}),this},stopToggleAnimation(){return void 0===this.toggleAnimProgressTask||this.toggleAnimProgressTask.stop(),this}},XL={};Object.assign(XL,jL,zL,NL,VL,YL);const HL=Phaser.Utils.Objects.GetValue,$L=Phaser.Utils.Objects.IsPlainObject,UL=23730;class KL extends eu{constructor(t,e,i,s,r,n,a){$L(e)?(e=HL(a=e,"x",0),i=HL(a,"y",0),s=HL(a,"width",2),r=HL(a,"height",2),n=HL(a,"color",UL)):$L(n)&&(n=HL(a=n,"color",UL)),super(t,e,i,s,r),this.type="rexToggleSwitch",void 0===n&&(n=UL),this.setTrackFillStyle(n,HL(a,"trackFillAlpha",1)),this.setFalseValueTrackFillStyle(HL(a,"falseValueTrackColor",function(t){var e=.3*yr(t)+.59*br(t)+.11*xr(t);return(255&e)<<16|(255&e)<<8|255&e}(n)),HL(a,"falseValueTrackFillAlpha",1)),this.setThumbStyle(HL(a,"thumbColor",16777215),HL(a,"thumbAlpha",1)),this.setTrackSize(HL(a,"trackWidth",.9),HL(a,"trackHeight",.5)),this.setTrackRadius(HL(a,"trackRadius",.5*this.trackHeight));var o=HL(a,"thumbHeight",void 0),h=HL(a,"thumbWidth",o);void 0===h&&(h=.9*this.trackHeight),this.setThumbSize(h,o),this.setThumbRadius(HL(a,"thumbRadius",.5*this.thumbHeight)),this.setThumbPosition(HL(a,"thumbLeft",.3),HL(a,"thumbRight",void 0)),this.setRTL(HL(a,"rtl",!1)),this.setToggleAnimationDuration(HL(a,"animationDuration",150)),this.buildShapes(),this.setValue(HL(a,"value",!1),0)}get value(){return this._value}set value(t){t=!!t,this._value!==t&&(this.dirty=!0,this._value=t,this.playToggleAnimation(),this.emit("valuechange",t))}setValue(t,e){void 0===e&&(e=this.toggleAnimDuration);var i=this.toggleAnimDuration;return this.toggleAnimDuration=e,this.value=t,this.toggleAnimDuration=i,this}toggleValue(t){return this.setValue(!this.value,t),this}get toggleAnimProgress(){return this._toggleAnimProgress}set toggleAnimProgress(t){this._toggleAnimProgress!==t&&(this._toggleAnimProgress=t,this.dirty=!0)}}Object.assign(KL.prototype,XL);const qL=Phaser.Utils.Objects.GetValue;class JL extends KL{constructor(t,e,i,s,r,n,a){super(t,e,i,s,r,n,a),this._click=new df(this,qL(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(qL(a,"readOnly",!1))}get readOnly(){return!this._click.enable}set readOnly(t){this._click.enable=!t}setReadOnly(t){return void 0===t&&(t=!0),this.readOnly=t,this}}var ZL={name:"ToggleSwitchInput",accept:t=>!!t.hasOwnProperty("view")&&"toggleSwitch"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.ToggleSwitchInput";var s=e.toggleSwitch,r=function(t,e){var i=new JL(t,e);return t.add.existing(i),i}(i,s),n=s.size;void 0!==n&&r.setSize(n,n);var a=void 0!==n?0:1;t.addSpace().add(r,{proportion:0,expand:!1,fitRatio:a,key:"toggleSwitch"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.toggleSwitch.setValue(e)}},QL={setWrapEnable(t){return void 0===t&&(t=!0),this.listWrapEnable=t,this},setCreateButtonCallback(t){return this.listCreateButtonCallback=t,this},setCreateListBackgroundCallback(t){return this.listCreateBackgroundCallback=t,this},setCreateListSliderTrackCallback(t){return this.listCreateSliderTrackCallback=t,this},setCreateListSliderThumbCallback(t){return this.listCreateSliderThumbCallback=t,this},setListSliderAdaptThumbSizeEnable(t){return void 0===t&&(t=!0),this.listSliderAdaptThumbSizeEnable=t,this},setListScrollerConfig(t){return void 0===t&&(t={}),this.listScrollerConfig=t,this},setListMouseWheelScrollerConfig(t){return this.listMouseWheelScrollerConfig=t,this},setButtonClickCallback(t){return this.listOnButtonClick=t,this},setButtonOverCallback(t){return this.listOnButtonOver=t,this},setButtonOutCallback(t){return this.listOnButtonOut=t,this},setListExpandDirection(t){return"string"==typeof t&&(t=tA[t]),this.listExpandDirection=t,this},setListEaseInDuration(t){return void 0===t&&(t=0),this.listEaseInDuration=t,this},setListEaseOutDuration(t){return void 0===t&&(t=0),this.listEaseOutDuration=t,this},setListTransitInCallback(t){return this.listTransitInCallback=t,this},settListTransitOutCallback(t){return this.listTransitOutCallback=t,this},setListBounds(t){return this.listBounds=t,this},setListWidth(t){return this.listWidth=t,this},setListHeight(t){return this.listHeight=t,this},setListSize(t,e){return this.setListWidth(t).setListHeight(e),this},setListMaxHeight(t){return this.listMaxHeight=t,this},setListAlignmentMode(t){return this.listAlignMode=t,this},setListAlignmentSide(t){return void 0===t&&(t=""),this.listAlignSide=t,this},setListSpace(t){return void 0===t&&(t={}),this.listSpace=t,this},setListDraggable(t){return void 0===t&&(t=!0),this.listDraggable=t,this}};const tA={down:0,up:1},eA=Phaser.Utils.Objects.GetValue;var iA=function(){var t,e=this.scene,i=this.listCreateBackgroundCallback;i&&(t=i.call(this,e),e.add.existing(t));var s=[],r=this.listCreateButtonCallback;if(r)for(var n=this.options,a=0,o=n.length;a0||this.listMaxHeight>0)){s=sA(e,d,this.listWrapEnable);if(this.listMaxHeight>0&&(s.layout(),s.height<=this.listMaxHeight&&(u=s)),!u){0===c&&(c=this.listMaxHeight);var p=rA(e,this.listCreateSliderTrackCallback),g=rA(e,this.listCreateSliderThumbCallback);u=new BM(e,{height:c,scrollMode:0,panel:{child:s,mask:{padding:1}},slider:{track:p,thumb:g,adaptThumbSize:this.listSliderAdaptThumbSizeEnable},scrollDetectionMode:1,scroller:this.listScrollerConfig,mouseWheelScroller:this.listMouseWheelScrollerConfig,space:{panel:eA(this.listSpace,"panel",0)}}),e.add.existing(u)}}else d.height=c,s=sA(e,d,this.listWrapEnable),u=s;return t&&u.addBackground(t,"background"),this.listDraggable&&u.setDraggable(!0),u!==s&&s.on("button.over",(function(t,e,i,s){u.emit("button.over",t,e,i,s)})).on("button.out",(function(t,e,i,s){u.emit("button.out",t,e,i,s)})).on("button.click",(function(t,e,i,s){u.emit("button.click",t,e,i,s)})),u},sA=function(t,e,i){var s;return i?(e.orientation="x",s=new lO(t,e)):(e.orientation="y",s=new FP(t,e)),t.add.existing(s),s},rA=function(t,e,i){var s;return e&&(s=e.call(i,t),t.add.existing(s)),s},nA={focusNextButton(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;void 0===e?t=0:t=(e+1)%this.listPanel.getButtons().length;return this.emitButtonOver(t),this},focusPrevButton(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;if(void 0===e)t=0;else{var i=this.listPanel.getButtons().length;t=(e-1+i)%i}return this.emitButtonOver(t),this}},aA={openListPanel:function(){if(this.listPanel)return this;if(0===this.options.length)return this;var t,e=iA.call(this);e.on("button.over",(function(t,i,s,r){this.currentOverIndex=i,this.listOnButtonOver&&this.listOnButtonOver.call(this,t,i,s,r),this.emit("button.over",this,e,t,i,s,r)}),this).on("button.out",(function(t,i,s,r){this.currentOverIndex===i&&(this.currentOverIndex=void 0),this.listOnButtonOut&&this.listOnButtonOut.call(this,t,i,s,r),this.emit("button.out",this,e,t,i,s,r)}),this),t=this.listAlignMode&&"label"!==this.listAlignMode?this.getElement(this.listAlignMode):this;var i=new xL(e,{duration:{in:this.listEaseInDuration,out:this.listEaseOutDuration},transitIn:this.listTransitInCallback,transitOut:this.listTransitOutCallback,expandDirection:this.listExpandDirection,alignTargetX:t,alignTargetY:this,alignSide:this.listAlignSide,bounds:this.listBounds}).on("open",(function(){e.on("button.click",(function(t,i,s,r){this.listOnButtonClick&&this.listOnButtonClick.call(this,t,i,s,r),this.emit("button.click",this,e,t,i,s,r),this.dropDownBehavior.requestClose()}),this),this.emit("list.open",this,e)}),this).on("close",(function(){this.listPanel=void 0,this.dropDownBehavior=void 0,this.emit("list.close",this)}),this);return e.onClickOutside((function(){i.requestClose()})),this.listPanel=e,this.dropDownBehavior=i,this.pin(e),this},closeListPanel:function(){return this.dropDownBehavior?(this.dropDownBehavior.requestClose(),this.currentOverIndex=void 0,this):this},toggleListPanel:function(){return this.listPanel?this.closeListPanel():this.openListPanel(),this},emitButtonClick:function(t){if(void 0===t&&(t=this.currentOverIndex),void 0===t)return this;var e=this.listPanel,i=e?e.getButton(t):this.options[t];return this.listOnButtonClick&&this.listOnButtonClick.call(this,i,t),this.emit("button.click",this,e,i,t),this},emitButtonOver:function(t){var e=this.listPanel;return e?(e.emitButtonOver(t),this):this}};Object.assign(aA,QL,nA);const oA=Phaser.Utils.Objects.GetValue;class hA extends WC{constructor(t,e){super(t,e),this.type="rexDropDownList",this.timer=void 0,this.listPanel=void 0,this.currentOverIndex=void 0,this.setOptions(oA(e,"options"));var i=oA(e,"list");this.setWrapEnable(oA(i,"wrap",!1)),this.setCreateButtonCallback(oA(i,"createButtonCallback")),this.setCreateListBackgroundCallback(oA(i,"createBackgroundCallback")),this.setCreateListSliderTrackCallback(oA(i,"createTrackCallback")),this.setCreateListSliderThumbCallback(oA(i,"createThumbCallback")),this.setListSliderAdaptThumbSizeEnable(oA(i,"sliderAdaptThumbSize",!1)),this.setListScrollerConfig(oA(i,"scroller")),this.setListMouseWheelScrollerConfig(oA(i,"mouseWheelScroller")),this.setButtonClickCallback(oA(i,"onButtonClick")),this.setButtonOverCallback(oA(i,"onButtonOver")),this.setButtonOutCallback(oA(i,"onButtonOut")),this.setListExpandDirection(oA(i,"expandDirection")),this.setListEaseInDuration(oA(i,"easeIn",500)),this.setListEaseOutDuration(oA(i,"easeOut",100)),this.setListTransitInCallback(oA(i,"transitIn")),this.settListTransitOutCallback(oA(i,"transitOut")),this.setListMaxHeight(oA(i,"maxHeight",0)),this.setListSize(oA(i,"width"),oA(i,"height",0)),this.setListAlignmentMode(oA(i,"alignParent","text")),this.setListAlignmentSide(oA(i,"alignSide","")),this.setListBounds(oA(i,"bounds")),this.setListSpace(oA(i,"space")),this.setListDraggable(oA(i,"draggable",!1)),this.setValueChangeCallback(oA(e,"setValueCallback"),oA(e,"setValueCallbackScope")),this.setValue(oA(e,"value")),this.onClick(this.toggleListPanel,this)}destroy(t){this.scene&&!this.ignoreDestroy&&(this.listPanel&&(this.listPanel.destroy(t),this.listPanel=void 0),super.destroy(t))}get isOpened(){return!!this.listPanel}setOptions(t){return void 0===t&&(t=[]),this.options=t,this}setValueChangeCallback(t,e){return this.valueChangeCallback=t,this.valueChangeCallbackScope=e,this}setValue(t){return this.value=t,this}get value(){return this._value}set value(t){if(this._value!==t){var e=this._value;this._value=t;var i=this.valueChangeCallback,s=this.valueChangeCallbackScope;i&&(s?i.call(s,this,t,e):i(this,t,e)),this.emit("valuechange",this,t,e)}}}Object.assign(hA.prototype,aA);var lA=function(t,e){e=function(t,e,i){void 0===i&&(i={});var s=(e=e?y(e):{}).label||e.button,r=e.button||e.label;delete e.label,delete e.button;var n=i.label||i.button||i,a=i.button||i.label||i,o=Iw(t,s,n);o.list=e.list||{},o.list.createButtonCallback=function(t,e){var i=PO(t,r,a).resetDisplayContent(e);return e.hasOwnProperty("value")&&(i.value=e.value),i};var h=e.track;h&&(o.list.createTrackCallback=function(t){return sk(t,h)},delete e.track);var l=e.thumb;return l&&(o.list.createThumbCallback=function(t){return sk(t,l)},delete e.thumb),o.list.onButtonOver=function(t,e,i,s){t.setHoverState&&t.setHoverState(!0)},o.list.onButtonOut=function(t,e,i,s){t.setHoverState&&t.setHoverState(!1)},o}(t,e);var i=new hA(t,e);return t.add.existing(i),i},uA=function(t,e){for(var i=0,s=t.length;it.hasOwnProperty("view")?"list"===t.view:t.hasOwnProperty("options"),build(t,e){var i=t.scene;t.type="rexTweaker.ListInput";var s=lA(i,e.list);t.add(s,{proportion:1,expand:!0,key:"list"}),s.on("button.click",(function(e,i,s,r,n,a){t.setValue(s.value)}))},setup(t,e,i){(i||e.hasOwnProperty("options"))&&function(t,e){t.childrenMap.list.setOptions(e)}(t,e.options)},displayValue(t,e){var i=t.childrenMap.list,s=function(t,e){var i=uA(t,e);if(null!=i)return t[i]}(i.options,e);i.resetDisplayContent(s).setMinSize(i.width,i.height).layout().setMinSize(0,0)}};const dA=Phaser.Utils.Objects.GetValue;var pA={name:"ButtonsInput",accept:t=>!!t.hasOwnProperty("view")&&"buttons"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.ButtonsInput";var s=e.button?y(e.button):{},r=dA(s,"expand",!0);r&&(s.align="center"),delete s.expand;var n=bD(i,{expand:r});n.buttonConfig=s,t.add(n,{proportion:1,expand:!0,key:"list"}),n.on("button.click",(function(e,i,s,r){var a=n.options[i];a&&(t._selectedIndex=i,t.setValue(a.value),t._selectedIndex=void 0)}))},setup(t,e,i){(i||e.hasOwnProperty("options"))&&function(t,e){var i=t.childrenMap.list;i.options=e;var s=t.scene,r=i.buttonConfig;i.clearButtons(!0);for(var n=0,a=e.length;n0?r.addScrollable():r).addRows(s,i,!0),r}(t,e,i,s)}}var mA={csv2md:function(t,e={}){"string"==typeof e&&(e={title:e});for(var i,s,r,{title:n}=e,a=lr.parse(t).data,o=!1,h=!1,l=[],u=0,c=a.length;u=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const T=Phaser.Math.DegToRad;var k={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=T(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},_={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=O(t.scaleX,i.scaleX),e.scaleY=O(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},E={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=O(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},L={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},D={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},z={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(t){void 0===t&&(t=!1);var e=this;return this._mask=null,this.setChildMaskVisible(this),this.children.forEach((function(t){t.clearMask&&t.clearMask(!1),t.hasOwnProperty("isRexContainerLite")||e.setChildMaskVisible(t)})),t&&this.mask&&this.mask.destroy(),this}},A=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},W=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const j=Phaser.Utils.Array;var I={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},_e=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const Ee=/(\S+)\[(\d+)\]/i,Me=Phaser.Utils.Objects.GetValue;var Re=function(t,e){return void 0===e?t:t[e]},Le=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Me(e,"left",0),t.right=Me(e,"right",0),t.top=Me(e,"top",0),t.bottom=Me(e,"bottom",0)),t},De={getInnerPadding(t){return Re(this.space,t)},setInnerPadding(t,e){return Le(this.space,t,e),this},getOuterPadding(t){return Re(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Le(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Re(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Le(this.getSizerConfig(t).padding,e,i),this}},ze=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Ae=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Ye=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Xe=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},We=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},Be=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},je={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Ie=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?mi:fi,this.repeatCounter=0,this}stop(){return this.state=gi,this}update(t,e){this.state!==gi&&this.state!==bi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=yi)):(this.nowTime=this.duration,this.state=bi):this.nowTime>=0&&(this.state=mi))}get t(){var t;switch(this.state){case gi:case fi:case yi:t=0;break;case mi:t=this.nowTime/this.duration;break;case bi:t=1}return pi(t,0,1)}set t(t){(t=pi(t,-1,1))<0?(this.state=fi,this.nowTime=-this.delay*t):(this.state=mi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===gi}get isDelay(){return this.state===fi}get isCountDown(){return this.state===mi}get isRunning(){return this.state===fi||this.state===mi}get isDone(){return this.state===bi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const gi=0,fi=1,mi=2,yi=3,bi=-1;class xi extends di{constructor(t,e){super(t,e),this.timer=new vi}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const Ci=Phaser.Utils.Objects.GetValue,Si=Phaser.Utils.Objects.GetAdvancedValue,wi=Phaser.Tweens.Builders.GetEaseFunction;class Oi extends xi{resetFromJSON(t){return this.timer.resetFromJSON(Ci(t,"timer")),this.setEnable(Ci(t,"enable",!0)),this.setTarget(Ci(t,"target",this.parent)),this.setDelay(Si(t,"delay",0)),this.setDuration(Si(t,"duration",1e3)),this.setEase(Ci(t,"ease","Linear")),this.setRepeat(Ci(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=wi(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Pi=Phaser.Utils.Objects.GetValue,Ti=Phaser.Utils.Objects.GetAdvancedValue,ki=Phaser.Math.Linear;let _i=class extends Oi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Pi(t,"mode",0)),this.setScaleRange(Ti(t,"start",void 0),Ti(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ei[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Ti(t,"x",this.parent.scaleX),this.startY=Ti(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Ti(e,"x",void 0),this.endY=Ti(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=ki(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=ki(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const Ei={stop:0,destroy:1,yoyo:2};var Mi=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new _i(t,a):r.resetFromJSON(a),r.restart(),r},Ri=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof _i&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new _i(t,h):n.resetFromJSON(h),n.restart(),n},Li=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Di=function(t){return Li(t,"complete")};const zi=Phaser.Utils.Objects.IsPlainObject;var Ai={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(zi(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Mi(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Di(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(zi(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Ri(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Di(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Di(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(zi(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new _i(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Di(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Yi={};Object.assign(Yi,Ai),Yi.onInitScale=function(){Ai.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=xe.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Xi=Phaser.Utils.Objects.GetValue,Wi=Phaser.Utils.Objects.GetAdvancedValue,Bi=Phaser.Math.Linear;class ji extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Xi(t,"mode",0)),this.setAlphaRange(Wi(t,"start",this.parent.alpha),Wi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ii[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Bi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ii={stop:0,destroy:1,yoyo:2},Fi=Phaser.Utils.Objects.IsPlainObject;var Ni=function(t,e,i,s){var r,n;Fi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new ji(t,h):s.resetFromJSON(h),s.restart(),s},Hi=function(t,e,i,s){i instanceof ji&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new ji(t,r):s.resetFromJSON(r),s.restart(),s};const Gi=Phaser.Utils.Objects.IsPlainObject;var Vi={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Gi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Ni(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Di(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Gi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Hi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Di(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Di(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Ui={};Object.assign(Ui,Vi),Ui.onInitFade=function(){Vi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=xe.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const $i=Phaser.Utils.Objects.GetValue,Ji=Phaser.Utils.Objects.GetAdvancedValue,Ki=Phaser.Math.Linear;class qi extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode($i(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ji(t,"x",void 0),i=Ji(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Zi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Ji(i,"startX",void 0),this.startY=Ji(i,"startY",void 0),this.endX=Ji(i,"endX",void 0),this.endY=Ji(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Ki(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ki(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Zi={stop:0,destroy:1,yoyo:2};var Qi=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const ts=Phaser.Utils.Objects.IsPlainObject,es=Phaser.Math.Distance.Between;var is={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(ts(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*es(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof qi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=Qi(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=Qi(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new qi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Di(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Di(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(ts(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*es(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof qi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=Qi(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=Qi(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new qi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Di(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Di(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},ss={};Object.assign(ss,is),ss.onInitEaseMove=function(){is.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=xe.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const rs=Phaser.Utils.Objects.GetValue;class ns extends ai{constructor(t,e){super(t,e),this.timer=new vi,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(rs(t,"timer")),this.setEnable(rs(t,"enable",!0)),this.setMode(rs(t,"mode",1)),this.isRunning=rs(t,"isRunning",!1),this.setMagnitudeMode(rs(t,"magnitudeMode",1)),this.setAxisMode(rs(t,"axis",0)),this.setDuration(rs(t,"duration",500)),this.setMagnitude(rs(t,"magnitude",10)),this.ox=rs(t,"ox",void 0),this.oy=rs(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=hs[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=os[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=as[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=rs(i,"magnitude",void 0),t=rs(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const hs={effect:0,behavior:1},as={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},os={constant:0,decay:1},ls=Phaser.Utils.Objects.IsPlainObject;var ds={shake(t,e,i){if(ls(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new ns(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Di(this._shake)}};const cs=Phaser.Utils.Objects.GetValue,us=Phaser.Math.Linear;class ps extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=cs(t,"key","value");var i=e[this.propertyKey];return this.fromValue=cs(t,"from",i),this.toValue=cs(t,"to",i),this.setEase(cs(t,"ease",this.ease)),this.setDuration(cs(t,"duration",this.duration)),this.setRepeat(cs(t,"repeat",0)),this.setDelay(cs(t,"delay",0)),this.setRepeatDelay(cs(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=us(this.fromValue,this.toValue,i)}}const vs=Phaser.Utils.Objects.IsPlainObject;class gs extends ii{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new ps(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(vs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(vs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var fs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new gs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Li(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},ms=Phaser.Utils.Array.Remove,ys={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var Ys={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=qe(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Xs={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=Xt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=Xt),this.transitOutCallback=t,this}},Ws={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Bs={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},js={};Object.assign(js,Ys,Xs,Ws,Bs);const Is=Phaser.Utils.Objects.GetValue;class Fs extends ii{constructor(t,e){super(t,e),this.setTransitInTime(Is(e,"duration.in",200)),this.setTransitOutTime(Is(e,"duration.out",200)),this.setTransitInCallback(Is(e,"transitIn")),this.setTransitOutCallback(Is(e,"transitOut")),this.oneShotMode=Is(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new As(this,{eventEmitter:!1,initState:Is(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Fs.prototype,js);var Ns=function(t){if(t.parentContainer)return Ns(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?Ns(e):t};class Hs extends ii{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Ns(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Gs=Phaser.GameObjects.Rectangle;let Vs=class extends Gs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Hs(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}};const Us=Phaser.Utils.Objects.GetValue;class $s extends ii{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Us(t,"hitAreaMode",0)),this.setEnable(Us(t,"enable",!0)),this.setStopMode(Us(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Js[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Js={default:0,fullWindow:1};const Ks=Phaser.Utils.Objects.GetValue;class qs extends Vs{constructor(t,e){super(t,Ks(e,"color",0),Ks(e,"alpha",.8)),this.touchEventStop=new $s(this,{hitAreaMode:1})}}var Zs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Mi(t,e)},scaleDown(t,e){Ri(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Ni(t,e)},fadeOut(t,e){Hi(t,e,!1)}},Qs=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Ni(t,e,t.alpha)},tr=function(t,e){Hi(t,e,!1)},er=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!nt(t,!0).contains(e,i)||r&&!r(t,e,i))};const ir=Phaser.Utils.Objects.GetValue;let sr=class extends Fs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=rr.popUp),null==e.transitOut&&(e.transitOut=rr.scaleDown),e.destroy=ir(e,"destroy",!0),super(t,e);var i=ir(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new qs(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(ir(i,"transitIn",Qs)),this.setCoverTransitOutCallback(ir(i,"transitOut",tr)));var s=ir(e,"touchOutsideClose",!1),r=ir(e,"duration.hold",-1),n=ir(e,"timeOutClose",r>=0),h=ir(e,"anyTouchClose",!1);ir(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),ir(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&er(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=rr[t]),t){case rr.popUp:t=Zs.popUp;break;case rr.fadeIn:t=Zs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=rr[t]),t){case rr.scaleDown:t=Zs.scaleDown;break;case rr.fadeOut:t=Zs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const rr={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var nr=function(t){return t&&"function"==typeof t},hr={modal(t,e){return nr(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new sr(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},ar=function(t,e,i,s,r){nr(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},or={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return ar.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return ar.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return ar.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return ar.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return ar.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return ar.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return ar.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return ar.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return ar.call(this,"shutdown",t,e,i,s),this}},lr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=dr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},dr={},cr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?er(t,e.x,e.y,i,s):!!(r=lr(e,n,!0))&&er(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const wr={press:0,pointerdown:0,release:1,pointerup:1};var Or={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new Sr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},Pr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!Tr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return kr.length=0,!0;return kr.length=0,!1},kr=[];const _r=Phaser.Utils.Objects.GetValue;class Er extends ii{constructor(t,e){super(t,e),this._enable=void 0;var i=_r(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(_r(t,"enable",!0)),this.setMode(_r(t,"mode",1)),this.setClickInterval(_r(t,"clickInterval",100)),this.setDragThreshold(_r(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Mr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?Pr:cr)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Mr={press:0,pointerdown:0,release:1,pointerup:1};var Rr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Er(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Lr extends zs{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Dr=Phaser.Utils.Objects.GetValue;class zr extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Lr,this.parent.setInteractive(Dr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Dr(t,"enable",!0)),this.setCooldown(Dr(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Ar={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&cr(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new zr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new zr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Yr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Xr=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Qr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===tn&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Qr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=en,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&cr(t,s,e,i)}}const Qr=0,tn=1,en="IDLE",sn=Phaser.Utils.Objects.GetValue,rn=Phaser.Math.Distance.Between;class nn extends Zr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=hn},eventEmitter:!1};this.setRecongizedStateObject(new zs(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(sn(t,"time",250)),this.setTapInterval(sn(t,"tapInterval",200)),this.setDragThreshold(sn(t,"threshold",9)),this.setTapOffset(sn(t,"tapOffset",10));var e=sn(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(sn(t,"maxTaps",void 0)),this.setMinTaps(sn(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case hn:this.state=an;break;case an:var t=this.lastPointer;rn(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=on,this.state=an);break;case on:this.state=an}}onDragEnd(){this.state===an&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=on))}onDrag(){this.state!==hn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=hn)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===an){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=hn):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=on:this.state=hn)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===on&&(this.state=hn)}get isTapped(){return this.state===on}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const hn="IDLE",an="BEGIN",on="RECOGNIZED",ln=Phaser.Utils.Objects.GetValue;class dn extends Zr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=cn},eventEmitter:!1};this.setRecongizedStateObject(new zs(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(ln(t,"threshold",9)),this.setHoldTime(ln(t,"time",251)),this}onDragStart(){this.state=un,0===this.holdTime&&(this.state=pn)}onDragEnd(){this.state=cn}onDrag(){this.state!==cn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=cn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===un&&t-this.pointer.downTime>=this.holdTime&&(this.state=pn)}get isPressed(){return this.state===pn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const cn="IDLE",un="BEGIN",pn="RECOGNIZED";Phaser.Utils.Objects.GetValue;var vn=function(t){return ti(t).loop.delta};const gn=Phaser.Math.Distance.Between,fn=Phaser.Math.Angle.Between;var mn={getDt:function(){return vn(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return gn(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return fn(e.x,e.y,t.x,t.y)}},yn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},bn={};const xn=Phaser.Utils.Objects.GetValue,Cn=Phaser.Math.RadToDeg;class Sn extends Zr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=wn},eventEmitter:!1};this.setRecongizedStateObject(new zs(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(xn(t,"threshold",10)),this.setVelocityThreshold(xn(t,"velocityThreshold",1e3)),this.setDirectionMode(xn(t,"dir","8dir")),this}onDragStart(){this.state=On}onDragEnd(){this.state=wn}onDrag(){this.state===On&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=Pn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Pn&&(this.state=wn)}get isSwiped(){return this.state===Pn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=yn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=bn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(Cn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(Sn.prototype,mn);const wn="IDLE",On="BEGIN",Pn="RECOGNIZED",Tn=Phaser.Utils.Objects.GetValue,kn=Phaser.Utils.Array.SpliceOne,_n=Phaser.Math.Distance.Between,En=Phaser.Math.Angle.Between;class Mn{constructor(t,e){var i=qe(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(Tn(e,"inputConfig",void 0)),this.setEventEmitter(Tn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(Tn(t,"enable",!0)),this.bounds=Tn(t,"bounds",void 0),this.tracerState=Ln,this.pointers.length=0,ft(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,ft(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case Ln:this.tracerState=Dn,this.onDrag1Start();break;case Dn:this.tracerState=zn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],kn(this.pointers,e),this.tracerState){case Dn:this.tracerState=Ln,this.onDrag1End();break;case zn:this.tracerState=Dn,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case Dn:this.onDrag1();break;case zn:this.onDrag2()}}}dragCancel(){return this.tracerState===zn&&this.onDrag2End(),this.pointers.length=0,ft(this.movedState),this.tracerState=Ln,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==zn)return 0;var t=this.pointers[0],e=this.pointers[1];return _n(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==zn)return 0;var t=this.pointers[0],e=this.pointers[1];return En(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Rn.x=e.x-i.x,Rn.y=e.y-i.y}else Rn.x=0,Rn.y=0;return Rn}get centerX(){if(this.tracerState!==zn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==zn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==zn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==zn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=An,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&cr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&cr(t,s,e,i)}}Object.assign(Mn.prototype,$e);var Rn={};const Ln=0,Dn=1,zn=2,An="IDLE";Phaser.Utils.Objects.GetValue;const Yn=Phaser.Math.RotateAround;var Xn=function(t,e,i,s){return Yn(t,e,i,s),t.rotation+=s,t},Wn={};const Bn=Phaser.Utils.Objects.GetValue,jn=Phaser.Math.Angle.WrapDegrees,In=Phaser.Math.Angle.ShortestBetween,Fn=Phaser.Math.RadToDeg,Nn=Phaser.Math.DegToRad;var Hn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Wn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=jn(Fn(this.angleBetween));this.angle=In(this.prevAngle,t),this.prevAngle=t,this.state=Un}break;case Un:t=jn(Fn(this.angleBetween)),this.angle=In(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Un}get rotation(){return Nn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Hn);const Gn="IDLE",Vn="BEGIN",Un="RECOGNIZED",$n=Phaser.Utils.Objects.GetValue;var Jn=function(t){var e=$n(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new nn(this,e),this._tap.on("tap",(function(t,e,s){Wr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Wr(i.eventEmitter,`${i.eventNamePrefix}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Kn=Phaser.Utils.Objects.GetValue;var qn=function(t){var e=Kn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new dn(this,e),this._press.on("pressstart",(function(t,e,s){Wr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this).on("pressend",(function(t,e,s){Wr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Zn=Phaser.Utils.Objects.GetValue;var Qn=function(t){var e=Zn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new Sn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Wr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Wr(i.eventEmitter,`${i.eventNamePrefix}swipe`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const th=Phaser.Utils.Objects.GetValue;var eh=function(t,e){return t.setInteractive(),th(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:th(e,"targets",[t]),targetMode:th(e,"targetMode","parent"),eventEmitter:th(e,"eventEmitter",t),eventNamePrefix:th(e,"inputEventPrefix","child.")},jr.call(t,e),Nr.call(t,e),Vr.call(t,e),Kr.call(t,e),Jn.call(t,e),qn.call(t,e),Qn.call(t,e),t},ih={getSizerConfig:function(t){return void 0===t&&(t=this),Mt(t)},getChildPrevState:function(t){var e=Mt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Dt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=oe(e,"color"),s=oe(e,"lineWidth");var o=oe(e,"name",!1);o&&(r=oe(o,"createTextCallback",ce),n=oe(o,"createTextCallbackScope",void 0),"string"==typeof(h=oe(o,"align","left-top"))&&(h=Yt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new le(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}var d,c,u=this.getAllShownChildren([this]);ue(u,u);for(var p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const ch=Phaser.Utils.Objects.IsPlainObject,uh=Phaser.Utils.Objects.GetValue,ph=Phaser.Display.Align.CENTER,vh={min:0,full:-1};var gh=function(t,e,i,s,r,n,h,a,o,l){var d,c,u,p;me.call(this,t);var v=t.isRexSpace,g=typeof e;if(null===e)return this;if("number"===g);else if("string"===g)e=vh[e];else if(ch(e)){var f;e=uh(f=e,"proportion",void 0),i=uh(f,"align",ph),s=uh(f,"padding",0),r=uh(f,"expand",!1),n=uh(f,"key",void 0),h=uh(f,"index",void 0),t.isRexSizer||(a=uh(f,"minWidth",void 0),o=uh(f,"minHeight",void 0)),l=uh(f,"fitRatio",0),d=uh(f,"offsetX",0),c=uh(f,"offsetY",0),u=uh(f,"offsetOriginX",0),p=uh(f,"offsetOriginY",0)}return"string"==typeof i&&(i=Yt[i]),void 0===e&&(e=v?1:0),void 0===i&&(i=ph),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(v?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(v?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),(f=this.getSizerConfig(t)).proportion=e,f.align=i,f.padding=ge(s),f.expand=r,f.fitRatio=0===e?l:0,f.alignOffsetX=d,f.alignOffsetY=c,f.alignOffsetOriginX=u,f.alignOffsetOriginY=p,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},fh={add:gh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),gh.call(this,new lh(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return ch(i)&&(i.index=t),gh.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=dh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const mh=Et.prototype.clear;var yh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),mh.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,yh.call(this,t),this}},Ch={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=Yt[e]),this.getSizerConfig(t).align=e,this}},Sh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},wh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},Oh={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},Ph={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(He(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Ie.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d,c,u=this.sizerChildren,p=this.innerLeft,v=this.innerTop,g=this.innerWidth,f=this.innerHeight,m=p,y=v,b=this.startChildIndex,x=0,C=u.length;x0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Xe.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Ae.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&ah.call(this,t,void 0),Ye.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||We.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&ah.call(this,void 0,t),Be.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(Ph,fh,xh,Ch,Sh,wh,Oh);var Th=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},kh={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},_h=function(t){return"string"==typeof t&&(t=kh[t]),t};const Eh=Phaser.Utils.Objects.IsPlainObject,Mh=Phaser.Utils.Objects.GetValue;class Rh extends rh{constructor(t,e,i,s,r,n,h){Eh(e)?(e=Mh(h=e,"x",0),i=Mh(h,"y",0),s=Mh(h,"width",void 0),r=Mh(h,"height",void 0),n=Mh(h,"orientation",0)):Eh(s)?(s=Mh(h=s,"width",void 0),r=Mh(h,"height",void 0),n=Mh(h,"orientation",0)):Eh(n)&&(n=Mh(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Mh(h,"space.item",0)),this.setStartChildIndex(Mh(h,"startChildIndex",0)),this.setRTL(Mh(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=_h(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=Th.call(this)),this._childrenProportion}}Object.assign(Rh.prototype,Ph);var Lh=function(t,e,i,s){if(void 0===i)i=0;else{var r=typeof i;"boolean"===r?(s=i,i=0):"string"===r&&(i=Dh[i])}void 0===s?s={}:!0===s&&(s=zh);var n=e.width/t.width,h=e.height/t.height,a=i?Math.max(n,h):Math.min(n,h);return s.width=t.width*a,s.height=t.height*a,s};const Dh={fit:0,FIT:0,envelop:1,ENVELOP:1};var zh={},Ah={},Yh={};const Xh=Phaser.Utils.Objects.IsPlainObject,Wh=Phaser.Utils.Objects.GetValue,Bh=Phaser.Display.Align.CENTER,jh=Phaser.Utils.String.UUID;var Ih={add:function(t,e,i,s,r,n,h,a,o,l){var d,c;me.call(this,t),Xh(e)&&(e=Wh(u=e,"key",void 0),i=Wh(u,"align",Bh),s=Wh(u,"padding",0),r=Wh(u,"expand",!0),t.isRexSizer||(n=Wh(u,"minWidth",t._minWidth),h=Wh(u,"minHeight",t._minHeighted)),a=Wh(u,"offsetX",0),o=Wh(u,"offsetY",0),d=Wh(u,"offsetOriginX",0),c=Wh(u,"offsetOriginY",0),l=Wh(u,"aspectRatio",0));var u,p=void 0!==e;return p||(e=jh()),"string"==typeof i&&(i=Yt[i]),void 0===i&&(i=Bh),void 0===s&&(s=0),void 0===r&&(r=!0),t.isRexSizer||(void 0===n&&(n=t._minWidth),void 0===h&&(h=t._minHeight)),void 0===a&&(a=0),void 0===o&&(o=0),void 0===d&&(d=0),void 0===c&&(c=0),void 0===l?l=0:!0===l&&(l=Q(t)/tt(t)),l>0&&(r=!0,void 0===n&&(n=0),void 0===h&&(h=0)),(u=this.getSizerConfig(t)).align=i,u.padding=ge(s),Xh(r)?(u.expandWidth=Wh(r,"width",!1),u.expandHeight=Wh(r,"height",!1)):(u.expandWidth=r,u.expandHeight=r),t.isRexSizer||(u.expandWidth&&(t.minWidth=void 0===n?Q(t):n),u.expandHeight&&(t.minHeight=void 0===h?tt(t):h)),u.alignOffsetX=a,u.alignOffsetY=o,u.alignOffsetOriginX=d,u.alignOffsetOriginY=c,u.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,p&&this.addChildrenMap(e,t),this}},Fh={remove(t,e){var i;if("string"==typeof t){if(i=t,!(t=this.sizerChildren[i]))return this}else{if(this.getParentSizer(t)!==this)return this;i=this.childToKey(t)}return i&&(delete this.sizerChildren[i],this.childrenMap.hasOwnProperty(i)&&delete this.childrenMap[i]),Oe.call(this,t,e),this},removeAll(t){for(var e in this.sizerChildren)this.remove(e,t);return this},clear(t){for(var e in this.sizerChildren)delete this.sizerChildren[e],this.childrenMap.hasOwnProperty(e)&&delete this.childrenMap[e];return yh.call(this,t),this}},Nh={getChildrenWidth:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var h in r)t=r[h],void 0===(i=this.getChildWidth(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).left+e.right)*this.scaleX,s=Math.max(i,s));return n?void 0:s+(this.space.left+this.space.right)*this.scaleX},getChildrenHeight:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var h in r)t=r[h],void 0===(i=this.getChildHeight(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).top+e.bottom)*this.scaleY,s=Math.max(i,s));return n?void 0:s+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(s.expandWidth){var r=e-(this.space.left+this.space.right)*this.scaleX,n=s.padding;i=r-(n.left+n.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(s.expandHeight){var r=e-(this.space.top+this.space.bottom)*this.scaleY,n=s.padding;i=r-(n.top+n.bottom)*this.scaleY}return i},getChildrenSizers:function(t){void 0===t&&(t=[]);var e,i=this.sizerChildren;for(var s in i)(e=i[s]).isRexSizer&&t.push(e);return t},layoutChildren:function(){var t,e,i,s,r,n,h,a,o,l,d,c,u=this.innerLeft,p=this.innerTop,v=this.innerWidth,g=this.innerHeight,f=this.sizerChildren;for(var m in f)(t=f[m]).rexSizer.hidden||(i=(e=t.rexSizer).padding,mr.call(this,t),l=this.getExpandedChildWidth(t),d=this.getExpandedChildHeight(t),e.aspectRatio>0&&(Ah.width=e.aspectRatio,Ah.height=1,Yh.width=l,Yh.height=d,l=(c=Lh(Ah,Yh,"FIT",!0)).width,d=c.height),t.isRexSizer?(t.runLayout(this,l,d),nh(t,this)):He(t,l,d),s=u+i.left*this.scaleX,n=v-(i.left+i.right)*this.scaleX,r=p+i.top*this.scaleY,h=g-(i.top+i.bottom)*this.scaleY,void 0===l&&(l=Q(t)),void 0===d&&(d=tt(t)),a=(e.alignOffsetX+e.alignOffsetOriginX*l)*this.scaleX,o=(e.alignOffsetY+e.alignOffsetOriginY*d)*this.scaleY,yr.call(this,t,s,r,n,h,e.align,a,o))}};Object.assign(Nh,Ih,Fh);const Hh=Phaser.Utils.Objects.IsPlainObject,Gh=Phaser.Utils.Objects.GetValue;class Vh extends rh{constructor(t,e,i,s,r,n){Hh(e)?(e=Gh(n=e,"x",0),i=Gh(n,"y",0),s=Gh(n,"width",void 0),r=Gh(n,"height",void 0)):Hh(s)&&(s=Gh(n=s,"width",void 0),r=Gh(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexOverlapSizer",this.sizerChildren={},this.addChildrenMap("items",this.sizerChildren)}childToKey(t){if("string"!=typeof t)return function(t,e){if(Array.isArray(t))return t.indexOf(e);for(var i in t)if(t[i]===e)return i;return null}(this.sizerChildren,t);var e=t;return this.sizerChildren.hasOwnPropery(e)?e:null}}Object.assign(Vh.prototype,Nh);const Uh=Rh.prototype.add,$h=Rh.prototype.addSpace;var Jh=function(t){var e=!t.isRexSpace,i=!e||this.buttonsExpand?1:0;if(0===this.sizerChildren.length)if(e){!this.buttonsExpand&&("right"===this.buttonsAlign||"center"===this.buttonsAlign||"bottom"===this.buttonsAlign)&&$h.call(this),Uh.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&$h.call(this),this.hasTailSpace=s}else Uh.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;Uh.call(this,t,{index:r,proportion:i,expand:!0})}else Uh.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},Kh={addButton(t){if(ur(t))for(var e=t,i=0,s=e.length;i=0;i--)Qh.call(this,e[i],t);return this}},ea=function(t,e,i){if(t){var s=this.setValueCallback,r=this.setValueCallbackScope;s&&(r?s.call(r,t,e,i):s(t,e,i)),this.fireEvent("button.statechange",t,e,i)}},ia=function(t){var e=this;t._selected=void 0,Object.defineProperty(t,"selected",{get:function(){return t._selected},set:function(i){if(t._selected!==i){var s=t._selected;t._selected=i,ea.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},sa={add(t){return this.buttons.push(t),t._click||(t._click=new Sr(t,this.clickConfig),t._click.on("click",(function(t,e,i,s){this.fireEvent("button.click",e,i,s)}),this).on("enable",(function(t,e){this.fireEvent("button.enable",e)}),this).on("disable",(function(t,e){this.fireEvent("button.disable",e)}),this).on("over",(function(t,e,i,s){this.fireEvent("button.over",e,i,s)}),this).on("out",(function(t,e,i,s){this.fireEvent("button.out",e,i,s)}),this).on("down",(function(t,e,i,s){this.fireEvent("button.down",e,i,s)}),this).on("up",(function(t,e,i,s){this.fireEvent("button.up",e,i,s)}),this),t.isRexContainerLite&&t.sendChildToBack(t)),this.buttonsType&&(void 0===t.name&&console.error(`${this.parent.constructor.name}: Option button miss value`),ia.call(this,t)),this},addMultiple(t){for(var e=0,i=t.length;e0},setButtonEnable(t,e){var i=this.buttons;if(void 0===t||"boolean"==typeof t){e=t;for(var s=0,r=i.length;sa.height/2)){r>(o=ma(a.left,a.centerY,t,e))&&(r=o,s=n);var o,l=i[n+1];l&&l.y===a.y||r>(o=ma(a.right,a.centerY,t,e))&&(r=o,s=n+1)}}return s};const ba=Phaser.Utils.Objects.IsPlainObject,xa=Phaser.Utils.Objects.GetValue,Ca=Phaser.Display.Align.CENTER;var Sa=function(t,e,i,s){return"\n"===t?(this.addNewLine(),this):(me.call(this,t),ba(e)&&(e=xa(o=e,"padding",0),i=xa(o,"key",void 0),s=xa(o,"index",void 0),r=xa(o,"offsetX",0),n=xa(o,"offsetY",0),h=xa(o,"offsetOriginX",0),a=xa(o,"offsetOriginY",0)),void 0===e&&(e=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===h&&(h=0),void 0===a&&(a=0),(o=this.getSizerConfig(t)).align=Ca,o.padding=ge(e),o.alignOffsetX=r,o.alignOffsetY=n,o.alignOffsetOriginX=h,o.alignOffsetOriginY=a,void 0===s||s>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(s,0,t),void 0!==i&&this.addChildrenMap(i,t),this);var r,n,h,a,o},wa={add(t,e,i){if(ur(t))for(var s=t,r=0,n=s.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,yh.call(this,t),this}},Ta={getChildrenWidth:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=0===this.orientation&&t?this.maxChildWidth:this.rexSizer.resolved?this.wrapResult.width:void 0)?e+(this.space.left+this.space.right)*this.scaleX:void 0);var e},getChildrenHeight:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=1===this.orientation&&t?this.maxChildHeight:this.rexSizer.resolved?this.wrapResult.height:void 0)?e+(this.space.top+this.space.bottom)*this.scaleY:void 0);var e},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;sr&&Da.addNewLine(this)}else for(n=0,h=t.length;n=0;i--)Wa.call(this,e[i],t);return this}};const ja=Phaser.Utils.Objects.GetValue;class Ia extends Ra{constructor(t,e){void 0===e&&(e={});var i=e.space;"number"==typeof i&&(e.space={item:i,line:i}),super(t,e),this.type="rexFixWidthButtons",this.buttonGroup=new da({parent:this,eventEmitter:ja(e,"eventEmitter",this),groupName:ja(e,"groupName",void 0),clickConfig:ja(e,"click",void 0)}).setButtonsType(e);var s=ja(e,"background",void 0),r=ja(e,"buttons",void 0);this.buttonsAlign=ja(e,"align",void 0),s&&this.addBackground(s),r&&this.addButtons(r),this.addChildrenMap("background",s),this.addChildrenMap("buttons",this.buttonGroup.buttons)}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.buttonGroup.destroy(),this.buttonGroup=void 0)}get buttons(){return this.buttonGroup.buttons}get groupName(){return this.buttonGroup.groupName}set groupName(t){this.buttonGroup.groupName=t}get eventEmitter(){return this.buttonGroup.eventEmitter}}Object.assign(Ia.prototype,Aa,Ba,la,ua);var Fa=function(){return Array.prototype.reduce.call(arguments,Na,0)},Na=function(t,e){return t+e};const Ha=Phaser.Utils.Objects.IsPlainObject,Ga=Phaser.Utils.Objects.GetValue,Va=Phaser.Display.Align.CENTER;var Ua=function(t,e,i,s,r){if("number"==typeof t||"number"==typeof e){if(void 0===t){for(var n=0;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return Ja(this.sizerChildren,null),yh.call(this,t),this}},qa={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)Ja(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},eo={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Xe.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,Ja(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Ja(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},so=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const ro=Phaser.Utils.Objects.IsPlainObject,no=Phaser.Utils.Objects.GetValue;class ho extends rh{constructor(t,e,i,s,r,n,h,a,o,l){ro(e)?(e=no(l=e,"x",0),i=no(l,"y",0),s=no(l,"width",void 0),r=no(l,"height",void 0),n=no(l,"column",l.col||0),h=no(l,"row",0),a=no(l,"columnProportions",0),o=no(l,"rowProportions",0)):ro(s)?(s=no(l=s,"width",void 0),r=no(l,"height",void 0),n=no(l,"column",l.col||0),h=no(l,"row",0),a=no(l,"columnProportions",0),o=no(l,"rowProportions",0)):ro(n)?(n=no(l=n,"column",l.col||0),h=no(l,"row",0),a=no(l,"columnProportions",0),o=no(l,"rowProportions",0)):ro(a)&&(a=no(l=a,"columnProportions",0),o=no(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(no(l,"createCellContainerCallback")),this.setIndentLeft(no(l,"space.indentLeftOdd",0),no(l,"space.indentLeftEven",0)),this.setIndentTop(no(l,"space.indentTopOdd",0),no(l,"space.indentTopEven",0)),this.resetGrid(n,h,a,o,no(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=io.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=so.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(ho.prototype,eo);const ao=ho.prototype.add;var oo={addButton(t,e,i){return ao.call(this,t,e,i,void 0,0,this.buttonsExpand),this.buttonGroup.add(t),this},addButtons(t,e){for(var i=0,s=t;i=0;i--)uo.call(this,e[i],t);return this}};const vo=Phaser.Utils.Objects.GetValue;class go extends ho{constructor(t,e){void 0===e&&(e={});var i=vo(e,"row",0),s=vo(e,"column",e.col||0),r=vo(e,"createCellContainerCallback"),n=vo(e,"buttons",void 0),h=vo(e,"expand",!0),a=h?1:0;if(r&&(e.createCellContainerCallback=void 0),void 0!==n){i=Math.max(i,n.length);for(var o=0,l=n.length;o0&&r.push(o.join("")),r},Zo=0,Qo=1,tl=2,el=0,il=1,sl=2,rl=/(?:\r\n|\r|\n)/;const nl={none:el,word:il,char:sl,character:sl,mix:3},hl=Phaser.Renderer.WebGL.Utils;var al={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,h=r.height,a=hl.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,h,e.x,e.y,n/e.resolution,h/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,h,a(e.tintTopLeft,i.alpha*e._alphaTL),a(e.tintTopRight,i.alpha*e._alphaTR),a(e.tintBottomLeft,i.alpha*e._alphaBL),a(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const ol=Phaser.Display.Color;var ll={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,h,a,o,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===h&&(h=0),void 0===a&&(a=0),void 0===o&&(o=c),void 0===l&&(l=u);var p=d.cutX+h,v=d.cutY+a;return this.context.drawImage(d.source.image,p,v,o,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new ol);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var h=i;i=h.red,s=h.green,r=h.blue,n=h.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var a=this.context.createImageData(1,1);return a.data[0]=i,a.data[1]=s,a.data[2]=r,a.data[3]=n,this.context.putImageData(a,t,e),this.dirty=!0,this}},dl=function(t,e,i,s,r,n,h){var a,o=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===h&&(h=e.height);var d=(a=o.exists(i)?o.get(i):o.createCanvas(i,n,h)).getSourceImage();d.width!==n&&(d.width=n),d.height!==h&&(d.height=h);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,h),c.drawImage(e,s,r,n,h),l.gl&&a&&l.canvasToTexture(d,a.source[0].glTexture,!0,0)},cl={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,dl(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};e();const ul=Phaser.Display.Canvas.CanvasPool,pl=Phaser.GameObjects.GameObject,vl=Phaser.Utils.String.UUID;class gl extends pl{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=ul.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=vl(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){ul.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}}const fl=Phaser.GameObjects.Components;Phaser.Class.mixin(gl,[fl.Alpha,fl.BlendMode,fl.Crop,fl.Depth,fl.Flip,fl.GetBounds,fl.Mask,fl.Origin,fl.Pipeline,fl.PostPipeline,fl.ScrollFactor,fl.Tint,fl.Transform,fl.Visible,al,ll,cl]);var ml={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:Es(this.data,t,e)},incData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)+e),this},mulData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)*e),this},clearData(){return this.data&&ft(this.data),this}};class yl{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}}Object.assign(yl.prototype,ml);var bl={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const xl=Phaser.Math.RotateAround;var Cl;const Sl=Phaser.Geom.Rectangle;var wl,Ol=function(t){void 0===wl&&(wl=new Sl);var e=t.drawTLX,i=t.drawTLY;return wl.setTo(e,i,t.drawTRX-e,t.drawBLY-i),wl};const Pl=Phaser.Math.RotateAround;var Tl,kl=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Tl&&(Tl={}),s=Tl),s.x=e,s.y=i,0!==t.rotation&&Pl(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const _l=Phaser.GameObjects.Components.TransformMatrix;var El,Ml,Rl={},Ll=function(t,e,i,s,r){var n=kl(e,i,s,!0),h=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=Rl);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===El&&(El=new _l,Ml=new _l),t.parentContainer?t.getWorldTransformMatrix(El,Ml):El.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),El.transformPoint(r,n,s),s}(t,n.x,n.y,r);return h},Dl=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,h=e.drawCenterY+s;return Ll(t,e,n,h,r)},zl={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Cl&&(Cl={}),s=Cl),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&xl(s,0,0,-i.rotation),s}(t,e,this,!0);return Ol(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return Dl(this.parent,this,t,e,i)}};Object.assign(zl,bl);const Al=Phaser.Math.DegToRad,Yl=Phaser.Math.RadToDeg,Xl=Phaser.Utils.Objects.GetValue;class Wl extends yl{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return Yl(this._rotation)}set angle(t){this.rotation=Al(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=Xl(t,"width",void 0),i=Xl(t,"height",void 0),s=Xl(t,"scaleX",void 0),r=Xl(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(Wl.prototype,zl);const Bl=Phaser.Utils.String.Pad;var jl=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${Bl(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},Il=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Fl=Phaser.Utils.Objects.GetValue;let Nl=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=Fl(t,"x",0),i=Fl(t,"y",0));var s=this.cornerRadius;s.tl=Hl(Fl(t,"tl",void 0),e,i),s.tr=Hl(Fl(t,"tr",void 0),e,i),s.bl=Hl(Fl(t,"bl",void 0),e,i),s.br=Hl(Fl(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Gl(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Gl(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Gl(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Gl(this.cornerRadius.br,t)}};var Hl=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Vl(t),t},Gl=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Fl(e,"x",0),t.y=Fl(e,"y",0)),Vl(t)},Vl=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const Ul=Phaser.Math.DegToRad;var $l=function(t){return!t.hasOwnProperty("convex")||t.convex},Jl=function(t){return t.x>0&&t.y>0},Kl=function(t,e,i,s,r,n,h,a,o){if(a&&h>n?h-=360:!a&&h=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=m.tl,Jl(a)?(o=a.x*g,l=a.y*f,$l(a)?Kl(t,o,l,o,l,180,270,!1,h):Kl(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,Jl(a)?(o=a.x*g,l=a.y*f,$l(a)?Kl(t,s-o,l,o,l,270,360,!1,h):Kl(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,Jl(a)?(o=a.x*g,l=a.y*f,$l(a)?Kl(t,s-o,r-l,o,l,0,90,!1,h):Kl(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,Jl(a)?(o=a.x*g,l=a.y*f,$l(a)?Kl(t,o,r-l,o,l,90,180,!1,h):Kl(t,0,r,o,l,360,270,!0,h)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,h,u),null!=a)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,a),p.addColorStop(1,d),a=p),e.fillStyle=a,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())},Zl=function(t,e,i,s,r,n,h,a){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),ql(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}};const Ql=Phaser.Utils.Objects.GetValue;class td extends Wl{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(Ql(e,"color",null),Ql(e,"color2",null),Ql(e,"horizontalGradient",!0)),this.setStroke(Ql(e,"stroke",null),Ql(e,"strokeThickness",2)),this.setCornerRadius(Ql(e,"cornerRadius",0),Ql(e,"cornerIteration",null))}set color(t){t=jl(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=jl(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=jl(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,Il("color2",t,this),Il("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Il("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Il("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){Zl(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const ed=Phaser.Utils.Objects.GetValue;class id extends Wl{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(ed(e,"color",null),ed(e,"color2",null),ed(e,"horizontalGradient",!0)),this.setStroke(ed(e,"stroke",null),ed(e,"strokeThickness",2))}set color(t){t=jl(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=jl(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=jl(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,ed(t,"color2",null),ed(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,ed(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,h=this.parent.height-i.top-i.bottom,a=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?a.createLinearGradient(0,0,n,0):a.createLinearGradient(0,0,0,h)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,a.fillStyle=t,a.fillRect(s,r,n,h));null!=this.stroke&&this.strokeThickness>0&&(a.strokeStyle=this.stroke,a.lineWidth=this.strokeThickness,a.strokeRect(s,r,n,h))}}const sd=Phaser.Utils.Objects.GetValue;let rd=class t{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(sd(t,"bold",!1)),this.setItalic(sd(t,"italic",!1)),this.setFontSize(sd(t,"fontSize","16px")),this.setFontFamily(sd(t,"fontFamily","Courier")),this.setColor(sd(t,"color","#fff")),this.setStrokeStyle(sd(t,"stroke",null),sd(t,"strokeThickness",0)),this.setShadow(sd(t,"shadowColor",null),sd(t,"shadowOffsetX",0),sd(t,"shadowOffsetY",0),sd(t,"shadowBlur",0)),this.setOffset(sd(t,"offsetX",0),sd(t,"offsetY",0)),this.setSpace(sd(t,"leftSpace",0),sd(t,"rightSpace",0)),this.setAlign(sd(t,"align",void 0)),this.setBackgroundColor(sd(t,"backgroundColor",null)),this.setBackgroundHeight(sd(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(sd(t,"backgroundBottomY",void 0)),this.setBackgroundLeftX(sd(t,"backgroundLeftX",0)),this.setBackgroundRightX(sd(t,"backgroundRightX",0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(Il("stroke",t,this),Il("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Il("shadowOffsetX",t,this),Il("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),t.hasOwnProperty("backgroundLeftX")&&this.setBackgroundLeftX(t.backgroundLeftX),t.hasOwnProperty("backgroundRightX")&&this.setBackgroundRightX(t.backgroundRightX),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new t(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=jl(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=jl(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=jl(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=jl(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setBackgroundLeftX(t){return this.backgroundLeftX=t,this}setBackgroundRightX(t){return this.backgroundRightX=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}};const nd=Phaser.Utils.Array.Remove,hd=Phaser.Utils.Array.Remove,ad="text",od="image",ld="drawer",dd="space",cd="command";var ud=function(t){return t.type===ad&&"\n"===t.text},pd=function(t){return t.type===ad&&"\f"===t.text},vd=function(t){return t.type===ad};class gd extends Wl{constructor(t,e,i){super(t,ad),this.updateTextFlag=!1,this.style=new rd(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX+e.backgroundLeftX,s=i,r=this.drawTRX+e.backgroundRightX-i+1;if(r>0){var n=e.backgroundBottomY;null==n&&(n=this.drawBLY);var h=e.backgroundHeight;null==h&&(h=n-this.drawTLY);var a=n-h;t.fillRect(s,a,r,h)}}var o=e.hasFill,l=e.hasStroke;(o||l)&&(e.syncFont(t).syncStyle(t),l&&(e.syncShadow(t),t.strokeText(this.text,0,0)),o&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var fd=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const md=Phaser.Display.Canvas.CanvasPool;var yd=function(t,e,i,s,r,n,h,a){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===a&&(a=!1),a&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(h){var l=md.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=h,d.fillRect(0,0,r,n),o.drawImage(l,0,0,r,n,i,s,r,n),md.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)};Phaser.Display.Canvas.CanvasPool;class bd extends Wl{constructor(t,e,i){super(t,od),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){yd(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class xd extends Wl{constructor(t,e,i,s){super(t,ld),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class Cd extends Wl{constructor(t,e){super(t,dd),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class Sd extends yl{constructor(t,e,i,s,r){super(t,cd),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}function wd(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>wd(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=wd(t[i]));return e}var Od=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const Pd={none:0,word:1,char:2,character:2,mix:3};var Td=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,h=!r&&!n,a=t.length,o=e,l=s.word,d=0,c=!1;o0&&!a){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=Md.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=Md.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=Ld(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=Ld(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=Ld(t,"wrapMode");void 0===c&&(c=Ld(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=Pd[c]);var u=Ld(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=Ld(t,"letterSpacing",0),v=Ld(t,"hAlign",0),g=Ld(t,"vAlign",0),f=Ld(t,"justifyPercentage",.25),m=Od({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:h,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,b=0,x=y.length;b0&&(E.push({children:M,width:R}),L=Math.max(L,R)),m.start+=_.length,m.isLastPage=!D&&m.start===k,m.maxLineWidth=L,m.linesHeight=E.length*n;var j=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,I=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,h=t.vAlign,a=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(h=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=Ad(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=Ad(t,"maxLines",0);var a=0===i,o=Ad(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=Ad(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=Ad(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=Ad(t,"letterSpacing",0),p=Ad(t,"rtl",!0),v=Ad(t,"hAlign",p?2:0),g=Ad(t,"vAlign",0),f=Od({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:o,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(_.push({children:E,height:M}),R=Math.max(R,M)),f.start+=k.length,f.isLastPage=f.start===T,f.maxLineHeight=R,f.linesWidth=_.length*n;var X=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,W=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,h=t.vAlign,a=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}a&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,h=i.bottom;return Le(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return Re(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),nd(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return hd(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(ad);return null===i?i=new gd(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),Dl(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const hc=Phaser.Utils.Objects.GetFastValue;var ac={};class oc{constructor(t){this.pools=hc(t,"pools",ac)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new nc),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;ei&&(r=Math.floor(i));for(var n={},h=fc(t,r,e,i,n),a=0;a<=pc&&0!==h;a++){if((r+=h)<0){r=0;break}h=fc(t,r,e,i,n)}return a===pc&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),mc(t,e,i),t},gc=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},fc=function(t,e,i,s,r){var n,h=gc(t,e,r),a=gc(t,e+1,r);if(void 0!==s)if(h.height<=s&&a.height>s)n=0;else{if(h.height>s)return-1;n=Math.floor(s-h.height)}if(h.width<=i&&a.width>i)return 0;if(h.width>i)return-1;var o=Math.floor(i-h.width);return void 0===n?o:Math.min(o,n)},mc=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const yc=Phaser.Utils.Objects.GetValue,bc=Phaser.Utils.Objects.GetValue;class xc extends Lo{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=bc(e,"background",void 0),r=bc(e,"icon",void 0),n=bc(e,"iconMask",void 0),h=bc(e,"text",void 0),a=bc(e,"action",void 0),o=bc(e,"actionMask",void 0),l=bc(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(h||a)&&(i={right:bc(e,"space.icon",0),top:bc(e,"space.iconTop",0),bottom:bc(e,"space.iconBottom",0),left:bc(e,"space.iconLeft",0)}):(h||a)&&(i={bottom:bc(e,"space.icon",0),left:bc(e,"space.iconLeft",0),right:bc(e,"space.iconRight",0),top:bc(e,"space.iconTop",0)});var d=bc(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=Fo.call(this,r,r,1)),!d){var c=bc(e,"iconSize",void 0);this.setIconSize(bc(e,"iconWidth",c),bc(e,"iconHeight",c))}}if(h){var u=bc(e,"wrapText",!1),p=bc(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),function(t,e){switch(Uo(t)){case 0:switch("string"==typeof e&&(e=nl[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=Ko;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=nl[e]||0),t.style.wrapMode=e}}(h,u),e.expandTextWidth=!0,uc(h)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=yc(e,"minWidth",0),s=yc(e,"minHeight",0),r=yc(e,"fitHeight",!1);t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return vc(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),vc(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t})}(h,{fitHeight:!0}));var v,g,f=bc(e,"space.text",0),m=bc(e,"expandTextWidth",!1),y=bc(e,"expandTextHeight",!1);0===this.orientation?(v=m?1:0,a&&(i={right:f}),g=y):(v=y?1:0,a&&(i={bottom:f}),g=m),this.add(h,{proportion:v,expand:g,padding:i})}if(a&&(i=0===this.orientation?{top:bc(e,"space.actionTop",0),bottom:bc(e,"space.actionBottom",0),right:bc(e,"space.actionRight",0)}:{left:bc(e,"space.actionLeft",0),right:bc(e,"space.actionRight",0),bottom:bc(e,"space.actionBottom",0)},d=bc(e,"squareFitAction",!1)?1:0,this.add(a,{proportion:0,padding:i,fitRatio:d}),o&&(o=Fo.call(this,a,a,1)),!d)){var b=bc(e,"actionSize");this.setActionSize(bc(e,"actionWidth",b),bc(e,"actionHeight",b))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",h),this.addChildrenMap("action",a),this.addChildrenMap("actionMask",o)}}var Cc=Phaser.Renderer.WebGL.Utils,Sc=function(t,e,i,s,r,n){for(var h=Cc.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),a=i.pathData,o=i.pathIndexes,l=0;l>>16,a=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+h+","+a+","+o+","+n+")"},kc=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,h=(16711680&r)>>>16,a=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+h+","+a+","+o+","+n+")",t.lineWidth=e.lineWidth};const _c=Phaser.Renderer.Canvas.SetTransform;var Ec={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Pc(e,i,s),h=r.calcMatrix.copyFrom(n.calc),a=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&Sc(r,h,e,l,a,o),e.isStroked&&Oc(r,e,l,a,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(_c(t,r,e,i,s)){var n=e._displayOriginX,h=e._displayOriginY,a=e.pathData,o=a.length-1,l=a[0]-n,d=a[1]-h;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(Rc.prototype,Ec);var Lc=function(t){return t.x>0&&t.y>0},Dc=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const zc=Phaser.Math.DegToRad;var Ac=function(t,e,i,s,r,n,h,a,o){h&&n>r?n-=360:!h&&n0,h=0,a=e.length;h=0?t.startAt(h+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(h+n,i):t.startAt(h,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(h,i),t.close(),t};const Au=Phaser.Utils.Objects.GetValue,Yu=Phaser.Utils.Objects.IsPlainObject;class Xu extends(lu(eu)){constructor(t,e,i,s,r,n,h,a){Yu(e)?(e=(a=e).x,i=a.y,s=a.width,r=a.height,n=a.barColor,h=a.value):Yu(s)?(s=(a=s).width,r=a.height,n=a.barColor,h=a.value):Yu(n)&&(n=(a=n).barColor,h=a.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===h&&(h=0),super(t,e,i,s,r,a),this.type="rexLineProgress",this.bootProgressBase(a),this.addShape((new Du).setName("trackFill")).addShape((new Du).setName("bar")).addShape((new Du).setName("trackStroke")),this.setTrackColor(Au(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(Au(a,"trackStrokeThickness",2),Au(a,"trackStrokeColor",void 0)),this.setSkewX(Au(a,"skewX",0)),this.setRTL(Au(a,"rtl",!1)),this.setValue(h)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var Wu={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&zu(s,0,0,e,i,t);var r,n,h=this.getShape("bar");h.fillStyle(this.barColor),h.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),zu(h,r,0,n,i,t));var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&zu(a,0,0,e,i,t)}};Object.assign(Xu.prototype,Wu);var Bu=function(t){return null==t||""===t||0===t.length},ju=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(Bu(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(Bu(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,h=e.length;n=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=wd(i),s=wd(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),h=n.width,a=0,o=0,l=i.length;o0?h/a:0,c=n.height,u=0;for(o=0,l=s.length;o0?0:g,b=0,o=0;for(var w=i.length;o0?0:f),f>=1&&g>=1){var O=typeof(m=this.getFrameNameCallback(o,C,e));"string"!==O&&"number"!==O||r.add(m,0,b+n.cutX,x+n.cutY,f,g)}b+=f}x+=g}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,h,a,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/o,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(u,p);if(u>v){var g=(u-v)*o;d>=0?d+=g:d=g,u=v}if(p>v){var f=(p-v)*l;c>=0?c+=f:c=f,p=v}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,x=this.rows.count;b0&&a>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(C,b)?0:1)?this._drawImage(this.textureKey,s,m,y,h,a):this._drawTileSprite(this.textureKey,s,m,y,h,a)),m+=h;y+=a}this._endDraw()},setStretchMode:function(t){return rp(t)?(this.stretchMode.edge=hp(np(t,"edge",0)),this.stretchMode.internal=hp(np(t,"internal",0))):(t=hp(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return op.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const dp=Phaser.Utils.Objects.IsPlainObject,cp=Phaser.Utils.Objects.GetValue,up=Phaser.GameObjects;var pp=void 0,vp=function(t,e){if(pp||(pp={},ti(t).events.once("destroy",(function(){for(var t in pp)pp[t].destroy();pp=void 0}))),!pp.hasOwnProperty(e)){var i=ti(t).scene.systemScene;(t=new up[e](i)).setOrigin(0),pp[e]=t}return pp[e]};const gp=Phaser.GameObjects.RenderTexture;class fp extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if(dp(i)?(i=cp(d=i,"x",0),s=cp(d,"y",0),r=cp(d,"width",1),n=cp(d,"height",1),h=cp(d,"key",void 0),a=cp(d,"baseFrame",void 0),o=cp(d,"columns",void 0),l=cp(d,"rows",void 0)):dp(r)?(r=cp(d=r,"width",1),n=cp(d,"height",1),h=cp(d,"key",void 0),a=cp(d,"baseFrame",void 0),o=cp(d,"columns",void 0),l=cp(d,"rows",void 0)):dp(h)?(h=cp(d=h,"key",void 0),a=cp(d,"baseFrame",void 0),o=cp(d,"columns",void 0),l=cp(d,"rows",void 0)):dp(a)?(a=cp(d=a,"baseFrame",void 0),o=cp(d,"columns",void 0),l=cp(d,"rows",void 0)):Array.isArray(a)?(d=l,l=o,o=a,a=cp(d,"baseFrame",void 0)):dp(o)&&(o=cp(d=o,"columns",void 0),l=cp(d,"rows",void 0)),void 0===a&&(a=cp(d,"frame",void 0)),void 0===o){var c=cp(d,"leftWidth",void 0),u=cp(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=cp(d,"topHeight",void 0),v=cp(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(cp(d,"getFrameNameCallback",void 0)),this.setStretchMode(cp(d,"stretchMode",0)),this.setPreserveRatio(cp(d,"preserveRatio",!0));var g=cp(d,"maxFixedPartScale",1),f=cp(d,"maxFixedPartScaleX",g),m=cp(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(h,a,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,lp),i}(gp,"rexNinePatch")){}var mp={_drawImage:function(t,e,i,s,r,n){var h=vp(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=vp(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(fp.prototype,mp);let yp=class extends ii{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Nu(t,e))return t[e];var i=t.parent;return Nu(i,e)?i[e]:void 0}set(t,e,i){return Nu(t,e)?t[e]=i:Nu(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}};const bp=Phaser.Utils.Objects.GetValue;class xp extends fp{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=bp(e,"effects",!0);i&&$u(this,i),this.style=new yp(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(xp.prototype,Uc);const Cp=["alpha","tint","flipX","flipY"];var Sp=function(t,e){if(!e)return t;for(var i=0,s=Cp.length;i=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const T=Phaser.Math.DegToRad;var k={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=T(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},_={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=O(t.scaleX,i.scaleX),e.scaleY=O(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},E={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=O(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},L={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},D={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},z={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(t){void 0===t&&(t=!1);var e=this;return this._mask=null,this.setChildMaskVisible(this),this.children.forEach((function(t){t.clearMask&&t.clearMask(!1),t.hasOwnProperty("isRexContainerLite")||e.setChildMaskVisible(t)})),t&&this.mask&&this.mask.destroy(),this}},A=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},W=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const j=Phaser.Utils.Array;var I={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},_e=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const Ee=/(\S+)\[(\d+)\]/i,Me=Phaser.Utils.Objects.GetValue;var Re=function(t,e){return void 0===e?t:t[e]},Le=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Me(e,"left",0),t.right=Me(e,"right",0),t.top=Me(e,"top",0),t.bottom=Me(e,"bottom",0)),t},De={getInnerPadding(t){return Re(this.space,t)},setInnerPadding(t,e){return Le(this.space,t,e),this},getOuterPadding(t){return Re(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Le(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Re(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Le(this.getSizerConfig(t).padding,e,i),this}},ze=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Ae=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Ye=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Xe=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},We=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},Be=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},je={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Ie=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?mi:fi,this.repeatCounter=0,this}stop(){return this.state=gi,this}update(t,e){this.state!==gi&&this.state!==bi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=yi)):(this.nowTime=this.duration,this.state=bi):this.nowTime>=0&&(this.state=mi))}get t(){var t;switch(this.state){case gi:case fi:case yi:t=0;break;case mi:t=this.nowTime/this.duration;break;case bi:t=1}return pi(t,0,1)}set t(t){(t=pi(t,-1,1))<0?(this.state=fi,this.nowTime=-this.delay*t):(this.state=mi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===gi}get isDelay(){return this.state===fi}get isCountDown(){return this.state===mi}get isRunning(){return this.state===fi||this.state===mi}get isDone(){return this.state===bi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const gi=0,fi=1,mi=2,yi=3,bi=-1;class xi extends di{constructor(t,e){super(t,e),this.timer=new vi}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const Ci=Phaser.Utils.Objects.GetValue,Si=Phaser.Utils.Objects.GetAdvancedValue,wi=Phaser.Tweens.Builders.GetEaseFunction;class Oi extends xi{resetFromJSON(t){return this.timer.resetFromJSON(Ci(t,"timer")),this.setEnable(Ci(t,"enable",!0)),this.setTarget(Ci(t,"target",this.parent)),this.setDelay(Si(t,"delay",0)),this.setDuration(Si(t,"duration",1e3)),this.setEase(Ci(t,"ease","Linear")),this.setRepeat(Ci(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=wi(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Pi=Phaser.Utils.Objects.GetValue,Ti=Phaser.Utils.Objects.GetAdvancedValue,ki=Phaser.Math.Linear;let _i=class extends Oi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Pi(t,"mode",0)),this.setScaleRange(Ti(t,"start",void 0),Ti(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ei[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Ti(t,"x",this.parent.scaleX),this.startY=Ti(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Ti(e,"x",void 0),this.endY=Ti(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=ki(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=ki(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const Ei={stop:0,destroy:1,yoyo:2};var Mi=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new _i(t,a):r.resetFromJSON(a),r.restart(),r},Ri=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof _i&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new _i(t,h):n.resetFromJSON(h),n.restart(),n},Li=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Di=function(t){return Li(t,"complete")};const zi=Phaser.Utils.Objects.IsPlainObject;var Ai={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(zi(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Mi(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Di(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(zi(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Ri(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Di(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Di(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(zi(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new _i(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Di(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Yi={};Object.assign(Yi,Ai),Yi.onInitScale=function(){Ai.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=xe.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Xi=Phaser.Utils.Objects.GetValue,Wi=Phaser.Utils.Objects.GetAdvancedValue,Bi=Phaser.Math.Linear;class ji extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Xi(t,"mode",0)),this.setAlphaRange(Wi(t,"start",this.parent.alpha),Wi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ii[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Bi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ii={stop:0,destroy:1,yoyo:2},Fi=Phaser.Utils.Objects.IsPlainObject;var Ni=function(t,e,i,s){var r,n;Fi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new ji(t,h):s.resetFromJSON(h),s.restart(),s},Hi=function(t,e,i,s){i instanceof ji&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new ji(t,r):s.resetFromJSON(r),s.restart(),s};const Gi=Phaser.Utils.Objects.IsPlainObject;var Vi={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Gi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Ni(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Di(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Gi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Hi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Di(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Di(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Ui={};Object.assign(Ui,Vi),Ui.onInitFade=function(){Vi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=xe.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const $i=Phaser.Utils.Objects.GetValue,Ji=Phaser.Utils.Objects.GetAdvancedValue,Ki=Phaser.Math.Linear;class qi extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode($i(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ji(t,"x",void 0),i=Ji(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Zi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Ji(i,"startX",void 0),this.startY=Ji(i,"startY",void 0),this.endX=Ji(i,"endX",void 0),this.endY=Ji(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Ki(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ki(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Zi={stop:0,destroy:1,yoyo:2};var Qi=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const ts=Phaser.Utils.Objects.IsPlainObject,es=Phaser.Math.Distance.Between;var is={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(ts(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*es(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof qi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=Qi(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=Qi(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new qi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Di(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Di(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(ts(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*es(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof qi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=Qi(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=Qi(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new qi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Di(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Di(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},ss={};Object.assign(ss,is),ss.onInitEaseMove=function(){is.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=xe.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const rs=Phaser.Utils.Objects.GetValue;class ns extends ai{constructor(t,e){super(t,e),this.timer=new vi,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(rs(t,"timer")),this.setEnable(rs(t,"enable",!0)),this.setMode(rs(t,"mode",1)),this.isRunning=rs(t,"isRunning",!1),this.setMagnitudeMode(rs(t,"magnitudeMode",1)),this.setAxisMode(rs(t,"axis",0)),this.setDuration(rs(t,"duration",500)),this.setMagnitude(rs(t,"magnitude",10)),this.ox=rs(t,"ox",void 0),this.oy=rs(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=hs[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=os[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=as[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=rs(i,"magnitude",void 0),t=rs(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const hs={effect:0,behavior:1},as={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},os={constant:0,decay:1},ls=Phaser.Utils.Objects.IsPlainObject;var ds={shake(t,e,i){if(ls(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new ns(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Di(this._shake)}};const cs=Phaser.Utils.Objects.GetValue,us=Phaser.Math.Linear;class ps extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=cs(t,"key","value");var i=e[this.propertyKey];return this.fromValue=cs(t,"from",i),this.toValue=cs(t,"to",i),this.setEase(cs(t,"ease",this.ease)),this.setDuration(cs(t,"duration",this.duration)),this.setRepeat(cs(t,"repeat",0)),this.setDelay(cs(t,"delay",0)),this.setRepeatDelay(cs(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=us(this.fromValue,this.toValue,i)}}const vs=Phaser.Utils.Objects.IsPlainObject;class gs extends ii{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new ps(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(vs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(vs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var fs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new gs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Li(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},ms=Phaser.Utils.Array.Remove,ys={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var Ys={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=qe(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Xs={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=Xt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=Xt),this.transitOutCallback=t,this}},Ws={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Bs={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},js={};Object.assign(js,Ys,Xs,Ws,Bs);const Is=Phaser.Utils.Objects.GetValue;class Fs extends ii{constructor(t,e){super(t,e),this.setTransitInTime(Is(e,"duration.in",200)),this.setTransitOutTime(Is(e,"duration.out",200)),this.setTransitInCallback(Is(e,"transitIn")),this.setTransitOutCallback(Is(e,"transitOut")),this.oneShotMode=Is(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new As(this,{eventEmitter:!1,initState:Is(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Fs.prototype,js);var Ns=function(t){if(t.parentContainer)return Ns(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?Ns(e):t};class Hs extends ii{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Ns(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Gs=Phaser.GameObjects.Rectangle;let Vs=class extends Gs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Hs(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}};const Us=Phaser.Utils.Objects.GetValue;class $s extends ii{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Us(t,"hitAreaMode",0)),this.setEnable(Us(t,"enable",!0)),this.setStopMode(Us(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Js[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Js={default:0,fullWindow:1};const Ks=Phaser.Utils.Objects.GetValue;class qs extends Vs{constructor(t,e){super(t,Ks(e,"color",0),Ks(e,"alpha",.8)),this.touchEventStop=new $s(this,{hitAreaMode:1})}}var Zs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Mi(t,e)},scaleDown(t,e){Ri(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Ni(t,e)},fadeOut(t,e){Hi(t,e,!1)}},Qs=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Ni(t,e,t.alpha)},tr=function(t,e){Hi(t,e,!1)},er=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!nt(t,!0).contains(e,i)||r&&!r(t,e,i))};const ir=Phaser.Utils.Objects.GetValue;let sr=class extends Fs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=rr.popUp),null==e.transitOut&&(e.transitOut=rr.scaleDown),e.destroy=ir(e,"destroy",!0),super(t,e);var i=ir(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new qs(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(ir(i,"transitIn",Qs)),this.setCoverTransitOutCallback(ir(i,"transitOut",tr)));var s=ir(e,"touchOutsideClose",!1),r=ir(e,"duration.hold",-1),n=ir(e,"timeOutClose",r>=0),h=ir(e,"anyTouchClose",!1);ir(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),ir(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&er(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=rr[t]),t){case rr.popUp:t=Zs.popUp;break;case rr.fadeIn:t=Zs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=rr[t]),t){case rr.scaleDown:t=Zs.scaleDown;break;case rr.fadeOut:t=Zs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const rr={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var nr=function(t){return t&&"function"==typeof t},hr={modal(t,e){return nr(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new sr(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},ar=function(t,e,i,s,r){nr(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},or={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return ar.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return ar.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return ar.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return ar.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return ar.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return ar.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return ar.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return ar.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return ar.call(this,"shutdown",t,e,i,s),this}},lr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=dr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},dr={},cr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?er(t,e.x,e.y,i,s):!!(r=lr(e,n,!0))&&er(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const wr={press:0,pointerdown:0,release:1,pointerup:1};var Or={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new Sr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},Pr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!Tr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return kr.length=0,!0;return kr.length=0,!1},kr=[];const _r=Phaser.Utils.Objects.GetValue;class Er extends ii{constructor(t,e){super(t,e),this._enable=void 0;var i=_r(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(_r(t,"enable",!0)),this.setMode(_r(t,"mode",1)),this.setClickInterval(_r(t,"clickInterval",100)),this.setDragThreshold(_r(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Mr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?Pr:cr)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Mr={press:0,pointerdown:0,release:1,pointerup:1};var Rr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Er(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Lr extends zs{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Dr=Phaser.Utils.Objects.GetValue;class zr extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Lr,this.parent.setInteractive(Dr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Dr(t,"enable",!0)),this.setCooldown(Dr(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Ar={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&cr(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new zr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new zr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Yr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Xr=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Qr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===tn&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Qr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=en,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&cr(t,s,e,i)}}const Qr=0,tn=1,en="IDLE",sn=Phaser.Utils.Objects.GetValue,rn=Phaser.Math.Distance.Between;class nn extends Zr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=hn},eventEmitter:!1};this.setRecongizedStateObject(new zs(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(sn(t,"time",250)),this.setTapInterval(sn(t,"tapInterval",200)),this.setDragThreshold(sn(t,"threshold",9)),this.setTapOffset(sn(t,"tapOffset",10));var e=sn(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(sn(t,"maxTaps",void 0)),this.setMinTaps(sn(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case hn:this.state=an;break;case an:var t=this.lastPointer;rn(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=on,this.state=an);break;case on:this.state=an}}onDragEnd(){this.state===an&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=on))}onDrag(){this.state!==hn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=hn)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===an){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=hn):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=on:this.state=hn)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===on&&(this.state=hn)}get isTapped(){return this.state===on}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const hn="IDLE",an="BEGIN",on="RECOGNIZED",ln=Phaser.Utils.Objects.GetValue;class dn extends Zr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=cn},eventEmitter:!1};this.setRecongizedStateObject(new zs(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(ln(t,"threshold",9)),this.setHoldTime(ln(t,"time",251)),this}onDragStart(){this.state=un,0===this.holdTime&&(this.state=pn)}onDragEnd(){this.state=cn}onDrag(){this.state!==cn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=cn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===un&&t-this.pointer.downTime>=this.holdTime&&(this.state=pn)}get isPressed(){return this.state===pn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const cn="IDLE",un="BEGIN",pn="RECOGNIZED";Phaser.Utils.Objects.GetValue;var vn=function(t){return ti(t).loop.delta};const gn=Phaser.Math.Distance.Between,fn=Phaser.Math.Angle.Between;var mn={getDt:function(){return vn(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return gn(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return fn(e.x,e.y,t.x,t.y)}},yn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},bn={};const xn=Phaser.Utils.Objects.GetValue,Cn=Phaser.Math.RadToDeg;class Sn extends Zr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=wn},eventEmitter:!1};this.setRecongizedStateObject(new zs(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(xn(t,"threshold",10)),this.setVelocityThreshold(xn(t,"velocityThreshold",1e3)),this.setDirectionMode(xn(t,"dir","8dir")),this}onDragStart(){this.state=On}onDragEnd(){this.state=wn}onDrag(){this.state===On&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=Pn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Pn&&(this.state=wn)}get isSwiped(){return this.state===Pn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=yn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=bn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(Cn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(Sn.prototype,mn);const wn="IDLE",On="BEGIN",Pn="RECOGNIZED",Tn=Phaser.Utils.Objects.GetValue,kn=Phaser.Utils.Array.SpliceOne,_n=Phaser.Math.Distance.Between,En=Phaser.Math.Angle.Between;class Mn{constructor(t,e){var i=qe(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(Tn(e,"inputConfig",void 0)),this.setEventEmitter(Tn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(Tn(t,"enable",!0)),this.bounds=Tn(t,"bounds",void 0),this.tracerState=Ln,this.pointers.length=0,ft(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,ft(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case Ln:this.tracerState=Dn,this.onDrag1Start();break;case Dn:this.tracerState=zn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],kn(this.pointers,e),this.tracerState){case Dn:this.tracerState=Ln,this.onDrag1End();break;case zn:this.tracerState=Dn,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case Dn:this.onDrag1();break;case zn:this.onDrag2()}}}dragCancel(){return this.tracerState===zn&&this.onDrag2End(),this.pointers.length=0,ft(this.movedState),this.tracerState=Ln,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==zn)return 0;var t=this.pointers[0],e=this.pointers[1];return _n(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==zn)return 0;var t=this.pointers[0],e=this.pointers[1];return En(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Rn.x=e.x-i.x,Rn.y=e.y-i.y}else Rn.x=0,Rn.y=0;return Rn}get centerX(){if(this.tracerState!==zn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==zn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==zn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==zn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=An,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&cr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&cr(t,s,e,i)}}Object.assign(Mn.prototype,$e);var Rn={};const Ln=0,Dn=1,zn=2,An="IDLE";Phaser.Utils.Objects.GetValue;const Yn=Phaser.Math.RotateAround;var Xn=function(t,e,i,s){return Yn(t,e,i,s),t.rotation+=s,t},Wn={};const Bn=Phaser.Utils.Objects.GetValue,jn=Phaser.Math.Angle.WrapDegrees,In=Phaser.Math.Angle.ShortestBetween,Fn=Phaser.Math.RadToDeg,Nn=Phaser.Math.DegToRad;var Hn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Wn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=jn(Fn(this.angleBetween));this.angle=In(this.prevAngle,t),this.prevAngle=t,this.state=Un}break;case Un:t=jn(Fn(this.angleBetween)),this.angle=In(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Un}get rotation(){return Nn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Hn);const Gn="IDLE",Vn="BEGIN",Un="RECOGNIZED",$n=Phaser.Utils.Objects.GetValue;var Jn=function(t){var e=$n(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new nn(this,e),this._tap.on("tap",(function(t,e,s){Wr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Wr(i.eventEmitter,`${i.eventNamePrefix}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Kn=Phaser.Utils.Objects.GetValue;var qn=function(t){var e=Kn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new dn(this,e),this._press.on("pressstart",(function(t,e,s){Wr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this).on("pressend",(function(t,e,s){Wr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Zn=Phaser.Utils.Objects.GetValue;var Qn=function(t){var e=Zn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new Sn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Wr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Wr(i.eventEmitter,`${i.eventNamePrefix}swipe`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const th=Phaser.Utils.Objects.GetValue;var eh=function(t,e){return t.setInteractive(),th(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:th(e,"targets",[t]),targetMode:th(e,"targetMode","parent"),eventEmitter:th(e,"eventEmitter",t),eventNamePrefix:th(e,"inputEventPrefix","child.")},jr.call(t,e),Nr.call(t,e),Vr.call(t,e),Kr.call(t,e),Jn.call(t,e),qn.call(t,e),Qn.call(t,e),t},ih={getSizerConfig:function(t){return void 0===t&&(t=this),Mt(t)},getChildPrevState:function(t){var e=Mt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Dt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=oe(e,"color"),s=oe(e,"lineWidth");var o=oe(e,"name",!1);o&&(r=oe(o,"createTextCallback",ce),n=oe(o,"createTextCallbackScope",void 0),"string"==typeof(h=oe(o,"align","left-top"))&&(h=Yt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new le(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}var d,c,u=this.getAllShownChildren([this]);ue(u,u);for(var p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const ch=Phaser.Utils.Objects.IsPlainObject,uh=Phaser.Utils.Objects.GetValue,ph=Phaser.Display.Align.CENTER,vh={min:0,full:-1};var gh=function(t,e,i,s,r,n,h,a,o,l){var d,c,u,p;me.call(this,t);var v=t.isRexSpace,g=typeof e;if(null===e)return this;if("number"===g);else if("string"===g)e=vh[e];else if(ch(e)){var f;e=uh(f=e,"proportion",void 0),i=uh(f,"align",ph),s=uh(f,"padding",0),r=uh(f,"expand",!1),n=uh(f,"key",void 0),h=uh(f,"index",void 0),t.isRexSizer||(a=uh(f,"minWidth",void 0),o=uh(f,"minHeight",void 0)),l=uh(f,"fitRatio",0),d=uh(f,"offsetX",0),c=uh(f,"offsetY",0),u=uh(f,"offsetOriginX",0),p=uh(f,"offsetOriginY",0)}return"string"==typeof i&&(i=Yt[i]),void 0===e&&(e=v?1:0),void 0===i&&(i=ph),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(v?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(v?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),(f=this.getSizerConfig(t)).proportion=e,f.align=i,f.padding=ge(s),f.expand=r,f.fitRatio=0===e?l:0,f.alignOffsetX=d,f.alignOffsetY=c,f.alignOffsetOriginX=u,f.alignOffsetOriginY=p,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},fh={add:gh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),gh.call(this,new lh(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return ch(i)&&(i.index=t),gh.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=dh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const mh=Et.prototype.clear;var yh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),mh.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,yh.call(this,t),this}},Ch={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=Yt[e]),this.getSizerConfig(t).align=e,this}},Sh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},wh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},Oh={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},Ph={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(He(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Ie.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d,c,u=this.sizerChildren,p=this.innerLeft,v=this.innerTop,g=this.innerWidth,f=this.innerHeight,m=p,y=v,b=this.startChildIndex,x=0,C=u.length;x0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Xe.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Ae.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&ah.call(this,t,void 0),Ye.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||We.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&ah.call(this,void 0,t),Be.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(Ph,fh,xh,Ch,Sh,wh,Oh);var Th=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},kh={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},_h=function(t){return"string"==typeof t&&(t=kh[t]),t};const Eh=Phaser.Utils.Objects.IsPlainObject,Mh=Phaser.Utils.Objects.GetValue;class Rh extends rh{constructor(t,e,i,s,r,n,h){Eh(e)?(e=Mh(h=e,"x",0),i=Mh(h,"y",0),s=Mh(h,"width",void 0),r=Mh(h,"height",void 0),n=Mh(h,"orientation",0)):Eh(s)?(s=Mh(h=s,"width",void 0),r=Mh(h,"height",void 0),n=Mh(h,"orientation",0)):Eh(n)&&(n=Mh(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Mh(h,"space.item",0)),this.setStartChildIndex(Mh(h,"startChildIndex",0)),this.setRTL(Mh(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=_h(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=Th.call(this)),this._childrenProportion}}Object.assign(Rh.prototype,Ph);var Lh=function(t,e,i,s){if(void 0===i)i=0;else{var r=typeof i;"boolean"===r?(s=i,i=0):"string"===r&&(i=Dh[i])}void 0===s?s={}:!0===s&&(s=zh);var n=e.width/t.width,h=e.height/t.height,a=i?Math.max(n,h):Math.min(n,h);return s.width=t.width*a,s.height=t.height*a,s};const Dh={fit:0,FIT:0,envelop:1,ENVELOP:1};var zh={},Ah={},Yh={};const Xh=Phaser.Utils.Objects.IsPlainObject,Wh=Phaser.Utils.Objects.GetValue,Bh=Phaser.Display.Align.CENTER,jh=Phaser.Utils.String.UUID;var Ih={add:function(t,e,i,s,r,n,h,a,o,l){var d,c;me.call(this,t),Xh(e)&&(e=Wh(u=e,"key",void 0),i=Wh(u,"align",Bh),s=Wh(u,"padding",0),r=Wh(u,"expand",!0),t.isRexSizer||(n=Wh(u,"minWidth",t._minWidth),h=Wh(u,"minHeight",t._minHeighted)),a=Wh(u,"offsetX",0),o=Wh(u,"offsetY",0),d=Wh(u,"offsetOriginX",0),c=Wh(u,"offsetOriginY",0),l=Wh(u,"aspectRatio",0));var u,p=void 0!==e;return p||(e=jh()),"string"==typeof i&&(i=Yt[i]),void 0===i&&(i=Bh),void 0===s&&(s=0),void 0===r&&(r=!0),t.isRexSizer||(void 0===n&&(n=t._minWidth),void 0===h&&(h=t._minHeight)),void 0===a&&(a=0),void 0===o&&(o=0),void 0===d&&(d=0),void 0===c&&(c=0),void 0===l?l=0:!0===l&&(l=Q(t)/tt(t)),l>0&&(r=!0,void 0===n&&(n=0),void 0===h&&(h=0)),(u=this.getSizerConfig(t)).align=i,u.padding=ge(s),Xh(r)?(u.expandWidth=Wh(r,"width",!1),u.expandHeight=Wh(r,"height",!1)):(u.expandWidth=r,u.expandHeight=r),t.isRexSizer||(u.expandWidth&&(t.minWidth=void 0===n?Q(t):n),u.expandHeight&&(t.minHeight=void 0===h?tt(t):h)),u.alignOffsetX=a,u.alignOffsetY=o,u.alignOffsetOriginX=d,u.alignOffsetOriginY=c,u.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,p&&this.addChildrenMap(e,t),this}},Fh={remove(t,e){var i;if("string"==typeof t){if(i=t,!(t=this.sizerChildren[i]))return this}else{if(this.getParentSizer(t)!==this)return this;i=this.childToKey(t)}return i&&(delete this.sizerChildren[i],this.childrenMap.hasOwnProperty(i)&&delete this.childrenMap[i]),Oe.call(this,t,e),this},removeAll(t){for(var e in this.sizerChildren)this.remove(e,t);return this},clear(t){for(var e in this.sizerChildren)delete this.sizerChildren[e],this.childrenMap.hasOwnProperty(e)&&delete this.childrenMap[e];return yh.call(this,t),this}},Nh={getChildrenWidth:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var h in r)t=r[h],void 0===(i=this.getChildWidth(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).left+e.right)*this.scaleX,s=Math.max(i,s));return n?void 0:s+(this.space.left+this.space.right)*this.scaleX},getChildrenHeight:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var h in r)t=r[h],void 0===(i=this.getChildHeight(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).top+e.bottom)*this.scaleY,s=Math.max(i,s));return n?void 0:s+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(s.expandWidth){var r=e-(this.space.left+this.space.right)*this.scaleX,n=s.padding;i=r-(n.left+n.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(s.expandHeight){var r=e-(this.space.top+this.space.bottom)*this.scaleY,n=s.padding;i=r-(n.top+n.bottom)*this.scaleY}return i},getChildrenSizers:function(t){void 0===t&&(t=[]);var e,i=this.sizerChildren;for(var s in i)(e=i[s]).isRexSizer&&t.push(e);return t},layoutChildren:function(){var t,e,i,s,r,n,h,a,o,l,d,c,u=this.innerLeft,p=this.innerTop,v=this.innerWidth,g=this.innerHeight,f=this.sizerChildren;for(var m in f)(t=f[m]).rexSizer.hidden||(i=(e=t.rexSizer).padding,mr.call(this,t),l=this.getExpandedChildWidth(t),d=this.getExpandedChildHeight(t),e.aspectRatio>0&&(Ah.width=e.aspectRatio,Ah.height=1,Yh.width=l,Yh.height=d,l=(c=Lh(Ah,Yh,"FIT",!0)).width,d=c.height),t.isRexSizer?(t.runLayout(this,l,d),nh(t,this)):He(t,l,d),s=u+i.left*this.scaleX,n=v-(i.left+i.right)*this.scaleX,r=p+i.top*this.scaleY,h=g-(i.top+i.bottom)*this.scaleY,void 0===l&&(l=Q(t)),void 0===d&&(d=tt(t)),a=(e.alignOffsetX+e.alignOffsetOriginX*l)*this.scaleX,o=(e.alignOffsetY+e.alignOffsetOriginY*d)*this.scaleY,yr.call(this,t,s,r,n,h,e.align,a,o))}};Object.assign(Nh,Ih,Fh);const Hh=Phaser.Utils.Objects.IsPlainObject,Gh=Phaser.Utils.Objects.GetValue;class Vh extends rh{constructor(t,e,i,s,r,n){Hh(e)?(e=Gh(n=e,"x",0),i=Gh(n,"y",0),s=Gh(n,"width",void 0),r=Gh(n,"height",void 0)):Hh(s)&&(s=Gh(n=s,"width",void 0),r=Gh(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexOverlapSizer",this.sizerChildren={},this.addChildrenMap("items",this.sizerChildren)}childToKey(t){if("string"!=typeof t)return function(t,e){if(Array.isArray(t))return t.indexOf(e);for(var i in t)if(t[i]===e)return i;return null}(this.sizerChildren,t);var e=t;return this.sizerChildren.hasOwnPropery(e)?e:null}}Object.assign(Vh.prototype,Nh);const Uh=Rh.prototype.add,$h=Rh.prototype.addSpace;var Jh=function(t){var e=!t.isRexSpace,i=!e||this.buttonsExpand?1:0;if(0===this.sizerChildren.length)if(e){!this.buttonsExpand&&("right"===this.buttonsAlign||"center"===this.buttonsAlign||"bottom"===this.buttonsAlign)&&$h.call(this),Uh.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&$h.call(this),this.hasTailSpace=s}else Uh.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;Uh.call(this,t,{index:r,proportion:i,expand:!0})}else Uh.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},Kh={addButton(t){if(ur(t))for(var e=t,i=0,s=e.length;i=0;i--)Qh.call(this,e[i],t);return this}},ea=function(t,e,i){if(t){var s=this.setValueCallback,r=this.setValueCallbackScope;s&&(r?s.call(r,t,e,i):s(t,e,i)),this.fireEvent("button.statechange",t,e,i)}},ia=function(t){var e=this;t._selected=void 0,Object.defineProperty(t,"selected",{get:function(){return t._selected},set:function(i){if(t._selected!==i){var s=t._selected;t._selected=i,ea.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},sa={add(t){return this.buttons.push(t),t._click||(t._click=new Sr(t,this.clickConfig),t._click.on("click",(function(t,e,i,s){this.fireEvent("button.click",e,i,s)}),this).on("enable",(function(t,e){this.fireEvent("button.enable",e)}),this).on("disable",(function(t,e){this.fireEvent("button.disable",e)}),this).on("over",(function(t,e,i,s){this.fireEvent("button.over",e,i,s)}),this).on("out",(function(t,e,i,s){this.fireEvent("button.out",e,i,s)}),this).on("down",(function(t,e,i,s){this.fireEvent("button.down",e,i,s)}),this).on("up",(function(t,e,i,s){this.fireEvent("button.up",e,i,s)}),this),t.isRexContainerLite&&t.sendChildToBack(t)),this.buttonsType&&(void 0===t.name&&console.error(`${this.parent.constructor.name}: Option button miss value`),ia.call(this,t)),this},addMultiple(t){for(var e=0,i=t.length;e0},setButtonEnable(t,e){var i=this.buttons;if(void 0===t||"boolean"==typeof t){e=t;for(var s=0,r=i.length;sa.height/2)){r>(o=ma(a.left,a.centerY,t,e))&&(r=o,s=n);var o,l=i[n+1];l&&l.y===a.y||r>(o=ma(a.right,a.centerY,t,e))&&(r=o,s=n+1)}}return s};const ba=Phaser.Utils.Objects.IsPlainObject,xa=Phaser.Utils.Objects.GetValue,Ca=Phaser.Display.Align.CENTER;var Sa=function(t,e,i,s){return"\n"===t?(this.addNewLine(),this):(me.call(this,t),ba(e)&&(e=xa(o=e,"padding",0),i=xa(o,"key",void 0),s=xa(o,"index",void 0),r=xa(o,"offsetX",0),n=xa(o,"offsetY",0),h=xa(o,"offsetOriginX",0),a=xa(o,"offsetOriginY",0)),void 0===e&&(e=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===h&&(h=0),void 0===a&&(a=0),(o=this.getSizerConfig(t)).align=Ca,o.padding=ge(e),o.alignOffsetX=r,o.alignOffsetY=n,o.alignOffsetOriginX=h,o.alignOffsetOriginY=a,void 0===s||s>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(s,0,t),void 0!==i&&this.addChildrenMap(i,t),this);var r,n,h,a,o},wa={add(t,e,i){if(ur(t))for(var s=t,r=0,n=s.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,yh.call(this,t),this}},Ta={getChildrenWidth:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=0===this.orientation&&t?this.maxChildWidth:this.rexSizer.resolved?this.wrapResult.width:void 0)?e+(this.space.left+this.space.right)*this.scaleX:void 0);var e},getChildrenHeight:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=1===this.orientation&&t?this.maxChildHeight:this.rexSizer.resolved?this.wrapResult.height:void 0)?e+(this.space.top+this.space.bottom)*this.scaleY:void 0);var e},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;sr&&Da.addNewLine(this)}else for(n=0,h=t.length;n=0;i--)Wa.call(this,e[i],t);return this}};const ja=Phaser.Utils.Objects.GetValue;class Ia extends Ra{constructor(t,e){void 0===e&&(e={});var i=e.space;"number"==typeof i&&(e.space={item:i,line:i}),super(t,e),this.type="rexFixWidthButtons",this.buttonGroup=new da({parent:this,eventEmitter:ja(e,"eventEmitter",this),groupName:ja(e,"groupName",void 0),clickConfig:ja(e,"click",void 0)}).setButtonsType(e);var s=ja(e,"background",void 0),r=ja(e,"buttons",void 0);this.buttonsAlign=ja(e,"align",void 0),s&&this.addBackground(s),r&&this.addButtons(r),this.addChildrenMap("background",s),this.addChildrenMap("buttons",this.buttonGroup.buttons)}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.buttonGroup.destroy(),this.buttonGroup=void 0)}get buttons(){return this.buttonGroup.buttons}get groupName(){return this.buttonGroup.groupName}set groupName(t){this.buttonGroup.groupName=t}get eventEmitter(){return this.buttonGroup.eventEmitter}}Object.assign(Ia.prototype,Aa,Ba,la,ua);var Fa=function(){return Array.prototype.reduce.call(arguments,Na,0)},Na=function(t,e){return t+e};const Ha=Phaser.Utils.Objects.IsPlainObject,Ga=Phaser.Utils.Objects.GetValue,Va=Phaser.Display.Align.CENTER;var Ua=function(t,e,i,s,r){if("number"==typeof t||"number"==typeof e){if(void 0===t){for(var n=0;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return Ja(this.sizerChildren,null),yh.call(this,t),this}},qa={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)Ja(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},eo={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Xe.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,Ja(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Ja(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},so=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const ro=Phaser.Utils.Objects.IsPlainObject,no=Phaser.Utils.Objects.GetValue;class ho extends rh{constructor(t,e,i,s,r,n,h,a,o,l){ro(e)?(e=no(l=e,"x",0),i=no(l,"y",0),s=no(l,"width",void 0),r=no(l,"height",void 0),n=no(l,"column",l.col||0),h=no(l,"row",0),a=no(l,"columnProportions",0),o=no(l,"rowProportions",0)):ro(s)?(s=no(l=s,"width",void 0),r=no(l,"height",void 0),n=no(l,"column",l.col||0),h=no(l,"row",0),a=no(l,"columnProportions",0),o=no(l,"rowProportions",0)):ro(n)?(n=no(l=n,"column",l.col||0),h=no(l,"row",0),a=no(l,"columnProportions",0),o=no(l,"rowProportions",0)):ro(a)&&(a=no(l=a,"columnProportions",0),o=no(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(no(l,"createCellContainerCallback")),this.setIndentLeft(no(l,"space.indentLeftOdd",0),no(l,"space.indentLeftEven",0)),this.setIndentTop(no(l,"space.indentTopOdd",0),no(l,"space.indentTopEven",0)),this.resetGrid(n,h,a,o,no(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=io.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=so.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(ho.prototype,eo);const ao=ho.prototype.add;var oo={addButton(t,e,i){return ao.call(this,t,e,i,void 0,0,this.buttonsExpand),this.buttonGroup.add(t),this},addButtons(t,e){for(var i=0,s=t;i=0;i--)uo.call(this,e[i],t);return this}};const vo=Phaser.Utils.Objects.GetValue;class go extends ho{constructor(t,e){void 0===e&&(e={});var i=vo(e,"row",0),s=vo(e,"column",e.col||0),r=vo(e,"createCellContainerCallback"),n=vo(e,"buttons",void 0),h=vo(e,"expand",!0),a=h?1:0;if(r&&(e.createCellContainerCallback=void 0),void 0!==n){i=Math.max(i,n.length);for(var o=0,l=n.length;o0&&r.push(o.join("")),r},Zo=0,Qo=1,tl=2,el=0,il=1,sl=2,rl=/(?:\r\n|\r|\n)/;const nl={none:el,word:il,char:sl,character:sl,mix:3},hl=Phaser.Renderer.WebGL.Utils;var al={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,h=r.height,a=hl.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,h,e.x,e.y,n/e.resolution,h/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,h,a(e.tintTopLeft,i.alpha*e._alphaTL),a(e.tintTopRight,i.alpha*e._alphaTR),a(e.tintBottomLeft,i.alpha*e._alphaBL),a(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const ol=Phaser.Display.Color;var ll={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,h,a,o,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===h&&(h=0),void 0===a&&(a=0),void 0===o&&(o=c),void 0===l&&(l=u);var p=d.cutX+h,v=d.cutY+a;return this.context.drawImage(d.source.image,p,v,o,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new ol);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var h=i;i=h.red,s=h.green,r=h.blue,n=h.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var a=this.context.createImageData(1,1);return a.data[0]=i,a.data[1]=s,a.data[2]=r,a.data[3]=n,this.context.putImageData(a,t,e),this.dirty=!0,this}},dl=function(t,e,i,s,r,n,h){var a,o=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===h&&(h=e.height);var d=(a=o.exists(i)?o.get(i):o.createCanvas(i,n,h)).getSourceImage();d.width!==n&&(d.width=n),d.height!==h&&(d.height=h);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,h),c.drawImage(e,s,r,n,h),l.gl&&a&&l.canvasToTexture(d,a.source[0].glTexture,!0,0)},cl={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,dl(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};e();const ul=Phaser.Display.Canvas.CanvasPool,pl=Phaser.GameObjects.GameObject,vl=Phaser.Utils.String.UUID;class gl extends pl{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=ul.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=vl(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){ul.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}}const fl=Phaser.GameObjects.Components;Phaser.Class.mixin(gl,[fl.Alpha,fl.BlendMode,fl.Crop,fl.Depth,fl.Flip,fl.GetBounds,fl.Mask,fl.Origin,fl.Pipeline,fl.PostPipeline,fl.ScrollFactor,fl.Tint,fl.Transform,fl.Visible,al,ll,cl]);var ml={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:Es(this.data,t,e)},incData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)+e),this},mulData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)*e),this},clearData(){return this.data&&ft(this.data),this}};class yl{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}}Object.assign(yl.prototype,ml);var bl={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const xl=Phaser.Math.RotateAround;var Cl;const Sl=Phaser.Geom.Rectangle;var wl,Ol=function(t){void 0===wl&&(wl=new Sl);var e=t.drawTLX,i=t.drawTLY;return wl.setTo(e,i,t.drawTRX-e,t.drawBLY-i),wl};const Pl=Phaser.Math.RotateAround;var Tl,kl=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Tl&&(Tl={}),s=Tl),s.x=e,s.y=i,0!==t.rotation&&Pl(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const _l=Phaser.GameObjects.Components.TransformMatrix;var El,Ml,Rl={},Ll=function(t,e,i,s,r){var n=kl(e,i,s,!0),h=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=Rl);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===El&&(El=new _l,Ml=new _l),t.parentContainer?t.getWorldTransformMatrix(El,Ml):El.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),El.transformPoint(r,n,s),s}(t,n.x,n.y,r);return h},Dl=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,h=e.drawCenterY+s;return Ll(t,e,n,h,r)},zl={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Cl&&(Cl={}),s=Cl),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&xl(s,0,0,-i.rotation),s}(t,e,this,!0);return Ol(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return Dl(this.parent,this,t,e,i)}};Object.assign(zl,bl);const Al=Phaser.Math.DegToRad,Yl=Phaser.Math.RadToDeg,Xl=Phaser.Utils.Objects.GetValue;class Wl extends yl{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return Yl(this._rotation)}set angle(t){this.rotation=Al(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=Xl(t,"width",void 0),i=Xl(t,"height",void 0),s=Xl(t,"scaleX",void 0),r=Xl(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(Wl.prototype,zl);const Bl=Phaser.Utils.String.Pad;var jl=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${Bl(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},Il=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Fl=Phaser.Utils.Objects.GetValue;let Nl=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=Fl(t,"x",0),i=Fl(t,"y",0));var s=this.cornerRadius;s.tl=Hl(Fl(t,"tl",void 0),e,i),s.tr=Hl(Fl(t,"tr",void 0),e,i),s.bl=Hl(Fl(t,"bl",void 0),e,i),s.br=Hl(Fl(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Gl(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Gl(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Gl(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Gl(this.cornerRadius.br,t)}};var Hl=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Vl(t),t},Gl=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Fl(e,"x",0),t.y=Fl(e,"y",0)),Vl(t)},Vl=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const Ul=Phaser.Math.DegToRad;var $l=function(t){return!t.hasOwnProperty("convex")||t.convex},Jl=function(t){return t.x>0&&t.y>0},Kl=function(t,e,i,s,r,n,h,a,o){if(a&&h>n?h-=360:!a&&h=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=m.tl,Jl(a)?(o=a.x*g,l=a.y*f,$l(a)?Kl(t,o,l,o,l,180,270,!1,h):Kl(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,Jl(a)?(o=a.x*g,l=a.y*f,$l(a)?Kl(t,s-o,l,o,l,270,360,!1,h):Kl(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,Jl(a)?(o=a.x*g,l=a.y*f,$l(a)?Kl(t,s-o,r-l,o,l,0,90,!1,h):Kl(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,Jl(a)?(o=a.x*g,l=a.y*f,$l(a)?Kl(t,o,r-l,o,l,90,180,!1,h):Kl(t,0,r,o,l,360,270,!0,h)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,h,u),null!=a)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,a),p.addColorStop(1,d),a=p),e.fillStyle=a,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())},Zl=function(t,e,i,s,r,n,h,a){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),ql(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}};const Ql=Phaser.Utils.Objects.GetValue;class td extends Wl{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(Ql(e,"color",null),Ql(e,"color2",null),Ql(e,"horizontalGradient",!0)),this.setStroke(Ql(e,"stroke",null),Ql(e,"strokeThickness",2)),this.setCornerRadius(Ql(e,"cornerRadius",0),Ql(e,"cornerIteration",null))}set color(t){t=jl(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=jl(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=jl(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,Il("color2",t,this),Il("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Il("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Il("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){Zl(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const ed=Phaser.Utils.Objects.GetValue;class id extends Wl{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(ed(e,"color",null),ed(e,"color2",null),ed(e,"horizontalGradient",!0)),this.setStroke(ed(e,"stroke",null),ed(e,"strokeThickness",2))}set color(t){t=jl(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=jl(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=jl(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,ed(t,"color2",null),ed(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,ed(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,h=this.parent.height-i.top-i.bottom,a=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?a.createLinearGradient(0,0,n,0):a.createLinearGradient(0,0,0,h)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,a.fillStyle=t,a.fillRect(s,r,n,h));null!=this.stroke&&this.strokeThickness>0&&(a.strokeStyle=this.stroke,a.lineWidth=this.strokeThickness,a.strokeRect(s,r,n,h))}}const sd=Phaser.Utils.Objects.GetValue;let rd=class t{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(sd(t,"bold",!1)),this.setItalic(sd(t,"italic",!1)),this.setFontSize(sd(t,"fontSize","16px")),this.setFontFamily(sd(t,"fontFamily","Courier")),this.setColor(sd(t,"color","#fff")),this.setStrokeStyle(sd(t,"stroke",null),sd(t,"strokeThickness",0)),this.setShadow(sd(t,"shadowColor",null),sd(t,"shadowOffsetX",0),sd(t,"shadowOffsetY",0),sd(t,"shadowBlur",0)),this.setOffset(sd(t,"offsetX",0),sd(t,"offsetY",0)),this.setSpace(sd(t,"leftSpace",0),sd(t,"rightSpace",0)),this.setAlign(sd(t,"align",void 0)),this.setBackgroundColor(sd(t,"backgroundColor",null)),this.setBackgroundHeight(sd(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(sd(t,"backgroundBottomY",void 0)),this.setBackgroundLeftX(sd(t,"backgroundLeftX",0)),this.setBackgroundRightX(sd(t,"backgroundRightX",0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(Il("stroke",t,this),Il("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Il("shadowOffsetX",t,this),Il("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),t.hasOwnProperty("backgroundLeftX")&&this.setBackgroundLeftX(t.backgroundLeftX),t.hasOwnProperty("backgroundRightX")&&this.setBackgroundRightX(t.backgroundRightX),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new t(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=jl(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=jl(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=jl(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=jl(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setBackgroundLeftX(t){return this.backgroundLeftX=t,this}setBackgroundRightX(t){return this.backgroundRightX=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}};const nd=Phaser.Utils.Array.Remove,hd=Phaser.Utils.Array.Remove,ad="text",od="image",ld="drawer",dd="space",cd="command";var ud=function(t){return t.type===ad&&"\n"===t.text},pd=function(t){return t.type===ad&&"\f"===t.text},vd=function(t){return t.type===ad};class gd extends Wl{constructor(t,e,i){super(t,ad),this.updateTextFlag=!1,this.style=new rd(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX+e.backgroundLeftX,s=i,r=this.drawTRX+e.backgroundRightX-i+1;if(r>0){var n=e.backgroundBottomY;null==n&&(n=this.drawBLY);var h=e.backgroundHeight;null==h&&(h=n-this.drawTLY);var a=n-h;t.fillRect(s,a,r,h)}}var o=e.hasFill,l=e.hasStroke;(o||l)&&(e.syncFont(t).syncStyle(t),l&&(e.syncShadow(t),t.strokeText(this.text,0,0)),o&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var fd=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const md=Phaser.Display.Canvas.CanvasPool;var yd=function(t,e,i,s,r,n,h,a){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===a&&(a=!1),a&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(h){var l=md.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=h,d.fillRect(0,0,r,n),o.drawImage(l,0,0,r,n,i,s,r,n),md.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)};Phaser.Display.Canvas.CanvasPool;class bd extends Wl{constructor(t,e,i){super(t,od),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){yd(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class xd extends Wl{constructor(t,e,i,s){super(t,ld),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class Cd extends Wl{constructor(t,e){super(t,dd),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class Sd extends yl{constructor(t,e,i,s,r){super(t,cd),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}function wd(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>wd(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=wd(t[i]));return e}var Od=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const Pd={none:0,word:1,char:2,character:2,mix:3};var Td=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,h=!r&&!n,a=t.length,o=e,l=s.word,d=0,c=!1;o0&&!a){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=Md.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=Md.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=Ld(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=Ld(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=Ld(t,"wrapMode");void 0===c&&(c=Ld(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=Pd[c]);var u=Ld(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=Ld(t,"letterSpacing",0),v=Ld(t,"hAlign",0),g=Ld(t,"vAlign",0),f=Ld(t,"justifyPercentage",.25),m=Od({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:h,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,b=0,x=y.length;b0&&(E.push({children:M,width:R}),L=Math.max(L,R)),m.start+=_.length,m.isLastPage=!D&&m.start===k,m.maxLineWidth=L,m.linesHeight=E.length*n;var j=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,I=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,h=t.vAlign,a=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(h=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=Ad(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=Ad(t,"maxLines",0);var a=0===i,o=Ad(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=Ad(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=Ad(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=Ad(t,"letterSpacing",0),p=Ad(t,"rtl",!0),v=Ad(t,"hAlign",p?2:0),g=Ad(t,"vAlign",0),f=Od({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:o,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(_.push({children:E,height:M}),R=Math.max(R,M)),f.start+=k.length,f.isLastPage=f.start===T,f.maxLineHeight=R,f.linesWidth=_.length*n;var X=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,W=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,h=t.vAlign,a=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}a&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,h=i.bottom;return Le(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return Re(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),nd(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return hd(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(ad);return null===i?i=new gd(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),Dl(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const hc=Phaser.Utils.Objects.GetFastValue;var ac={};class oc{constructor(t){this.pools=hc(t,"pools",ac)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new nc),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;ei&&(r=Math.floor(i));for(var n={},h=fc(t,r,e,i,n),a=0;a<=pc&&0!==h;a++){if((r+=h)<0){r=0;break}h=fc(t,r,e,i,n)}return a===pc&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),mc(t,e,i),t},gc=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},fc=function(t,e,i,s,r){var n,h=gc(t,e,r),a=gc(t,e+1,r);if(void 0!==s)if(h.height<=s&&a.height>s)n=0;else{if(h.height>s)return-1;n=Math.floor(s-h.height)}if(h.width<=i&&a.width>i)return 0;if(h.width>i)return-1;var o=Math.floor(i-h.width);return void 0===n?o:Math.min(o,n)},mc=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const yc=Phaser.Utils.Objects.GetValue,bc=Phaser.Utils.Objects.GetValue;class xc extends Lo{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=bc(e,"background",void 0),r=bc(e,"icon",void 0),n=bc(e,"iconMask",void 0),h=bc(e,"text",void 0),a=bc(e,"action",void 0),o=bc(e,"actionMask",void 0),l=bc(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(h||a)&&(i={right:bc(e,"space.icon",0),top:bc(e,"space.iconTop",0),bottom:bc(e,"space.iconBottom",0),left:bc(e,"space.iconLeft",0)}):(h||a)&&(i={bottom:bc(e,"space.icon",0),left:bc(e,"space.iconLeft",0),right:bc(e,"space.iconRight",0),top:bc(e,"space.iconTop",0)});var d=bc(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=Fo.call(this,r,r,1)),!d){var c=bc(e,"iconSize",void 0);this.setIconSize(bc(e,"iconWidth",c),bc(e,"iconHeight",c))}}if(h){var u=bc(e,"wrapText",!1),p=bc(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),function(t,e){switch(Uo(t)){case 0:switch("string"==typeof e&&(e=nl[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=Ko;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=nl[e]||0),t.style.wrapMode=e}}(h,u),e.expandTextWidth=!0,uc(h)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=yc(e,"minWidth",0),s=yc(e,"minHeight",0),r=yc(e,"fitHeight",!1);t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return vc(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),vc(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t})}(h,{fitHeight:!0}));var v,g,f=bc(e,"space.text",0),m=bc(e,"expandTextWidth",!1),y=bc(e,"expandTextHeight",!1);0===this.orientation?(v=m?1:0,a&&(i={right:f}),g=y):(v=y?1:0,a&&(i={bottom:f}),g=m),this.add(h,{proportion:v,expand:g,padding:i})}if(a&&(i=0===this.orientation?{top:bc(e,"space.actionTop",0),bottom:bc(e,"space.actionBottom",0),right:bc(e,"space.actionRight",0)}:{left:bc(e,"space.actionLeft",0),right:bc(e,"space.actionRight",0),bottom:bc(e,"space.actionBottom",0)},d=bc(e,"squareFitAction",!1)?1:0,this.add(a,{proportion:0,padding:i,fitRatio:d}),o&&(o=Fo.call(this,a,a,1)),!d)){var b=bc(e,"actionSize");this.setActionSize(bc(e,"actionWidth",b),bc(e,"actionHeight",b))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",h),this.addChildrenMap("action",a),this.addChildrenMap("actionMask",o)}}var Cc=Phaser.Renderer.WebGL.Utils,Sc=function(t,e,i,s,r,n){for(var h=Cc.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),a=i.pathData,o=i.pathIndexes,l=0;l>>16,a=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+h+","+a+","+o+","+n+")"},kc=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,h=(16711680&r)>>>16,a=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+h+","+a+","+o+","+n+")",t.lineWidth=e.lineWidth};const _c=Phaser.Renderer.Canvas.SetTransform;var Ec={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Pc(e,i,s),h=r.calcMatrix.copyFrom(n.calc),a=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&Sc(r,h,e,l,a,o),e.isStroked&&Oc(r,e,l,a,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(_c(t,r,e,i,s)){var n=e._displayOriginX,h=e._displayOriginY,a=e.pathData,o=a.length-1,l=a[0]-n,d=a[1]-h;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(Rc.prototype,Ec);var Lc=function(t){return t.x>0&&t.y>0},Dc=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const zc=Phaser.Math.DegToRad;var Ac=function(t,e,i,s,r,n,h,a,o){h&&n>r?n-=360:!h&&n0,h=0,a=e.length;h=0?t.startAt(h+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(h+n,i):t.startAt(h,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(h,i),t.close(),t};const Yu=Phaser.Utils.Objects.GetValue,Xu=Phaser.Utils.Objects.IsPlainObject;class Wu extends(lu(eu)){constructor(t,e,i,s,r,n,h,a){Xu(e)?(e=(a=e).x,i=a.y,s=a.width,r=a.height,n=a.barColor,h=a.value):Xu(s)?(s=(a=s).width,r=a.height,n=a.barColor,h=a.value):Xu(n)&&(n=(a=n).barColor,h=a.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===h&&(h=0),super(t,e,i,s,r,a),this.type="rexLineProgress",this.bootProgressBase(a),this.addShape((new zu).setName("trackFill")).addShape((new zu).setName("bar")).addShape((new zu).setName("trackStroke")),this.setTrackColor(Yu(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(Yu(a,"trackStrokeThickness",2),Yu(a,"trackStrokeColor",void 0)),this.setSkewX(Yu(a,"skewX",0)),this.setRTL(Yu(a,"rtl",!1)),this.setValue(h)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var Bu={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&Au(s,0,0,e,i,t);var r,n,h=this.getShape("bar");h.fillStyle(this.barColor),h.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),Au(h,r,0,n,i,t));var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&Au(a,0,0,e,i,t)}};Object.assign(Wu.prototype,Bu);var ju=function(t){return null==t||""===t||0===t.length},Iu=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(ju(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(ju(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,h=e.length;n=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=wd(i),s=wd(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),h=n.width,a=0,o=0,l=i.length;o0?h/a:0,c=n.height,u=0;for(o=0,l=s.length;o0?0:g,b=0,o=0;for(var w=i.length;o0?0:f),f>=1&&g>=1){var O=typeof(m=this.getFrameNameCallback(o,C,e));"string"!==O&&"number"!==O||r.add(m,0,b+n.cutX,x+n.cutY,f,g)}b+=f}x+=g}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,h,a,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/o,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(u,p);if(u>v){var g=(u-v)*o;d>=0?d+=g:d=g,u=v}if(p>v){var f=(p-v)*l;c>=0?c+=f:c=f,p=v}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,x=this.rows.count;b0&&a>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(C,b)?0:1)?this._drawImage(this.textureKey,s,m,y,h,a):this._drawTileSprite(this.textureKey,s,m,y,h,a)),m+=h;y+=a}this._endDraw()},setStretchMode:function(t){return np(t)?(this.stretchMode.edge=ap(hp(t,"edge",0)),this.stretchMode.internal=ap(hp(t,"internal",0))):(t=ap(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return lp.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const cp=Phaser.Utils.Objects.IsPlainObject,up=Phaser.Utils.Objects.GetValue,pp=Phaser.GameObjects;var vp=void 0,gp=function(t,e){if(vp||(vp={},ti(t).events.once("destroy",(function(){for(var t in vp)vp[t].destroy();vp=void 0}))),!vp.hasOwnProperty(e)){var i=ti(t).scene.systemScene;(t=new pp[e](i)).setOrigin(0),vp[e]=t}return vp[e]};const fp=Phaser.GameObjects.RenderTexture;class mp extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if(cp(i)?(i=up(d=i,"x",0),s=up(d,"y",0),r=up(d,"width",1),n=up(d,"height",1),h=up(d,"key",void 0),a=up(d,"baseFrame",void 0),o=up(d,"columns",void 0),l=up(d,"rows",void 0)):cp(r)?(r=up(d=r,"width",1),n=up(d,"height",1),h=up(d,"key",void 0),a=up(d,"baseFrame",void 0),o=up(d,"columns",void 0),l=up(d,"rows",void 0)):cp(h)?(h=up(d=h,"key",void 0),a=up(d,"baseFrame",void 0),o=up(d,"columns",void 0),l=up(d,"rows",void 0)):cp(a)?(a=up(d=a,"baseFrame",void 0),o=up(d,"columns",void 0),l=up(d,"rows",void 0)):Array.isArray(a)?(d=l,l=o,o=a,a=up(d,"baseFrame",void 0)):cp(o)&&(o=up(d=o,"columns",void 0),l=up(d,"rows",void 0)),void 0===a&&(a=up(d,"frame",void 0)),void 0===o){var c=up(d,"leftWidth",void 0),u=up(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=up(d,"topHeight",void 0),v=up(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(up(d,"getFrameNameCallback",void 0)),this.setStretchMode(up(d,"stretchMode",0)),this.setPreserveRatio(up(d,"preserveRatio",!0));var g=up(d,"maxFixedPartScale",1),f=up(d,"maxFixedPartScaleX",g),m=up(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(h,a,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,dp),i}(fp,"rexNinePatch")){}var yp={_drawImage:function(t,e,i,s,r,n){var h=gp(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=gp(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(mp.prototype,yp);let bp=class extends ii{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Hu(t,e))return t[e];var i=t.parent;return Hu(i,e)?i[e]:void 0}set(t,e,i){return Hu(t,e)?t[e]=i:Hu(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}};const xp=Phaser.Utils.Objects.GetValue;class Cp extends mp{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=xp(e,"effects",!0);i&&Ju(this,i),this.style=new bp(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Cp.prototype,Uc);const Sp=["alpha","tint","flipX","flipY"];var wp=function(t,e){if(!e)return t;for(var i=0,s=Sp.length;i * @copyright 2018 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */const zp=Phaser.Display.Canvas.CanvasPool;var Ap=function(t){var e=zp.create(this),i=e.getContext("2d",{willReadFrequently:!0});t.syncFont(e,i);var s=i.measureText(t.testString);if("actualBoundingBoxAscent"in s){var r=s.actualBoundingBoxAscent,n=s.actualBoundingBoxDescent,h={ascent:r,descent:n,fontSize:r+n};return zp.remove(e),h}var a=Math.ceil(s.width*t.baselineX),o=a,l=2*o;if(o=o*t.baselineY|0,e.width=a,e.height=l,i.fillStyle="#f00",i.fillRect(0,0,a,l),i.font=t._font,i.textBaseline="alphabetic",i.fillStyle="#000",i.fillText(t.testString,0,o),h={ascent:0,descent:0,fontSize:0},!i.getImageData(0,0,a,l))return h.ascent=o,h.descent=o+6,h.fontSize=h.ascent+h.descent,zp.remove(e),h;var d,c,u=i.getImageData(0,0,a,l).data,p=u.length,v=4*a,g=0,f=!1;for(d=0;do;d--){for(c=0;c0&&this.wrapMode!==el&&0===this.wrapWidth}setStyle(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wordWrap")){var s=t.wordWrap;s.hasOwnProperty("width")&&(t.wrap={mode:"word",width:s.width})}if(t&&t.hasOwnProperty("wrap")){var r=t.wrap;if(r.hasOwnProperty("mode")){var n=r.mode;"string"==typeof n&&(r.mode=nl[n])}else r.hasOwnProperty("width")&&(r.mode=1)}t&&t.rtl&&i&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var h=this.propertyMap;for(var a in h){var o=h[a],l=o[0],d=i?o[1]:this[a],c=o[2];if("wrapCallback"===a||"wrapCallbackScope"===a)this[a]=Xp(t,l,d);else{var u=Yp(t,l,d);c&&(u=c(u)),this[a]=u}}var p=Xp(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var v=Xp(t,"fill",null);null!==v&&(this.color=jl(v));var g=Xp(t,"metrics",!1);return g?this.metrics={ascent:Xp(g,"ascent",0),descent:Xp(g,"descent",0),fontSize:Xp(g,"fontSize",0)}:!e&&this.metrics||(this.metrics=Ap(this)),e?this.parent.updateText():this.parent}syncFont(t,e){e.font=this._font}syncStyle(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"}syncShadow(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)}update(t){return t&&(this._font=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim(),this.metrics=Ap(this)),this.parent.updateText(t)}buildFont(){var t=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim();return t!==this._font&&(this._font=t),this}setFont(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=Xp(t,"fontFamily","Courier"),this.fontSize=Xp(t,"fontSize","16px"),this.fontStyle=Xp(t,"fontStyle","")),this.update(!0)}setFontFamily(t){return this.fontFamily=t,this.update(!0)}setFontStyle(t){return this.fontStyle=t,this.update(!0)}setFontSize(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}setTestString(t){return this.testString=t,this.update(!0)}setFixedSize(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}setResolution(t){return this.resolution=t,this.update(!1)}setXOffset(t){return this.xOffset=t,this.update(!1)}setBackgroundColor(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=jl(t,this.parent.canvas,this.parent.context),this.backgroundColor2=jl(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=jl(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}setBackgroundCornerRadius(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}setFill(t){return this.color=jl(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=jl(t,this.parent.canvas,this.parent.context),this.update(!1)}setStroke(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=jl(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}setShadow(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===n&&(n=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=jl(i,this.parent.canvas,this.parent.context),this.shadowBlur=s,this.shadowStroke=r,this.shadowFill=n,this.update(!1)}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}setShadowColor(t){return void 0===t&&(t="#000"),this.shadowColor=jl(t,this.parent.canvas,this.parent.context),this.update(!1)}setShadowBlur(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}setShadowStroke(t){return this.shadowStroke=t,this.update(!1)}setShadowFill(t){return this.shadowFill=t,this.update(!1)}setUnderline(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=jl(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}setUnderlineColor(t){return void 0===t&&(t="#000"),this.underlineColor=jl(t,this.parent.canvas,this.parent.context),this.update(!1)}setUnderlineThickness(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}setUnderlineOffset(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}setStrikethrough(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=jl(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}setStrikethroughColor(t){return void 0===t&&(t="#000"),this.strikethroughColor=jl(t,this.parent.canvas,this.parent.context),this.update(!1)}setStrikethroughThickness(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}setStrikethroughOffset(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}setWrapMode(t){return"string"==typeof t&&(t=nl[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}setWrapWidth(t){return this.wrapWidth=t,this.update(!1)}setAlign(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}setHAlign(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}setVAlign(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}setMaxLines(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}getTextMetrics(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}setTextMetrics(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=Xp(e,"fontFamily",this.fontFamily),this.fontSize=Xp(e,"fontSize",this.fontSize),this.fontStyle=Xp(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}get lineHeight(){return this.metrics.fontSize+this.parent.lineSpacing}toJSON(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}destroy(){this.parent=void 0}}var Bp={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var h=this.defaultStyle;this.clear(),Zl(this,h.backgroundColor,h.backgroundStrokeColor,h.backgroundStrokeLineWidth,h.backgroundCornerRadius,h.backgroundColor2,h.backgroundHorizontalGradient,h.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var a,o,l,d,c,u,p=h.halign,v=h.valign,g=h.lineHeight,f=r.lines,m=f.length,y=h.maxLines;y>0&&m>y?(o=y,l="center"===v?Math.floor((m-o)/2):"bottom"===v?m-o:0):(o=m,l=0),d=l+o;var b=this.rtl,x=b?this.parent.width:void 0;u="center"===v?Math.max((s-o*g)/2,0):"bottom"===v?Math.max(s-o*g-2,0):0,u+=e;for(var C=l;C0){var a=this.defaultStyle.metrics,o=i-a.ascent,l=a.fontSize;this.drawRectangle(e,o,t.width,l,h.bgcolor,h)}if(h.underlineThickness>0&&t.width>0){var d=i+h.underlineOffset-h.underlineThickness/2;this.drawLine(e,d,t.width,h.underlineThickness,h.underlineColor,h)}if(t.isTextPen&&(h.buildFont(),h.syncFont(r,n),h.syncStyle(r,n),this.drawText(e,i,t.text,h)),t.isImagePen&&this.drawImage(e,i,t.prop.img,t.prop.color,h),h.strikethroughThickness>0&&t.width>0&&(d=i+h.strikethroughOffset-h.strikethroughThickness/2,this.drawLine(e,d,t.width,h.strikethroughThickness,h.strikethroughColor,h)),n.restore(),t.hasAreaMarker&&t.width>0){var c,u=t.prop.area;if(u)c={key:u};else{var p=t.prop.url;c={key:`url:${p}`,url:p}}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,c)}},clear(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawRectangle(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var h=this.context;h.fillStyle=r,h.fillRect(t,e,i,s)},drawLine(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var h=this.context;n.syncShadow(h,n.shadowStroke);var a=h.lineCap;h.lineCap="butt",h.strokeStyle=r,h.lineWidth=s,h.beginPath(),h.moveTo(t,e),h.lineTo(t+i,e),h.stroke(),h.lineCap=a},drawText(t,e,i,s){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;s.stroke&&"none"!==s.stroke&&s.strokeThickness>0&&(s.syncShadow(r,s.shadowStroke),r.strokeText(i,t,e)),s.color&&"none"!==s.color&&(s.syncShadow(r,s.shadowFill),r.fillText(i,t,e))},drawImage(t,e,i,s,r){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,s,this.autoRound)}};const jp=Phaser.Utils.Objects.GetValue,Ip=Zo,Fp=Qo;class Np{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=jp(t,"text",""),this.x=jp(t,"x",0),this.y=jp(t,"y",0),this.width=jp(t,"width",0);var e=jp(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=jp(t,"newLineMode",0),this.startIndex=jp(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===Fp&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==Ip&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===Fp&&(t+=1),t}get endIndex(){return this.startIndex+this.rawTextLength}get lastX(){return this.x+this.width}get isTextPen(){return""!==this.text}get isImagePen(){return!!this.prop.img}get hasAreaMarker(){return!!this.prop.area||!!this.prop.url}}const Hp=Phaser.Utils.Objects.GetFastValue,Gp=Zo,Vp=tl;class Up{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=Hp(t,"tagToText",Xt),this.tagToTextScope=Hp(t,"tagToTextScope",void 0)}destroy(){this.clear(),this.tagToText=void 0,this.tagToTextScope=void 0}clear(){for(var t=0,e=this.lines.length;t=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}getLineEndIndex(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,s=!1;for(e=t;e>=0&&!(s=null!=(i=this.lines[e])&&i.length>0);e--);return s?i[i.length-1].endIndex:0}getLineWidth(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}getMaxLineWidth(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,s=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}getLineWidths(){for(var t=[],e=0,i=this.lines.length;e=t&&o<=e||(h=h.substring(t-a,e-a)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,h,l,d):c+=this.tagToText(h,l,d),d=l,!(o>=e)));u++);return c}get length(){return this.lines.length}set length(t){this.clear()}}var $p={};const Jp=Phaser.Geom.Rectangle;var Kp=new nc;class qp{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&cv(g)){""!==b?h.push(n.getLine(b,x,rv)):0===C&&r>0&&h.push(n.getLine("",0,rv)),h.push(...lv(g,e,av,s,0,n));var w=h.pop();b=w.text,x=w.width,n.freeLine(w)," "===b&&(b="",x=0)}else(m=x+f)>o?(h.push(n.getLine(b,x,rv)),b=g,x=f,o=s):(b+=g,x=m),C===S-1&&h.push(n.getLine(b,x,l))}return h},dv=function(t,e){var i;switch(e){case hv:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==pv&&i0&&t>e&&(t=e),t}get linesWidth(){return Math.ceil(this.penManager.getMaxLineWidth())}get linesHeight(){var t=this.displayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}get imageManager(){return this.parent.imageManager}get rtl(){return this.parent.style.rtl}newPenManager(){return new Up({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}get tmpPenManager(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}getPlainText(t,e,i){var s;if(null==t)s=this.penManager.plainText;else{var r=this.parser.splitText(t,1);s="";for(var n=0,h=r.length;n=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const Ng=Phaser.Utils.Objects.GetValue,Hg=Phaser.Math.Distance.Between;class Gg extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=Ng(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(Ng(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(Ng(t,"enable",!0)),this.holdThreshold=Ng(t,"holdThreshold",50),this.pointerOutReleaseEnable=Ng(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return vn(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:Hg(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!cr(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!cr(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const Vg=Phaser.Utils.Objects.GetValue;class Ug{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(Vg(t,"value",0)),this.setSpeed(Vg(t,"speed",0)),this.setAcceleration(Vg(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class $g{constructor(){this.value,this.dir,this.movement=new Ug}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const Zg={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},Qg=Phaser.Utils.Objects.GetValue;class tf extends ii{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=Qg(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(Qg(e,"speed",.1)),this.setEnable(Qg(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(Qg(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||cr(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const ef=Phaser.Utils.Objects.GetValue;var sf=function(t,e,i,s){var r,n,h="Y"===(i=i.toUpperCase()),a=2===t.scrollMode,o=t.childrenMap.child,l=`slider${i}`;if(r=a||s.hasOwnProperty(l)?ef(s,l,void 0):ef(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=h?1:0,n=function(t,e){void 0===e&&(e={});var i=mt(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new Ig(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r),n.tickLength=ef(r,"tickLength",void 0);var p=ef(r,"position",0);"string"==typeof p&&(p=rf[p]);var v,g,f=ef(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=ef(s,"space.slider",void 0))&&(a?f=0:v=ef(s,"space.child",0)),g=void 0===v?"number"==typeof f:"number"==typeof v,h?0===p?(d=2,c=1,u=void 0===v?g?{left:f}:f:{left:ef(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:ef(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:ef(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:ef(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=ef(r,"hideUnscrollableSlider",!1),t[`disableUnscrollableDrag${i}`]=ef(r,"disableUnscrollableDrag",!1),t[`adaptThumb${i}SizeMode`]=ef(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=ef(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`disableUnscrollableDrag${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=ef(s,"scrollDetectionMode");"string"==typeof b&&(b=nf[b]);var x=`scroller${i}`;(m=a||s.hasOwnProperty(x)?ef(s,x,!0):ef(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new qg(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var C,S,w,O,P,T=ef(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);T&&o&&(void 0!==b&&(T.focus=1===b?2:0),C=new tf(o,T)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,C),a&&!h||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.disableUnscrollableDrag=t[`disableUnscrollableDrag${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",C)),n&&(a?(S=h?"t":"s",O=`scroll${i}`):(S="t",O="scroll"),n.on("valuechange",(function(e){t[S]=e,t.emit(O,t)}))),y&&(a?(w=`childO${i}`,O=`scroll${i}`):(w="childOY",O="scroll"),y.on("valuechange",(function(e){t[w]=e,t.emit(O,t)}))),C&&(P=a?`addChildO${i}`:"addChildOY",C.on("scroll",(function(e){t[P](-e,!0)})))};const rf={right:0,left:1,bottom:0,top:1},nf={gameObject:0,rectBounds:1},hf=Phaser.Utils.Objects.GetValue;var af=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=hf(e,"width"),h=hf(e,"height");n||hf(e,"child.expandWidth",!0)||(s[1]=0),h||hf(e,"child.expandHeight",!0)||(r[1]=0);var a=new ho(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=ug(i,"child"),r=ug(s,"gameObject",void 0);if(r){var n=ug(i,"space.child",0);t.childMargin={};var h=t.childMargin,a={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:h.top=0,h.bottom=0,h.left=0,h.right=0;break;default:h.top=n,h.bottom=n,h.left=n,h.right=n}else switch(t.scrollMode){case 0:h.top=ug(n,"top",0),h.bottom=ug(n,"bottom",0),a.left=ug(n,"left",0),a.right=ug(n,"right",0);break;case 1:h.top=ug(n,"left",0),h.bottom=ug(n,"right",0),a.top=ug(n,"top",0),a.bottom=ug(n,"bottom",0);break;default:h.top=ug(n,"top",0),h.bottom=ug(n,"bottom",0),h.left=ug(n,"left",0),h.right=ug(n,"right",0)}e.add(r,{column:1,row:1,align:ug(s,"align","center"),padding:a,expand:{width:ug(s,"expandWidth",!0),height:ug(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:sf(t,a,"y",e);break;case 1:sf(t,a,"x",e);break;default:sf(t,a,"y",e),sf(t,a,"x",e)}return a},of=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}i*="Y"===t?this.scaleY:this.scaleX,s&&s.setBounds(e,i),r&&(r.setEnable(e!==i),r.tickLength&&r.setTick(r.tickLength,e,i))},lf=function(t){switch(this.scrollMode){case 0:case 1:(i=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(i,this.isOverflow),(r=this.childrenMap.scroller)&&this.disableUnscrollableDrag&&r.setEnable(this.isOverflow);break;default:var e=this[`isOverflow${t=t.toUpperCase()}`],i=this.childrenMap[`slider${t}`],s=this[`hideUnscrollableSlider${t}`];i&&s&&this.setChildVisible(i,e);var r=this.childrenMap.scroller,n=this[`disableUnscrollableDrag${t}`];r&&n&&r.setEnable(e)}},df=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(a=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=a.childrenMap.track,s=a.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&n0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n")}return i}(this.textObject,this.text,this.lines),this.linesCount=this.lines.length,this._textHeight=void 0,this._textVisibleHeight=void 0,this.updateTextObject(),this},updateTextObject:function(){var t=Math.max(Math.floor(ff.call(this,-this.textOY)),0),e=mf.call(this,t)+this.textOY,i=yf.call(this,t);return function(t,e){switch(Uo(t)){case 0:var i=(r=t.style).wordWrapWidth,s=r.wordWrapCallback;r.wordWrapWidth=0,r.wordWrapCallback=void 0,t.setText(e),r.wordWrapWidth=i,r.wordWrapCallback=s;break;case 1:var r,n=(r=t.style).wrapMode;r.wrapMode=0,t.setText(e),r.wrapMode=n;break;case 2:var h=t._maxWidth;t._maxWidth=0,t.setText(e),t._maxWidth=h}}(this.textObject,i),this.textObject.rexSizer.offsetY=e,bf.call(this),this},preLayout:function(){return this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,Ie.call(this),this},layoutChildren:function(){var t,e,i,s,r,n,h,a=this.left,o=this.top;(t=this.textObject).rexSizer.hidden||(s=a+(i=(e=t.rexSizer).padding).left*this.scaleX,r=o+i.top*this.scaleY,n=this.width*this.scaleX-(i.left+i.right)*this.scaleX,h=this.height*this.scaleY-(i.top+i.bottom)*this.scaleY,Cf.call(this,t,n,h),ae(t,s,r,n,h,e.align),e.preOffsetY=0,bf.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const wf=Phaser.Utils.Objects.IsPlainObject,Of=Phaser.Utils.Objects.GetValue,Pf=Phaser.Display.Align.TOP_LEFT;class Tf extends rh{constructor(t,e,i,s,r,n){wf(e)?(e=Of(n=e,"x",0),i=Of(n,"y",0),s=Of(n,"width",void 0),r=Of(n,"height",void 0)):wf(s)&&(s=Of(n=s,"width",void 0),r=Of(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexTextBlock",this.textObject=void 0,this.linesCount=0,this.textMask=void 0,this.textObjectType=void 0,this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,this._textObjectRealHeight=0,this.lines=void 0,this.text=Of(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode(Of(n,"clampTextOY",!0)),this.alwaysScrollable=Of(n,"alwaysScrollable",!1);var h=Of(n,"background",void 0),a=Of(n,"text",void 0);void 0===a&&(a=kf(t)),this.textCropEnable=Of(n,"textCrop",!!a.setCrop);var o=Of(n,"textMask",!this.textCropEnable);h&&this.addBackground(h),this.add(a),this.sizerChildren=[a];var l=this.getSizerConfig(a);l.align=Pf,l.padding=ge(0),l.expand=!0,this.textObject=a,this.textObjectType=Uo(a),l.preOffsetY=0,l.offsetY=0,o&&(this.textMask=Fo.call(this,this.textObject,this)),this.addChildrenMap("background",h),this.addChildrenMap("text",a)}destroy(t){if(this.scene&&!this.ignoreDestroy){if(this.textObject=void 0,this.textMask=void 0,this.lines){switch(this.textObjectType){case 0:case 2:this.lines.length=0;break;case 1:this.lines.destroy()}this.lines=void 0}super.destroy(t)}}setClampMode(t){return void 0===t&&(t=!0),this.clampTextOY=t,this}get textLineHeight(){if(void 0===this._textLineHeight){var t;switch(this.textObjectType){case 0:case 1:var e=this.textObject.style;t=e.metrics.fontSize+e.strokeThickness;break;case 2:var i=this.textObject.fontSize/this.textObject.fontData.size;t=this.textObject.fontData.lineHeight*i}this._textLineHeight=t}return this._textLineHeight}get textLineSpacing(){if(void 0===this._textLineSpacing){var t;switch(this.textObjectType){case 0:case 1:t=this.textObject.lineSpacing;break;case 2:t=0}this._textLineSpacing=t}return this._textLineSpacing}get visibleLinesCount(){return void 0===this._visibleLinesCount&&(this._visibleLinesCount=Math.floor(ff.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=mf.call(this,this.linesCount)),this._textHeight}get textObjectHeight(){return this._textObjectRealHeight-(this.textLineHeight+this.textLineSpacing)}get textVisibleHeight(){if(void 0===this._textVisibleHeight){var t=this.textHeight-this.textObjectHeight;!this.alwaysScrollable&&t<0&&(t=0),this._textVisibleHeight=t}return this._textVisibleHeight}textOYExceedTop(t){return void 0===t&&(t=this.textOY),t>this.topTextOY}textOYExeceedBottom(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:s?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}setTextOY(t){return this.textOY=t,this}set t(t){this.textOY=-this.textVisibleHeight*t}get t(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t}setTextOYByPercentage(t){return this.t=t,this}}var kf=function(t){return t.add.text(0,0,"")};Object.assign(Tf.prototype,Sf);var _f={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},Ef={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const Mf=Phaser.Utils.Objects.GetValue;class Rf extends vf{constructor(t,e){void 0===e&&(e={});var i=Mf(e,"text",void 0),s=Mf(e,"textWidth",void 0),r=Mf(e,"textHeight",void 0),n=Mf(e,"textCrop",!!i.setCrop),h=Mf(e,"textMask",!n),a=Mf(e,"content",""),o=new Tf(t,{width:s,height:r,text:i,textMask:h,textCrop:n&&!h,content:a,clampTextOY:Mf(e,"clampChildOY",!1),alwaysScrollable:Mf(e,"alwaysScrollable",!1)});t.add.existing(o),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textObjectHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.textHeight}})}(o),e.scrollMode=0,e.type="rexTextArea",e.child={gameObject:o,expandWidth:void 0===s,expandHeight:void 0===r};var l=Mf(e,"space",void 0);l&&(l.child=Mf(l,"text",0)),super(t,e),this.addChildrenMap("text",i)}get text(){return this.childrenMap.child.text}get lineHeight(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.textHeight}}Object.assign(Rf.prototype,_f,Ef);const Lf=Phaser.Utils.Objects.GetValue;var Df=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("key")&&(i="bitmaptext",e.font=e.key)),i){case"bitmaptext":case"bitmap":s=new lg(t,e);break;case"bbcodetext":case"bbcode":s=new ng(t,0,0,"",e);break;case"label":s=new Yf(t,e);break;case"textarea":s=function(t,e,i){e=e?wd(e):{};var s=Lf(i,"background",wp),r=Lf(i,"text",Df),n=Lf(i,"track",wp),h=Lf(i,"thumb",wp);s?e.background=s(t,e.background):delete e.background,r?e.text=r(t,e.text):delete e.text;var a=e.slider;!1!==a&&null!==a&&(void 0===a&&(a={}),n?a.track=n(t,a.track):delete a.track,h?a.thumb=h(t,a.thumb):delete a.thumb,e.slider=a);var o=new Rf(t,e);return t.add.existing(o),o}(t,e);break;default:s=new Tp(t,e)}return Sp(s,e),t.add.existing(s),s},zf=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("leftWidth")?i="nineSlice":(e.hasOwnProperty("color")||e.hasOwnProperty("strokeColor"))&&(i="roundRectangle")),i){case"nineSlice":s=e.hasOwnProperty("stretchMode")?new xp(t,e):new Zu(t,e);break;case"roundRectangle":s=new $c(t,e);break;default:s=new ip(t,e)}return Sp(s,e),t.add.existing(s),s};const Af=Phaser.Utils.Objects.GetValue;class Yf extends xc{constructor(t,e,i){e=function(t,e,i){e=e?wd(e):{};var s=Af(i,"background",wp),r=Af(i,"text",Df),n=Af(i,"icon",zf),h=Af(i,"action",zf);return null!==e.background&&s?e.background=s(t,e.background):delete e.background,null!==e.text&&r?e.text=r(t,e.text):delete e.text,null!==e.icon&&n?e.icon=n(t,e.icon):delete e.icon,null!==e.action&&h?e.action=h(t,e.action):delete e.action,e}(t,e,i),super(t,e),this.type="rexSimpleLabel"}setActiveState(t){return Xf(this.getChildren(),"setActiveState",t),this}setHoverState(t){return Xf(this.getChildren(),"setHoverState",t),this}setDisableState(t){return Xf(this.getChildren(),"setDisableState",t),this}}var Xf=function(t,e,i){for(var s=0,r=t.length;s=r&&o=i&&oi.length&&(t.prevCursorPosition=null),null!==t.prevCursorPosition&&(s=e.getCharChild(t.prevCursorPosition))&&("\n"===s.text&&s.clearTextSize(),e.emit("cursorout",s,t.prevCursorPosition,e)),null!=r&&(s=e.getCharChild(r))&&("\n"===s.text&&s.copyTextSize(e.lastInsertCursor),function(t){var e,i,s=t.parent,r=s.width,n=s.height,h=t.drawX,a=t.drawY,o=h+t.drawTLX,l=h+t.drawTRX,d=a+t.drawTLY,c=a+t.drawBLY;e=o<0?0-o:l>r?r-l:0,i=d<0?0-d:c>n?n-c:0,s._textOX+=e,s._textOY+=i}(s),e.emit("cursorin",s,r,e)),e.emit("movecursor",r,t.prevCursorPosition,e),t.prevCursorPosition=r)}(this)):(rm(this),nm(this)),this}setNumberInput(){return this.onUpdateCallback=sm,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}}const om=Phaser.Utils.Objects.GetValue,lm=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var dm=function(t,e){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return!0;if(-1!==e.indexOf(".")){for(var i=e.split("."),s=t,r=0;rt.length?i:t})),h.value=t.join(e)}else h.value=t.join(i.slice(a,a+h.count));a+=h.count,h.added||(o+=h.count)}}let l=e[h-1];return h>1&&"string"==typeof l.value&&(l.added||l.removed)&&t.equals("",l.value)&&(e[h-2].value+=l.value,e.pop()),e}ym.prototype={diff(t,e,i={}){let s=i.callback;"function"==typeof i&&(s=i,i={}),this.options=i;let r=this;function n(t){return s?(setTimeout((function(){s(void 0,t)}),0),!0):t}t=this.castInput(t),e=this.castInput(e),t=this.removeEmpty(this.tokenize(t));let h=(e=this.removeEmpty(this.tokenize(e))).length,a=t.length,o=1,l=h+a;i.maxEditLength&&(l=Math.min(l,i.maxEditLength));let d=[{newPos:-1,components:[]}],c=this.extractCommon(d[0],e,t,0);if(d[0].newPos+1>=h&&c+1>=a)return n([{value:this.join(e),count:e.length}]);function u(){for(let s=-1*o;s<=o;s+=2){let o,l=d[s-1],c=d[s+1],u=(c?c.newPos:0)-s;l&&(d[s-1]=void 0);let p=l&&l.newPos+1=h&&u+1>=a)return n(bm(r,o.components,e,t,r.useLongestToken));d[s]=o}else d[s]=void 0}var i;o++}if(s)!function t(){setTimeout((function(){if(o>l)return s();u()||t()}),0)}();else for(;o<=l;){let t=u();if(t)return t}},pushComponent(t,e,i){let s=t[t.length-1];s&&s.added===e&&s.removed===i?t[t.length-1]={count:s.count+1,added:e,removed:i}:t.push({count:1,added:e,removed:i})},extractCommon(t,e,i,s){let r=e.length,n=i.length,h=t.newPos,a=h-s,o=0;for(;h+1t,tokenize:t=>t.split(""),join:t=>t.join("")};const xm=new ym,Cm=/^[a-zA-Z\u{C0}-\u{FF}\u{D8}-\u{F6}\u{F8}-\u{2C6}\u{2C8}-\u{2D7}\u{2DE}-\u{2FF}\u{1E00}-\u{1EFF}]+$/u,Sm=/\S/,wm=new ym;wm.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!Sm.test(t)&&!Sm.test(e)},wm.tokenize=function(t){let e=t.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/);for(let t=0;tvoid 0===i?e:i}=this.options;return"string"==typeof t?t:JSON.stringify(km(t,null,null,i),i," ")},Tm.equals=function(t,e){return ym.prototype.equals.call(Tm,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const _m=new ym;_m.tokenize=function(t){return t.slice()},_m.join=_m.removeEmpty=function(t){return t};const Em=Phaser.Utils.Array.Remove;var Mm=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),Em(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(o=i,l=e,xm.diff(o,l,d)),r=0,n=0,h=s.length;nr)i+=h;else{if(s!==r)break;i+=Math.min(e.position,h)}}return i},Am={cursorMoveLeft(){if(!this.isOpened)return this;var t=Lm(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=Lm(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=Dm(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=Lm(zm(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=Dm(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=Lm(zm(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const Ym=Phaser.Utils.Objects.IsPlainObject;class Xm extends cc{constructor(t,e,i,s,r,n){Ym(e)?n=e:Ym(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(dm(e,"wrap.vAlign")||ju(e,"wrap.vAlign",s=i?"center":"top"),dm(e,"wrap.wrapMode")||ju(e,"wrap.wrapMode","char"),dm(e,"wrap.maxLines")||ju(e,"wrap.maxLines",s=i?1:void 0),i&&ju(e,"wrap.wrapWidth",1/0),dm(e,"wrap.useDefaultTextHeight")||ju(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!dm(e.edit,"inputType")){var s=i?"text":"textarea";ju(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new um(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var h=n.text;h&&delete n.text;var a=Ic(n.background,"focus"),o=Ic(n.style,"cursor"),l=Ic(n.style,"range");super(t,e,i,s,r,n),this.type="rexCanvasInput",this.contentWidth=void 0,this.contentHeight=void 0,this.lineHeight=void 0,this.linesCount=void 0,this.characterCountOfLines=[],this._text,this.textEdit=function(t,e){var i=om(e,"edit");return void 0===i&&(i={}),If(e,i,lm),new am(t,i)}(this,n),pm.call(this),n.focusStyle&&Object.assign(a,n.focusStyle),mm.call(this,a),n.cursorStyle&&Object.assign(o,n.cursorStyle),gm.call(this,o),n.rangeStyle&&Object.assign(l,n.rangeStyle),vm(l)&&Object.assign(l,o),fm.call(this,l);var d=n.onAddChar;d&&this.on("addchar",d);var c=n.onCursorIn;c&&this.on("cursorin",c);var u=n.onCursorOut;u&&this.on("cursorout",u);var p=!n.onRangeIn&&!n.onRangeOut,v=p?n.onCursorIn:n.onRangeIn;v&&this.on("rangein",v);var g=p?n.onCursorOut:n.onRangeOut;g&&this.on("rangeout",g);var f,m=n.onMoveCursor;m&&this.on("movecursor",m),this.setParseTextCallback(n.parseTextCallback),this.lastInsertCursor=((f=this.createCharChild("|")).text="",f),h||(h=""),this.setText(h)}addChild(t,e){if(super.addChild(t,e),Array.isArray(t))for(var i=t,s=0,r=i.length;so;d--){for(c=0;c0&&this.wrapMode!==el&&0===this.wrapWidth}setStyle(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wordWrap")){var s=t.wordWrap;s.hasOwnProperty("width")&&(t.wrap={mode:"word",width:s.width})}if(t&&t.hasOwnProperty("wrap")){var r=t.wrap;if(r.hasOwnProperty("mode")){var n=r.mode;"string"==typeof n&&(r.mode=nl[n])}else r.hasOwnProperty("width")&&(r.mode=1)}t&&t.rtl&&i&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var h=this.propertyMap;for(var a in h){var o=h[a],l=o[0],d=i?o[1]:this[a],c=o[2];if("wrapCallback"===a||"wrapCallbackScope"===a)this[a]=Wp(t,l,d);else{var u=Xp(t,l,d);c&&(u=c(u)),this[a]=u}}var p=Wp(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var v=Wp(t,"fill",null);null!==v&&(this.color=jl(v));var g=Wp(t,"metrics",!1);return g?this.metrics={ascent:Wp(g,"ascent",0),descent:Wp(g,"descent",0),fontSize:Wp(g,"fontSize",0)}:!e&&this.metrics||(this.metrics=Yp(this)),e?this.parent.updateText():this.parent}syncFont(t,e){e.font=this._font}syncStyle(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"}syncShadow(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)}update(t){return t&&(this._font=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim(),this.metrics=Yp(this)),this.parent.updateText(t)}buildFont(){var t=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim();return t!==this._font&&(this._font=t),this}setFont(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=Wp(t,"fontFamily","Courier"),this.fontSize=Wp(t,"fontSize","16px"),this.fontStyle=Wp(t,"fontStyle","")),this.update(!0)}setFontFamily(t){return this.fontFamily=t,this.update(!0)}setFontStyle(t){return this.fontStyle=t,this.update(!0)}setFontSize(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}setTestString(t){return this.testString=t,this.update(!0)}setFixedSize(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}setResolution(t){return this.resolution=t,this.update(!1)}setXOffset(t){return this.xOffset=t,this.update(!1)}setBackgroundColor(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=jl(t,this.parent.canvas,this.parent.context),this.backgroundColor2=jl(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=jl(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}setBackgroundCornerRadius(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}setFill(t){return this.color=jl(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=jl(t,this.parent.canvas,this.parent.context),this.update(!1)}setStroke(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=jl(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}setShadow(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===n&&(n=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=jl(i,this.parent.canvas,this.parent.context),this.shadowBlur=s,this.shadowStroke=r,this.shadowFill=n,this.update(!1)}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}setShadowColor(t){return void 0===t&&(t="#000"),this.shadowColor=jl(t,this.parent.canvas,this.parent.context),this.update(!1)}setShadowBlur(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}setShadowStroke(t){return this.shadowStroke=t,this.update(!1)}setShadowFill(t){return this.shadowFill=t,this.update(!1)}setUnderline(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=jl(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}setUnderlineColor(t){return void 0===t&&(t="#000"),this.underlineColor=jl(t,this.parent.canvas,this.parent.context),this.update(!1)}setUnderlineThickness(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}setUnderlineOffset(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}setStrikethrough(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=jl(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}setStrikethroughColor(t){return void 0===t&&(t="#000"),this.strikethroughColor=jl(t,this.parent.canvas,this.parent.context),this.update(!1)}setStrikethroughThickness(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}setStrikethroughOffset(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}setWrapMode(t){return"string"==typeof t&&(t=nl[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}setWrapWidth(t){return this.wrapWidth=t,this.update(!1)}setAlign(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}setHAlign(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}setVAlign(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}setMaxLines(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}getTextMetrics(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}setTextMetrics(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=Wp(e,"fontFamily",this.fontFamily),this.fontSize=Wp(e,"fontSize",this.fontSize),this.fontStyle=Wp(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}get lineHeight(){return this.metrics.fontSize+this.parent.lineSpacing}toJSON(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}destroy(){this.parent=void 0}}var jp={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var h=this.defaultStyle;this.clear(),Zl(this,h.backgroundColor,h.backgroundStrokeColor,h.backgroundStrokeLineWidth,h.backgroundCornerRadius,h.backgroundColor2,h.backgroundHorizontalGradient,h.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var a,o,l,d,c,u,p=h.halign,v=h.valign,g=h.lineHeight,f=r.lines,m=f.length,y=h.maxLines;y>0&&m>y?(o=y,l="center"===v?Math.floor((m-o)/2):"bottom"===v?m-o:0):(o=m,l=0),d=l+o;var b=this.rtl,x=b?this.parent.width:void 0;u="center"===v?Math.max((s-o*g)/2,0):"bottom"===v?Math.max(s-o*g-2,0):0,u+=e;for(var C=l;C0){var a=this.defaultStyle.metrics,o=i-a.ascent,l=a.fontSize;this.drawRectangle(e,o,t.width,l,h.bgcolor,h)}if(h.underlineThickness>0&&t.width>0){var d=i+h.underlineOffset-h.underlineThickness/2;this.drawLine(e,d,t.width,h.underlineThickness,h.underlineColor,h)}if(t.isTextPen&&(h.buildFont(),h.syncFont(r,n),h.syncStyle(r,n),this.drawText(e,i,t.text,h)),t.isImagePen&&this.drawImage(e,i,t.prop.img,t.prop.color,h),h.strikethroughThickness>0&&t.width>0&&(d=i+h.strikethroughOffset-h.strikethroughThickness/2,this.drawLine(e,d,t.width,h.strikethroughThickness,h.strikethroughColor,h)),n.restore(),t.hasAreaMarker&&t.width>0){var c,u=t.prop.area;if(u)c={key:u};else{var p=t.prop.url;c={key:`url:${p}`,url:p}}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,c)}},clear(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawRectangle(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var h=this.context;h.fillStyle=r,h.fillRect(t,e,i,s)},drawLine(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var h=this.context;n.syncShadow(h,n.shadowStroke);var a=h.lineCap;h.lineCap="butt",h.strokeStyle=r,h.lineWidth=s,h.beginPath(),h.moveTo(t,e),h.lineTo(t+i,e),h.stroke(),h.lineCap=a},drawText(t,e,i,s){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;s.stroke&&"none"!==s.stroke&&s.strokeThickness>0&&(s.syncShadow(r,s.shadowStroke),r.strokeText(i,t,e)),s.color&&"none"!==s.color&&(s.syncShadow(r,s.shadowFill),r.fillText(i,t,e))},drawImage(t,e,i,s,r){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,s,this.autoRound)}};const Ip=Phaser.Utils.Objects.GetValue,Fp=Zo,Np=Qo;class Hp{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=Ip(t,"text",""),this.x=Ip(t,"x",0),this.y=Ip(t,"y",0),this.width=Ip(t,"width",0);var e=Ip(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=Ip(t,"newLineMode",0),this.startIndex=Ip(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===Np&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==Fp&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===Np&&(t+=1),t}get endIndex(){return this.startIndex+this.rawTextLength}get lastX(){return this.x+this.width}get isTextPen(){return""!==this.text}get isImagePen(){return!!this.prop.img}get hasAreaMarker(){return!!this.prop.area||!!this.prop.url}}const Gp=Phaser.Utils.Objects.GetFastValue,Vp=Zo,Up=tl;class $p{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=Gp(t,"tagToText",Xt),this.tagToTextScope=Gp(t,"tagToTextScope",void 0)}destroy(){this.clear(),this.tagToText=void 0,this.tagToTextScope=void 0}clear(){for(var t=0,e=this.lines.length;t=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}getLineEndIndex(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,s=!1;for(e=t;e>=0&&!(s=null!=(i=this.lines[e])&&i.length>0);e--);return s?i[i.length-1].endIndex:0}getLineWidth(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}getMaxLineWidth(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,s=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}getLineWidths(){for(var t=[],e=0,i=this.lines.length;e=t&&o<=e||(h=h.substring(t-a,e-a)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,h,l,d):c+=this.tagToText(h,l,d),d=l,!(o>=e)));u++);return c}get length(){return this.lines.length}set length(t){this.clear()}}var Jp={};const Kp=Phaser.Geom.Rectangle;var qp=new nc;class Zp{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&uv(g)){""!==b?h.push(n.getLine(b,x,nv)):0===C&&r>0&&h.push(n.getLine("",0,nv)),h.push(...dv(g,e,ov,s,0,n));var w=h.pop();b=w.text,x=w.width,n.freeLine(w)," "===b&&(b="",x=0)}else(m=x+f)>o?(h.push(n.getLine(b,x,nv)),b=g,x=f,o=s):(b+=g,x=m),C===S-1&&h.push(n.getLine(b,x,l))}return h},cv=function(t,e){var i;switch(e){case av:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==vv&&i0&&t>e&&(t=e),t}get linesWidth(){return Math.ceil(this.penManager.getMaxLineWidth())}get linesHeight(){var t=this.displayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}get imageManager(){return this.parent.imageManager}get rtl(){return this.parent.style.rtl}newPenManager(){return new $p({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}get tmpPenManager(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}getPlainText(t,e,i){var s;if(null==t)s=this.penManager.plainText;else{var r=this.parser.splitText(t,1);s="";for(var n=0,h=r.length;n=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const Hg=Phaser.Utils.Objects.GetValue,Gg=Phaser.Math.Distance.Between;class Vg extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=Hg(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(Hg(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(Hg(t,"enable",!0)),this.holdThreshold=Hg(t,"holdThreshold",50),this.pointerOutReleaseEnable=Hg(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return vn(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:Gg(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!cr(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!cr(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const Ug=Phaser.Utils.Objects.GetValue;class $g{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(Ug(t,"value",0)),this.setSpeed(Ug(t,"speed",0)),this.setAcceleration(Ug(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class Jg{constructor(){this.value,this.dir,this.movement=new $g}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const Qg={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},tf=Phaser.Utils.Objects.GetValue;class ef extends ii{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=tf(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(tf(e,"speed",.1)),this.setEnable(tf(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(tf(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||cr(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const sf=Phaser.Utils.Objects.GetValue;var rf=function(t,e,i,s){var r,n,h="Y"===(i=i.toUpperCase()),a=2===t.scrollMode,o=t.childrenMap.child,l=`slider${i}`;if(r=a||s.hasOwnProperty(l)?sf(s,l,void 0):sf(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=h?1:0,n=function(t,e){void 0===e&&(e={});var i=mt(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new Fg(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r),n.tickLength=sf(r,"tickLength",void 0);var p=sf(r,"position",0);"string"==typeof p&&(p=nf[p]);var v,g,f=sf(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=sf(s,"space.slider",void 0))&&(a?f=0:v=sf(s,"space.child",0)),g=void 0===v?"number"==typeof f:"number"==typeof v,h?0===p?(d=2,c=1,u=void 0===v?g?{left:f}:f:{left:sf(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:sf(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:sf(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:sf(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=sf(r,"hideUnscrollableSlider",!1),t[`disableUnscrollableDrag${i}`]=sf(r,"disableUnscrollableDrag",!1),t[`adaptThumb${i}SizeMode`]=sf(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=sf(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`disableUnscrollableDrag${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=sf(s,"scrollDetectionMode");"string"==typeof b&&(b=hf[b]);var x=`scroller${i}`;(m=a||s.hasOwnProperty(x)?sf(s,x,!0):sf(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new Zg(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var C,S,w,O,P,T=sf(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);T&&o&&(void 0!==b&&(T.focus=1===b?2:0),C=new ef(o,T)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,C),a&&!h||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.disableUnscrollableDrag=t[`disableUnscrollableDrag${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",C)),n&&(a?(S=h?"t":"s",O=`scroll${i}`):(S="t",O="scroll"),n.on("valuechange",(function(e){t[S]=e,t.emit(O,t)}))),y&&(a?(w=`childO${i}`,O=`scroll${i}`):(w="childOY",O="scroll"),y.on("valuechange",(function(e){t[w]=e,t.emit(O,t)}))),C&&(P=a?`addChildO${i}`:"addChildOY",C.on("scroll",(function(e){t[P](-e,!0)})))};const nf={right:0,left:1,bottom:0,top:1},hf={gameObject:0,rectBounds:1},af=Phaser.Utils.Objects.GetValue;var of=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=af(e,"width"),h=af(e,"height");n||af(e,"child.expandWidth",!0)||(s[1]=0),h||af(e,"child.expandHeight",!0)||(r[1]=0);var a=new ho(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=pg(i,"child"),r=pg(s,"gameObject",void 0);if(r){var n=pg(i,"space.child",0);t.childMargin={};var h=t.childMargin,a={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:h.top=0,h.bottom=0,h.left=0,h.right=0;break;default:h.top=n,h.bottom=n,h.left=n,h.right=n}else switch(t.scrollMode){case 0:h.top=pg(n,"top",0),h.bottom=pg(n,"bottom",0),a.left=pg(n,"left",0),a.right=pg(n,"right",0);break;case 1:h.top=pg(n,"left",0),h.bottom=pg(n,"right",0),a.top=pg(n,"top",0),a.bottom=pg(n,"bottom",0);break;default:h.top=pg(n,"top",0),h.bottom=pg(n,"bottom",0),h.left=pg(n,"left",0),h.right=pg(n,"right",0)}e.add(r,{column:1,row:1,align:pg(s,"align","center"),padding:a,expand:{width:pg(s,"expandWidth",!0),height:pg(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:rf(t,a,"y",e);break;case 1:rf(t,a,"x",e);break;default:rf(t,a,"y",e),rf(t,a,"x",e)}return a},lf=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}i*="Y"===t?this.scaleY:this.scaleX,s&&s.setBounds(e,i),r&&(r.setEnable(e!==i),r.tickLength&&r.setTick(r.tickLength,e,i))},df=function(t){switch(this.scrollMode){case 0:case 1:(i=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(i,this.isOverflow),(r=this.childrenMap.scroller)&&this.disableUnscrollableDrag&&r.setEnable(this.isOverflow);break;default:var e=this[`isOverflow${t=t.toUpperCase()}`],i=this.childrenMap[`slider${t}`],s=this[`hideUnscrollableSlider${t}`];i&&s&&this.setChildVisible(i,e);var r=this.childrenMap.scroller,n=this[`disableUnscrollableDrag${t}`];r&&n&&r.setEnable(e)}},cf=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(a=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=a.childrenMap.track,s=a.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&n0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n")}return i}(this.textObject,this.text,this.lines),this.linesCount=this.lines.length,this._textHeight=void 0,this._textVisibleHeight=void 0,this.updateTextObject(),this},updateTextObject:function(){var t=Math.max(Math.floor(mf.call(this,-this.textOY)),0),e=yf.call(this,t)+this.textOY,i=bf.call(this,t);return function(t,e){switch(Uo(t)){case 0:var i=(r=t.style).wordWrapWidth,s=r.wordWrapCallback;r.wordWrapWidth=0,r.wordWrapCallback=void 0,t.setText(e),r.wordWrapWidth=i,r.wordWrapCallback=s;break;case 1:var r,n=(r=t.style).wrapMode;r.wrapMode=0,t.setText(e),r.wrapMode=n;break;case 2:var h=t._maxWidth;t._maxWidth=0,t.setText(e),t._maxWidth=h}}(this.textObject,i),this.textObject.rexSizer.offsetY=e,xf.call(this),this},preLayout:function(){return this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,Ie.call(this),this},layoutChildren:function(){var t,e,i,s,r,n,h,a=this.left,o=this.top;(t=this.textObject).rexSizer.hidden||(s=a+(i=(e=t.rexSizer).padding).left*this.scaleX,r=o+i.top*this.scaleY,n=this.width*this.scaleX-(i.left+i.right)*this.scaleX,h=this.height*this.scaleY-(i.top+i.bottom)*this.scaleY,Sf.call(this,t,n,h),ae(t,s,r,n,h,e.align),e.preOffsetY=0,xf.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const Of=Phaser.Utils.Objects.IsPlainObject,Pf=Phaser.Utils.Objects.GetValue,Tf=Phaser.Display.Align.TOP_LEFT;class kf extends rh{constructor(t,e,i,s,r,n){Of(e)?(e=Pf(n=e,"x",0),i=Pf(n,"y",0),s=Pf(n,"width",void 0),r=Pf(n,"height",void 0)):Of(s)&&(s=Pf(n=s,"width",void 0),r=Pf(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexTextBlock",this.textObject=void 0,this.linesCount=0,this.textMask=void 0,this.textObjectType=void 0,this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,this._textObjectRealHeight=0,this.lines=void 0,this.text=Pf(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode(Pf(n,"clampTextOY",!0)),this.alwaysScrollable=Pf(n,"alwaysScrollable",!1);var h=Pf(n,"background",void 0),a=Pf(n,"text",void 0);void 0===a&&(a=_f(t)),this.textCropEnable=Pf(n,"textCrop",!!a.setCrop);var o=Pf(n,"textMask",!this.textCropEnable);h&&this.addBackground(h),this.add(a),this.sizerChildren=[a];var l=this.getSizerConfig(a);l.align=Tf,l.padding=ge(0),l.expand=!0,this.textObject=a,this.textObjectType=Uo(a),l.preOffsetY=0,l.offsetY=0,o&&(this.textMask=Fo.call(this,this.textObject,this)),this.addChildrenMap("background",h),this.addChildrenMap("text",a)}destroy(t){if(this.scene&&!this.ignoreDestroy){if(this.textObject=void 0,this.textMask=void 0,this.lines){switch(this.textObjectType){case 0:case 2:this.lines.length=0;break;case 1:this.lines.destroy()}this.lines=void 0}super.destroy(t)}}setClampMode(t){return void 0===t&&(t=!0),this.clampTextOY=t,this}get textLineHeight(){if(void 0===this._textLineHeight){var t;switch(this.textObjectType){case 0:case 1:var e=this.textObject.style;t=e.metrics.fontSize+e.strokeThickness;break;case 2:var i=this.textObject.fontSize/this.textObject.fontData.size;t=this.textObject.fontData.lineHeight*i}this._textLineHeight=t}return this._textLineHeight}get textLineSpacing(){if(void 0===this._textLineSpacing){var t;switch(this.textObjectType){case 0:case 1:t=this.textObject.lineSpacing;break;case 2:t=0}this._textLineSpacing=t}return this._textLineSpacing}get visibleLinesCount(){return void 0===this._visibleLinesCount&&(this._visibleLinesCount=Math.floor(mf.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=yf.call(this,this.linesCount)),this._textHeight}get textObjectHeight(){return this._textObjectRealHeight-(this.textLineHeight+this.textLineSpacing)}get textVisibleHeight(){if(void 0===this._textVisibleHeight){var t=this.textHeight-this.textObjectHeight;!this.alwaysScrollable&&t<0&&(t=0),this._textVisibleHeight=t}return this._textVisibleHeight}textOYExceedTop(t){return void 0===t&&(t=this.textOY),t>this.topTextOY}textOYExeceedBottom(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:s?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}setTextOY(t){return this.textOY=t,this}set t(t){this.textOY=-this.textVisibleHeight*t}get t(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t}setTextOYByPercentage(t){return this.t=t,this}}var _f=function(t){return t.add.text(0,0,"")};Object.assign(kf.prototype,wf);var Ef={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},Mf={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const Rf=Phaser.Utils.Objects.GetValue;class Lf extends gf{constructor(t,e){void 0===e&&(e={});var i=Rf(e,"text",void 0),s=Rf(e,"textWidth",void 0),r=Rf(e,"textHeight",void 0),n=Rf(e,"textCrop",!!i.setCrop),h=Rf(e,"textMask",!n),a=Rf(e,"content",""),o=new kf(t,{width:s,height:r,text:i,textMask:h,textCrop:n&&!h,content:a,clampTextOY:Rf(e,"clampChildOY",!1),alwaysScrollable:Rf(e,"alwaysScrollable",!1)});t.add.existing(o),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textObjectHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.textHeight}})}(o),e.scrollMode=0,e.type="rexTextArea",e.child={gameObject:o,expandWidth:void 0===s,expandHeight:void 0===r};var l=Rf(e,"space",void 0);l&&(l.child=Rf(l,"text",0)),super(t,e),this.addChildrenMap("text",i)}get text(){return this.childrenMap.child.text}get lineHeight(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.textHeight}}Object.assign(Lf.prototype,Ef,Mf);const Df=Phaser.Utils.Objects.GetValue;var zf=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("key")&&(i="bitmaptext",e.font=e.key)),i){case"bitmaptext":case"bitmap":s=new dg(t,e);break;case"bbcodetext":case"bbcode":s=new hg(t,0,0,"",e);break;case"label":s=new Xf(t,e);break;case"textarea":s=function(t,e,i){e=e?wd(e):{};var s=Df(i,"background",Op),r=Df(i,"text",zf),n=Df(i,"track",Op),h=Df(i,"thumb",Op);s?e.background=s(t,e.background):delete e.background,r?e.text=r(t,e.text):delete e.text;var a=e.slider;!1!==a&&null!==a&&(void 0===a&&(a={}),n?a.track=n(t,a.track):delete a.track,h?a.thumb=h(t,a.thumb):delete a.thumb,e.slider=a);var o=new Lf(t,e);return t.add.existing(o),o}(t,e);break;default:s=new kp(t,e)}return wp(s,e),t.add.existing(s),s},Af=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("leftWidth")?i="nineSlice":(e.hasOwnProperty("color")||e.hasOwnProperty("strokeColor"))&&(i="roundRectangle")),i){case"nineSlice":s=e.hasOwnProperty("stretchMode")?new Cp(t,e):new Qu(t,e);break;case"roundRectangle":s=new $c(t,e);break;default:s=new sp(t,e)}return wp(s,e),t.add.existing(s),s};const Yf=Phaser.Utils.Objects.GetValue;class Xf extends xc{constructor(t,e,i){e=function(t,e,i){e=e?wd(e):{};var s=Yf(i,"background",Op),r=Yf(i,"text",zf),n=Yf(i,"icon",Af),h=Yf(i,"action",Af);return null!==e.background&&s?e.background=s(t,e.background):delete e.background,null!==e.text&&r?e.text=r(t,e.text):delete e.text,null!==e.icon&&n?e.icon=n(t,e.icon):delete e.icon,null!==e.action&&h?e.action=h(t,e.action):delete e.action,e}(t,e,i),super(t,e),this.type="rexSimpleLabel"}setActiveState(t){return Wf(this.getChildren(),"setActiveState",t),this}setHoverState(t){return Wf(this.getChildren(),"setHoverState",t),this}setDisableState(t){return Wf(this.getChildren(),"setDisableState",t),this}}var Wf=function(t,e,i){for(var s=0,r=t.length;s=r&&o=i&&oi.length&&(t.prevCursorPosition=null),null!==t.prevCursorPosition&&(s=e.getCharChild(t.prevCursorPosition))&&("\n"===s.text&&s.clearTextSize(),e.emit("cursorout",s,t.prevCursorPosition,e)),null!=r&&(s=e.getCharChild(r))&&("\n"===s.text&&s.copyTextSize(e.lastInsertCursor),function(t){var e,i,s=t.parent,r=s.width,n=s.height,h=t.drawX,a=t.drawY,o=h+t.drawTLX,l=h+t.drawTRX,d=a+t.drawTLY,c=a+t.drawBLY;e=o<0?0-o:l>r?r-l:0,i=d<0?0-d:c>n?n-c:0,s._textOX+=e,s._textOY+=i}(s),e.emit("cursorin",s,r,e)),e.emit("movecursor",r,t.prevCursorPosition,e),t.prevCursorPosition=r)}(this)):(nm(this),hm(this)),this}setNumberInput(){return this.onUpdateCallback=rm,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}}const lm=Phaser.Utils.Objects.GetValue,dm=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var cm=function(t,e){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return!0;if(-1!==e.indexOf(".")){for(var i=e.split("."),s=t,r=0;rt.length?i:t})),h.value=t.join(e)}else h.value=t.join(i.slice(a,a+h.count));a+=h.count,h.added||(o+=h.count)}}let l=e[h-1];return h>1&&"string"==typeof l.value&&(l.added||l.removed)&&t.equals("",l.value)&&(e[h-2].value+=l.value,e.pop()),e}bm.prototype={diff(t,e,i={}){let s=i.callback;"function"==typeof i&&(s=i,i={}),this.options=i;let r=this;function n(t){return s?(setTimeout((function(){s(void 0,t)}),0),!0):t}t=this.castInput(t),e=this.castInput(e),t=this.removeEmpty(this.tokenize(t));let h=(e=this.removeEmpty(this.tokenize(e))).length,a=t.length,o=1,l=h+a;i.maxEditLength&&(l=Math.min(l,i.maxEditLength));let d=[{newPos:-1,components:[]}],c=this.extractCommon(d[0],e,t,0);if(d[0].newPos+1>=h&&c+1>=a)return n([{value:this.join(e),count:e.length}]);function u(){for(let s=-1*o;s<=o;s+=2){let o,l=d[s-1],c=d[s+1],u=(c?c.newPos:0)-s;l&&(d[s-1]=void 0);let p=l&&l.newPos+1=h&&u+1>=a)return n(xm(r,o.components,e,t,r.useLongestToken));d[s]=o}else d[s]=void 0}var i;o++}if(s)!function t(){setTimeout((function(){if(o>l)return s();u()||t()}),0)}();else for(;o<=l;){let t=u();if(t)return t}},pushComponent(t,e,i){let s=t[t.length-1];s&&s.added===e&&s.removed===i?t[t.length-1]={count:s.count+1,added:e,removed:i}:t.push({count:1,added:e,removed:i})},extractCommon(t,e,i,s){let r=e.length,n=i.length,h=t.newPos,a=h-s,o=0;for(;h+1t,tokenize:t=>t.split(""),join:t=>t.join("")};const Cm=new bm,Sm=/^[a-zA-Z\u{C0}-\u{FF}\u{D8}-\u{F6}\u{F8}-\u{2C6}\u{2C8}-\u{2D7}\u{2DE}-\u{2FF}\u{1E00}-\u{1EFF}]+$/u,wm=/\S/,Om=new bm;Om.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!wm.test(t)&&!wm.test(e)},Om.tokenize=function(t){let e=t.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/);for(let t=0;tvoid 0===i?e:i}=this.options;return"string"==typeof t?t:JSON.stringify(_m(t,null,null,i),i," ")},km.equals=function(t,e){return bm.prototype.equals.call(km,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const Em=new bm;Em.tokenize=function(t){return t.slice()},Em.join=Em.removeEmpty=function(t){return t};const Mm=Phaser.Utils.Array.Remove;var Rm=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),Mm(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(o=i,l=e,Cm.diff(o,l,d)),r=0,n=0,h=s.length;nr)i+=h;else{if(s!==r)break;i+=Math.min(e.position,h)}}return i},Ym={cursorMoveLeft(){if(!this.isOpened)return this;var t=Dm(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=Dm(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=zm(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=Dm(Am(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=zm(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=Dm(Am(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const Xm=Phaser.Utils.Objects.IsPlainObject;class Wm extends cc{constructor(t,e,i,s,r,n){Xm(e)?n=e:Xm(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(cm(e,"wrap.vAlign")||Iu(e,"wrap.vAlign",s=i?"center":"top"),cm(e,"wrap.wrapMode")||Iu(e,"wrap.wrapMode","char"),cm(e,"wrap.maxLines")||Iu(e,"wrap.maxLines",s=i?1:void 0),i&&Iu(e,"wrap.wrapWidth",1/0),cm(e,"wrap.useDefaultTextHeight")||Iu(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!cm(e.edit,"inputType")){var s=i?"text":"textarea";Iu(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new pm(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var h=n.text;h&&delete n.text;var a=Ic(n.background,"focus"),o=Ic(n.style,"cursor"),l=Ic(n.style,"range");super(t,e,i,s,r,n),this.type="rexCanvasInput",this.contentWidth=void 0,this.contentHeight=void 0,this.lineHeight=void 0,this.linesCount=void 0,this.characterCountOfLines=[],this._text,this.textEdit=function(t,e){var i=lm(e,"edit");return void 0===i&&(i={}),Ff(e,i,dm),new om(t,i)}(this,n),vm.call(this),n.focusStyle&&Object.assign(a,n.focusStyle),ym.call(this,a),n.cursorStyle&&Object.assign(o,n.cursorStyle),fm.call(this,o),n.rangeStyle&&Object.assign(l,n.rangeStyle),gm(l)&&Object.assign(l,o),mm.call(this,l);var d=n.onAddChar;d&&this.on("addchar",d);var c=n.onCursorIn;c&&this.on("cursorin",c);var u=n.onCursorOut;u&&this.on("cursorout",u);var p=!n.onRangeIn&&!n.onRangeOut,v=p?n.onCursorIn:n.onRangeIn;v&&this.on("rangein",v);var g=p?n.onCursorOut:n.onRangeOut;g&&this.on("rangeout",g);var f,m=n.onMoveCursor;m&&this.on("movecursor",m),this.setParseTextCallback(n.parseTextCallback),this.lastInsertCursor=((f=this.createCharChild("|")).text="",f),h||(h=""),this.setText(h)}addChild(t,e){if(super.addChild(t,e),Array.isArray(t))for(var i=t,s=0,r=i.length;s=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const O=Phaser.Math.DegToRad;var E={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=O(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},T={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=x(t.scaleX,i.scaleX),e.scaleY=x(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},k={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},D={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=x(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},M={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},R={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},L={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},A={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(t){void 0===t&&(t=!1);var e=this;return this._mask=null,this.setChildMaskVisible(this),this.children.forEach((function(t){t.clearMask&&t.clearMask(!1),t.hasOwnProperty("isRexContainerLite")||e.setChildMaskVisible(t)})),t&&this.mask&&this.mask.destroy(),this}},j=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},F=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const I=Phaser.Utils.Array;var N={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Te=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const ke=/(\S+)\[(\d+)\]/i,De=Phaser.Utils.Objects.GetValue;var Me=function(t,e){return void 0===e?t:t[e]},Re=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=De(e,"left",0),t.right=De(e,"right",0),t.top=De(e,"top",0),t.bottom=De(e,"bottom",0)),t},Le={getInnerPadding(t){return Me(this.space,t)},setInnerPadding(t,e){return Re(this.space,t,e),this},getOuterPadding(t){return Me(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Re(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Me(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Re(this.getSizerConfig(t).padding,e,i),this}},Ae=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},je=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},ze=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Xe=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Fe=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},Ye=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Ie={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Ne=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?mi:gi,this.repeatCounter=0,this}stop(){return this.state=fi,this}update(t,e){this.state!==fi&&this.state!==bi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=yi)):(this.nowTime=this.duration,this.state=bi):this.nowTime>=0&&(this.state=mi))}get t(){var t;switch(this.state){case fi:case gi:case yi:t=0;break;case mi:t=this.nowTime/this.duration;break;case bi:t=1}return pi(t,0,1)}set t(t){(t=pi(t,-1,1))<0?(this.state=gi,this.nowTime=-this.delay*t):(this.state=mi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===fi}get isDelay(){return this.state===gi}get isCountDown(){return this.state===mi}get isRunning(){return this.state===gi||this.state===mi}get isDone(){return this.state===bi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const fi=0,gi=1,mi=2,yi=3,bi=-1;class Ci extends di{constructor(t,e){super(t,e),this.timer=new vi}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const _i=Phaser.Utils.Objects.GetValue,Si=Phaser.Utils.Objects.GetAdvancedValue,Pi=Phaser.Tweens.Builders.GetEaseFunction;class xi extends Ci{resetFromJSON(t){return this.timer.resetFromJSON(_i(t,"timer")),this.setEnable(_i(t,"enable",!0)),this.setTarget(_i(t,"target",this.parent)),this.setDelay(Si(t,"delay",0)),this.setDuration(Si(t,"duration",1e3)),this.setEase(_i(t,"ease","Linear")),this.setRepeat(_i(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Pi(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const wi=Phaser.Utils.Objects.GetValue,Oi=Phaser.Utils.Objects.GetAdvancedValue,Ei=Phaser.Math.Linear;let Ti=class extends xi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(wi(t,"mode",0)),this.setScaleRange(Oi(t,"start",void 0),Oi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=ki[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Oi(t,"x",this.parent.scaleX),this.startY=Oi(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Oi(e,"x",void 0),this.endY=Oi(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Ei(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Ei(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const ki={stop:0,destroy:1,yoyo:2};var Di=function(t,e,i,s,r){var n,a;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},a={x:t.scaleX};break;case 1:case"y":n={y:0},a={y:t.scaleY};break;default:n=0,a=t.scale}var h={mode:0,start:n,end:a,duration:e,ease:s};return void 0===r?r=new Ti(t,h):r.resetFromJSON(h),r.restart(),r},Mi=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Ti&&(n=r,r=void 0),void 0===r&&(r=!0);var a={};switch(a.mode=r?1:0,i){case 0:case"x":a.end={x:0};break;case 1:case"y":a.end={y:0};break;default:a.end=0}return a.duration=e,a.ease=s,void 0===n?n=new Ti(t,a):n.resetFromJSON(a),n.restart(),n},Ri=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Li=function(t){return Ri(t,"complete")};const Ai=Phaser.Utils.Objects.IsPlainObject;var ji={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Ai(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Di(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Li(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Ai(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Mi(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Li(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Li(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Ai(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var a=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,a){var h,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":h={x:t.scaleX},o={x:i};break;case 1:case"y":h={y:t.scaleX},o={y:i};break;default:h=t.scaleX,o=i}var l={mode:2,start:h,end:o,duration:e/2,ease:n,repeat:s};return void 0===a?a=new Ti(t,l):a.resetFromJSON(l),a.restart(),a}(this,t,e,i,s,r,this._scaleBehavior),a&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Li(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},zi={};Object.assign(zi,ji),zi.onInitScale=function(){ji.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=Ce.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Xi=Phaser.Utils.Objects.GetValue,Fi=Phaser.Utils.Objects.GetAdvancedValue,Yi=Phaser.Math.Linear;class Ii extends xi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Xi(t,"mode",0)),this.setAlphaRange(Fi(t,"start",this.parent.alpha),Fi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ni[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Yi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ni={stop:0,destroy:1,yoyo:2},Wi=Phaser.Utils.Objects.IsPlainObject;var Vi=function(t,e,i,s){var r,n;Wi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var a={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Ii(t,a):s.resetFromJSON(a),s.restart(),s},Bi=function(t,e,i,s){i instanceof Ii&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Ii(t,r):s.resetFromJSON(r),s.restart(),s};const Gi=Phaser.Utils.Objects.IsPlainObject;var Ui={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Gi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Vi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Li(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Gi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Bi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Li(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Li(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Hi={};Object.assign(Hi,Ui),Hi.onInitFade=function(){Ui.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=Ce.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Ji=Phaser.Utils.Objects.GetValue,$i=Phaser.Utils.Objects.GetAdvancedValue,qi=Phaser.Math.Linear;class Ki extends xi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Ji(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=$i(t,"x",void 0),i=$i(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Zi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=$i(i,"startX",void 0),this.startY=$i(i,"startY",void 0),this.endX=$i(i,"endX",void 0),this.endY=$i(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=qi(this.startX,this.endX,i)),this.hasMoveY&&(t.y=qi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Zi={stop:0,destroy:1,yoyo:2};var Qi=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const ts=Phaser.Utils.Objects.IsPlainObject,es=Phaser.Math.Distance.Between;var is={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(ts(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*es(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var a=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,a){n instanceof Ki&&(a=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=Qi(i,t.x),h.endX=t.x),void 0!==s&&(h.startY=Qi(s,t.y),h.endY=t.y),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===a?a=new Ki(t,h):a.resetFromJSON(h),a.restart(),a}(this,t,e,i,s,r,this._easeMove),a&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Li(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Li(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(ts(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*es(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var a=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,a){n instanceof Ki&&(a=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=t.x,h.endX=Qi(i,t.x)),void 0!==s&&(h.startY=t.y,h.endY=Qi(s,t.y)),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===a?a=new Ki(t,h):a.resetFromJSON(h),a.restart(),a}(this,t,e,i,s,r,this._easeMove),a&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Li(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Li(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},ss={};Object.assign(ss,is),ss.onInitEaseMove=function(){is.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=Ce.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const rs=Phaser.Utils.Objects.GetValue;class ns extends hi{constructor(t,e){super(t,e),this.timer=new vi,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(rs(t,"timer")),this.setEnable(rs(t,"enable",!0)),this.setMode(rs(t,"mode",1)),this.isRunning=rs(t,"isRunning",!1),this.setMagnitudeMode(rs(t,"magnitudeMode",1)),this.setAxisMode(rs(t,"axis",0)),this.setDuration(rs(t,"duration",500)),this.setMagnitude(rs(t,"magnitude",10)),this.ox=rs(t,"ox",void 0),this.oy=rs(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=as[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=os[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=hs[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=rs(i,"magnitude",void 0),t=rs(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,a=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=a;break;default:i.x=n,i.y=a}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const as={effect:0,behavior:1},hs={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},os={constant:0,decay:1},ls=Phaser.Utils.Objects.IsPlainObject;var ds={shake(t,e,i){if(ls(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new ns(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Li(this._shake)}};const cs=Phaser.Utils.Objects.GetValue,us=Phaser.Math.Linear;class ps extends xi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=cs(t,"key","value");var i=e[this.propertyKey];return this.fromValue=cs(t,"from",i),this.toValue=cs(t,"to",i),this.setEase(cs(t,"ease",this.ease)),this.setDuration(cs(t,"duration",this.duration)),this.setRepeat(cs(t,"repeat",0)),this.setDelay(cs(t,"delay",0)),this.setRepeatDelay(cs(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=us(this.fromValue,this.toValue,i)}}const vs=Phaser.Utils.Objects.IsPlainObject;class fs extends ii{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new ps(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(vs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(vs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var gs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new fs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Ri(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},ms=Phaser.Utils.Array.Remove,ys={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}}var Ls={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Ke(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},As={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=Xt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=Xt),this.transitOutCallback=t,this}},js={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},zs={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Xs={};Object.assign(Xs,Ls,As,js,zs);const Fs=Phaser.Utils.Objects.GetValue;class Ys extends ii{constructor(t,e){super(t,e),this.setTransitInTime(Fs(e,"duration.in",200)),this.setTransitOutTime(Fs(e,"duration.out",200)),this.setTransitInCallback(Fs(e,"transitIn")),this.setTransitOutCallback(Fs(e,"transitOut")),this.oneShotMode=Fs(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Rs(this,{eventEmitter:!1,initState:Fs(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Ys.prototype,Xs);var Is=function(t){if(t.parentContainer)return Is(t.parentContainer);var e=function(t){var e=t.displayList;return H(e)?e:null}(t);return e?Is(e):t};class Ns extends ii{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Is(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,a=1/i.zoom,h=r/2,o=n/2,l=r*a,d=n*a;e.x===h&&e.y===o||e.setPosition(h,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Ws=Phaser.GameObjects.Rectangle;class Vs extends Ws{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Ns(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Bs=Phaser.Utils.Objects.GetValue;class Gs extends ii{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Bs(t,"hitAreaMode",0)),this.setEnable(Bs(t,"enable",!0)),this.setStopMode(Bs(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Us[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Us={default:0,fullWindow:1};const Hs=Phaser.Utils.Objects.GetValue;class Js extends Vs{constructor(t,e){super(t,Hs(e,"color",0),Hs(e,"alpha",.8)),this.touchEventStop=new Gs(this,{hitAreaMode:1})}}var $s={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Di(t,e)},scaleDown(t,e){Mi(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Vi(t,e)},fadeOut(t,e){Bi(t,e,!1)}},qs=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Vi(t,e,t.alpha)},Ks=function(t,e){Bi(t,e,!1)},Zs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!nt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Qs=Phaser.Utils.Objects.GetValue;let tr=class extends Ys{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=er.popUp),null==e.transitOut&&(e.transitOut=er.scaleDown),e.destroy=Qs(e,"destroy",!0),super(t,e);var i=Qs(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Js(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Qs(i,"transitIn",qs)),this.setCoverTransitOutCallback(Qs(i,"transitOut",Ks)));var s=Qs(e,"touchOutsideClose",!1),r=Qs(e,"duration.hold",-1),n=Qs(e,"timeOutClose",r>=0),a=Qs(e,"anyTouchClose",!1);Qs(e,"manualClose",!1)&&(s=!1,a=!1,n=!1),a&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),a?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Qs(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Zs(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=er[t]),t){case er.popUp:t=$s.popUp;break;case er.fadeIn:t=$s.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=er[t]),t){case er.scaleDown:t=$s.scaleDown;break;case er.fadeOut:t=$s.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const er={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var ir=function(t){return t&&"function"==typeof t},sr={modal(t,e){return ir(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new tr(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},rr=function(t,e,i,s,r){ir(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},nr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return rr.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return rr.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return rr.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return rr.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return rr.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return rr.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return rr.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return rr.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return rr.call(this,"shutdown",t,e,i,s),this}},ar=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=hr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},hr={},or=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,a=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return a?Zs(t,e.x,e.y,i,s):!!(r=ar(e,n,!0))&&Zs(t,r.x,r.y,i,s);for(var h=t.scene.input.manager,o=h.pointersTotal,l=h.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const br={press:0,pointerdown:0,release:1,pointerup:1};var Cr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new yr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},_r=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!Sr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,a=n.pointersTotal,h=n.pointers,o=0;o0)return Pr.length=0,!0;return Pr.length=0,!1},Pr=[];const xr=Phaser.Utils.Objects.GetValue;class wr extends ii{constructor(t,e){super(t,e),this._enable=void 0;var i=xr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(xr(t,"enable",!0)),this.setMode(xr(t,"mode",1)),this.setClickInterval(xr(t,"clickInterval",100)),this.setDragThreshold(xr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Or[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?_r:or)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Or={press:0,pointerdown:0,release:1,pointerup:1};var Er={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new wr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Tr extends Ms{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const kr=Phaser.Utils.Objects.GetValue;class Dr extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Tr,this.parent.setInteractive(kr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(kr(t,"enable",!0)),this.setCooldown(kr(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Mr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&or(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Dr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Dr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Rr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Lr=function(t,e,i,s){if("parent"===t){for(var r,n=0,a=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=$r,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===qr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=$r,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Kr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&or(t,s,e,i)}}const $r=0,qr=1,Kr="IDLE",Zr=Phaser.Utils.Objects.GetValue,Qr=Phaser.Math.Distance.Between;class tn extends Jr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=en},eventEmitter:!1};this.setRecongizedStateObject(new Ms(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Zr(t,"time",250)),this.setTapInterval(Zr(t,"tapInterval",200)),this.setDragThreshold(Zr(t,"threshold",9)),this.setTapOffset(Zr(t,"tapOffset",10));var e=Zr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Zr(t,"maxTaps",void 0)),this.setMinTaps(Zr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case en:this.state=sn;break;case sn:var t=this.lastPointer;Qr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=rn,this.state=sn);break;case rn:this.state=sn}}onDragEnd(){this.state===sn&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=rn))}onDrag(){this.state!==en&&this.pointer.getDistance()>this.dragThreshold&&(this.state=en)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===sn){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=en):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=rn:this.state=en)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===rn&&(this.state=en)}get isTapped(){return this.state===rn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const en="IDLE",sn="BEGIN",rn="RECOGNIZED",nn=Phaser.Utils.Objects.GetValue;class an extends Jr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=hn},eventEmitter:!1};this.setRecongizedStateObject(new Ms(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(nn(t,"threshold",9)),this.setHoldTime(nn(t,"time",251)),this}onDragStart(){this.state=on,0===this.holdTime&&(this.state=ln)}onDragEnd(){this.state=hn}onDrag(){this.state!==hn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=hn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===on&&t-this.pointer.downTime>=this.holdTime&&(this.state=ln)}get isPressed(){return this.state===ln}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const hn="IDLE",on="BEGIN",ln="RECOGNIZED";Phaser.Utils.Objects.GetValue;const dn=Phaser.Math.Distance.Between,cn=Phaser.Math.Angle.Between;var un={getDt:function(){var t;return t=this.scene,ti(t).loop.delta},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return dn(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return cn(e.x,e.y,t.x,t.y)}},pn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},vn={};const fn=Phaser.Utils.Objects.GetValue,gn=Phaser.Math.RadToDeg;class mn extends Jr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=yn},eventEmitter:!1};this.setRecongizedStateObject(new Ms(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(fn(t,"threshold",10)),this.setVelocityThreshold(fn(t,"velocityThreshold",1e3)),this.setDirectionMode(fn(t,"dir","8dir")),this}onDragStart(){this.state=bn}onDragEnd(){this.state=yn}onDrag(){this.state===bn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=Cn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Cn&&(this.state=yn)}get isSwiped(){return this.state===Cn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=pn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=vn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(gn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(mn.prototype,un);const yn="IDLE",bn="BEGIN",Cn="RECOGNIZED",_n=Phaser.Utils.Objects.GetValue,Sn=Phaser.Utils.Array.SpliceOne,Pn=Phaser.Math.Distance.Between,xn=Phaser.Math.Angle.Between;class wn{constructor(t,e){var i=Ke(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(_n(e,"inputConfig",void 0)),this.setEventEmitter(_n(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(_n(t,"enable",!0)),this.bounds=_n(t,"bounds",void 0),this.tracerState=En,this.pointers.length=0,gt(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,gt(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case En:this.tracerState=Tn,this.onDrag1Start();break;case Tn:this.tracerState=kn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],Sn(this.pointers,e),this.tracerState){case Tn:this.tracerState=En,this.onDrag1End();break;case kn:this.tracerState=Tn,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case Tn:this.onDrag1();break;case kn:this.onDrag2()}}}dragCancel(){return this.tracerState===kn&&this.onDrag2End(),this.pointers.length=0,gt(this.movedState),this.tracerState=En,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==kn)return 0;var t=this.pointers[0],e=this.pointers[1];return Pn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==kn)return 0;var t=this.pointers[0],e=this.pointers[1];return xn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;On.x=e.x-i.x,On.y=e.y-i.y}else On.x=0,On.y=0;return On}get centerX(){if(this.tracerState!==kn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==kn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==kn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==kn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Dn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&or(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&or(t,s,e,i)}}Object.assign(wn.prototype,Je);var On={};const En=0,Tn=1,kn=2,Dn="IDLE";Phaser.Utils.Objects.GetValue;const Mn=Phaser.Math.RotateAround;var Rn=function(t,e,i,s){return Mn(t,e,i,s),t.rotation+=s,t},Ln={};const An=Phaser.Utils.Objects.GetValue,jn=Phaser.Math.Angle.WrapDegrees,zn=Phaser.Math.Angle.ShortestBetween,Xn=Phaser.Math.RadToDeg,Fn=Phaser.Math.DegToRad;var Yn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Ln),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,a=r.y,h=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=jn(Xn(this.angleBetween));this.angle=zn(this.prevAngle,t),this.prevAngle=t,this.state=Wn}break;case Wn:t=jn(Xn(this.angleBetween)),this.angle=zn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Wn}get rotation(){return Fn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Yn);const In="IDLE",Nn="BEGIN",Wn="RECOGNIZED",Vn=Phaser.Utils.Objects.GetValue;var Bn=function(t){var e=Vn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new tn(this,e),this._tap.on("tap",(function(t,e,s){Ar(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Ar(i.eventEmitter,`${i.eventNamePrefix}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Gn=Phaser.Utils.Objects.GetValue;var Un=function(t){var e=Gn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new an(this,e),this._press.on("pressstart",(function(t,e,s){Ar(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this).on("pressend",(function(t,e,s){Ar(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Hn=Phaser.Utils.Objects.GetValue;var Jn=function(t){var e=Hn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new mn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Ar(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Ar(i.eventEmitter,`${i.eventNamePrefix}swipe`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const $n=Phaser.Utils.Objects.GetValue;var qn=function(t,e){return t.setInteractive(),$n(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:$n(e,"targets",[t]),targetMode:$n(e,"targetMode","parent"),eventEmitter:$n(e,"eventEmitter",t),eventNamePrefix:$n(e,"inputEventPrefix","child.")},zr.call(t,e),Yr.call(t,e),Wr.call(t,e),Ur.call(t,e),Bn.call(t,e),Un.call(t,e),Jn.call(t,e),t},Kn={getSizerConfig:function(t){return void 0===t&&(t=this),Dt(t)},getChildPrevState:function(t){var e=Dt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Lt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,a,h=t.scene;if("number"==typeof e)i=e;else{i=oe(e,"color"),s=oe(e,"lineWidth");var o=oe(e,"name",!1);o&&(r=oe(o,"createTextCallback",ce),n=oe(o,"createTextCallbackScope",void 0),"string"==typeof(a=oe(o,"align","left-top"))&&(a=zt[a]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new le(h),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}var d,c,u=this.getAllShownChildren([this]);ue(u,u);for(var p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=a)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=a+1),r};const aa=Phaser.Utils.Objects.IsPlainObject,ha=Phaser.Utils.Objects.GetValue,oa=Phaser.Display.Align.CENTER,la={min:0,full:-1};var da=function(t,e,i,s,r,n,a,h,o,l){var d,c,u,p;me.call(this,t);var v=t.isRexSpace,f=typeof e;if(null===e)return this;if("number"===f);else if("string"===f)e=la[e];else if(aa(e)){var g;e=ha(g=e,"proportion",void 0),i=ha(g,"align",oa),s=ha(g,"padding",0),r=ha(g,"expand",!1),n=ha(g,"key",void 0),a=ha(g,"index",void 0),t.isRexSizer||(h=ha(g,"minWidth",void 0),o=ha(g,"minHeight",void 0)),l=ha(g,"fitRatio",0),d=ha(g,"offsetX",0),c=ha(g,"offsetY",0),u=ha(g,"offsetOriginX",0),p=ha(g,"offsetOriginY",0)}return"string"==typeof i&&(i=zt[i]),void 0===e&&(e=v?1:0),void 0===i&&(i=oa),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===h&&(v?h=0:t.isRexSizer||(h=t._minWidth)),void 0===o&&(v?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),(g=this.getSizerConfig(t)).proportion=e,g.align=i,g.padding=fe(s),g.expand=r,g.fitRatio=0===e?l:0,g.alignOffsetX=d,g.alignOffsetY=c,g.alignOffsetOriginX=u,g.alignOffsetOriginY=p,void 0===a||a>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(a,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===h?Q(t):h:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=h)),void 0!==n&&this.addChildrenMap(n,t),this},ca={add:da,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),da.call(this,new ra(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,h){return aa(i)&&(i.index=t),da.call(this,e,i,s,r,n,a,t,h),this},insertAtPosition(t,e,i,s,r,n,a,h,o){var l=na.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,h,o),this}};const ua=kt.prototype.clear;var pa=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),ua.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,pa.call(this,t),this}},ga={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=zt[e]),this.getSizerConfig(t).align=e,this}},ma={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},ya={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},ba={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},Ca={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,h=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=h.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,a+=n)));else for(d=0,c=h.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,a+=n)))}return o?void 0:a+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,a=s.padding;i=n-(a.left+a.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,a=s.padding;i=n-(a.top+a.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Be(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Ne.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,h,o,l,d,c,u=this.sizerChildren,p=this.innerLeft,v=this.innerTop,f=this.innerWidth,g=this.innerHeight,m=p,y=v,b=this.startChildIndex,C=0,_=u.length;C<_;C++)c=0===b?C:ea(C+b,0,_),this.rtl&&(c=_-c-1),(t=u[c]).rexSizer.hidden||(i=(e=t.rexSizer).padding,pr.call(this,t),t.isRexSpace?(l=0,d=0):(l=this.getExpandedChildWidth(t),d=this.getExpandedChildHeight(t)),t.isRexSizer?(t.runLayout(this,l,d),ta(t,this)):Be(t,l,d),void 0===l&&(l=Q(t)),void 0===d&&(d=tt(t)),0===this.orientation?(s=m+i.left*this.scaleX,n=0===e.proportion||0===this.proportionLength?l:e.proportion*this.proportionLength,r=y+i.top*this.scaleY,a=g-(i.top+i.bottom)*this.scaleY):(s=m+i.left*this.scaleX,n=f-(i.left+i.right)*this.scaleX,r=y+i.top*this.scaleY,a=0===e.proportion||0===this.proportionLength?d:e.proportion*this.proportionLength),void 0===l&&(l=Q(t)),void 0===d&&(d=tt(t)),h=(e.alignOffsetX+e.alignOffsetOriginX*l)*this.scaleX,o=(e.alignOffsetY+e.alignOffsetOriginY*d)*this.scaleY,vr.call(this,t,s,r,n,a,e.align,h,o),0===this.orientation?m+=n+(i.left+i.right)*this.scaleX+this.space.item*this.scaleX:y+=a+(i.top+i.bottom)*this.scaleY+this.space.item*this.scaleY)},resolveWidth:function(t){if(void 0!==(t=Ae.call(this,t))&&0===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenWidth;e>0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Xe.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||je.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&ia.call(this,t,void 0),ze.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Fe.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&ia.call(this,void 0,t),Ye.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],a=n&&n.isRexSpace;return"center"===t?a||this.insertSpace(r+1):a&&this.remove(n,!0),this}};Object.assign(Ca,ca,fa,ga,ma,ya,ba);var _a=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},Sa={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const Pa=Phaser.Utils.Objects.IsPlainObject,xa=Phaser.Utils.Objects.GetValue;class wa extends Qn{constructor(t,e,i,s,r,n,a){Pa(e)?(e=xa(a=e,"x",0),i=xa(a,"y",0),s=xa(a,"width",void 0),r=xa(a,"height",void 0),n=xa(a,"orientation",0)):Pa(s)?(s=xa(a=s,"width",void 0),r=xa(a,"height",void 0),n=xa(a,"orientation",0)):Pa(n)&&(n=xa(a=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,a),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(xa(a,"space.item",0)),this.setStartChildIndex(xa(a,"startChildIndex",0)),this.setRTL(xa(a,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=Sa[t]),t}(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=_a.call(this)),this._childrenProportion}}Object.assign(wa.prototype,Ca);const Oa=Phaser.GameObjects.Graphics.prototype.setPosition,Ea=Phaser.Geom.Rectangle,Ta=Phaser.Geom.Circle;var ka=function(t,e,i,s,r){this.geom=function(t,e,i,s,r,n,a){if(1===t){s=s.left;var h=-e*(r-.5),o=-i*(n-.5),l=Math.min(e,i)/2+s;void 0!==a&&a instanceof Ta||(a=new Ta),a.setTo(h,o,l)}else{var d=-e*r-s.left,c=-i*n-s.top,u=e+s.left+s.right,p=i+s.top+s.bottom;void 0!==a&&a instanceof Ea||(a=new Ea),a.setTo(d,c,u,p)}return a}(this.shapeType,t,e,i,s,r,this.geom),this.clear().fillStyle(16777215),1===this.shapeType?this.fillCircleShape(this.geom):this.fillRectShape(this.geom)},Da=function(t,e){for(var i in t){if(!(i in e))return!1;if(t[i]!==e[i])return!1}for(var i in e)if(!(i in t))return!1;return!0},Ma={setPosition:function(t,e){var i=this.parent;return void 0===t&&(t=i.x),void 0===e&&(e=i.y),Oa.call(this,t,e),this},resize:function(t,e,i){var s=this.parent;void 0===t&&(t=s.width),void 0===e&&(e=s.height),void 0===i?i=this.padding:"number"==typeof i&&(i=GetBoundsConfig(i));var r=this.width!==t||this.height!==e,n=this.padding!==i&&!Da(this.padding,i);return r||n?(this.width=t,this.height=e,n&&mt(i,this.padding),this.originX=s.originX,this.originY=s.originY,ka.call(this,t,e,i,s.originX,s.originY),this):this},setOrigin:function(t,e){void 0===e&&(e=t);var i=this.parent;return void 0===t&&(t=i.originX),void 0===e&&(e=i.originY),this.originX===t&&this.originY===e||(this.originX=t,this.originY=e,ka.call(this,this.width,this.height,this.padding,t,e)),this},contains:function(t,e){return t-=this.x,e-=this.y,this.geom.contains(t,e)}};const Ra=Phaser.GameObjects.Graphics;class La extends Ra{constructor(t,e,i){void 0===e&&(e=0),"string"==typeof e&&(e=Aa[e]),super(t.scene),this.parent=t,this.shapeType=e,this.padding=fe(i),this.setPosition().resize().setVisible(!1)}destroy(){return this.parent=void 0,super.destroy(),this}}const Aa={rectangle:0,circle:1};Object.assign(La.prototype,Ma);var ja=function(t,e,i,s){var r=new La(e,i,s);if(t&&!t.isRexSizer){var n=r.createGeometryMask();t.setMask(n),this.once("destroy",(function(){t.setMask(),n.destroy()}))}return this.pin(r),r},za=Phaser.Renderer.WebGL.Utils,Xa=function(t,e,i,s,r,n){for(var a=za.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),h=i.pathData,o=i.pathIndexes,l=0;l>>16,h=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+a+","+h+","+o+","+n+")"},Wa=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,a=(16711680&r)>>>16,h=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+a+","+h+","+o+","+n+")",t.lineWidth=e.lineWidth};const Va=Phaser.Renderer.Canvas.SetTransform;var Ba={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Ia(e,i,s),a=r.calcMatrix.copyFrom(n.calc),h=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&Xa(r,a,e,l,h,o),e.isStroked&&Ya(r,e,l,h,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(Va(t,r,e,i,s)){var n=e._displayOriginX,a=e._displayOriginY,h=e.pathData,o=h.length-1,l=h[0]-n,d=h[1]-a;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(Ua.prototype,Ba);const Ha=Phaser.Utils.Objects.GetValue;let Ja=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=Ha(t,"x",0),i=Ha(t,"y",0));var s=this.cornerRadius;s.tl=$a(Ha(t,"tl",void 0),e,i),s.tr=$a(Ha(t,"tr",void 0),e,i),s.bl=$a(Ha(t,"bl",void 0),e,i),s.br=$a(Ha(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){qa(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){qa(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){qa(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){qa(this.cornerRadius.br,t)}};var $a=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Ka(t),t},qa=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Ha(e,"x",0),t.y=Ha(e,"y",0)),Ka(t)},Ka=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},Za=function(t){return t.x>0&&t.y>0},Qa=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const th=Phaser.Math.DegToRad;var eh=function(t,e,i,s,r,n,a,h,o){a&&n>r?n-=360:!a&&n0,a=0,h=e.length;a=0?t.startAt(a+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(a+n,i):t.startAt(a,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(a,i),t.close(),t};const to=Phaser.Utils.Objects.GetValue,eo=Phaser.Utils.Objects.IsPlainObject;class io extends(Eh(bh)){constructor(t,e,i,s,r,n,a,h){eo(e)?(e=(h=e).x,i=h.y,s=h.width,r=h.height,n=h.barColor,a=h.value):eo(s)?(s=(h=s).width,r=h.height,n=h.barColor,a=h.value):eo(n)&&(n=(h=n).barColor,a=h.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===a&&(a=0),super(t,e,i,s,r,h),this.type="rexLineProgress",this.bootProgressBase(h),this.addShape((new Zh).setName("trackFill")).addShape((new Zh).setName("bar")).addShape((new Zh).setName("trackStroke")),this.setTrackColor(to(h,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(to(h,"trackStrokeThickness",2),to(h,"trackStrokeColor",void 0)),this.setSkewX(to(h,"skewX",0)),this.setRTL(to(h,"rtl",!1)),this.setValue(a)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var so={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&Qh(s,0,0,e,i,t);var r,n,a=this.getShape("bar");a.fillStyle(this.barColor),a.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),Qh(a,r,0,n,i,t));var h=this.getShape("trackStroke");h.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),h.isStroked&&Qh(h,0,0,e,i,t)}};Object.assign(io.prototype,so);var ro=function(t){return null==t||""===t||0===t.length},no=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(ro(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(ro(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,a=e.length;nxo(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=xo(t[i]));return e}const wo=Phaser.Utils.Objects.IsPlainObject,Oo=Phaser.Utils.Objects.GetValue;var Eo=function(t){return"string"==typeof t&&(t=To[t]),t};const To={scale:0,repeat:1};var ko=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},Do={_beginDraw:Xt,_drawImage:Xt,_drawTileSprite:Xt,_endDraw:Xt,setGetFrameNameCallback:function(t){return void 0===t&&(t=Po),this.getFrameNameCallback=t,this},setBaseTexture:function(t,e,i,s){Array.isArray(e)&&(s=i,i=e,e=void 0),null==e&&(e="__BASE"),"number"==typeof i&&arguments.length>=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=xo(i),s=xo(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),a=n.width,h=0,o=0,l=i.length;o0?a/h:0,c=n.height,u=0;for(o=0,l=s.length;o0?0:f,b=0,o=0;for(var P=i.length;o0?0:g),g>=1&&f>=1){var x=typeof(m=this.getFrameNameCallback(o,_,e));"string"!==x&&"number"!==x||r.add(m,0,b+n.cutX,C+n.cutY,g,f)}b+=g}C+=f}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,a,h,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/o,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(u,p);if(u>v){var f=(u-v)*o;d>=0?d+=f:d=f,u=v}if(p>v){var g=(p-v)*l;c>=0?c+=g:c=g,p=v}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,C=this.rows.count;b0&&h>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(_,b)?0:1)?this._drawImage(this.textureKey,s,m,y,a,h):this._drawTileSprite(this.textureKey,s,m,y,a,h)),m+=a;y+=h}this._endDraw()},setStretchMode:function(t){return wo(t)?(this.stretchMode.edge=Eo(Oo(t,"edge",0)),this.stretchMode.internal=Eo(Oo(t,"internal",0))):(t=Eo(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return ko.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const Mo=Phaser.Utils.Objects.IsPlainObject,Ro=Phaser.Utils.Objects.GetValue,Lo=Phaser.GameObjects;var Ao=void 0,jo=function(t,e){if(Ao||(Ao={},ti(t).events.once("destroy",(function(){for(var t in Ao)Ao[t].destroy();Ao=void 0}))),!Ao.hasOwnProperty(e)){var i=ti(t).scene.systemScene;(t=new Lo[e](i)).setOrigin(0),Ao[e]=t}return Ao[e]};const zo=Phaser.GameObjects.RenderTexture;class Xo extends(function(t,e){class i extends t{constructor(t,i,s,r,n,a,h,o,l,d){if(Mo(i)?(i=Ro(d=i,"x",0),s=Ro(d,"y",0),r=Ro(d,"width",1),n=Ro(d,"height",1),a=Ro(d,"key",void 0),h=Ro(d,"baseFrame",void 0),o=Ro(d,"columns",void 0),l=Ro(d,"rows",void 0)):Mo(r)?(r=Ro(d=r,"width",1),n=Ro(d,"height",1),a=Ro(d,"key",void 0),h=Ro(d,"baseFrame",void 0),o=Ro(d,"columns",void 0),l=Ro(d,"rows",void 0)):Mo(a)?(a=Ro(d=a,"key",void 0),h=Ro(d,"baseFrame",void 0),o=Ro(d,"columns",void 0),l=Ro(d,"rows",void 0)):Mo(h)?(h=Ro(d=h,"baseFrame",void 0),o=Ro(d,"columns",void 0),l=Ro(d,"rows",void 0)):Array.isArray(h)?(d=l,l=o,o=h,h=Ro(d,"baseFrame",void 0)):Mo(o)&&(o=Ro(d=o,"columns",void 0),l=Ro(d,"rows",void 0)),void 0===h&&(h=Ro(d,"frame",void 0)),void 0===o){var c=Ro(d,"leftWidth",void 0),u=Ro(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=Ro(d,"topHeight",void 0),v=Ro(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(Ro(d,"getFrameNameCallback",void 0)),this.setStretchMode(Ro(d,"stretchMode",0)),this.setPreserveRatio(Ro(d,"preserveRatio",!0));var f=Ro(d,"maxFixedPartScale",1),g=Ro(d,"maxFixedPartScaleX",f),m=Ro(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(g,m),this.setBaseTexture(a,h,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,Do),i}(zo,"rexNinePatch")){}var Fo={_drawImage:function(t,e,i,s,r,n){var a=jo(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(a,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var a=jo(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(a,i,s)}};Object.assign(Xo.prototype,Fo);class Yo extends ii{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(oo(t,e))return t[e];var i=t.parent;return oo(i,e)?i[e]:void 0}set(t,e,i){return oo(t,e)?t[e]=i:oo(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}}const Io=Phaser.Utils.Objects.GetValue;class No extends Xo{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=Io(e,"effects",!0);i&&vo(this,i),this.style=new Yo(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(No.prototype,ch);const Wo=["alpha","tint","flipX","flipY"];var Vo=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("barColor")?i="bar":e.hasOwnProperty("leftWidth")?i="nineSlice":e.hasOwnProperty("key")&&(i="image")),i){case"bar":s=new ao(t,e);break;case"image":s=new So(t,e);break;case"nineSlice":s=e.hasOwnProperty("stretchMode")?new No(t,e):new yo(t,e);break;default:s=new uh(t,e)}return function(t,e){if(!e)return t;for(var i=0,s=Wo.length;i=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const O=Phaser.Math.DegToRad;var E={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=O(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},T={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=x(t.scaleX,i.scaleX),e.scaleY=x(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},k={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},D={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=x(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},M={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},L={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},A={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(t){void 0===t&&(t=!1);var e=this;return this._mask=null,this.setChildMaskVisible(this),this.children.forEach((function(t){t.clearMask&&t.clearMask(!1),t.hasOwnProperty("isRexContainerLite")||e.setChildMaskVisible(t)})),t&&this.mask&&this.mask.destroy(),this}},j=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},F=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const I=Phaser.Utils.Array;var N={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Te=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const ke=/(\S+)\[(\d+)\]/i,De=Phaser.Utils.Objects.GetValue;var Re=function(t,e){return void 0===e?t:t[e]},Me=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=De(e,"left",0),t.right=De(e,"right",0),t.top=De(e,"top",0),t.bottom=De(e,"bottom",0)),t},Le={getInnerPadding(t){return Re(this.space,t)},setInnerPadding(t,e){return Me(this.space,t,e),this},getOuterPadding(t){return Re(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Me(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Re(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Me(this.getSizerConfig(t).padding,e,i),this}},Ae=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},je=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},ze=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Xe=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Fe=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},Ye=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Ie={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Ne=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?mi:gi,this.repeatCounter=0,this}stop(){return this.state=fi,this}update(t,e){this.state!==fi&&this.state!==bi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=yi)):(this.nowTime=this.duration,this.state=bi):this.nowTime>=0&&(this.state=mi))}get t(){var t;switch(this.state){case fi:case gi:case yi:t=0;break;case mi:t=this.nowTime/this.duration;break;case bi:t=1}return pi(t,0,1)}set t(t){(t=pi(t,-1,1))<0?(this.state=gi,this.nowTime=-this.delay*t):(this.state=mi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===fi}get isDelay(){return this.state===gi}get isCountDown(){return this.state===mi}get isRunning(){return this.state===gi||this.state===mi}get isDone(){return this.state===bi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const fi=0,gi=1,mi=2,yi=3,bi=-1;class Ci extends di{constructor(t,e){super(t,e),this.timer=new vi}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const _i=Phaser.Utils.Objects.GetValue,Si=Phaser.Utils.Objects.GetAdvancedValue,Pi=Phaser.Tweens.Builders.GetEaseFunction;class xi extends Ci{resetFromJSON(t){return this.timer.resetFromJSON(_i(t,"timer")),this.setEnable(_i(t,"enable",!0)),this.setTarget(_i(t,"target",this.parent)),this.setDelay(Si(t,"delay",0)),this.setDuration(Si(t,"duration",1e3)),this.setEase(_i(t,"ease","Linear")),this.setRepeat(_i(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Pi(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const wi=Phaser.Utils.Objects.GetValue,Oi=Phaser.Utils.Objects.GetAdvancedValue,Ei=Phaser.Math.Linear;let Ti=class extends xi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(wi(t,"mode",0)),this.setScaleRange(Oi(t,"start",void 0),Oi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=ki[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Oi(t,"x",this.parent.scaleX),this.startY=Oi(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Oi(e,"x",void 0),this.endY=Oi(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Ei(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Ei(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const ki={stop:0,destroy:1,yoyo:2};var Di=function(t,e,i,s,r){var n,a;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},a={x:t.scaleX};break;case 1:case"y":n={y:0},a={y:t.scaleY};break;default:n=0,a=t.scale}var h={mode:0,start:n,end:a,duration:e,ease:s};return void 0===r?r=new Ti(t,h):r.resetFromJSON(h),r.restart(),r},Ri=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Ti&&(n=r,r=void 0),void 0===r&&(r=!0);var a={};switch(a.mode=r?1:0,i){case 0:case"x":a.end={x:0};break;case 1:case"y":a.end={y:0};break;default:a.end=0}return a.duration=e,a.ease=s,void 0===n?n=new Ti(t,a):n.resetFromJSON(a),n.restart(),n},Mi=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Li=function(t){return Mi(t,"complete")};const Ai=Phaser.Utils.Objects.IsPlainObject;var ji={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Ai(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Di(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Li(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Ai(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Ri(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Li(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Li(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Ai(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var a=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,a){var h,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":h={x:t.scaleX},o={x:i};break;case 1:case"y":h={y:t.scaleX},o={y:i};break;default:h=t.scaleX,o=i}var l={mode:2,start:h,end:o,duration:e/2,ease:n,repeat:s};return void 0===a?a=new Ti(t,l):a.resetFromJSON(l),a.restart(),a}(this,t,e,i,s,r,this._scaleBehavior),a&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Li(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},zi={};Object.assign(zi,ji),zi.onInitScale=function(){ji.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=Ce.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Xi=Phaser.Utils.Objects.GetValue,Fi=Phaser.Utils.Objects.GetAdvancedValue,Yi=Phaser.Math.Linear;class Ii extends xi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Xi(t,"mode",0)),this.setAlphaRange(Fi(t,"start",this.parent.alpha),Fi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ni[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Yi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ni={stop:0,destroy:1,yoyo:2},Wi=Phaser.Utils.Objects.IsPlainObject;var Vi=function(t,e,i,s){var r,n;Wi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var a={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Ii(t,a):s.resetFromJSON(a),s.restart(),s},Bi=function(t,e,i,s){i instanceof Ii&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Ii(t,r):s.resetFromJSON(r),s.restart(),s};const Gi=Phaser.Utils.Objects.IsPlainObject;var Ui={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Gi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Vi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Li(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Gi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Bi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Li(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Li(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Hi={};Object.assign(Hi,Ui),Hi.onInitFade=function(){Ui.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=Ce.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Ji=Phaser.Utils.Objects.GetValue,$i=Phaser.Utils.Objects.GetAdvancedValue,qi=Phaser.Math.Linear;class Ki extends xi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Ji(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=$i(t,"x",void 0),i=$i(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Zi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=$i(i,"startX",void 0),this.startY=$i(i,"startY",void 0),this.endX=$i(i,"endX",void 0),this.endY=$i(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=qi(this.startX,this.endX,i)),this.hasMoveY&&(t.y=qi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Zi={stop:0,destroy:1,yoyo:2};var Qi=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const ts=Phaser.Utils.Objects.IsPlainObject,es=Phaser.Math.Distance.Between;var is={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(ts(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*es(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var a=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,a){n instanceof Ki&&(a=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=Qi(i,t.x),h.endX=t.x),void 0!==s&&(h.startY=Qi(s,t.y),h.endY=t.y),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===a?a=new Ki(t,h):a.resetFromJSON(h),a.restart(),a}(this,t,e,i,s,r,this._easeMove),a&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Li(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Li(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(ts(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*es(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var a=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,a){n instanceof Ki&&(a=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=t.x,h.endX=Qi(i,t.x)),void 0!==s&&(h.startY=t.y,h.endY=Qi(s,t.y)),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===a?a=new Ki(t,h):a.resetFromJSON(h),a.restart(),a}(this,t,e,i,s,r,this._easeMove),a&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Li(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Li(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},ss={};Object.assign(ss,is),ss.onInitEaseMove=function(){is.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=Ce.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const rs=Phaser.Utils.Objects.GetValue;class ns extends hi{constructor(t,e){super(t,e),this.timer=new vi,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(rs(t,"timer")),this.setEnable(rs(t,"enable",!0)),this.setMode(rs(t,"mode",1)),this.isRunning=rs(t,"isRunning",!1),this.setMagnitudeMode(rs(t,"magnitudeMode",1)),this.setAxisMode(rs(t,"axis",0)),this.setDuration(rs(t,"duration",500)),this.setMagnitude(rs(t,"magnitude",10)),this.ox=rs(t,"ox",void 0),this.oy=rs(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=as[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=os[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=hs[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=rs(i,"magnitude",void 0),t=rs(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,a=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=a;break;default:i.x=n,i.y=a}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const as={effect:0,behavior:1},hs={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},os={constant:0,decay:1},ls=Phaser.Utils.Objects.IsPlainObject;var ds={shake(t,e,i){if(ls(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new ns(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Li(this._shake)}};const cs=Phaser.Utils.Objects.GetValue,us=Phaser.Math.Linear;class ps extends xi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=cs(t,"key","value");var i=e[this.propertyKey];return this.fromValue=cs(t,"from",i),this.toValue=cs(t,"to",i),this.setEase(cs(t,"ease",this.ease)),this.setDuration(cs(t,"duration",this.duration)),this.setRepeat(cs(t,"repeat",0)),this.setDelay(cs(t,"delay",0)),this.setRepeatDelay(cs(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=us(this.fromValue,this.toValue,i)}}const vs=Phaser.Utils.Objects.IsPlainObject;class fs extends ii{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new ps(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(vs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(vs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var gs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new fs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Mi(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},ms=Phaser.Utils.Array.Remove,ys={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}}var Ls={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Ke(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},As={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=Xt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=Xt),this.transitOutCallback=t,this}},js={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},zs={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Xs={};Object.assign(Xs,Ls,As,js,zs);const Fs=Phaser.Utils.Objects.GetValue;class Ys extends ii{constructor(t,e){super(t,e),this.setTransitInTime(Fs(e,"duration.in",200)),this.setTransitOutTime(Fs(e,"duration.out",200)),this.setTransitInCallback(Fs(e,"transitIn")),this.setTransitOutCallback(Fs(e,"transitOut")),this.oneShotMode=Fs(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Ms(this,{eventEmitter:!1,initState:Fs(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Ys.prototype,Xs);var Is=function(t){if(t.parentContainer)return Is(t.parentContainer);var e=function(t){var e=t.displayList;return H(e)?e:null}(t);return e?Is(e):t};class Ns extends ii{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Is(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,a=1/i.zoom,h=r/2,o=n/2,l=r*a,d=n*a;e.x===h&&e.y===o||e.setPosition(h,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Ws=Phaser.GameObjects.Rectangle;class Vs extends Ws{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Ns(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Bs=Phaser.Utils.Objects.GetValue;class Gs extends ii{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Bs(t,"hitAreaMode",0)),this.setEnable(Bs(t,"enable",!0)),this.setStopMode(Bs(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Us[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Us={default:0,fullWindow:1};const Hs=Phaser.Utils.Objects.GetValue;class Js extends Vs{constructor(t,e){super(t,Hs(e,"color",0),Hs(e,"alpha",.8)),this.touchEventStop=new Gs(this,{hitAreaMode:1})}}var $s={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Di(t,e)},scaleDown(t,e){Ri(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Vi(t,e)},fadeOut(t,e){Bi(t,e,!1)}},qs=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Vi(t,e,t.alpha)},Ks=function(t,e){Bi(t,e,!1)},Zs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!nt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Qs=Phaser.Utils.Objects.GetValue;let tr=class extends Ys{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=er.popUp),null==e.transitOut&&(e.transitOut=er.scaleDown),e.destroy=Qs(e,"destroy",!0),super(t,e);var i=Qs(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Js(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Qs(i,"transitIn",qs)),this.setCoverTransitOutCallback(Qs(i,"transitOut",Ks)));var s=Qs(e,"touchOutsideClose",!1),r=Qs(e,"duration.hold",-1),n=Qs(e,"timeOutClose",r>=0),a=Qs(e,"anyTouchClose",!1);Qs(e,"manualClose",!1)&&(s=!1,a=!1,n=!1),a&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),a?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Qs(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Zs(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=er[t]),t){case er.popUp:t=$s.popUp;break;case er.fadeIn:t=$s.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=er[t]),t){case er.scaleDown:t=$s.scaleDown;break;case er.fadeOut:t=$s.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const er={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var ir=function(t){return t&&"function"==typeof t},sr={modal(t,e){return ir(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new tr(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},rr=function(t,e,i,s,r){ir(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},nr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return rr.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return rr.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return rr.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return rr.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return rr.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return rr.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return rr.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return rr.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return rr.call(this,"shutdown",t,e,i,s),this}},ar=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=hr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},hr={},or=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,a=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return a?Zs(t,e.x,e.y,i,s):!!(r=ar(e,n,!0))&&Zs(t,r.x,r.y,i,s);for(var h=t.scene.input.manager,o=h.pointersTotal,l=h.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const br={press:0,pointerdown:0,release:1,pointerup:1};var Cr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new yr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},_r=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!Sr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,a=n.pointersTotal,h=n.pointers,o=0;o0)return Pr.length=0,!0;return Pr.length=0,!1},Pr=[];const xr=Phaser.Utils.Objects.GetValue;class wr extends ii{constructor(t,e){super(t,e),this._enable=void 0;var i=xr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(xr(t,"enable",!0)),this.setMode(xr(t,"mode",1)),this.setClickInterval(xr(t,"clickInterval",100)),this.setDragThreshold(xr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Or[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?_r:or)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Or={press:0,pointerdown:0,release:1,pointerup:1};var Er={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new wr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Tr extends Rs{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const kr=Phaser.Utils.Objects.GetValue;class Dr extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Tr,this.parent.setInteractive(kr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(kr(t,"enable",!0)),this.setCooldown(kr(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Rr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&or(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Dr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Dr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Mr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Lr=function(t,e,i,s){if("parent"===t){for(var r,n=0,a=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=$r,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===qr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=$r,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Kr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&or(t,s,e,i)}}const $r=0,qr=1,Kr="IDLE",Zr=Phaser.Utils.Objects.GetValue,Qr=Phaser.Math.Distance.Between;class tn extends Jr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=en},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Zr(t,"time",250)),this.setTapInterval(Zr(t,"tapInterval",200)),this.setDragThreshold(Zr(t,"threshold",9)),this.setTapOffset(Zr(t,"tapOffset",10));var e=Zr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Zr(t,"maxTaps",void 0)),this.setMinTaps(Zr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case en:this.state=sn;break;case sn:var t=this.lastPointer;Qr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=rn,this.state=sn);break;case rn:this.state=sn}}onDragEnd(){this.state===sn&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=rn))}onDrag(){this.state!==en&&this.pointer.getDistance()>this.dragThreshold&&(this.state=en)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===sn){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=en):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=rn:this.state=en)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===rn&&(this.state=en)}get isTapped(){return this.state===rn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const en="IDLE",sn="BEGIN",rn="RECOGNIZED",nn=Phaser.Utils.Objects.GetValue;class an extends Jr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=hn},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(nn(t,"threshold",9)),this.setHoldTime(nn(t,"time",251)),this}onDragStart(){this.state=on,0===this.holdTime&&(this.state=ln)}onDragEnd(){this.state=hn}onDrag(){this.state!==hn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=hn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===on&&t-this.pointer.downTime>=this.holdTime&&(this.state=ln)}get isPressed(){return this.state===ln}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const hn="IDLE",on="BEGIN",ln="RECOGNIZED";Phaser.Utils.Objects.GetValue;const dn=Phaser.Math.Distance.Between,cn=Phaser.Math.Angle.Between;var un={getDt:function(){var t;return t=this.scene,ti(t).loop.delta},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return dn(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return cn(e.x,e.y,t.x,t.y)}},pn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},vn={};const fn=Phaser.Utils.Objects.GetValue,gn=Phaser.Math.RadToDeg;class mn extends Jr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=yn},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(fn(t,"threshold",10)),this.setVelocityThreshold(fn(t,"velocityThreshold",1e3)),this.setDirectionMode(fn(t,"dir","8dir")),this}onDragStart(){this.state=bn}onDragEnd(){this.state=yn}onDrag(){this.state===bn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=Cn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Cn&&(this.state=yn)}get isSwiped(){return this.state===Cn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=pn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=vn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(gn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(mn.prototype,un);const yn="IDLE",bn="BEGIN",Cn="RECOGNIZED",_n=Phaser.Utils.Objects.GetValue,Sn=Phaser.Utils.Array.SpliceOne,Pn=Phaser.Math.Distance.Between,xn=Phaser.Math.Angle.Between;class wn{constructor(t,e){var i=Ke(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(_n(e,"inputConfig",void 0)),this.setEventEmitter(_n(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(_n(t,"enable",!0)),this.bounds=_n(t,"bounds",void 0),this.tracerState=En,this.pointers.length=0,gt(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,gt(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case En:this.tracerState=Tn,this.onDrag1Start();break;case Tn:this.tracerState=kn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],Sn(this.pointers,e),this.tracerState){case Tn:this.tracerState=En,this.onDrag1End();break;case kn:this.tracerState=Tn,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case Tn:this.onDrag1();break;case kn:this.onDrag2()}}}dragCancel(){return this.tracerState===kn&&this.onDrag2End(),this.pointers.length=0,gt(this.movedState),this.tracerState=En,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==kn)return 0;var t=this.pointers[0],e=this.pointers[1];return Pn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==kn)return 0;var t=this.pointers[0],e=this.pointers[1];return xn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;On.x=e.x-i.x,On.y=e.y-i.y}else On.x=0,On.y=0;return On}get centerX(){if(this.tracerState!==kn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==kn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==kn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==kn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Dn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&or(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&or(t,s,e,i)}}Object.assign(wn.prototype,Je);var On={};const En=0,Tn=1,kn=2,Dn="IDLE";Phaser.Utils.Objects.GetValue;const Rn=Phaser.Math.RotateAround;var Mn=function(t,e,i,s){return Rn(t,e,i,s),t.rotation+=s,t},Ln={};const An=Phaser.Utils.Objects.GetValue,jn=Phaser.Math.Angle.WrapDegrees,zn=Phaser.Math.Angle.ShortestBetween,Xn=Phaser.Math.RadToDeg,Fn=Phaser.Math.DegToRad;var Yn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Ln),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,a=r.y,h=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=jn(Xn(this.angleBetween));this.angle=zn(this.prevAngle,t),this.prevAngle=t,this.state=Wn}break;case Wn:t=jn(Xn(this.angleBetween)),this.angle=zn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Wn}get rotation(){return Fn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Yn);const In="IDLE",Nn="BEGIN",Wn="RECOGNIZED",Vn=Phaser.Utils.Objects.GetValue;var Bn=function(t){var e=Vn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new tn(this,e),this._tap.on("tap",(function(t,e,s){Ar(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Ar(i.eventEmitter,`${i.eventNamePrefix}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Gn=Phaser.Utils.Objects.GetValue;var Un=function(t){var e=Gn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new an(this,e),this._press.on("pressstart",(function(t,e,s){Ar(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this).on("pressend",(function(t,e,s){Ar(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Hn=Phaser.Utils.Objects.GetValue;var Jn=function(t){var e=Hn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new mn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Ar(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Ar(i.eventEmitter,`${i.eventNamePrefix}swipe`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const $n=Phaser.Utils.Objects.GetValue;var qn=function(t,e){return t.setInteractive(),$n(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:$n(e,"targets",[t]),targetMode:$n(e,"targetMode","parent"),eventEmitter:$n(e,"eventEmitter",t),eventNamePrefix:$n(e,"inputEventPrefix","child.")},zr.call(t,e),Yr.call(t,e),Wr.call(t,e),Ur.call(t,e),Bn.call(t,e),Un.call(t,e),Jn.call(t,e),t},Kn={getSizerConfig:function(t){return void 0===t&&(t=this),Dt(t)},getChildPrevState:function(t){var e=Dt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Lt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,a,h=t.scene;if("number"==typeof e)i=e;else{i=oe(e,"color"),s=oe(e,"lineWidth");var o=oe(e,"name",!1);o&&(r=oe(o,"createTextCallback",ce),n=oe(o,"createTextCallbackScope",void 0),"string"==typeof(a=oe(o,"align","left-top"))&&(a=zt[a]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new le(h),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}var d,c,u=this.getAllShownChildren([this]);ue(u,u);for(var p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=a)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=a+1),r};const aa=Phaser.Utils.Objects.IsPlainObject,ha=Phaser.Utils.Objects.GetValue,oa=Phaser.Display.Align.CENTER,la={min:0,full:-1};var da=function(t,e,i,s,r,n,a,h,o,l){var d,c,u,p;me.call(this,t);var v=t.isRexSpace,f=typeof e;if(null===e)return this;if("number"===f);else if("string"===f)e=la[e];else if(aa(e)){var g;e=ha(g=e,"proportion",void 0),i=ha(g,"align",oa),s=ha(g,"padding",0),r=ha(g,"expand",!1),n=ha(g,"key",void 0),a=ha(g,"index",void 0),t.isRexSizer||(h=ha(g,"minWidth",void 0),o=ha(g,"minHeight",void 0)),l=ha(g,"fitRatio",0),d=ha(g,"offsetX",0),c=ha(g,"offsetY",0),u=ha(g,"offsetOriginX",0),p=ha(g,"offsetOriginY",0)}return"string"==typeof i&&(i=zt[i]),void 0===e&&(e=v?1:0),void 0===i&&(i=oa),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===h&&(v?h=0:t.isRexSizer||(h=t._minWidth)),void 0===o&&(v?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),(g=this.getSizerConfig(t)).proportion=e,g.align=i,g.padding=fe(s),g.expand=r,g.fitRatio=0===e?l:0,g.alignOffsetX=d,g.alignOffsetY=c,g.alignOffsetOriginX=u,g.alignOffsetOriginY=p,void 0===a||a>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(a,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===h?Q(t):h:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=h)),void 0!==n&&this.addChildrenMap(n,t),this},ca={add:da,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),da.call(this,new ra(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,h){return aa(i)&&(i.index=t),da.call(this,e,i,s,r,n,a,t,h),this},insertAtPosition(t,e,i,s,r,n,a,h,o){var l=na.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,h,o),this}};const ua=kt.prototype.clear;var pa=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),ua.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,pa.call(this,t),this}},ga={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=zt[e]),this.getSizerConfig(t).align=e,this}},ma={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},ya={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},ba={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},Ca={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,h=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=h.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,a+=n)));else for(d=0,c=h.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,a+=n)))}return o?void 0:a+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,a=s.padding;i=n-(a.left+a.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,a=s.padding;i=n-(a.top+a.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Be(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Ne.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,h,o,l,d,c,u=this.sizerChildren,p=this.innerLeft,v=this.innerTop,f=this.innerWidth,g=this.innerHeight,m=p,y=v,b=this.startChildIndex,C=0,_=u.length;C<_;C++)c=0===b?C:ea(C+b,0,_),this.rtl&&(c=_-c-1),(t=u[c]).rexSizer.hidden||(i=(e=t.rexSizer).padding,pr.call(this,t),t.isRexSpace?(l=0,d=0):(l=this.getExpandedChildWidth(t),d=this.getExpandedChildHeight(t)),t.isRexSizer?(t.runLayout(this,l,d),ta(t,this)):Be(t,l,d),void 0===l&&(l=Q(t)),void 0===d&&(d=tt(t)),0===this.orientation?(s=m+i.left*this.scaleX,n=0===e.proportion||0===this.proportionLength?l:e.proportion*this.proportionLength,r=y+i.top*this.scaleY,a=g-(i.top+i.bottom)*this.scaleY):(s=m+i.left*this.scaleX,n=f-(i.left+i.right)*this.scaleX,r=y+i.top*this.scaleY,a=0===e.proportion||0===this.proportionLength?d:e.proportion*this.proportionLength),void 0===l&&(l=Q(t)),void 0===d&&(d=tt(t)),h=(e.alignOffsetX+e.alignOffsetOriginX*l)*this.scaleX,o=(e.alignOffsetY+e.alignOffsetOriginY*d)*this.scaleY,vr.call(this,t,s,r,n,a,e.align,h,o),0===this.orientation?m+=n+(i.left+i.right)*this.scaleX+this.space.item*this.scaleX:y+=a+(i.top+i.bottom)*this.scaleY+this.space.item*this.scaleY)},resolveWidth:function(t){if(void 0!==(t=Ae.call(this,t))&&0===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenWidth;e>0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Xe.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||je.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&ia.call(this,t,void 0),ze.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Fe.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&ia.call(this,void 0,t),Ye.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],a=n&&n.isRexSpace;return"center"===t?a||this.insertSpace(r+1):a&&this.remove(n,!0),this}};Object.assign(Ca,ca,fa,ga,ma,ya,ba);var _a=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},Sa={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const Pa=Phaser.Utils.Objects.IsPlainObject,xa=Phaser.Utils.Objects.GetValue;class wa extends Qn{constructor(t,e,i,s,r,n,a){Pa(e)?(e=xa(a=e,"x",0),i=xa(a,"y",0),s=xa(a,"width",void 0),r=xa(a,"height",void 0),n=xa(a,"orientation",0)):Pa(s)?(s=xa(a=s,"width",void 0),r=xa(a,"height",void 0),n=xa(a,"orientation",0)):Pa(n)&&(n=xa(a=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,a),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(xa(a,"space.item",0)),this.setStartChildIndex(xa(a,"startChildIndex",0)),this.setRTL(xa(a,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=Sa[t]),t}(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=_a.call(this)),this._childrenProportion}}Object.assign(wa.prototype,Ca);const Oa=Phaser.GameObjects.Graphics.prototype.setPosition,Ea=Phaser.Geom.Rectangle,Ta=Phaser.Geom.Circle;var ka=function(t,e,i,s,r){this.geom=function(t,e,i,s,r,n,a){if(1===t){s=s.left;var h=-e*(r-.5),o=-i*(n-.5),l=Math.min(e,i)/2+s;void 0!==a&&a instanceof Ta||(a=new Ta),a.setTo(h,o,l)}else{var d=-e*r-s.left,c=-i*n-s.top,u=e+s.left+s.right,p=i+s.top+s.bottom;void 0!==a&&a instanceof Ea||(a=new Ea),a.setTo(d,c,u,p)}return a}(this.shapeType,t,e,i,s,r,this.geom),this.clear().fillStyle(16777215),1===this.shapeType?this.fillCircleShape(this.geom):this.fillRectShape(this.geom)},Da=function(t,e){for(var i in t){if(!(i in e))return!1;if(t[i]!==e[i])return!1}for(var i in e)if(!(i in t))return!1;return!0},Ra={setPosition:function(t,e){var i=this.parent;return void 0===t&&(t=i.x),void 0===e&&(e=i.y),Oa.call(this,t,e),this},resize:function(t,e,i){var s=this.parent;void 0===t&&(t=s.width),void 0===e&&(e=s.height),void 0===i?i=this.padding:"number"==typeof i&&(i=GetBoundsConfig(i));var r=this.width!==t||this.height!==e,n=this.padding!==i&&!Da(this.padding,i);return r||n?(this.width=t,this.height=e,n&&mt(i,this.padding),this.originX=s.originX,this.originY=s.originY,ka.call(this,t,e,i,s.originX,s.originY),this):this},setOrigin:function(t,e){void 0===e&&(e=t);var i=this.parent;return void 0===t&&(t=i.originX),void 0===e&&(e=i.originY),this.originX===t&&this.originY===e||(this.originX=t,this.originY=e,ka.call(this,this.width,this.height,this.padding,t,e)),this},contains:function(t,e){return t-=this.x,e-=this.y,this.geom.contains(t,e)}};const Ma=Phaser.GameObjects.Graphics;class La extends Ma{constructor(t,e,i){void 0===e&&(e=0),"string"==typeof e&&(e=Aa[e]),super(t.scene),this.parent=t,this.shapeType=e,this.padding=fe(i),this.setPosition().resize().setVisible(!1)}destroy(){return this.parent=void 0,super.destroy(),this}}const Aa={rectangle:0,circle:1};Object.assign(La.prototype,Ra);var ja=function(t,e,i,s){var r=new La(e,i,s);if(t&&!t.isRexSizer){var n=r.createGeometryMask();t.setMask(n),this.once("destroy",(function(){t.setMask(),n.destroy()}))}return this.pin(r),r},za=Phaser.Renderer.WebGL.Utils,Xa=function(t,e,i,s,r,n){for(var a=za.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),h=i.pathData,o=i.pathIndexes,l=0;l>>16,h=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+a+","+h+","+o+","+n+")"},Wa=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,a=(16711680&r)>>>16,h=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+a+","+h+","+o+","+n+")",t.lineWidth=e.lineWidth};const Va=Phaser.Renderer.Canvas.SetTransform;var Ba={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Ia(e,i,s),a=r.calcMatrix.copyFrom(n.calc),h=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&Xa(r,a,e,l,h,o),e.isStroked&&Ya(r,e,l,h,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(Va(t,r,e,i,s)){var n=e._displayOriginX,a=e._displayOriginY,h=e.pathData,o=h.length-1,l=h[0]-n,d=h[1]-a;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(Ua.prototype,Ba);const Ha=Phaser.Utils.Objects.GetValue;let Ja=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=Ha(t,"x",0),i=Ha(t,"y",0));var s=this.cornerRadius;s.tl=$a(Ha(t,"tl",void 0),e,i),s.tr=$a(Ha(t,"tr",void 0),e,i),s.bl=$a(Ha(t,"bl",void 0),e,i),s.br=$a(Ha(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){qa(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){qa(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){qa(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){qa(this.cornerRadius.br,t)}};var $a=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Ka(t),t},qa=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Ha(e,"x",0),t.y=Ha(e,"y",0)),Ka(t)},Ka=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},Za=function(t){return t.x>0&&t.y>0},Qa=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const th=Phaser.Math.DegToRad;var eh=function(t,e,i,s,r,n,a,h,o){a&&n>r?n-=360:!a&&n0,a=0,h=e.length;a=0?t.startAt(a+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(a+n,i):t.startAt(a,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(a,i),t.close(),t};const eo=Phaser.Utils.Objects.GetValue,io=Phaser.Utils.Objects.IsPlainObject;class so extends(Eh(bh)){constructor(t,e,i,s,r,n,a,h){io(e)?(e=(h=e).x,i=h.y,s=h.width,r=h.height,n=h.barColor,a=h.value):io(s)?(s=(h=s).width,r=h.height,n=h.barColor,a=h.value):io(n)&&(n=(h=n).barColor,a=h.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===a&&(a=0),super(t,e,i,s,r,h),this.type="rexLineProgress",this.bootProgressBase(h),this.addShape((new Qh).setName("trackFill")).addShape((new Qh).setName("bar")).addShape((new Qh).setName("trackStroke")),this.setTrackColor(eo(h,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(eo(h,"trackStrokeThickness",2),eo(h,"trackStrokeColor",void 0)),this.setSkewX(eo(h,"skewX",0)),this.setRTL(eo(h,"rtl",!1)),this.setValue(a)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var ro={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&to(s,0,0,e,i,t);var r,n,a=this.getShape("bar");a.fillStyle(this.barColor),a.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),to(a,r,0,n,i,t));var h=this.getShape("trackStroke");h.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),h.isStroked&&to(h,0,0,e,i,t)}};Object.assign(so.prototype,ro);var no=function(t){return null==t||""===t||0===t.length},ao=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(no(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(no(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,a=e.length;nwo(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=wo(t[i]));return e}const Oo=Phaser.Utils.Objects.IsPlainObject,Eo=Phaser.Utils.Objects.GetValue;var To=function(t){return"string"==typeof t&&(t=ko[t]),t};const ko={scale:0,repeat:1};var Do=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},Ro={_beginDraw:Xt,_drawImage:Xt,_drawTileSprite:Xt,_endDraw:Xt,setGetFrameNameCallback:function(t){return void 0===t&&(t=xo),this.getFrameNameCallback=t,this},setBaseTexture:function(t,e,i,s){Array.isArray(e)&&(s=i,i=e,e=void 0),null==e&&(e="__BASE"),"number"==typeof i&&arguments.length>=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=wo(i),s=wo(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),a=n.width,h=0,o=0,l=i.length;o0?a/h:0,c=n.height,u=0;for(o=0,l=s.length;o0?0:f,b=0,o=0;for(var P=i.length;o0?0:g),g>=1&&f>=1){var x=typeof(m=this.getFrameNameCallback(o,_,e));"string"!==x&&"number"!==x||r.add(m,0,b+n.cutX,C+n.cutY,g,f)}b+=g}C+=f}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,a,h,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/o,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(u,p);if(u>v){var f=(u-v)*o;d>=0?d+=f:d=f,u=v}if(p>v){var g=(p-v)*l;c>=0?c+=g:c=g,p=v}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,C=this.rows.count;b0&&h>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(_,b)?0:1)?this._drawImage(this.textureKey,s,m,y,a,h):this._drawTileSprite(this.textureKey,s,m,y,a,h)),m+=a;y+=h}this._endDraw()},setStretchMode:function(t){return Oo(t)?(this.stretchMode.edge=To(Eo(t,"edge",0)),this.stretchMode.internal=To(Eo(t,"internal",0))):(t=To(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Do.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const Mo=Phaser.Utils.Objects.IsPlainObject,Lo=Phaser.Utils.Objects.GetValue,Ao=Phaser.GameObjects;var jo=void 0,zo=function(t,e){if(jo||(jo={},ti(t).events.once("destroy",(function(){for(var t in jo)jo[t].destroy();jo=void 0}))),!jo.hasOwnProperty(e)){var i=ti(t).scene.systemScene;(t=new Ao[e](i)).setOrigin(0),jo[e]=t}return jo[e]};const Xo=Phaser.GameObjects.RenderTexture;class Fo extends(function(t,e){class i extends t{constructor(t,i,s,r,n,a,h,o,l,d){if(Mo(i)?(i=Lo(d=i,"x",0),s=Lo(d,"y",0),r=Lo(d,"width",1),n=Lo(d,"height",1),a=Lo(d,"key",void 0),h=Lo(d,"baseFrame",void 0),o=Lo(d,"columns",void 0),l=Lo(d,"rows",void 0)):Mo(r)?(r=Lo(d=r,"width",1),n=Lo(d,"height",1),a=Lo(d,"key",void 0),h=Lo(d,"baseFrame",void 0),o=Lo(d,"columns",void 0),l=Lo(d,"rows",void 0)):Mo(a)?(a=Lo(d=a,"key",void 0),h=Lo(d,"baseFrame",void 0),o=Lo(d,"columns",void 0),l=Lo(d,"rows",void 0)):Mo(h)?(h=Lo(d=h,"baseFrame",void 0),o=Lo(d,"columns",void 0),l=Lo(d,"rows",void 0)):Array.isArray(h)?(d=l,l=o,o=h,h=Lo(d,"baseFrame",void 0)):Mo(o)&&(o=Lo(d=o,"columns",void 0),l=Lo(d,"rows",void 0)),void 0===h&&(h=Lo(d,"frame",void 0)),void 0===o){var c=Lo(d,"leftWidth",void 0),u=Lo(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=Lo(d,"topHeight",void 0),v=Lo(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(Lo(d,"getFrameNameCallback",void 0)),this.setStretchMode(Lo(d,"stretchMode",0)),this.setPreserveRatio(Lo(d,"preserveRatio",!0));var f=Lo(d,"maxFixedPartScale",1),g=Lo(d,"maxFixedPartScaleX",f),m=Lo(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(g,m),this.setBaseTexture(a,h,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,Ro),i}(Xo,"rexNinePatch")){}var Yo={_drawImage:function(t,e,i,s,r,n){var a=zo(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(a,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var a=zo(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(a,i,s)}};Object.assign(Fo.prototype,Yo);class Io extends ii{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(lo(t,e))return t[e];var i=t.parent;return lo(i,e)?i[e]:void 0}set(t,e,i){return lo(t,e)?t[e]=i:lo(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}}const No=Phaser.Utils.Objects.GetValue;class Wo extends Fo{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=No(e,"effects",!0);i&&fo(this,i),this.style=new Io(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Wo.prototype,ch);const Vo=["alpha","tint","flipX","flipY"];var Bo=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("barColor")?i="bar":e.hasOwnProperty("leftWidth")?i="nineSlice":e.hasOwnProperty("key")&&(i="image")),i){case"bar":s=new ho(t,e);break;case"image":s=new Po(t,e);break;case"nineSlice":s=e.hasOwnProperty("stretchMode")?new Wo(t,e):new bo(t,e);break;default:s=new uh(t,e)}return function(t,e){if(!e)return t;for(var i=0,s=Vo.length;i0?-this.delay:0,this.state=this.nowTime>=0?b:T,this.repeatCounter=0,this}stop(){return this.state=k,this}update(t,e){this.state!==k&&this.state!==w&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=E)):(this.nowTime=this.duration,this.state=w):this.nowTime>=0&&(this.state=b))}get t(){var t;switch(this.state){case k:case T:case E:t=0;break;case b:t=this.nowTime/this.duration;break;case w:t=1}return _(t,0,1)}set t(t){(t=_(t,-1,1))<0?(this.state=T,this.nowTime=-this.delay*t):(this.state=b,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===k}get isDelay(){return this.state===T}get isCountDown(){return this.state===b}get isRunning(){return this.state===T||this.state===b}get isDone(){return this.state===w}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const k=0,T=1,b=2,E=3,w=-1;class A extends f{constructor(t,e){super(t,e),this.timer=new S}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const C=Phaser.Utils.Objects.GetValue,R=Phaser.Utils.Objects.GetAdvancedValue,x=Phaser.Tweens.Builders.GetEaseFunction;class L extends A{resetFromJSON(t){return this.timer.resetFromJSON(C(t,"timer")),this.setEnable(C(t,"enable",!0)),this.setTarget(C(t,"target",this.parent)),this.setDelay(R(t,"delay",0)),this.setDuration(R(t,"duration",1e3)),this.setEase(C(t,"ease","Linear")),this.setRepeat(C(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=x(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const X=Phaser.Utils.Objects.GetValue,Y=Phaser.Math.Linear;class O extends L{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=X(t,"key","value");var i=e[this.propertyKey];return this.fromValue=X(t,"from",i),this.toValue=X(t,"to",i),this.setEase(X(t,"ease",this.ease)),this.setDuration(X(t,"duration",this.duration)),this.setRepeat(X(t,"repeat",0)),this.setDelay(X(t,"delay",0)),this.setRepeatDelay(X(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=Y(this.fromValue,this.toValue,i)}}var M={start:function(t){return this.easeValueTask||(this.easeValueTask=new O(this,{eventEmitter:null})),void 0!==t&&(this.duration=t,this.easeValueTask.stop()),this.easeValueTask.isRunning||(this.easeValueTask.restart({key:"value",from:0,to:1,duration:this.duration,ease:this.ease,repeat:-1,delay:this.delay,repeatDelay:this.repeatDelay}),this.setDirty()),this},stop:function(){return this.easeValueTask?(this.easeValueTask.stop(),this.setDirty(),this):this},pause:function(){return this.easeValueTask?(this.easeValueTask.pause(),this.setDirty(),this):this},resume:function(){return this.easeValueTask?(this.easeValueTask.pause(),this.setDirty(),this):this}};const V=Phaser.Utils.Objects.GetValue;class z extends a{constructor(t,e){super(t,V(e,"x",0),V(e,"y",0),V(e,"width",64),V(e,"height",64)),this.resetFromConfig(e,!0),this.buildShapes(e),V(e,"start",!0)&&this.start()}resetFromConfig(t,e){var i;return void 0===e&&(e=!1),i=e?1e3:this.duration,this.setDuration(V(t,"duration",i)),i=e?"Linear":this.ease,this.setEase(V(t,"ease",i)),i=e?0:this.delay,this.setDelay(V(t,"delay",i)),i=e?0:this.repeatDelay,this.setRepeatDelay(V(t,"repeatDelay",i)),i=e?16777215:this.color,this.setColor(V(t,"color",i)),i=e?0:this.value,this.setValue(V(t,"value",i)),this}buildShapes(){}get centerX(){return this.width/2}get centerY(){return this.height/2}get radius(){return Math.min(this.centerX,this.centerY)}get color(){return this._color}set color(t){this.isColorChanged=this.isColorChanged||this._color!==t,this.dirty=this.dirty||this.isColorChanged,this._color=t,this.setShapesColor(t)}setColor(t){return this.color=t,this}setShapesColor(t){}get value(){return this._value}set value(t){t=Phaser.Math.Clamp(t,0,1),this.dirty=this.dirty||this._value!=t,this._value=t}setValue(t){return this.value=t,this}setDuration(t){return this.duration=t,this}setDelay(t){return this.delay=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return this.ease=t,this}get isRunning(){return!!this.tweenTask&&this.tweenTask.isRunning}}Object.assign(z.prototype,M);var F={fillStyle:function(t,e){return null==t?this.isFilled=!1:(void 0===e&&(e=1),this.isFilled=!0,this.fillColor=t,this.fillAlpha=e),this},lineStyle:function(t,e,i){return null==t||null==e?this.isStroked=!1:(void 0===i&&(i=1),this.isStroked=!0,this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i),this}},j={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:function(t,e,i){if(!t||"number"==typeof t)return i;if("string"==typeof e){if(t.hasOwnProperty(e))return t[e];if(-1===e.indexOf("."))return i;e=e.split(".")}for(var s=e,h=t,r=i,a=0;a>>16,n=(65280&h)>>>8,o=255&h;t.fillStyle="rgba("+a+","+n+","+o+","+r+")"},B=function(t,e,i,s){var h=i||e.strokeColor,r=s||e.strokeAlpha,a=(16711680&h)>>>16,n=(65280&h)>>>8,o=255&h;t.strokeStyle="rgba("+a+","+n+","+o+","+r+")",t.lineWidth=e.lineWidth};const U=Phaser.Geom.Polygon.Earcut;class J extends I{constructor(){super(),this.pathData=[],this.pathIndexes=[],this.closePath=!1}updateData(){return this.pathIndexes=U(this.pathData),super.updateData(),this}webglRender(t,e,i,s,h){this.isFilled&&function(t,e,i,s,h,r){for(var a=N.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),n=i.pathData,o=i.pathIndexes,l=0;l=2){var h=i[s-2],r=i[s-1];if(t===h&&e===r)return i}return i.push(t,e),i};const q=Phaser.Math.DegToRad;var H=function(t,e,i,s,h,r,a,n,o){a&&r>h?r-=360:!a&&r0,a=0,n=e.length;a0?-this.delay:0,this.state=this.nowTime>=0?b:T,this.repeatCounter=0,this}stop(){return this.state=k,this}update(t,e){this.state!==k&&this.state!==w&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=E)):(this.nowTime=this.duration,this.state=w):this.nowTime>=0&&(this.state=b))}get t(){var t;switch(this.state){case k:case T:case E:t=0;break;case b:t=this.nowTime/this.duration;break;case w:t=1}return _(t,0,1)}set t(t){(t=_(t,-1,1))<0?(this.state=T,this.nowTime=-this.delay*t):(this.state=b,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===k}get isDelay(){return this.state===T}get isCountDown(){return this.state===b}get isRunning(){return this.state===T||this.state===b}get isDone(){return this.state===w}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const k=0,T=1,b=2,E=3,w=-1;class A extends f{constructor(t,e){super(t,e),this.timer=new S}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const C=Phaser.Utils.Objects.GetValue,R=Phaser.Utils.Objects.GetAdvancedValue,x=Phaser.Tweens.Builders.GetEaseFunction;class L extends A{resetFromJSON(t){return this.timer.resetFromJSON(C(t,"timer")),this.setEnable(C(t,"enable",!0)),this.setTarget(C(t,"target",this.parent)),this.setDelay(R(t,"delay",0)),this.setDuration(R(t,"duration",1e3)),this.setEase(C(t,"ease","Linear")),this.setRepeat(C(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=x(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const X=Phaser.Utils.Objects.GetValue,Y=Phaser.Math.Linear;class O extends L{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=X(t,"key","value");var i=e[this.propertyKey];return this.fromValue=X(t,"from",i),this.toValue=X(t,"to",i),this.setEase(X(t,"ease",this.ease)),this.setDuration(X(t,"duration",this.duration)),this.setRepeat(X(t,"repeat",0)),this.setDelay(X(t,"delay",0)),this.setRepeatDelay(X(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=Y(this.fromValue,this.toValue,i)}}var M={start:function(t){return this.easeValueTask||(this.easeValueTask=new O(this,{eventEmitter:null})),void 0!==t&&(this.duration=t,this.easeValueTask.stop()),this.easeValueTask.isRunning||(this.easeValueTask.restart({key:"value",from:0,to:1,duration:this.duration,ease:this.ease,repeat:-1,delay:this.delay,repeatDelay:this.repeatDelay}),this.setDirty()),this},stop:function(){return this.easeValueTask?(this.easeValueTask.stop(),this.setDirty(),this):this},pause:function(){return this.easeValueTask?(this.easeValueTask.pause(),this.setDirty(),this):this},resume:function(){return this.easeValueTask?(this.easeValueTask.pause(),this.setDirty(),this):this}};const V=Phaser.Utils.Objects.GetValue;class z extends a{constructor(t,e){super(t,V(e,"x",0),V(e,"y",0),V(e,"width",64),V(e,"height",64)),this.resetFromConfig(e,!0),this.buildShapes(e),V(e,"start",!0)&&this.start()}resetFromConfig(t,e){var i;return void 0===e&&(e=!1),i=e?1e3:this.duration,this.setDuration(V(t,"duration",i)),i=e?"Linear":this.ease,this.setEase(V(t,"ease",i)),i=e?0:this.delay,this.setDelay(V(t,"delay",i)),i=e?0:this.repeatDelay,this.setRepeatDelay(V(t,"repeatDelay",i)),i=e?16777215:this.color,this.setColor(V(t,"color",i)),i=e?0:this.value,this.setValue(V(t,"value",i)),this}buildShapes(){}get centerX(){return this.width/2}get centerY(){return this.height/2}get radius(){return Math.min(this.centerX,this.centerY)}get color(){return this._color}set color(t){this.isColorChanged=this.isColorChanged||this._color!==t,this.dirty=this.dirty||this.isColorChanged,this._color=t,this.setShapesColor(t)}setColor(t){return this.color=t,this}setShapesColor(t){}get value(){return this._value}set value(t){t=Phaser.Math.Clamp(t,0,1),this.dirty=this.dirty||this._value!=t,this._value=t}setValue(t){return this.value=t,this}setDuration(t){return this.duration=t,this}setDelay(t){return this.delay=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return this.ease=t,this}get isRunning(){return!!this.tweenTask&&this.tweenTask.isRunning}}Object.assign(z.prototype,M);var F={fillStyle:function(t,e){return null==t?this.isFilled=!1:(void 0===e&&(e=1),this.isFilled=!0,this.fillColor=t,this.fillAlpha=e),this},lineStyle:function(t,e,i){return null==t||null==e?this.isStroked=!1:(void 0===i&&(i=1),this.isStroked=!0,this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i),this}},j={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:function(t,e,i){if(!t||"number"==typeof t)return i;if("string"==typeof e){if(t.hasOwnProperty(e))return t[e];if(-1===e.indexOf("."))return i;e=e.split(".")}for(var s=e,h=t,r=i,a=0;a>>16,n=(65280&h)>>>8,o=255&h;t.fillStyle="rgba("+a+","+n+","+o+","+r+")"},B=function(t,e,i,s){var h=i||e.strokeColor,r=s||e.strokeAlpha,a=(16711680&h)>>>16,n=(65280&h)>>>8,o=255&h;t.strokeStyle="rgba("+a+","+n+","+o+","+r+")",t.lineWidth=e.lineWidth};const U=Phaser.Geom.Polygon.Earcut;class J extends I{constructor(){super(),this.pathData=[],this.pathIndexes=[],this.closePath=!1}updateData(){return this.pathIndexes=U(this.pathData),super.updateData(),this}webglRender(t,e,i,s,h){this.isFilled&&function(t,e,i,s,h,r){for(var a=N.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),n=i.pathData,o=i.pathIndexes,l=0;l=2){var h=i[s-2],r=i[s-1];if(t===h&&e===r)return i}return i.push(t,e),i};const q=Phaser.Math.DegToRad;var H=function(t,e,i,s,h,r,a,n,o){a&&r>h?r-=360:!a&&r0,a=0,n=e.length;a0?-this.delay:0,this.state=this.nowTime>=0?E:_,this.repeatCounter=0,this}stop(){return this.state=R,this}update(t,e){this.state!==R&&this.state!==A&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=C)):(this.nowTime=this.duration,this.state=A):this.nowTime>=0&&(this.state=E))}get t(){var t;switch(this.state){case R:case _:case C:t=0;break;case E:t=this.nowTime/this.duration;break;case A:t=1}return x(t,0,1)}set t(t){(t=x(t,-1,1))<0?(this.state=_,this.nowTime=-this.delay*t):(this.state=E,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===R}get isDelay(){return this.state===_}get isCountDown(){return this.state===E}get isRunning(){return this.state===_||this.state===E}get isDone(){return this.state===A}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const R=0,_=1,E=2,C=3,A=-1;class w extends b{constructor(t,e){super(t,e),this.timer=new S}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const L=Phaser.Utils.Objects.GetValue,M=Phaser.Utils.Objects.GetAdvancedValue,V=Phaser.Tweens.Builders.GetEaseFunction;class O extends w{resetFromJSON(t){return this.timer.resetFromJSON(L(t,"timer")),this.setEnable(L(t,"enable",!0)),this.setTarget(L(t,"target",this.parent)),this.setDelay(M(t,"delay",0)),this.setDuration(M(t,"duration",1e3)),this.setEase(L(t,"ease","Linear")),this.setRepeat(L(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=V(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const G=Phaser.Utils.Objects.GetValue,F=Phaser.Math.Linear;class B extends O{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=G(t,"key","value");var i=e[this.propertyKey];return this.fromValue=G(t,"from",i),this.toValue=G(t,"to",i),this.setEase(G(t,"ease",this.ease)),this.setDuration(G(t,"duration",this.duration)),this.setRepeat(G(t,"repeat",0)),this.setDelay(G(t,"delay",0)),this.setRepeatDelay(G(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=F(this.fromValue,this.toValue,i)}}const j=Phaser.Math.Percent;var z={setEaseValuePropName:function(t){return this.easeValuePropName=t,this},setEaseValueDuration:function(t){return this.easeValueDuration=t,this},setEaseValueFunction:function(t){return this.easeFunction=t,this},stopEaseValue:function(){return this.easeValueTask&&this.easeValueTask.stop(),this},easeValueTo:function(t,e,i){return null==t||(void 0!==e&&(t=j(t,e,i)),void 0===this.easeValueTask&&(this.easeValueTask=new B(this,{eventEmitter:null})),this.easeValueTask.restart({key:this.easeValuePropName,to:t,duration:this.easeValueDuration,ease:this.easeFunction})),this},easeValueRepeat:function(t,e,i,s){return void 0===i&&(i=-1),void 0===s&&(s=0),void 0===this.easeValueTask&&(this.easeValueTask=new B(this,{eventEmitter:null})),this.easeValueTask.restart({key:this.easeValuePropName,from:t,to:e,duration:this.easeValueDuration,ease:this.easeFunction,repeat:i,repeatDelay:s}),this}};const N=Phaser.Utils.Objects.GetValue,X=Phaser.Math.Clamp;var Y={fillStyle:function(t,e){return null==t?this.isFilled=!1:(void 0===e&&(e=1),this.isFilled=!0,this.fillColor=t,this.fillAlpha=e),this},lineStyle:function(t,e,i){return null==t||null==e?this.isStroked=!1:(void 0===i&&(i=1),this.isStroked=!0,this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i),this}},W={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:function(t,e,i){if(!t||"number"==typeof t)return i;if("string"==typeof e){if(t.hasOwnProperty(e))return t[e];if(-1===e.indexOf("."))return i;e=e.split(".")}for(var s=e,r=t,a=i,h=0;h>>16,n=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+h+","+n+","+o+","+a+")"}(t,this),t.fill()),this.isStroked&&(function(t,e,i,s){var r=i||e.strokeColor,a=s||e.strokeAlpha,h=(16711680&r)>>>16,n=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+h+","+n+","+o+","+a+")",t.lineWidth=e.lineWidth}(t,this),t.stroke())}}var H=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],a=i[s-1];if(t===r&&e===a)return i}return i.push(t,e),i};const Q=Phaser.Math.DegToRad;Phaser.Math.DegToRad;const Z=Phaser.Math.Interpolation.QuadraticBezier,$=Phaser.Math.Interpolation.CubicBezier;var tt=function(t){var e=t.length;if(e<2)return t;var i=t[e-2],s=t[e-1];return t.push(i),t.push(s),t},et={clear(){return this.start(),this},start(){return this.startAt(),this},startAt(t,e){return this.restorePathData(),this.accumulationLengths=void 0,function(t,e,i){i.length=0,null!=t&&i.push(t,e)}(t,e,this.pathData),this.firstPointX=t,this.firstPointY=e,this.lastPointX=t,this.lastPointY=e,this},lineTo(t,e,i){return void 0===i&&(i=!1),i&&(t+=this.lastPointX,e+=this.lastPointY),H(t,e,this.pathData),this.lastPointX=t,this.lastPointY=e,this},verticalLineTo(t,e){return this.lineTo(t,this.lastPointY,e),this},horizontalLineTo(t,e){return this.lineTo(this.lastPointX,t,e),this},ellipticalArc(t,e,i,s,r,a,h){return void 0===h&&(h=!1),function(t,e,i,s,r,a,h,n,o){h&&a>r?a-=360:!h&&a0,h=0,n=e.length;h0&&t.y>0},kt=function(t,e,i,s,r){t.setIterations(r).start();var a=s.tl;if(ft(a))if(a.convex){var h=a.x,n=a.y;t.ellipticalArc(h,n,a.x,a.y,180,270,!1)}else h=0,n=0,t.ellipticalArc(h,n,a.x,a.y,90,0,!0);else t.lineTo(0,0);return a=s.tr,ft(a)?a.convex?(h=e-a.x,n=a.y,t.ellipticalArc(h,n,a.x,a.y,270,360,!1)):(h=e,n=0,t.ellipticalArc(h,n,a.x,a.y,180,90,!0)):t.lineTo(e,0),a=s.br,ft(a)?a.convex?(h=e-a.x,n=i-a.y,t.ellipticalArc(h,n,a.x,a.y,0,90,!1)):(h=e,n=i,t.ellipticalArc(h,n,a.x,a.y,270,180,!0)):t.lineTo(e,i),a=s.bl,ft(a)?a.convex?(h=a.x,n=i-a.y,t.ellipticalArc(h,n,a.x,a.y,90,180,!1)):(h=0,n=i,t.ellipticalArc(h,n,a.x,a.y,360,270,!0)):t.lineTo(0,i),t.close(),t},Pt=Phaser.Math.RadToDeg,bt=function(t,e,i,s,r){var a=e*r,h=s.tl;if(ft(h)){l=a>h.x?90:Pt(Math.acos((h.x-a)/h.x));var n=h.x,o=h.y;t.ellipticalArc(n,o,h.x,h.y,180,180+l,!1)}else t.lineTo(0,0);if(h=s.tr,ft(h)&&a>e-h.x){var l=90-Pt(Math.acos((a-(e-h.x))/h.x));n=e-h.x,o=h.y,t.ellipticalArc(n,o,h.x,h.y,270,270+l,!1)}else t.lineTo(a,0);h=s.br,ft(h)&&a>e-h.x?(l=90-Pt(Math.acos((a-(e-h.x))/h.x)),n=e-h.x,o=i-h.y,t.ellipticalArc(n,o,h.x,h.y,90-l,90,!1)):t.lineTo(a,i),h=s.bl,ft(h)?(l=a>h.x?90:Pt(Math.acos((h.x-a)/h.x)),n=h.x,o=i-h.y,t.ellipticalArc(n,o,h.x,h.y,180-l,180,!1)):t.lineTo(0,i)},Tt=Phaser.Math.RadToDeg,Dt=function(t,e,i,s,r){var a=i*r,h=s.tl;if(ft(h)){l=a>h.y?90:Tt(Math.acos((h.y-a)/h.y));var n=h.x,o=h.y;t.ellipticalArc(n,o,h.x,h.y,270-l,270,!1)}else t.lineTo(0,0);if(h=s.tr,ft(h)?(l=a>h.y?90:Tt(Math.acos((h.y-a)/h.y)),n=e-h.x,o=h.y,t.ellipticalArc(n,o,h.x,h.y,270,270+l,!1)):t.lineTo(e,0),h=s.br,ft(h)&&a>i-h.y){var l=90-Tt(Math.acos((a-(i-h.y))/h.y));n=e-h.x,o=i-h.y,t.ellipticalArc(n,o,h.x,h.y,0,0+l,!1)}else t.lineTo(e,a);h=s.bl,ft(h)&&a>i-h.y?(l=90-Tt(Math.acos((a-(i-h.y))/h.y)),n=h.x,o=i-h.y,t.ellipticalArc(n,o,h.x,h.y,180-l,180,!1)):t.lineTo(0,a)},xt=Phaser.Math.RadToDeg,St=function(t,e,i,s,r){var a=e*r,h=s.tr;if(ft(h)){l=a>h.x?90:xt(Math.acos((h.x-a)/h.x));var n=e-h.x,o=h.y;t.ellipticalArc(n,o,h.x,h.y,360-l,360,!1)}else t.lineTo(e,0);if(h=s.br,ft(h)?(l=a>h.x?90:xt(Math.acos((h.x-a)/h.x)),n=e-h.x,o=i-h.y,t.ellipticalArc(n,o,h.x,h.y,0,0+l,!1)):t.lineTo(e,i),h=s.bl,ft(h)&&a>e-h.x){var l=90-xt(Math.acos((a-(e-h.x))/h.x));n=h.x,o=i-h.y,t.ellipticalArc(n,o,h.x,h.y,90,90+l,!1)}else t.lineTo(e-a,i);h=s.tl,ft(h)&&a>e-h.x?(l=90-xt(Math.acos((a-(e-h.x))/h.x)),n=h.x,o=h.y,t.ellipticalArc(n,o,h.x,h.y,270-l,270,!1)):t.lineTo(e-a,0)},Rt=Phaser.Math.RadToDeg,_t=function(t,e,i,s,r){var a=i*r,h=s.br;if(ft(h)){l=a>h.y?90:Rt(Math.acos((h.y-a)/h.y));var n=e-h.x,o=i-h.y;t.ellipticalArc(n,o,h.x,h.y,90-l,90,!1)}else t.lineTo(e,i);if(h=s.bl,ft(h)?(l=a>h.y?90:Rt(Math.acos((h.y-a)/h.y)),n=h.x,o=i-h.y,t.ellipticalArc(n,o,h.x,h.y,90,90+l,!1)):t.lineTo(0,i),h=s.tl,ft(h)&&a>i-h.y){var l=90-Rt(Math.acos((a-(i-h.y))/h.y));n=h.x,o=h.y,t.ellipticalArc(n,o,h.x,h.y,180,180+l,!1)}else t.lineTo(0,i-a);h=s.tr,ft(h)&&a>i-h.y?(l=90-Rt(Math.acos((a-(i-h.y))/h.y)),n=e-h.x,o=h.y,t.ellipticalArc(n,o,h.x,h.y,360-l,360,!1)):t.lineTo(e,i-a)};const Et=Phaser.Utils.Objects.GetValue;class Ct{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=Et(t,"x",0),i=Et(t,"y",0));var s=this.cornerRadius;s.tl=At(Et(t,"tl",void 0),e,i),s.tr=At(Et(t,"tr",void 0),e,i),s.bl=At(Et(t,"bl",void 0),e,i),s.br=At(Et(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){wt(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){wt(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){wt(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){wt(this.cornerRadius.br,t)}}var At=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Lt(t),t},wt=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Et(e,"x",0),t.y=Et(e,"y",0)),Lt(t)},Lt=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},Mt={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const Vt=Phaser.Utils.Objects.GetValue,Ot=Phaser.Utils.Objects.IsPlainObject;class Gt extends(function(t){class e extends t{bootProgressBase(t){this.eventEmitter=N(t,"eventEmitter",this);var e=N(t,"valuechangeCallback",null);if(null!==e){var i=N(t,"valuechangeCallbackScope",void 0);this.eventEmitter.on("valuechange",e,i)}return this.setEaseValuePropName("value").setEaseValueDuration(N(t,"easeValue.duration",0)).setEaseValueFunction(N(t,"easeValue.ease","Linear")),this}get value(){return this._value}set value(t){t=X(t,0,1);var e=this._value,i=e!=t;this.dirty=this.dirty||i,this._value=t,i&&this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter)}}return Object.assign(e.prototype,l,z),e}(h)){constructor(t,e,i,s,r,a,h,n,o){Ot(e)?(e=(o=e).x,i=o.y,s=o.width,r=o.height,a=o.radius,h=o.barColor,n=o.value):Ot(s)?(s=(o=s).width,r=o.height,a=o.radius,h=o.barColor,n=o.value):Ot(a)&&(a=(o=a).radius,h=o.barColor,n=o.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=s),void 0===a&&(a=0),void 0===n&&(n=0),super(t,e,i,s,r,o),this.type="rexRoundRectangleProgress",this.rrGeom=new Ct,this.bootProgressBase(o),this.addShape((new mt).setName("trackFill")).addShape((new mt).setName("bar")).addShape((new mt).setName("trackStroke")),this.setTrackColor(Vt(o,"trackColor",void 0)),this.setBarColor(h),this.setTrackStroke(Vt(o,"trackStrokeThickness",2),Vt(o,"trackStrokeColor",void 0)),this.setOrientation(Vt(o,"orientation",0)),this.setRTL(Vt(o,"rtl",!1)),this.setRadius(a),this.setIteration(Vt(a,"iteration",void 0)),this.setValue(n)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get orientation(){return this._orientation}set orientation(t){var e;"string"==typeof(e=t)&&(e=Mt[e]),t=e,this.dirty=this.dirty||this._orientation!=t,this._orientation=t}setOrientation(t){return this.orientation=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get radius(){return this.rrGeom.radius}set radius(t){this.rrGeom.setRadius(t),this.dirty=!0}get radiusTL(){return this.rrGeom.radiusTL}set radiusTL(t){this.rrGeom.radiusTL=t,this.dirty=!0}get radiusTR(){return this.rrGeom.radiusTR}set radiusTR(t){this.rrGeom.radiusTR=t,this.dirty=!0}get radiusBL(){return this.rrGeom.radiusBL}set radiusBL(t){this.rrGeom.radiusBL=t,this.dirty=!0}get radiusBR(){return this.rrGeom.radiusBR}set radiusBR(t){this.rrGeom.radiusBR=t,this.dirty=!0}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setRadiusTL(t){return void 0===t&&(t=0),this.radiusTL=t,this}setRadiusTR(t){return void 0===t&&(t=0),this.radiusTR=t,this}setRadiusBL(t){return void 0===t&&(t=0),this.radiusBL=t,this}setRadiusBR(t){return void 0===t&&(t=0),this.radiusBR=t,this}get cornerRadius(){return this.rrGeom.cornerRadius}set cornerRadius(t){this.radius=t}setCornerRadius(t){return this.setRadius(t)}get iteration(){return this._iteration}set iteration(t){void 0!==this._iteration?this._iteration!==t&&(this._iteration=t,this.dirty=!0):this._iteration=t}setIteration(t){return void 0===t&&(t=6),this.iteration=t,this}}var Ft={updateShapes:function(){var t=this.width,e=this.height,i=this.rrGeom.cornerRadius,s=this.value,r=this.orientation,a=this.rtl,h=this.iteration+1,n=this.getShape("trackFill");n.fillStyle(this.trackColor),n.isFilled&&kt(n,t,e,i,h);var o=this.getShape("bar");o.fillStyle(this.barColor),o.isFilled&&function(t,e,i,s,r,a,h,n){t.setIterations(n).start(),0===r||(1===r?kt(t,e,i,s,n):((0===a?h?St:bt:h?_t:Dt)(t,e,i,s,r),t.close()))}(o,t,e,i,s,r,a,h);var l=this.getShape("trackStroke");l.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),l.isStroked&&kt(l,t,e,i,h)}};return Object.assign(Gt.prototype,Ft),Gt},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rexroundrectangleprogress=e(); +var t,e;t=void 0,e=function(){const t=Phaser.GameObjects.GetCalcMatrix,e=Phaser.Renderer.Canvas.SetTransform;var i={renderWebGL:function(e,i,s,r){i.updateData(),s.addToRenderList(i);var a=e.pipelines.set(i.pipeline),h=t(i,s,r),n=a.calcMatrix.copyFrom(h.calc),o=i._displayOriginX,l=i._displayOriginY,u=s.alpha*i.alpha;e.pipelines.preBatch(i);for(var d,c=i.geom,p=0,v=c.length;p0?-this.delay:0,this.state=this.nowTime>=0?E:_,this.repeatCounter=0,this}stop(){return this.state=R,this}update(t,e){this.state!==R&&this.state!==A&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=C)):(this.nowTime=this.duration,this.state=A):this.nowTime>=0&&(this.state=E))}get t(){var t;switch(this.state){case R:case _:case C:t=0;break;case E:t=this.nowTime/this.duration;break;case A:t=1}return x(t,0,1)}set t(t){(t=x(t,-1,1))<0?(this.state=_,this.nowTime=-this.delay*t):(this.state=E,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===R}get isDelay(){return this.state===_}get isCountDown(){return this.state===E}get isRunning(){return this.state===_||this.state===E}get isDone(){return this.state===A}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const R=0,_=1,E=2,C=3,A=-1;class w extends T{constructor(t,e){super(t,e),this.timer=new S}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const L=Phaser.Utils.Objects.GetValue,M=Phaser.Utils.Objects.GetAdvancedValue,V=Phaser.Tweens.Builders.GetEaseFunction;class O extends w{resetFromJSON(t){return this.timer.resetFromJSON(L(t,"timer")),this.setEnable(L(t,"enable",!0)),this.setTarget(L(t,"target",this.parent)),this.setDelay(M(t,"delay",0)),this.setDuration(M(t,"duration",1e3)),this.setEase(L(t,"ease","Linear")),this.setRepeat(L(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=V(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const G=Phaser.Utils.Objects.GetValue,F=Phaser.Math.Linear;class B extends O{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=G(t,"key","value");var i=e[this.propertyKey];return this.fromValue=G(t,"from",i),this.toValue=G(t,"to",i),this.setEase(G(t,"ease",this.ease)),this.setDuration(G(t,"duration",this.duration)),this.setRepeat(G(t,"repeat",0)),this.setDelay(G(t,"delay",0)),this.setRepeatDelay(G(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=F(this.fromValue,this.toValue,i)}}const j=Phaser.Math.Percent;var z={setEaseValuePropName:function(t){return this.easeValuePropName=t,this},setEaseValueDuration:function(t){return this.easeValueDuration=t,this},setEaseValueFunction:function(t){return this.easeFunction=t,this},stopEaseValue:function(){return this.easeValueTask&&this.easeValueTask.stop(),this},easeValueTo:function(t,e,i){return null==t||(void 0!==e&&(t=j(t,e,i)),void 0===this.easeValueTask&&(this.easeValueTask=new B(this,{eventEmitter:null})),this.easeValueTask.restart({key:this.easeValuePropName,to:t,duration:this.easeValueDuration,ease:this.easeFunction})),this},easeValueRepeat:function(t,e,i,s){return void 0===i&&(i=-1),void 0===s&&(s=0),void 0===this.easeValueTask&&(this.easeValueTask=new B(this,{eventEmitter:null})),this.easeValueTask.restart({key:this.easeValuePropName,from:t,to:e,duration:this.easeValueDuration,ease:this.easeFunction,repeat:i,repeatDelay:s}),this}};const N=Phaser.Utils.Objects.GetValue,X=Phaser.Math.Clamp;var Y={fillStyle:function(t,e){return null==t?this.isFilled=!1:(void 0===e&&(e=1),this.isFilled=!0,this.fillColor=t,this.fillAlpha=e),this},lineStyle:function(t,e,i){return null==t||null==e?this.isStroked=!1:(void 0===i&&(i=1),this.isStroked=!0,this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i),this}},W={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:function(t,e,i){if(!t||"number"==typeof t)return i;if("string"==typeof e){if(t.hasOwnProperty(e))return t[e];if(-1===e.indexOf("."))return i;e=e.split(".")}for(var s=e,r=t,a=i,h=0;h>>16,n=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+h+","+n+","+o+","+a+")"}(t,this),t.fill()),this.isStroked&&(function(t,e,i,s){var r=i||e.strokeColor,a=s||e.strokeAlpha,h=(16711680&r)>>>16,n=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+h+","+n+","+o+","+a+")",t.lineWidth=e.lineWidth}(t,this),t.stroke())}}var H=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],a=i[s-1];if(t===r&&e===a)return i}return i.push(t,e),i};const Q=Phaser.Math.DegToRad;Phaser.Math.DegToRad;const Z=Phaser.Math.Interpolation.QuadraticBezier,$=Phaser.Math.Interpolation.CubicBezier,tt=Phaser.Math.Interpolation.CatmullRom;var et=function(t){var e=t.length;if(e<2)return t;var i=t[e-2],s=t[e-1];return t.push(i),t.push(s),t},it={clear(){return this.start(),this},start(){return this.startAt(),this},startAt(t,e){return this.restorePathData(),this.accumulationLengths=void 0,function(t,e,i){i.length=0,null!=t&&i.push(t,e)}(t,e,this.pathData),this.firstPointX=t,this.firstPointY=e,this.lastPointX=t,this.lastPointY=e,this},lineTo(t,e,i){return void 0===i&&(i=!1),i&&(t+=this.lastPointX,e+=this.lastPointY),H(t,e,this.pathData),this.lastPointX=t,this.lastPointY=e,this},verticalLineTo(t,e){return this.lineTo(t,this.lastPointY,e),this},horizontalLineTo(t,e){return this.lineTo(this.lastPointX,t,e),this},ellipticalArc(t,e,i,s,r,a,h){return void 0===h&&(h=!1),function(t,e,i,s,r,a,h,n,o){h&&a>r?a-=360:!h&&a0,h=0,n=e.length;h0&&t.y>0},kt=function(t,e,i,s,r){t.setIterations(r).start();var a=s.tl;if(Pt(a))if(a.convex){var h=a.x,n=a.y;t.ellipticalArc(h,n,a.x,a.y,180,270,!1)}else h=0,n=0,t.ellipticalArc(h,n,a.x,a.y,90,0,!0);else t.lineTo(0,0);return a=s.tr,Pt(a)?a.convex?(h=e-a.x,n=a.y,t.ellipticalArc(h,n,a.x,a.y,270,360,!1)):(h=e,n=0,t.ellipticalArc(h,n,a.x,a.y,180,90,!0)):t.lineTo(e,0),a=s.br,Pt(a)?a.convex?(h=e-a.x,n=i-a.y,t.ellipticalArc(h,n,a.x,a.y,0,90,!1)):(h=e,n=i,t.ellipticalArc(h,n,a.x,a.y,270,180,!0)):t.lineTo(e,i),a=s.bl,Pt(a)?a.convex?(h=a.x,n=i-a.y,t.ellipticalArc(h,n,a.x,a.y,90,180,!1)):(h=0,n=i,t.ellipticalArc(h,n,a.x,a.y,360,270,!0)):t.lineTo(0,i),t.close(),t},Tt=Phaser.Math.RadToDeg,bt=function(t,e,i,s,r){var a=e*r,h=s.tl;if(Pt(h)){l=a>h.x?90:Tt(Math.acos((h.x-a)/h.x));var n=h.x,o=h.y;t.ellipticalArc(n,o,h.x,h.y,180,180+l,!1)}else t.lineTo(0,0);if(h=s.tr,Pt(h)&&a>e-h.x){var l=90-Tt(Math.acos((a-(e-h.x))/h.x));n=e-h.x,o=h.y,t.ellipticalArc(n,o,h.x,h.y,270,270+l,!1)}else t.lineTo(a,0);h=s.br,Pt(h)&&a>e-h.x?(l=90-Tt(Math.acos((a-(e-h.x))/h.x)),n=e-h.x,o=i-h.y,t.ellipticalArc(n,o,h.x,h.y,90-l,90,!1)):t.lineTo(a,i),h=s.bl,Pt(h)?(l=a>h.x?90:Tt(Math.acos((h.x-a)/h.x)),n=h.x,o=i-h.y,t.ellipticalArc(n,o,h.x,h.y,180-l,180,!1)):t.lineTo(0,i)},Dt=Phaser.Math.RadToDeg,xt=function(t,e,i,s,r){var a=i*r,h=s.tl;if(Pt(h)){l=a>h.y?90:Dt(Math.acos((h.y-a)/h.y));var n=h.x,o=h.y;t.ellipticalArc(n,o,h.x,h.y,270-l,270,!1)}else t.lineTo(0,0);if(h=s.tr,Pt(h)?(l=a>h.y?90:Dt(Math.acos((h.y-a)/h.y)),n=e-h.x,o=h.y,t.ellipticalArc(n,o,h.x,h.y,270,270+l,!1)):t.lineTo(e,0),h=s.br,Pt(h)&&a>i-h.y){var l=90-Dt(Math.acos((a-(i-h.y))/h.y));n=e-h.x,o=i-h.y,t.ellipticalArc(n,o,h.x,h.y,0,0+l,!1)}else t.lineTo(e,a);h=s.bl,Pt(h)&&a>i-h.y?(l=90-Dt(Math.acos((a-(i-h.y))/h.y)),n=h.x,o=i-h.y,t.ellipticalArc(n,o,h.x,h.y,180-l,180,!1)):t.lineTo(0,a)},St=Phaser.Math.RadToDeg,Rt=function(t,e,i,s,r){var a=e*r,h=s.tr;if(Pt(h)){l=a>h.x?90:St(Math.acos((h.x-a)/h.x));var n=e-h.x,o=h.y;t.ellipticalArc(n,o,h.x,h.y,360-l,360,!1)}else t.lineTo(e,0);if(h=s.br,Pt(h)?(l=a>h.x?90:St(Math.acos((h.x-a)/h.x)),n=e-h.x,o=i-h.y,t.ellipticalArc(n,o,h.x,h.y,0,0+l,!1)):t.lineTo(e,i),h=s.bl,Pt(h)&&a>e-h.x){var l=90-St(Math.acos((a-(e-h.x))/h.x));n=h.x,o=i-h.y,t.ellipticalArc(n,o,h.x,h.y,90,90+l,!1)}else t.lineTo(e-a,i);h=s.tl,Pt(h)&&a>e-h.x?(l=90-St(Math.acos((a-(e-h.x))/h.x)),n=h.x,o=h.y,t.ellipticalArc(n,o,h.x,h.y,270-l,270,!1)):t.lineTo(e-a,0)},_t=Phaser.Math.RadToDeg,Et=function(t,e,i,s,r){var a=i*r,h=s.br;if(Pt(h)){l=a>h.y?90:_t(Math.acos((h.y-a)/h.y));var n=e-h.x,o=i-h.y;t.ellipticalArc(n,o,h.x,h.y,90-l,90,!1)}else t.lineTo(e,i);if(h=s.bl,Pt(h)?(l=a>h.y?90:_t(Math.acos((h.y-a)/h.y)),n=h.x,o=i-h.y,t.ellipticalArc(n,o,h.x,h.y,90,90+l,!1)):t.lineTo(0,i),h=s.tl,Pt(h)&&a>i-h.y){var l=90-_t(Math.acos((a-(i-h.y))/h.y));n=h.x,o=h.y,t.ellipticalArc(n,o,h.x,h.y,180,180+l,!1)}else t.lineTo(0,i-a);h=s.tr,Pt(h)&&a>i-h.y?(l=90-_t(Math.acos((a-(i-h.y))/h.y)),n=e-h.x,o=h.y,t.ellipticalArc(n,o,h.x,h.y,360-l,360,!1)):t.lineTo(e,i-a)};const Ct=Phaser.Utils.Objects.GetValue;class At{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=Ct(t,"x",0),i=Ct(t,"y",0));var s=this.cornerRadius;s.tl=wt(Ct(t,"tl",void 0),e,i),s.tr=wt(Ct(t,"tr",void 0),e,i),s.bl=wt(Ct(t,"bl",void 0),e,i),s.br=wt(Ct(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Lt(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Lt(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Lt(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Lt(this.cornerRadius.br,t)}}var wt=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Mt(t),t},Lt=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Ct(e,"x",0),t.y=Ct(e,"y",0)),Mt(t)},Mt=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},Vt={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const Ot=Phaser.Utils.Objects.GetValue,Gt=Phaser.Utils.Objects.IsPlainObject;class Ft extends(function(t){class e extends t{bootProgressBase(t){this.eventEmitter=N(t,"eventEmitter",this);var e=N(t,"valuechangeCallback",null);if(null!==e){var i=N(t,"valuechangeCallbackScope",void 0);this.eventEmitter.on("valuechange",e,i)}return this.setEaseValuePropName("value").setEaseValueDuration(N(t,"easeValue.duration",0)).setEaseValueFunction(N(t,"easeValue.ease","Linear")),this}get value(){return this._value}set value(t){t=X(t,0,1);var e=this._value,i=e!=t;this.dirty=this.dirty||i,this._value=t,i&&this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter)}}return Object.assign(e.prototype,l,z),e}(h)){constructor(t,e,i,s,r,a,h,n,o){Gt(e)?(e=(o=e).x,i=o.y,s=o.width,r=o.height,a=o.radius,h=o.barColor,n=o.value):Gt(s)?(s=(o=s).width,r=o.height,a=o.radius,h=o.barColor,n=o.value):Gt(a)&&(a=(o=a).radius,h=o.barColor,n=o.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=s),void 0===a&&(a=0),void 0===n&&(n=0),super(t,e,i,s,r,o),this.type="rexRoundRectangleProgress",this.rrGeom=new At,this.bootProgressBase(o),this.addShape((new ft).setName("trackFill")).addShape((new ft).setName("bar")).addShape((new ft).setName("trackStroke")),this.setTrackColor(Ot(o,"trackColor",void 0)),this.setBarColor(h),this.setTrackStroke(Ot(o,"trackStrokeThickness",2),Ot(o,"trackStrokeColor",void 0)),this.setOrientation(Ot(o,"orientation",0)),this.setRTL(Ot(o,"rtl",!1)),this.setRadius(a),this.setIteration(Ot(a,"iteration",void 0)),this.setValue(n)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get orientation(){return this._orientation}set orientation(t){var e;"string"==typeof(e=t)&&(e=Vt[e]),t=e,this.dirty=this.dirty||this._orientation!=t,this._orientation=t}setOrientation(t){return this.orientation=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get radius(){return this.rrGeom.radius}set radius(t){this.rrGeom.setRadius(t),this.dirty=!0}get radiusTL(){return this.rrGeom.radiusTL}set radiusTL(t){this.rrGeom.radiusTL=t,this.dirty=!0}get radiusTR(){return this.rrGeom.radiusTR}set radiusTR(t){this.rrGeom.radiusTR=t,this.dirty=!0}get radiusBL(){return this.rrGeom.radiusBL}set radiusBL(t){this.rrGeom.radiusBL=t,this.dirty=!0}get radiusBR(){return this.rrGeom.radiusBR}set radiusBR(t){this.rrGeom.radiusBR=t,this.dirty=!0}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setRadiusTL(t){return void 0===t&&(t=0),this.radiusTL=t,this}setRadiusTR(t){return void 0===t&&(t=0),this.radiusTR=t,this}setRadiusBL(t){return void 0===t&&(t=0),this.radiusBL=t,this}setRadiusBR(t){return void 0===t&&(t=0),this.radiusBR=t,this}get cornerRadius(){return this.rrGeom.cornerRadius}set cornerRadius(t){this.radius=t}setCornerRadius(t){return this.setRadius(t)}get iteration(){return this._iteration}set iteration(t){void 0!==this._iteration?this._iteration!==t&&(this._iteration=t,this.dirty=!0):this._iteration=t}setIteration(t){return void 0===t&&(t=6),this.iteration=t,this}}var Bt={updateShapes:function(){var t=this.width,e=this.height,i=this.rrGeom.cornerRadius,s=this.value,r=this.orientation,a=this.rtl,h=this.iteration+1,n=this.getShape("trackFill");n.fillStyle(this.trackColor),n.isFilled&&kt(n,t,e,i,h);var o=this.getShape("bar");o.fillStyle(this.barColor),o.isFilled&&function(t,e,i,s,r,a,h,n){t.setIterations(n).start(),0===r||(1===r?kt(t,e,i,s,n):((0===a?h?Rt:bt:h?Et:xt)(t,e,i,s,r),t.close()))}(o,t,e,i,s,r,a,h);var l=this.getShape("trackStroke");l.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),l.isStroked&&kt(l,t,e,i,h)}};return Object.assign(Ft.prototype,Bt),Ft},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rexroundrectangleprogress=e(); diff --git a/dist/rexroundrectangleprogressplugin.js b/dist/rexroundrectangleprogressplugin.js index 6ffac2e083..3dec8129bf 100644 --- a/dist/rexroundrectangleprogressplugin.js +++ b/dist/rexroundrectangleprogressplugin.js @@ -1695,6 +1695,32 @@ return pathData; }; + //import CatmullRomInterpolation from '../../utils/math/interpolation/CatmullRomInterpolation.js'; + + const CatmullRomInterpolation = Phaser.Math.Interpolation.CatmullRom; + + var CatmullRomTo = function (points, iterations, pathData) { + var pathDataCnt = pathData.length; + var p0x = pathData[pathDataCnt - 2]; + var p0y = pathData[pathDataCnt - 1]; + + var xList = [p0x]; + var yList = [p0y]; + for (var i = 0, cnt = points.length; i < cnt; i += 2) { + xList.push(points[i]); + yList.push(points[i + 1]); + } + + for (var i = 1, last = iterations - 1; i <= last; i++) { + var t = i / last; + pathData.push( + CatmullRomInterpolation(xList, t), + CatmullRomInterpolation(yList, t) + ); + } + return pathData; + }; + var DuplicateLast = function (pathData) { var len = pathData.length; if (len < 2) { @@ -1806,6 +1832,18 @@ return this; }, + catmullRomTo(...points) { + CatmullRomTo( + points, + this.iterations, + this.pathData + ); + + this.lastPointX = points[points.length-2]; + this.lastPointY = points[points.length-1]; + return this; + }, + close() { // Line to first point var startX = this.pathData[0], @@ -2243,6 +2281,13 @@ return this; } + catmullRomTo(...points) { + this.builder.catmullRomTo(...points); + + this.dirty = true; + return this; + } + close() { this.builder.close(); diff --git a/dist/rexroundrectangleprogressplugin.min.js b/dist/rexroundrectangleprogressplugin.min.js index f7d53b5347..4b9fdf87c0 100644 --- a/dist/rexroundrectangleprogressplugin.min.js +++ b/dist/rexroundrectangleprogressplugin.min.js @@ -1 +1 @@ -var t,e;t=void 0,e=function(){const t=Phaser.GameObjects.GetCalcMatrix,e=Phaser.Renderer.Canvas.SetTransform;var i={renderWebGL:function(e,i,s,r){i.updateData(),s.addToRenderList(i);var a=e.pipelines.set(i.pipeline),h=t(i,s,r),n=a.calcMatrix.copyFrom(h.calc),o=i._displayOriginX,l=i._displayOriginY,u=s.alpha*i.alpha;e.pipelines.preBatch(i);for(var d,c=i.geom,p=0,v=c.length;p0?-this.delay:0,this.state=this.nowTime>=0?E:_,this.repeatCounter=0,this}stop(){return this.state=R,this}update(t,e){this.state!==R&&this.state!==A&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=C)):(this.nowTime=this.duration,this.state=A):this.nowTime>=0&&(this.state=E))}get t(){var t;switch(this.state){case R:case _:case C:t=0;break;case E:t=this.nowTime/this.duration;break;case A:t=1}return x(t,0,1)}set t(t){(t=x(t,-1,1))<0?(this.state=_,this.nowTime=-this.delay*t):(this.state=E,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===R}get isDelay(){return this.state===_}get isCountDown(){return this.state===E}get isRunning(){return this.state===_||this.state===E}get isDone(){return this.state===A}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const R=0,_=1,E=2,C=3,A=-1;class w extends k{constructor(t,e){super(t,e),this.timer=new S}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const L=Phaser.Utils.Objects.GetValue,M=Phaser.Utils.Objects.GetAdvancedValue,V=Phaser.Tweens.Builders.GetEaseFunction;class O extends w{resetFromJSON(t){return this.timer.resetFromJSON(L(t,"timer")),this.setEnable(L(t,"enable",!0)),this.setTarget(L(t,"target",this.parent)),this.setDelay(M(t,"delay",0)),this.setDuration(M(t,"duration",1e3)),this.setEase(L(t,"ease","Linear")),this.setRepeat(L(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=V(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const G=Phaser.Utils.Objects.GetValue,j=Phaser.Math.Linear;class B extends O{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=G(t,"key","value");var i=e[this.propertyKey];return this.fromValue=G(t,"from",i),this.toValue=G(t,"to",i),this.setEase(G(t,"ease",this.ease)),this.setDuration(G(t,"duration",this.duration)),this.setRepeat(G(t,"repeat",0)),this.setDelay(G(t,"delay",0)),this.setRepeatDelay(G(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=j(this.fromValue,this.toValue,i)}}const F=Phaser.Math.Percent;var z={setEaseValuePropName:function(t){return this.easeValuePropName=t,this},setEaseValueDuration:function(t){return this.easeValueDuration=t,this},setEaseValueFunction:function(t){return this.easeFunction=t,this},stopEaseValue:function(){return this.easeValueTask&&this.easeValueTask.stop(),this},easeValueTo:function(t,e,i){return null==t||(void 0!==e&&(t=F(t,e,i)),void 0===this.easeValueTask&&(this.easeValueTask=new B(this,{eventEmitter:null})),this.easeValueTask.restart({key:this.easeValuePropName,to:t,duration:this.easeValueDuration,ease:this.easeFunction})),this},easeValueRepeat:function(t,e,i,s){return void 0===i&&(i=-1),void 0===s&&(s=0),void 0===this.easeValueTask&&(this.easeValueTask=new B(this,{eventEmitter:null})),this.easeValueTask.restart({key:this.easeValuePropName,from:t,to:e,duration:this.easeValueDuration,ease:this.easeFunction,repeat:i,repeatDelay:s}),this}};const N=Phaser.Utils.Objects.GetValue,X=Phaser.Math.Clamp;var Y={fillStyle:function(t,e){return null==t?this.isFilled=!1:(void 0===e&&(e=1),this.isFilled=!0,this.fillColor=t,this.fillAlpha=e),this},lineStyle:function(t,e,i){return null==t||null==e?this.isStroked=!1:(void 0===i&&(i=1),this.isStroked=!0,this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i),this}},W={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:function(t,e,i){if(!t||"number"==typeof t)return i;if("string"==typeof e){if(t.hasOwnProperty(e))return t[e];if(-1===e.indexOf("."))return i;e=e.split(".")}for(var s=e,r=t,a=i,h=0;h>>16,n=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+h+","+n+","+o+","+a+")"}(t,this),t.fill()),this.isStroked&&(function(t,e,i,s){var r=i||e.strokeColor,a=s||e.strokeAlpha,h=(16711680&r)>>>16,n=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+h+","+n+","+o+","+a+")",t.lineWidth=e.lineWidth}(t,this),t.stroke())}}var H=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],a=i[s-1];if(t===r&&e===a)return i}return i.push(t,e),i};const Q=Phaser.Math.DegToRad;Phaser.Math.DegToRad;const Z=Phaser.Math.Interpolation.QuadraticBezier,$=Phaser.Math.Interpolation.CubicBezier;var tt=function(t){var e=t.length;if(e<2)return t;var i=t[e-2],s=t[e-1];return t.push(i),t.push(s),t},et={clear(){return this.start(),this},start(){return this.startAt(),this},startAt(t,e){return this.restorePathData(),this.accumulationLengths=void 0,function(t,e,i){i.length=0,null!=t&&i.push(t,e)}(t,e,this.pathData),this.firstPointX=t,this.firstPointY=e,this.lastPointX=t,this.lastPointY=e,this},lineTo(t,e,i){return void 0===i&&(i=!1),i&&(t+=this.lastPointX,e+=this.lastPointY),H(t,e,this.pathData),this.lastPointX=t,this.lastPointY=e,this},verticalLineTo(t,e){return this.lineTo(t,this.lastPointY,e),this},horizontalLineTo(t,e){return this.lineTo(this.lastPointX,t,e),this},ellipticalArc(t,e,i,s,r,a,h){return void 0===h&&(h=!1),function(t,e,i,s,r,a,h,n,o){h&&a>r?a-=360:!h&&a0,h=0,n=e.length;h0&&t.y>0},Pt=function(t,e,i,s,r){t.setIterations(r).start();var a=s.tl;if(ft(a))if(a.convex){var h=a.x,n=a.y;t.ellipticalArc(h,n,a.x,a.y,180,270,!1)}else h=0,n=0,t.ellipticalArc(h,n,a.x,a.y,90,0,!0);else t.lineTo(0,0);return a=s.tr,ft(a)?a.convex?(h=e-a.x,n=a.y,t.ellipticalArc(h,n,a.x,a.y,270,360,!1)):(h=e,n=0,t.ellipticalArc(h,n,a.x,a.y,180,90,!0)):t.lineTo(e,0),a=s.br,ft(a)?a.convex?(h=e-a.x,n=i-a.y,t.ellipticalArc(h,n,a.x,a.y,0,90,!1)):(h=e,n=i,t.ellipticalArc(h,n,a.x,a.y,270,180,!0)):t.lineTo(e,i),a=s.bl,ft(a)?a.convex?(h=a.x,n=i-a.y,t.ellipticalArc(h,n,a.x,a.y,90,180,!1)):(h=0,n=i,t.ellipticalArc(h,n,a.x,a.y,360,270,!0)):t.lineTo(0,i),t.close(),t},bt=Phaser.Math.RadToDeg,kt=function(t,e,i,s,r){var a=e*r,h=s.tl;if(ft(h)){l=a>h.x?90:bt(Math.acos((h.x-a)/h.x));var n=h.x,o=h.y;t.ellipticalArc(n,o,h.x,h.y,180,180+l,!1)}else t.lineTo(0,0);if(h=s.tr,ft(h)&&a>e-h.x){var l=90-bt(Math.acos((a-(e-h.x))/h.x));n=e-h.x,o=h.y,t.ellipticalArc(n,o,h.x,h.y,270,270+l,!1)}else t.lineTo(a,0);h=s.br,ft(h)&&a>e-h.x?(l=90-bt(Math.acos((a-(e-h.x))/h.x)),n=e-h.x,o=i-h.y,t.ellipticalArc(n,o,h.x,h.y,90-l,90,!1)):t.lineTo(a,i),h=s.bl,ft(h)?(l=a>h.x?90:bt(Math.acos((h.x-a)/h.x)),n=h.x,o=i-h.y,t.ellipticalArc(n,o,h.x,h.y,180-l,180,!1)):t.lineTo(0,i)},Tt=Phaser.Math.RadToDeg,Dt=function(t,e,i,s,r){var a=i*r,h=s.tl;if(ft(h)){l=a>h.y?90:Tt(Math.acos((h.y-a)/h.y));var n=h.x,o=h.y;t.ellipticalArc(n,o,h.x,h.y,270-l,270,!1)}else t.lineTo(0,0);if(h=s.tr,ft(h)?(l=a>h.y?90:Tt(Math.acos((h.y-a)/h.y)),n=e-h.x,o=h.y,t.ellipticalArc(n,o,h.x,h.y,270,270+l,!1)):t.lineTo(e,0),h=s.br,ft(h)&&a>i-h.y){var l=90-Tt(Math.acos((a-(i-h.y))/h.y));n=e-h.x,o=i-h.y,t.ellipticalArc(n,o,h.x,h.y,0,0+l,!1)}else t.lineTo(e,a);h=s.bl,ft(h)&&a>i-h.y?(l=90-Tt(Math.acos((a-(i-h.y))/h.y)),n=h.x,o=i-h.y,t.ellipticalArc(n,o,h.x,h.y,180-l,180,!1)):t.lineTo(0,a)},xt=Phaser.Math.RadToDeg,St=function(t,e,i,s,r){var a=e*r,h=s.tr;if(ft(h)){l=a>h.x?90:xt(Math.acos((h.x-a)/h.x));var n=e-h.x,o=h.y;t.ellipticalArc(n,o,h.x,h.y,360-l,360,!1)}else t.lineTo(e,0);if(h=s.br,ft(h)?(l=a>h.x?90:xt(Math.acos((h.x-a)/h.x)),n=e-h.x,o=i-h.y,t.ellipticalArc(n,o,h.x,h.y,0,0+l,!1)):t.lineTo(e,i),h=s.bl,ft(h)&&a>e-h.x){var l=90-xt(Math.acos((a-(e-h.x))/h.x));n=h.x,o=i-h.y,t.ellipticalArc(n,o,h.x,h.y,90,90+l,!1)}else t.lineTo(e-a,i);h=s.tl,ft(h)&&a>e-h.x?(l=90-xt(Math.acos((a-(e-h.x))/h.x)),n=h.x,o=h.y,t.ellipticalArc(n,o,h.x,h.y,270-l,270,!1)):t.lineTo(e-a,0)},Rt=Phaser.Math.RadToDeg,_t=function(t,e,i,s,r){var a=i*r,h=s.br;if(ft(h)){l=a>h.y?90:Rt(Math.acos((h.y-a)/h.y));var n=e-h.x,o=i-h.y;t.ellipticalArc(n,o,h.x,h.y,90-l,90,!1)}else t.lineTo(e,i);if(h=s.bl,ft(h)?(l=a>h.y?90:Rt(Math.acos((h.y-a)/h.y)),n=h.x,o=i-h.y,t.ellipticalArc(n,o,h.x,h.y,90,90+l,!1)):t.lineTo(0,i),h=s.tl,ft(h)&&a>i-h.y){var l=90-Rt(Math.acos((a-(i-h.y))/h.y));n=h.x,o=h.y,t.ellipticalArc(n,o,h.x,h.y,180,180+l,!1)}else t.lineTo(0,i-a);h=s.tr,ft(h)&&a>i-h.y?(l=90-Rt(Math.acos((a-(i-h.y))/h.y)),n=e-h.x,o=h.y,t.ellipticalArc(n,o,h.x,h.y,360-l,360,!1)):t.lineTo(e,i-a)};const Et=Phaser.Utils.Objects.GetValue;class Ct{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=Et(t,"x",0),i=Et(t,"y",0));var s=this.cornerRadius;s.tl=At(Et(t,"tl",void 0),e,i),s.tr=At(Et(t,"tr",void 0),e,i),s.bl=At(Et(t,"bl",void 0),e,i),s.br=At(Et(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){wt(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){wt(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){wt(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){wt(this.cornerRadius.br,t)}}var At=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Lt(t),t},wt=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Et(e,"x",0),t.y=Et(e,"y",0)),Lt(t)},Lt=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},Mt={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const Vt=Phaser.Utils.Objects.GetValue,Ot=Phaser.Utils.Objects.IsPlainObject;class Gt extends(function(t){class e extends t{bootProgressBase(t){this.eventEmitter=N(t,"eventEmitter",this);var e=N(t,"valuechangeCallback",null);if(null!==e){var i=N(t,"valuechangeCallbackScope",void 0);this.eventEmitter.on("valuechange",e,i)}return this.setEaseValuePropName("value").setEaseValueDuration(N(t,"easeValue.duration",0)).setEaseValueFunction(N(t,"easeValue.ease","Linear")),this}get value(){return this._value}set value(t){t=X(t,0,1);var e=this._value,i=e!=t;this.dirty=this.dirty||i,this._value=t,i&&this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter)}}return Object.assign(e.prototype,l,z),e}(h)){constructor(t,e,i,s,r,a,h,n,o){Ot(e)?(e=(o=e).x,i=o.y,s=o.width,r=o.height,a=o.radius,h=o.barColor,n=o.value):Ot(s)?(s=(o=s).width,r=o.height,a=o.radius,h=o.barColor,n=o.value):Ot(a)&&(a=(o=a).radius,h=o.barColor,n=o.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=s),void 0===a&&(a=0),void 0===n&&(n=0),super(t,e,i,s,r,o),this.type="rexRoundRectangleProgress",this.rrGeom=new Ct,this.bootProgressBase(o),this.addShape((new mt).setName("trackFill")).addShape((new mt).setName("bar")).addShape((new mt).setName("trackStroke")),this.setTrackColor(Vt(o,"trackColor",void 0)),this.setBarColor(h),this.setTrackStroke(Vt(o,"trackStrokeThickness",2),Vt(o,"trackStrokeColor",void 0)),this.setOrientation(Vt(o,"orientation",0)),this.setRTL(Vt(o,"rtl",!1)),this.setRadius(a),this.setIteration(Vt(a,"iteration",void 0)),this.setValue(n)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get orientation(){return this._orientation}set orientation(t){var e;"string"==typeof(e=t)&&(e=Mt[e]),t=e,this.dirty=this.dirty||this._orientation!=t,this._orientation=t}setOrientation(t){return this.orientation=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get radius(){return this.rrGeom.radius}set radius(t){this.rrGeom.setRadius(t),this.dirty=!0}get radiusTL(){return this.rrGeom.radiusTL}set radiusTL(t){this.rrGeom.radiusTL=t,this.dirty=!0}get radiusTR(){return this.rrGeom.radiusTR}set radiusTR(t){this.rrGeom.radiusTR=t,this.dirty=!0}get radiusBL(){return this.rrGeom.radiusBL}set radiusBL(t){this.rrGeom.radiusBL=t,this.dirty=!0}get radiusBR(){return this.rrGeom.radiusBR}set radiusBR(t){this.rrGeom.radiusBR=t,this.dirty=!0}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setRadiusTL(t){return void 0===t&&(t=0),this.radiusTL=t,this}setRadiusTR(t){return void 0===t&&(t=0),this.radiusTR=t,this}setRadiusBL(t){return void 0===t&&(t=0),this.radiusBL=t,this}setRadiusBR(t){return void 0===t&&(t=0),this.radiusBR=t,this}get cornerRadius(){return this.rrGeom.cornerRadius}set cornerRadius(t){this.radius=t}setCornerRadius(t){return this.setRadius(t)}get iteration(){return this._iteration}set iteration(t){void 0!==this._iteration?this._iteration!==t&&(this._iteration=t,this.dirty=!0):this._iteration=t}setIteration(t){return void 0===t&&(t=6),this.iteration=t,this}}var jt={updateShapes:function(){var t=this.width,e=this.height,i=this.rrGeom.cornerRadius,s=this.value,r=this.orientation,a=this.rtl,h=this.iteration+1,n=this.getShape("trackFill");n.fillStyle(this.trackColor),n.isFilled&&Pt(n,t,e,i,h);var o=this.getShape("bar");o.fillStyle(this.barColor),o.isFilled&&function(t,e,i,s,r,a,h,n){t.setIterations(n).start(),0===r||(1===r?Pt(t,e,i,s,n):((0===a?h?St:kt:h?_t:Dt)(t,e,i,s,r),t.close()))}(o,t,e,i,s,r,a,h);var l=this.getShape("trackStroke");l.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),l.isStroked&&Pt(l,t,e,i,h)}};function Bt(t,e,i,s,r,a,h){var n=new Gt(this.scene,t,e,i,s,r,a,h);return this.scene.add.existing(n),n}Object.assign(Gt.prototype,jt);const Ft=Phaser.GameObjects.BuildGameObject;function zt(t,e){void 0===t&&(t={}),void 0!==e&&(t.add=e);var i=new Gt(this.scene,t);return Ft(this.scene,i,t),i}var Nt=function(t){return null==t||""===t||0===t.length};class Xt extends Phaser.Plugins.BasePlugin{constructor(t){super(t),t.registerGameObject("rexRoundRectangleProgress",Bt,zt)}start(){this.game.events.on("destroy",this.destroy,this)}}return function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t)if(Nt(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),a=function(t,e,i){var s=t;if(Nt(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var a=0,h=e.length;a0?-this.delay:0,this.state=this.nowTime>=0?E:_,this.repeatCounter=0,this}stop(){return this.state=R,this}update(t,e){this.state!==R&&this.state!==A&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=C)):(this.nowTime=this.duration,this.state=A):this.nowTime>=0&&(this.state=E))}get t(){var t;switch(this.state){case R:case _:case C:t=0;break;case E:t=this.nowTime/this.duration;break;case A:t=1}return x(t,0,1)}set t(t){(t=x(t,-1,1))<0?(this.state=_,this.nowTime=-this.delay*t):(this.state=E,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===R}get isDelay(){return this.state===_}get isCountDown(){return this.state===E}get isRunning(){return this.state===_||this.state===E}get isDone(){return this.state===A}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const R=0,_=1,E=2,C=3,A=-1;class w extends k{constructor(t,e){super(t,e),this.timer=new S}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const L=Phaser.Utils.Objects.GetValue,M=Phaser.Utils.Objects.GetAdvancedValue,V=Phaser.Tweens.Builders.GetEaseFunction;class O extends w{resetFromJSON(t){return this.timer.resetFromJSON(L(t,"timer")),this.setEnable(L(t,"enable",!0)),this.setTarget(L(t,"target",this.parent)),this.setDelay(M(t,"delay",0)),this.setDuration(M(t,"duration",1e3)),this.setEase(L(t,"ease","Linear")),this.setRepeat(L(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=V(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const G=Phaser.Utils.Objects.GetValue,j=Phaser.Math.Linear;class B extends O{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=G(t,"key","value");var i=e[this.propertyKey];return this.fromValue=G(t,"from",i),this.toValue=G(t,"to",i),this.setEase(G(t,"ease",this.ease)),this.setDuration(G(t,"duration",this.duration)),this.setRepeat(G(t,"repeat",0)),this.setDelay(G(t,"delay",0)),this.setRepeatDelay(G(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=j(this.fromValue,this.toValue,i)}}const F=Phaser.Math.Percent;var z={setEaseValuePropName:function(t){return this.easeValuePropName=t,this},setEaseValueDuration:function(t){return this.easeValueDuration=t,this},setEaseValueFunction:function(t){return this.easeFunction=t,this},stopEaseValue:function(){return this.easeValueTask&&this.easeValueTask.stop(),this},easeValueTo:function(t,e,i){return null==t||(void 0!==e&&(t=F(t,e,i)),void 0===this.easeValueTask&&(this.easeValueTask=new B(this,{eventEmitter:null})),this.easeValueTask.restart({key:this.easeValuePropName,to:t,duration:this.easeValueDuration,ease:this.easeFunction})),this},easeValueRepeat:function(t,e,i,s){return void 0===i&&(i=-1),void 0===s&&(s=0),void 0===this.easeValueTask&&(this.easeValueTask=new B(this,{eventEmitter:null})),this.easeValueTask.restart({key:this.easeValuePropName,from:t,to:e,duration:this.easeValueDuration,ease:this.easeFunction,repeat:i,repeatDelay:s}),this}};const N=Phaser.Utils.Objects.GetValue,X=Phaser.Math.Clamp;var Y={fillStyle:function(t,e){return null==t?this.isFilled=!1:(void 0===e&&(e=1),this.isFilled=!0,this.fillColor=t,this.fillAlpha=e),this},lineStyle:function(t,e,i){return null==t||null==e?this.isStroked=!1:(void 0===i&&(i=1),this.isStroked=!0,this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i),this}},W={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:function(t,e,i){if(!t||"number"==typeof t)return i;if("string"==typeof e){if(t.hasOwnProperty(e))return t[e];if(-1===e.indexOf("."))return i;e=e.split(".")}for(var s=e,r=t,a=i,h=0;h>>16,n=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+h+","+n+","+o+","+a+")"}(t,this),t.fill()),this.isStroked&&(function(t,e,i,s){var r=i||e.strokeColor,a=s||e.strokeAlpha,h=(16711680&r)>>>16,n=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+h+","+n+","+o+","+a+")",t.lineWidth=e.lineWidth}(t,this),t.stroke())}}var H=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],a=i[s-1];if(t===r&&e===a)return i}return i.push(t,e),i};const Q=Phaser.Math.DegToRad;Phaser.Math.DegToRad;const Z=Phaser.Math.Interpolation.QuadraticBezier,$=Phaser.Math.Interpolation.CubicBezier,tt=Phaser.Math.Interpolation.CatmullRom;var et=function(t){var e=t.length;if(e<2)return t;var i=t[e-2],s=t[e-1];return t.push(i),t.push(s),t},it={clear(){return this.start(),this},start(){return this.startAt(),this},startAt(t,e){return this.restorePathData(),this.accumulationLengths=void 0,function(t,e,i){i.length=0,null!=t&&i.push(t,e)}(t,e,this.pathData),this.firstPointX=t,this.firstPointY=e,this.lastPointX=t,this.lastPointY=e,this},lineTo(t,e,i){return void 0===i&&(i=!1),i&&(t+=this.lastPointX,e+=this.lastPointY),H(t,e,this.pathData),this.lastPointX=t,this.lastPointY=e,this},verticalLineTo(t,e){return this.lineTo(t,this.lastPointY,e),this},horizontalLineTo(t,e){return this.lineTo(this.lastPointX,t,e),this},ellipticalArc(t,e,i,s,r,a,h){return void 0===h&&(h=!1),function(t,e,i,s,r,a,h,n,o){h&&a>r?a-=360:!h&&a0,h=0,n=e.length;h0&&t.y>0},bt=function(t,e,i,s,r){t.setIterations(r).start();var a=s.tl;if(Pt(a))if(a.convex){var h=a.x,n=a.y;t.ellipticalArc(h,n,a.x,a.y,180,270,!1)}else h=0,n=0,t.ellipticalArc(h,n,a.x,a.y,90,0,!0);else t.lineTo(0,0);return a=s.tr,Pt(a)?a.convex?(h=e-a.x,n=a.y,t.ellipticalArc(h,n,a.x,a.y,270,360,!1)):(h=e,n=0,t.ellipticalArc(h,n,a.x,a.y,180,90,!0)):t.lineTo(e,0),a=s.br,Pt(a)?a.convex?(h=e-a.x,n=i-a.y,t.ellipticalArc(h,n,a.x,a.y,0,90,!1)):(h=e,n=i,t.ellipticalArc(h,n,a.x,a.y,270,180,!0)):t.lineTo(e,i),a=s.bl,Pt(a)?a.convex?(h=a.x,n=i-a.y,t.ellipticalArc(h,n,a.x,a.y,90,180,!1)):(h=0,n=i,t.ellipticalArc(h,n,a.x,a.y,360,270,!0)):t.lineTo(0,i),t.close(),t},kt=Phaser.Math.RadToDeg,Tt=function(t,e,i,s,r){var a=e*r,h=s.tl;if(Pt(h)){l=a>h.x?90:kt(Math.acos((h.x-a)/h.x));var n=h.x,o=h.y;t.ellipticalArc(n,o,h.x,h.y,180,180+l,!1)}else t.lineTo(0,0);if(h=s.tr,Pt(h)&&a>e-h.x){var l=90-kt(Math.acos((a-(e-h.x))/h.x));n=e-h.x,o=h.y,t.ellipticalArc(n,o,h.x,h.y,270,270+l,!1)}else t.lineTo(a,0);h=s.br,Pt(h)&&a>e-h.x?(l=90-kt(Math.acos((a-(e-h.x))/h.x)),n=e-h.x,o=i-h.y,t.ellipticalArc(n,o,h.x,h.y,90-l,90,!1)):t.lineTo(a,i),h=s.bl,Pt(h)?(l=a>h.x?90:kt(Math.acos((h.x-a)/h.x)),n=h.x,o=i-h.y,t.ellipticalArc(n,o,h.x,h.y,180-l,180,!1)):t.lineTo(0,i)},Dt=Phaser.Math.RadToDeg,xt=function(t,e,i,s,r){var a=i*r,h=s.tl;if(Pt(h)){l=a>h.y?90:Dt(Math.acos((h.y-a)/h.y));var n=h.x,o=h.y;t.ellipticalArc(n,o,h.x,h.y,270-l,270,!1)}else t.lineTo(0,0);if(h=s.tr,Pt(h)?(l=a>h.y?90:Dt(Math.acos((h.y-a)/h.y)),n=e-h.x,o=h.y,t.ellipticalArc(n,o,h.x,h.y,270,270+l,!1)):t.lineTo(e,0),h=s.br,Pt(h)&&a>i-h.y){var l=90-Dt(Math.acos((a-(i-h.y))/h.y));n=e-h.x,o=i-h.y,t.ellipticalArc(n,o,h.x,h.y,0,0+l,!1)}else t.lineTo(e,a);h=s.bl,Pt(h)&&a>i-h.y?(l=90-Dt(Math.acos((a-(i-h.y))/h.y)),n=h.x,o=i-h.y,t.ellipticalArc(n,o,h.x,h.y,180-l,180,!1)):t.lineTo(0,a)},St=Phaser.Math.RadToDeg,Rt=function(t,e,i,s,r){var a=e*r,h=s.tr;if(Pt(h)){l=a>h.x?90:St(Math.acos((h.x-a)/h.x));var n=e-h.x,o=h.y;t.ellipticalArc(n,o,h.x,h.y,360-l,360,!1)}else t.lineTo(e,0);if(h=s.br,Pt(h)?(l=a>h.x?90:St(Math.acos((h.x-a)/h.x)),n=e-h.x,o=i-h.y,t.ellipticalArc(n,o,h.x,h.y,0,0+l,!1)):t.lineTo(e,i),h=s.bl,Pt(h)&&a>e-h.x){var l=90-St(Math.acos((a-(e-h.x))/h.x));n=h.x,o=i-h.y,t.ellipticalArc(n,o,h.x,h.y,90,90+l,!1)}else t.lineTo(e-a,i);h=s.tl,Pt(h)&&a>e-h.x?(l=90-St(Math.acos((a-(e-h.x))/h.x)),n=h.x,o=h.y,t.ellipticalArc(n,o,h.x,h.y,270-l,270,!1)):t.lineTo(e-a,0)},_t=Phaser.Math.RadToDeg,Et=function(t,e,i,s,r){var a=i*r,h=s.br;if(Pt(h)){l=a>h.y?90:_t(Math.acos((h.y-a)/h.y));var n=e-h.x,o=i-h.y;t.ellipticalArc(n,o,h.x,h.y,90-l,90,!1)}else t.lineTo(e,i);if(h=s.bl,Pt(h)?(l=a>h.y?90:_t(Math.acos((h.y-a)/h.y)),n=h.x,o=i-h.y,t.ellipticalArc(n,o,h.x,h.y,90,90+l,!1)):t.lineTo(0,i),h=s.tl,Pt(h)&&a>i-h.y){var l=90-_t(Math.acos((a-(i-h.y))/h.y));n=h.x,o=h.y,t.ellipticalArc(n,o,h.x,h.y,180,180+l,!1)}else t.lineTo(0,i-a);h=s.tr,Pt(h)&&a>i-h.y?(l=90-_t(Math.acos((a-(i-h.y))/h.y)),n=e-h.x,o=h.y,t.ellipticalArc(n,o,h.x,h.y,360-l,360,!1)):t.lineTo(e,i-a)};const Ct=Phaser.Utils.Objects.GetValue;class At{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=Ct(t,"x",0),i=Ct(t,"y",0));var s=this.cornerRadius;s.tl=wt(Ct(t,"tl",void 0),e,i),s.tr=wt(Ct(t,"tr",void 0),e,i),s.bl=wt(Ct(t,"bl",void 0),e,i),s.br=wt(Ct(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Lt(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Lt(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Lt(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Lt(this.cornerRadius.br,t)}}var wt=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Mt(t),t},Lt=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Ct(e,"x",0),t.y=Ct(e,"y",0)),Mt(t)},Mt=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},Vt={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const Ot=Phaser.Utils.Objects.GetValue,Gt=Phaser.Utils.Objects.IsPlainObject;class jt extends(function(t){class e extends t{bootProgressBase(t){this.eventEmitter=N(t,"eventEmitter",this);var e=N(t,"valuechangeCallback",null);if(null!==e){var i=N(t,"valuechangeCallbackScope",void 0);this.eventEmitter.on("valuechange",e,i)}return this.setEaseValuePropName("value").setEaseValueDuration(N(t,"easeValue.duration",0)).setEaseValueFunction(N(t,"easeValue.ease","Linear")),this}get value(){return this._value}set value(t){t=X(t,0,1);var e=this._value,i=e!=t;this.dirty=this.dirty||i,this._value=t,i&&this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter)}}return Object.assign(e.prototype,l,z),e}(h)){constructor(t,e,i,s,r,a,h,n,o){Gt(e)?(e=(o=e).x,i=o.y,s=o.width,r=o.height,a=o.radius,h=o.barColor,n=o.value):Gt(s)?(s=(o=s).width,r=o.height,a=o.radius,h=o.barColor,n=o.value):Gt(a)&&(a=(o=a).radius,h=o.barColor,n=o.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=s),void 0===a&&(a=0),void 0===n&&(n=0),super(t,e,i,s,r,o),this.type="rexRoundRectangleProgress",this.rrGeom=new At,this.bootProgressBase(o),this.addShape((new ft).setName("trackFill")).addShape((new ft).setName("bar")).addShape((new ft).setName("trackStroke")),this.setTrackColor(Ot(o,"trackColor",void 0)),this.setBarColor(h),this.setTrackStroke(Ot(o,"trackStrokeThickness",2),Ot(o,"trackStrokeColor",void 0)),this.setOrientation(Ot(o,"orientation",0)),this.setRTL(Ot(o,"rtl",!1)),this.setRadius(a),this.setIteration(Ot(a,"iteration",void 0)),this.setValue(n)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get orientation(){return this._orientation}set orientation(t){var e;"string"==typeof(e=t)&&(e=Vt[e]),t=e,this.dirty=this.dirty||this._orientation!=t,this._orientation=t}setOrientation(t){return this.orientation=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get radius(){return this.rrGeom.radius}set radius(t){this.rrGeom.setRadius(t),this.dirty=!0}get radiusTL(){return this.rrGeom.radiusTL}set radiusTL(t){this.rrGeom.radiusTL=t,this.dirty=!0}get radiusTR(){return this.rrGeom.radiusTR}set radiusTR(t){this.rrGeom.radiusTR=t,this.dirty=!0}get radiusBL(){return this.rrGeom.radiusBL}set radiusBL(t){this.rrGeom.radiusBL=t,this.dirty=!0}get radiusBR(){return this.rrGeom.radiusBR}set radiusBR(t){this.rrGeom.radiusBR=t,this.dirty=!0}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setRadiusTL(t){return void 0===t&&(t=0),this.radiusTL=t,this}setRadiusTR(t){return void 0===t&&(t=0),this.radiusTR=t,this}setRadiusBL(t){return void 0===t&&(t=0),this.radiusBL=t,this}setRadiusBR(t){return void 0===t&&(t=0),this.radiusBR=t,this}get cornerRadius(){return this.rrGeom.cornerRadius}set cornerRadius(t){this.radius=t}setCornerRadius(t){return this.setRadius(t)}get iteration(){return this._iteration}set iteration(t){void 0!==this._iteration?this._iteration!==t&&(this._iteration=t,this.dirty=!0):this._iteration=t}setIteration(t){return void 0===t&&(t=6),this.iteration=t,this}}var Bt={updateShapes:function(){var t=this.width,e=this.height,i=this.rrGeom.cornerRadius,s=this.value,r=this.orientation,a=this.rtl,h=this.iteration+1,n=this.getShape("trackFill");n.fillStyle(this.trackColor),n.isFilled&&bt(n,t,e,i,h);var o=this.getShape("bar");o.fillStyle(this.barColor),o.isFilled&&function(t,e,i,s,r,a,h,n){t.setIterations(n).start(),0===r||(1===r?bt(t,e,i,s,n):((0===a?h?Rt:Tt:h?Et:xt)(t,e,i,s,r),t.close()))}(o,t,e,i,s,r,a,h);var l=this.getShape("trackStroke");l.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),l.isStroked&&bt(l,t,e,i,h)}};function Ft(t,e,i,s,r,a,h){var n=new jt(this.scene,t,e,i,s,r,a,h);return this.scene.add.existing(n),n}Object.assign(jt.prototype,Bt);const zt=Phaser.GameObjects.BuildGameObject;function Nt(t,e){void 0===t&&(t={}),void 0!==e&&(t.add=e);var i=new jt(this.scene,t);return zt(this.scene,i,t),i}var Xt=function(t){return null==t||""===t||0===t.length};class Yt extends Phaser.Plugins.BasePlugin{constructor(t){super(t),t.registerGameObject("rexRoundRectangleProgress",Ft,Nt)}start(){this.game.events.on("destroy",this.destroy,this)}}return function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t)if(Xt(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),a=function(t,e,i){var s=t;if(Xt(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var a=0,h=e.length;a=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const O=Phaser.Math.DegToRad;var E={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=O(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},k={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=x(t.scaleX,i.scaleX),e.scaleY=x(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},M={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},T={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=x(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},D={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},R={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},L={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},X={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(t){void 0===t&&(t=!1);var e=this;return this._mask=null,this.setChildMaskVisible(this),this.children.forEach((function(t){t.clearMask&&t.clearMask(!1),t.hasOwnProperty("isRexContainerLite")||e.setChildMaskVisible(t)})),t&&this.mask&&this.mask.destroy(),this}},Y=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},j=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const W=Phaser.Utils.Array;var F={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Me=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const Te=/(\S+)\[(\d+)\]/i,De=Phaser.Utils.Objects.GetValue;var Re=function(t,e){return void 0===e?t:t[e]},Le=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=De(e,"left",0),t.right=De(e,"right",0),t.top=De(e,"top",0),t.bottom=De(e,"bottom",0)),t},Xe={getInnerPadding(t){return Re(this.space,t)},setInnerPadding(t,e){return Le(this.space,t,e),this},getOuterPadding(t){return Re(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Le(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Re(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Le(this.getSizerConfig(t).padding,e,i),this}},Ye=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},ze=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Ae=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},je=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Ie=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},We=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Fe={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Ve=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?yi:mi,this.repeatCounter=0,this}stop(){return this.state=fi,this}update(t,e){this.state!==fi&&this.state!==Ci&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=bi)):(this.nowTime=this.duration,this.state=Ci):this.nowTime>=0&&(this.state=yi))}get t(){var t;switch(this.state){case fi:case mi:case bi:t=0;break;case yi:t=this.nowTime/this.duration;break;case Ci:t=1}return vi(t,0,1)}set t(t){(t=vi(t,-1,1))<0?(this.state=mi,this.nowTime=-this.delay*t):(this.state=yi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===fi}get isDelay(){return this.state===mi}get isCountDown(){return this.state===yi}get isRunning(){return this.state===mi||this.state===yi}get isDone(){return this.state===Ci}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const fi=0,mi=1,yi=2,bi=3,Ci=-1;class Si extends ci{constructor(t,e){super(t,e),this.timer=new gi}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const Pi=Phaser.Utils.Objects.GetValue,wi=Phaser.Utils.Objects.GetAdvancedValue,xi=Phaser.Tweens.Builders.GetEaseFunction;class _i extends Si{resetFromJSON(t){return this.timer.resetFromJSON(Pi(t,"timer")),this.setEnable(Pi(t,"enable",!0)),this.setTarget(Pi(t,"target",this.parent)),this.setDelay(wi(t,"delay",0)),this.setDuration(wi(t,"duration",1e3)),this.setEase(Pi(t,"ease","Linear")),this.setRepeat(Pi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=xi(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Oi=Phaser.Utils.Objects.GetValue,Ei=Phaser.Utils.Objects.GetAdvancedValue,ki=Phaser.Math.Linear;let Mi=class extends _i{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Oi(t,"mode",0)),this.setScaleRange(Ei(t,"start",void 0),Ei(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ti[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Ei(t,"x",this.parent.scaleX),this.startY=Ei(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Ei(e,"x",void 0),this.endY=Ei(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=ki(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=ki(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const Ti={stop:0,destroy:1,yoyo:2};var Di=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new Mi(t,a):r.resetFromJSON(a),r.restart(),r},Ri=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Mi&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new Mi(t,h):n.resetFromJSON(h),n.restart(),n},Li=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Xi=function(t){return Li(t,"complete")};const Yi=Phaser.Utils.Objects.IsPlainObject;var zi={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Yi(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Di(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Xi(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Yi(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Ri(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Xi(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Xi(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Yi(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new Mi(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Xi(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Ai={};Object.assign(Ai,zi),Ai.onInitScale=function(){zi.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=Se.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const ji=Phaser.Utils.Objects.GetValue,Ii=Phaser.Utils.Objects.GetAdvancedValue,Wi=Phaser.Math.Linear;class Fi extends _i{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(ji(t,"mode",0)),this.setAlphaRange(Ii(t,"start",this.parent.alpha),Ii(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Vi[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Wi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Vi={stop:0,destroy:1,yoyo:2},Bi=Phaser.Utils.Objects.IsPlainObject;var Ni=function(t,e,i,s){var r,n;Bi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Fi(t,h):s.resetFromJSON(h),s.restart(),s},Gi=function(t,e,i,s){i instanceof Fi&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Fi(t,r):s.resetFromJSON(r),s.restart(),s};const Ui=Phaser.Utils.Objects.IsPlainObject;var Hi={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Ui(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Ni(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Xi(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Ui(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Gi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Xi(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Xi(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},$i={};Object.assign($i,Hi),$i.onInitFade=function(){Hi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=Se.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Ji=Phaser.Utils.Objects.GetValue,qi=Phaser.Utils.Objects.GetAdvancedValue,Ki=Phaser.Math.Linear;class Zi extends _i{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Ji(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=qi(t,"x",void 0),i=qi(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Qi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=qi(i,"startX",void 0),this.startY=qi(i,"startY",void 0),this.endX=qi(i,"endX",void 0),this.endY=qi(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Ki(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ki(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Qi={stop:0,destroy:1,yoyo:2};var ts=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const es=Phaser.Utils.Objects.IsPlainObject,is=Phaser.Math.Distance.Between;var ss={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(es(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*is(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Zi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=ts(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=ts(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Zi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Xi(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Xi(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(es(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*is(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Zi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=ts(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=ts(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Zi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Xi(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Xi(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},rs={};Object.assign(rs,ss),rs.onInitEaseMove=function(){ss.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=Se.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const ns=Phaser.Utils.Objects.GetValue;class hs extends oi{constructor(t,e){super(t,e),this.timer=new gi,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(ns(t,"timer")),this.setEnable(ns(t,"enable",!0)),this.setMode(ns(t,"mode",1)),this.isRunning=ns(t,"isRunning",!1),this.setMagnitudeMode(ns(t,"magnitudeMode",1)),this.setAxisMode(ns(t,"axis",0)),this.setDuration(ns(t,"duration",500)),this.setMagnitude(ns(t,"magnitude",10)),this.ox=ns(t,"ox",void 0),this.oy=ns(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=as[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ls[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=os[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=ns(i,"magnitude",void 0),t=ns(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const as={effect:0,behavior:1},os={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ls={constant:0,decay:1},ds=Phaser.Utils.Objects.IsPlainObject;var cs={shake(t,e,i){if(ds(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new hs(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Xi(this._shake)}};const us=Phaser.Utils.Objects.GetValue,ps=Phaser.Math.Linear;class vs extends _i{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=us(t,"key","value");var i=e[this.propertyKey];return this.fromValue=us(t,"from",i),this.toValue=us(t,"to",i),this.setEase(us(t,"ease",this.ease)),this.setDuration(us(t,"duration",this.duration)),this.setRepeat(us(t,"repeat",0)),this.setDelay(us(t,"delay",0)),this.setRepeatDelay(us(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=ps(this.fromValue,this.toValue,i)}}const gs=Phaser.Utils.Objects.IsPlainObject;class fs extends si{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new vs(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(gs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(gs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var ms={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new fs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Li(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},ys=Phaser.Utils.Array.Remove,bs={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var Xs={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Ze(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Ys={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=jt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=jt),this.transitOutCallback=t,this}},zs={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},As={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},js={};Object.assign(js,Xs,Ys,zs,As);const Is=Phaser.Utils.Objects.GetValue;class Ws extends si{constructor(t,e){super(t,e),this.setTransitInTime(Is(e,"duration.in",200)),this.setTransitOutTime(Is(e,"duration.out",200)),this.setTransitInCallback(Is(e,"transitIn")),this.setTransitOutCallback(Is(e,"transitOut")),this.oneShotMode=Is(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Ls(this,{eventEmitter:!1,initState:Is(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Ws.prototype,js);var Fs=function(t){if(t.parentContainer)return Fs(t.parentContainer);var e=function(t){var e=t.displayList;return H(e)?e:null}(t);return e?Fs(e):t};class Vs extends si{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Fs(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Bs=Phaser.GameObjects.Rectangle;class Ns extends Bs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Vs(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Gs=Phaser.Utils.Objects.GetValue;class Us extends si{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Gs(t,"hitAreaMode",0)),this.setEnable(Gs(t,"enable",!0)),this.setStopMode(Gs(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Hs[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Hs={default:0,fullWindow:1};const $s=Phaser.Utils.Objects.GetValue;class Js extends Ns{constructor(t,e){super(t,$s(e,"color",0),$s(e,"alpha",.8)),this.touchEventStop=new Us(this,{hitAreaMode:1})}}var qs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Di(t,e)},scaleDown(t,e){Ri(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Ni(t,e)},fadeOut(t,e){Gi(t,e,!1)}},Ks=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Ni(t,e,t.alpha)},Zs=function(t,e){Gi(t,e,!1)},Qs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!nt(t,!0).contains(e,i)||r&&!r(t,e,i))};const tr=Phaser.Utils.Objects.GetValue;let er=class extends Ws{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=ir.popUp),null==e.transitOut&&(e.transitOut=ir.scaleDown),e.destroy=tr(e,"destroy",!0),super(t,e);var i=tr(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Js(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(tr(i,"transitIn",Ks)),this.setCoverTransitOutCallback(tr(i,"transitOut",Zs)));var s=tr(e,"touchOutsideClose",!1),r=tr(e,"duration.hold",-1),n=tr(e,"timeOutClose",r>=0),h=tr(e,"anyTouchClose",!1);tr(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),tr(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Qs(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=ir[t]),t){case ir.popUp:t=qs.popUp;break;case ir.fadeIn:t=qs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=ir[t]),t){case ir.scaleDown:t=qs.scaleDown;break;case ir.fadeOut:t=qs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const ir={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var sr=function(t){return t&&"function"==typeof t},rr={modal(t,e){return sr(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new er(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},nr=function(t,e,i,s,r){sr(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},hr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return nr.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return nr.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return nr.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return nr.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return nr.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return nr.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return nr.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return nr.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return nr.call(this,"shutdown",t,e,i,s),this}},ar=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=or),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},or={},lr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?Qs(t,e.x,e.y,i,s):!!(r=ar(e,n,!0))&&Qs(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const Cr={press:0,pointerdown:0,release:1,pointerup:1};var Sr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new br(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},Pr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!wr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return xr.length=0,!0;return xr.length=0,!1},xr=[];const _r=Phaser.Utils.Objects.GetValue;class Or extends si{constructor(t,e){super(t,e),this._enable=void 0;var i=_r(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(_r(t,"enable",!0)),this.setMode(_r(t,"mode",1)),this.setClickInterval(_r(t,"clickInterval",100)),this.setDragThreshold(_r(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Er[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?Pr:lr)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Er={press:0,pointerdown:0,release:1,pointerup:1};var kr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Or(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Mr extends Rs{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Tr=Phaser.Utils.Objects.GetValue;class Dr extends si{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Mr,this.parent.setInteractive(Tr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Tr(t,"enable",!0)),this.setCooldown(Tr(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Rr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&lr(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Dr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Dr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Lr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Xr=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=qr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Kr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=qr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Zr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&lr(t,s,e,i)}}const qr=0,Kr=1,Zr="IDLE",Qr=Phaser.Utils.Objects.GetValue,tn=Phaser.Math.Distance.Between;class en extends Jr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=sn},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Qr(t,"time",250)),this.setTapInterval(Qr(t,"tapInterval",200)),this.setDragThreshold(Qr(t,"threshold",9)),this.setTapOffset(Qr(t,"tapOffset",10));var e=Qr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Qr(t,"maxTaps",void 0)),this.setMinTaps(Qr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case sn:this.state=rn;break;case rn:var t=this.lastPointer;tn(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=nn,this.state=rn);break;case nn:this.state=rn}}onDragEnd(){this.state===rn&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=nn))}onDrag(){this.state!==sn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=sn)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===rn){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=sn):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=nn:this.state=sn)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===nn&&(this.state=sn)}get isTapped(){return this.state===nn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const sn="IDLE",rn="BEGIN",nn="RECOGNIZED",hn=Phaser.Utils.Objects.GetValue;class an extends Jr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=on},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(hn(t,"threshold",9)),this.setHoldTime(hn(t,"time",251)),this}onDragStart(){this.state=ln,0===this.holdTime&&(this.state=dn)}onDragEnd(){this.state=on}onDrag(){this.state!==on&&this.pointer.getDistance()>this.dragThreshold&&(this.state=on)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===ln&&t-this.pointer.downTime>=this.holdTime&&(this.state=dn)}get isPressed(){return this.state===dn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const on="IDLE",ln="BEGIN",dn="RECOGNIZED";Phaser.Utils.Objects.GetValue;var cn=function(t){return ei(t).loop.delta};const un=Phaser.Math.Distance.Between,pn=Phaser.Math.Angle.Between;var vn={getDt:function(){return cn(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return un(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return pn(e.x,e.y,t.x,t.y)}},gn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},fn={};const mn=Phaser.Utils.Objects.GetValue,yn=Phaser.Math.RadToDeg;class bn extends Jr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=Cn},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(mn(t,"threshold",10)),this.setVelocityThreshold(mn(t,"velocityThreshold",1e3)),this.setDirectionMode(mn(t,"dir","8dir")),this}onDragStart(){this.state=Sn}onDragEnd(){this.state=Cn}onDrag(){this.state===Sn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=Pn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Pn&&(this.state=Cn)}get isSwiped(){return this.state===Pn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=gn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=fn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(yn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(bn.prototype,vn);const Cn="IDLE",Sn="BEGIN",Pn="RECOGNIZED",wn=Phaser.Utils.Objects.GetValue,xn=Phaser.Utils.Array.SpliceOne,_n=Phaser.Math.Distance.Between,On=Phaser.Math.Angle.Between;class En{constructor(t,e){var i=Ze(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(wn(e,"inputConfig",void 0)),this.setEventEmitter(wn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(wn(t,"enable",!0)),this.bounds=wn(t,"bounds",void 0),this.tracerState=Mn,this.pointers.length=0,mt(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,mt(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case Mn:this.tracerState=Tn,this.onDrag1Start();break;case Tn:this.tracerState=Dn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],xn(this.pointers,e),this.tracerState){case Tn:this.tracerState=Mn,this.onDrag1End();break;case Dn:this.tracerState=Tn,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case Tn:this.onDrag1();break;case Dn:this.onDrag2()}}}dragCancel(){return this.tracerState===Dn&&this.onDrag2End(),this.pointers.length=0,mt(this.movedState),this.tracerState=Mn,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Dn)return 0;var t=this.pointers[0],e=this.pointers[1];return _n(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Dn)return 0;var t=this.pointers[0],e=this.pointers[1];return On(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;kn.x=e.x-i.x,kn.y=e.y-i.y}else kn.x=0,kn.y=0;return kn}get centerX(){if(this.tracerState!==Dn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Dn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Dn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Dn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Rn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&lr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&lr(t,s,e,i)}}Object.assign(En.prototype,Je);var kn={};const Mn=0,Tn=1,Dn=2,Rn="IDLE";Phaser.Utils.Objects.GetValue;const Ln=Phaser.Math.RotateAround;var Xn=function(t,e,i,s){return Ln(t,e,i,s),t.rotation+=s,t},Yn={};const zn=Phaser.Utils.Objects.GetValue,An=Phaser.Math.Angle.WrapDegrees,jn=Phaser.Math.Angle.ShortestBetween,In=Phaser.Math.RadToDeg,Wn=Phaser.Math.DegToRad;var Fn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Yn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=An(In(this.angleBetween));this.angle=jn(this.prevAngle,t),this.prevAngle=t,this.state=Nn}break;case Nn:t=An(In(this.angleBetween)),this.angle=jn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Nn}get rotation(){return Wn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Fn);const Vn="IDLE",Bn="BEGIN",Nn="RECOGNIZED",Gn=Phaser.Utils.Objects.GetValue;var Un=function(t){var e=Gn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new en(this,e),this._tap.on("tap",(function(t,e,s){Yr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Yr(i.eventEmitter,`${i.eventNamePrefix}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Hn=Phaser.Utils.Objects.GetValue;var $n=function(t){var e=Hn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new an(this,e),this._press.on("pressstart",(function(t,e,s){Yr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this).on("pressend",(function(t,e,s){Yr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Jn=Phaser.Utils.Objects.GetValue;var qn=function(t){var e=Jn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new bn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Yr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Yr(i.eventEmitter,`${i.eventNamePrefix}swipe`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Kn=Phaser.Utils.Objects.GetValue;var Zn=function(t,e){return t.setInteractive(),Kn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Kn(e,"targets",[t]),targetMode:Kn(e,"targetMode","parent"),eventEmitter:Kn(e,"eventEmitter",t),eventNamePrefix:Kn(e,"inputEventPrefix","child.")},Ar.call(t,e),Wr.call(t,e),Br.call(t,e),Hr.call(t,e),Un.call(t,e),$n.call(t,e),qn.call(t,e),t},Qn={getSizerConfig:function(t){return void 0===t&&(t=this),Dt(t)},getChildPrevState:function(t){var e=Dt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Xt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=le(e,"color"),s=le(e,"lineWidth");var o=le(e,"name",!1);o&&(r=le(o,"createTextCallback",ue),n=le(o,"createTextCallbackScope",void 0),"string"==typeof(h=le(o,"align","left-top"))&&(h=At[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new de(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}var d,c,u=this.getAllShownChildren([this]);pe(u,u);for(var p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const oh=Phaser.Utils.Objects.IsPlainObject,lh=Phaser.Utils.Objects.GetValue,dh=Phaser.Display.Align.CENTER,ch={min:0,full:-1};var uh=function(t,e,i,s,r,n,h,a,o,l){var d,c,u,p;ye.call(this,t);var v=t.isRexSpace,g=typeof e;if(null===e)return this;if("number"===g);else if("string"===g)e=ch[e];else if(oh(e)){var f;e=lh(f=e,"proportion",void 0),i=lh(f,"align",dh),s=lh(f,"padding",0),r=lh(f,"expand",!1),n=lh(f,"key",void 0),h=lh(f,"index",void 0),t.isRexSizer||(a=lh(f,"minWidth",void 0),o=lh(f,"minHeight",void 0)),l=lh(f,"fitRatio",0),d=lh(f,"offsetX",0),c=lh(f,"offsetY",0),u=lh(f,"offsetOriginX",0),p=lh(f,"offsetOriginY",0)}return"string"==typeof i&&(i=At[i]),void 0===e&&(e=v?1:0),void 0===i&&(i=dh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(v?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(v?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),(f=this.getSizerConfig(t)).proportion=e,f.align=i,f.padding=fe(s),f.expand=r,f.fitRatio=0===e?l:0,f.alignOffsetX=d,f.alignOffsetY=c,f.alignOffsetOriginX=u,f.alignOffsetOriginY=p,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},ph={add:uh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),uh.call(this,new hh(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return oh(i)&&(i.index=t),uh.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=ah.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const vh=Tt.prototype.clear;var gh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),vh.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,gh.call(this,t),this}},yh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=At[e]),this.getSizerConfig(t).align=e,this}},bh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},Ch={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},Sh={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},Ph={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Ge(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Ve.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d,c,u=this.sizerChildren,p=this.innerLeft,v=this.innerTop,g=this.innerWidth,f=this.innerHeight,m=p,y=v,b=this.startChildIndex,C=0,S=u.length;C0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=je.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||ze.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&rh.call(this,t,void 0),Ae.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Ie.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&rh.call(this,void 0,t),We.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(Ph,ph,mh,yh,bh,Ch,Sh);var wh=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},xh={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const _h=Phaser.Utils.Objects.IsPlainObject,Oh=Phaser.Utils.Objects.GetValue;class Eh extends eh{constructor(t,e,i,s,r,n,h){_h(e)?(e=Oh(h=e,"x",0),i=Oh(h,"y",0),s=Oh(h,"width",void 0),r=Oh(h,"height",void 0),n=Oh(h,"orientation",0)):_h(s)?(s=Oh(h=s,"width",void 0),r=Oh(h,"height",void 0),n=Oh(h,"orientation",0)):_h(n)&&(n=Oh(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Oh(h,"space.item",0)),this.setStartChildIndex(Oh(h,"startChildIndex",0)),this.setRTL(Oh(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=xh[t]),t}(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=wh.call(this)),this._childrenProportion}}Object.assign(Eh.prototype,Ph);var kh={v:0,vertical:0,y:0,h:1,horizontal:1,x:1,xy:2,vh:2},Mh=function(t,e){void 0===e&&(e="scrollMode"),t.hasOwnProperty(e)||(t[e]=Th(t));var i=t[e];return"string"==typeof i&&(i=kh[i]),i},Th=function(t){var e=!!t.sliderY||!!t.scrollerY,i=!!t.sliderX||!!t.scrollerX;return e&&i?2:e?0:i?1:0},Dh=function(){return Array.prototype.reduce.call(arguments,Rh,0)},Rh=function(t,e){return t+e};const Lh=Phaser.Utils.Objects.IsPlainObject,Xh=Phaser.Utils.Objects.GetValue,Yh=Phaser.Display.Align.CENTER;var zh=function(t,e,i,s,r){if("number"==typeof t||"number"==typeof e){if(void 0===t){for(var n=0;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return jh(this.sizerChildren,null),gh.call(this,t),this}},Wh={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)jh(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},Nh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=je.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,jh(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)jh(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},Uh=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const Hh=Phaser.Utils.Objects.IsPlainObject,$h=Phaser.Utils.Objects.GetValue;class Jh extends eh{constructor(t,e,i,s,r,n,h,a,o,l){Hh(e)?(e=$h(l=e,"x",0),i=$h(l,"y",0),s=$h(l,"width",void 0),r=$h(l,"height",void 0),n=$h(l,"column",l.col||0),h=$h(l,"row",0),a=$h(l,"columnProportions",0),o=$h(l,"rowProportions",0)):Hh(s)?(s=$h(l=s,"width",void 0),r=$h(l,"height",void 0),n=$h(l,"column",l.col||0),h=$h(l,"row",0),a=$h(l,"columnProportions",0),o=$h(l,"rowProportions",0)):Hh(n)?(n=$h(l=n,"column",l.col||0),h=$h(l,"row",0),a=$h(l,"columnProportions",0),o=$h(l,"rowProportions",0)):Hh(a)&&(a=$h(l=a,"columnProportions",0),o=$h(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback($h(l,"createCellContainerCallback")),this.setIndentLeft($h(l,"space.indentLeftOdd",0),$h(l,"space.indentLeftEven",0)),this.setIndentTop($h(l,"space.indentTopOdd",0),$h(l,"space.indentTopEven",0)),this.resetGrid(n,h,a,o,$h(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=Gh.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=Uh.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(Jh.prototype,Nh);const qh=Phaser.Utils.Objects.GetValue;var Kh=Phaser.Renderer.WebGL.Utils,Zh=function(t,e,i,s,r,n){for(var h=Kh.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),a=i.pathData,o=i.pathIndexes,l=0;l>>16,a=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+h+","+a+","+o+","+n+")"},sa=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,h=(16711680&r)>>>16,a=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+h+","+a+","+o+","+n+")",t.lineWidth=e.lineWidth};const ra=Phaser.Renderer.Canvas.SetTransform;var na={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=ea(e,i,s),h=r.calcMatrix.copyFrom(n.calc),a=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&Zh(r,h,e,l,a,o),e.isStroked&&ta(r,e,l,a,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(ra(t,r,e,i,s)){var n=e._displayOriginX,h=e._displayOriginY,a=e.pathData,o=a.length-1,l=a[0]-n,d=a[1]-h;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(aa.prototype,na);const oa=Phaser.Utils.Objects.GetValue;let la=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=oa(t,"x",0),i=oa(t,"y",0));var s=this.cornerRadius;s.tl=da(oa(t,"tl",void 0),e,i),s.tr=da(oa(t,"tr",void 0),e,i),s.bl=da(oa(t,"bl",void 0),e,i),s.br=da(oa(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){ca(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){ca(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){ca(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){ca(this.cornerRadius.br,t)}};var da=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),ua(t),t},ca=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=oa(e,"x",0),t.y=oa(e,"y",0)),ua(t)},ua=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},pa=function(t){return t.x>0&&t.y>0},va=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const ga=Phaser.Math.DegToRad;var fa=function(t,e,i,s,r,n,h,a,o){h&&n>r?n-=360:!h&&n0,h=0,a=e.length;h=0?t.startAt(h+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(h+n,i):t.startAt(h,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(h,i),t.close(),t};const mo=Phaser.Utils.Objects.GetValue,yo=Phaser.Utils.Objects.IsPlainObject;class bo extends(Ba(Ya)){constructor(t,e,i,s,r,n,h,a){yo(e)?(e=(a=e).x,i=a.y,s=a.width,r=a.height,n=a.barColor,h=a.value):yo(s)?(s=(a=s).width,r=a.height,n=a.barColor,h=a.value):yo(n)&&(n=(a=n).barColor,h=a.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===h&&(h=0),super(t,e,i,s,r,a),this.type="rexLineProgress",this.bootProgressBase(a),this.addShape((new go).setName("trackFill")).addShape((new go).setName("bar")).addShape((new go).setName("trackStroke")),this.setTrackColor(mo(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(mo(a,"trackStrokeThickness",2),mo(a,"trackStrokeColor",void 0)),this.setSkewX(mo(a,"skewX",0)),this.setRTL(mo(a,"rtl",!1)),this.setValue(h)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var Co={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&fo(s,0,0,e,i,t);var r,n,h=this.getShape("bar");h.fillStyle(this.barColor),h.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),fo(h,r,0,n,i,t));var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&fo(a,0,0,e,i,t)}};Object.assign(bo.prototype,Co);var So=function(t){return null==t||""===t||0===t.length},Po=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(So(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(So(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,h=e.length;nWo(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=Wo(t[i]));return e}const Fo=Phaser.Utils.Objects.IsPlainObject,Vo=Phaser.Utils.Objects.GetValue;var Bo=function(t){return"string"==typeof t&&(t=No[t]),t};const No={scale:0,repeat:1};var Go=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},Uo={_beginDraw:jt,_drawImage:jt,_drawTileSprite:jt,_endDraw:jt,setGetFrameNameCallback:function(t){return void 0===t&&(t=Io),this.getFrameNameCallback=t,this},setBaseTexture:function(t,e,i,s){Array.isArray(e)&&(s=i,i=e,e=void 0),null==e&&(e="__BASE"),"number"==typeof i&&arguments.length>=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=Wo(i),s=Wo(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),h=n.width,a=0,o=0,l=i.length;o0?h/a:0,c=n.height,u=0;for(o=0,l=s.length;o0?0:g,b=0,o=0;for(var w=i.length;o0?0:f),f>=1&&g>=1){var x=typeof(m=this.getFrameNameCallback(o,S,e));"string"!==x&&"number"!==x||r.add(m,0,b+n.cutX,C+n.cutY,f,g)}b+=f}C+=g}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,h,a,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/o,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(u,p);if(u>v){var g=(u-v)*o;d>=0?d+=g:d=g,u=v}if(p>v){var f=(p-v)*l;c>=0?c+=f:c=f,p=v}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,C=this.rows.count;b0&&a>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(S,b)?0:1)?this._drawImage(this.textureKey,s,m,y,h,a):this._drawTileSprite(this.textureKey,s,m,y,h,a)),m+=h;y+=a}this._endDraw()},setStretchMode:function(t){return Fo(t)?(this.stretchMode.edge=Bo(Vo(t,"edge",0)),this.stretchMode.internal=Bo(Vo(t,"internal",0))):(t=Bo(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Go.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const Ho=Phaser.Utils.Objects.IsPlainObject,$o=Phaser.Utils.Objects.GetValue,Jo=Phaser.GameObjects;var qo=void 0,Ko=function(t,e){if(qo||(qo={},ei(t).events.once("destroy",(function(){for(var t in qo)qo[t].destroy();qo=void 0}))),!qo.hasOwnProperty(e)){var i=ei(t).scene.systemScene;(t=new Jo[e](i)).setOrigin(0),qo[e]=t}return qo[e]};const Zo=Phaser.GameObjects.RenderTexture;class Qo extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if(Ho(i)?(i=$o(d=i,"x",0),s=$o(d,"y",0),r=$o(d,"width",1),n=$o(d,"height",1),h=$o(d,"key",void 0),a=$o(d,"baseFrame",void 0),o=$o(d,"columns",void 0),l=$o(d,"rows",void 0)):Ho(r)?(r=$o(d=r,"width",1),n=$o(d,"height",1),h=$o(d,"key",void 0),a=$o(d,"baseFrame",void 0),o=$o(d,"columns",void 0),l=$o(d,"rows",void 0)):Ho(h)?(h=$o(d=h,"key",void 0),a=$o(d,"baseFrame",void 0),o=$o(d,"columns",void 0),l=$o(d,"rows",void 0)):Ho(a)?(a=$o(d=a,"baseFrame",void 0),o=$o(d,"columns",void 0),l=$o(d,"rows",void 0)):Array.isArray(a)?(d=l,l=o,o=a,a=$o(d,"baseFrame",void 0)):Ho(o)&&(o=$o(d=o,"columns",void 0),l=$o(d,"rows",void 0)),void 0===a&&(a=$o(d,"frame",void 0)),void 0===o){var c=$o(d,"leftWidth",void 0),u=$o(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=$o(d,"topHeight",void 0),v=$o(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback($o(d,"getFrameNameCallback",void 0)),this.setStretchMode($o(d,"stretchMode",0)),this.setPreserveRatio($o(d,"preserveRatio",!0));var g=$o(d,"maxFixedPartScale",1),f=$o(d,"maxFixedPartScaleX",g),m=$o(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(h,a,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,Uo),i}(Zo,"rexNinePatch")){}var tl={_drawImage:function(t,e,i,s,r,n){var h=Ko(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=Ko(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(Qo.prototype,tl);class el extends si{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(_o(t,e))return t[e];var i=t.parent;return _o(i,e)?i[e]:void 0}set(t,e,i){return _o(t,e)?t[e]=i:_o(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}}const il=Phaser.Utils.Objects.GetValue;class sl extends Qo{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=il(e,"effects",!0);i&&To(this,i),this.style=new el(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(sl.prototype,Ea);const rl=["alpha","tint","flipX","flipY"];var nl=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("barColor")?i="bar":e.hasOwnProperty("leftWidth")?i="nineSlice":e.hasOwnProperty("key")&&(i="image")),i){case"bar":s=new wo(t,e);break;case"image":s=new jo(t,e);break;case"nineSlice":s=e.hasOwnProperty("stretchMode")?new sl(t,e):new Xo(t,e);break;default:s=new ka(t,e)}return function(t,e){if(!e)return t;for(var i=0,s=rl.length;i=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const zl=Phaser.Utils.Objects.GetValue,Al=Phaser.Math.Distance.Between;class jl extends si{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=zl(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(zl(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(zl(t,"enable",!0)),this.holdThreshold=zl(t,"holdThreshold",50),this.pointerOutReleaseEnable=zl(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return cn(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:Al(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!lr(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!lr(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const Il=Phaser.Utils.Objects.GetValue;class Wl{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(Il(t,"value",0)),this.setSpeed(Il(t,"speed",0)),this.setAcceleration(Il(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class Fl{constructor(){this.value,this.dir,this.movement=new Wl}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const Gl={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},Ul=Phaser.Utils.Objects.GetValue;class Hl extends si{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=Ul(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(Ul(e,"speed",.1)),this.setEnable(Ul(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(Ul(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||lr(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const $l=Phaser.Utils.Objects.GetValue;var Jl=function(t,e,i,s){var r,n,h="Y"===(i=i.toUpperCase()),a=2===t.scrollMode,o=t.childrenMap.child,l=`slider${i}`;if(r=a||s.hasOwnProperty(l)?$l(s,l,void 0):$l(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=h?1:0,n=function(t,e){void 0===e&&(e={});var i=yt(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new Xl(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r),n.tickLength=$l(r,"tickLength",void 0);var p=$l(r,"position",0);"string"==typeof p&&(p=ql[p]);var v,g,f=$l(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=$l(s,"space.slider",void 0))&&(a?f=0:v=$l(s,"space.child",0)),g=void 0===v?"number"==typeof f:"number"==typeof v,h?0===p?(d=2,c=1,u=void 0===v?g?{left:f}:f:{left:$l(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:$l(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:$l(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:$l(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=$l(r,"hideUnscrollableSlider",!1),t[`disableUnscrollableDrag${i}`]=$l(r,"disableUnscrollableDrag",!1),t[`adaptThumb${i}SizeMode`]=$l(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=$l(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`disableUnscrollableDrag${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=$l(s,"scrollDetectionMode");"string"==typeof b&&(b=Kl[b]);var C=`scroller${i}`;(m=a||s.hasOwnProperty(C)?$l(s,C,!0):$l(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new Nl(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var S,P,w,x,_,O=$l(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);O&&o&&(void 0!==b&&(O.focus=1===b?2:0),S=new Hl(o,O)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,S),a&&!h||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.disableUnscrollableDrag=t[`disableUnscrollableDrag${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",S)),n&&(a?(P=h?"t":"s",x=`scroll${i}`):(P="t",x="scroll"),n.on("valuechange",(function(e){t[P]=e,t.emit(x,t)}))),y&&(a?(w=`childO${i}`,x=`scroll${i}`):(w="childOY",x="scroll"),y.on("valuechange",(function(e){t[w]=e,t.emit(x,t)}))),S&&(_=a?`addChildO${i}`:"addChildOY",S.on("scroll",(function(e){t[_](-e,!0)})))};const ql={right:0,left:1,bottom:0,top:1},Kl={gameObject:0,rectBounds:1},Zl=Phaser.Utils.Objects.GetValue;var Ql=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=Zl(e,"width"),h=Zl(e,"height");n||Zl(e,"child.expandWidth",!0)||(s[1]=0),h||Zl(e,"child.expandHeight",!0)||(r[1]=0);var a=new Jh(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=qh(i,"child"),r=qh(s,"gameObject",void 0);if(r){var n=qh(i,"space.child",0);t.childMargin={};var h=t.childMargin,a={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:h.top=0,h.bottom=0,h.left=0,h.right=0;break;default:h.top=n,h.bottom=n,h.left=n,h.right=n}else switch(t.scrollMode){case 0:h.top=qh(n,"top",0),h.bottom=qh(n,"bottom",0),a.left=qh(n,"left",0),a.right=qh(n,"right",0);break;case 1:h.top=qh(n,"left",0),h.bottom=qh(n,"right",0),a.top=qh(n,"top",0),a.bottom=qh(n,"bottom",0);break;default:h.top=qh(n,"top",0),h.bottom=qh(n,"bottom",0),h.left=qh(n,"left",0),h.right=qh(n,"right",0)}e.add(r,{column:1,row:1,align:qh(s,"align","center"),padding:a,expand:{width:qh(s,"expandWidth",!0),height:qh(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:Jl(t,a,"y",e);break;case 1:Jl(t,a,"x",e);break;default:Jl(t,a,"y",e),Jl(t,a,"x",e)}return a},td=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}i*="Y"===t?this.scaleY:this.scaleX,s&&s.setBounds(e,i),r&&(r.setEnable(e!==i),r.tickLength&&r.setTick(r.tickLength,e,i))},ed=function(t){switch(this.scrollMode){case 0:case 1:(i=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(i,this.isOverflow),(r=this.childrenMap.scroller)&&this.disableUnscrollableDrag&&r.setEnable(this.isOverflow);break;default:var e=this[`isOverflow${t=t.toUpperCase()}`],i=this.childrenMap[`slider${t}`],s=this[`hideUnscrollableSlider${t}`];i&&s&&this.setChildVisible(i,e);var r=this.childrenMap.scroller,n=this[`disableUnscrollableDrag${t}`];r&&n&&r.setEnable(e)}},id=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(a=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=a.childrenMap.track,s=a.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&nthis.topChildOY}childOYExeceedBottom(t){return void 0===t&&(t=this.childOY),tthis.leftChildOX}childOXExeceedRight(t){return void 0===t&&(t=this.childOX),tthis.childHeight?t=0:s?t=e:r&&(t=i)),this._childOY!==t&&(this._childOY=t,this.resetChildPosition()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}get childOX(){return this._childOX}set childOX(t){var e=this.leftChildOX,i=this.rightChildOX,s=this.childOXExceedLeft(t),r=this.childOXExeceedRight(t);this.clampChildOX&&(this.childVisibleWidth>this.childWidth?t=0:s?t=e:r&&(t=i)),this._childOX!==t&&(this._childOX=t,this.resetChildPosition()),s&&(this.execeedLeftState||this.emit("execeedleft",this,t,e)),this.execeedLeftState=s,r&&(this.execeedRightState||this.emit("execeedright",this,t,i)),this.execeedRightState=r}setChildOY(t){return this.childOY=t,this}setChildOX(t){return this.childOX=t,this}set t(t){this.childOY=-this.visibleHeight*t}get t(){var t=this.visibleHeight;return 0===t?0:this.childOY/-t}set s(t){this.childOX=-this.visibleWidth*t}get s(){var t=this.visibleWidth;return 0===t?0:this.childOX/-t}setChildOYByPercentage(t){return this.t=t,this}setChildOXByPercentage(t){return this.s=t,this}}Object.assign(Rd.prototype,kd);const Ld=["top","bottom","centerY","center"],Xd=["left","right","centerX","center"];var Yd=function(t,e,i){var s,r="Y"===(e=e.toUpperCase()),n=this.childrenMap.child;if(r){if(i)for(var h=0,a=Ld.length;h=0?0:Math.abs(l)<=Math.abs(d)?l:d}}else{if(i)for(h=0,a=Xd.length;h=0?0:Math.abs(c)<=Math.abs(u)?c:u}}switch(this.scrollMode){case 0:case 1:this.childOY+=s;break;default:this[`childO${e}`]+=s}};const zd=Phaser.Utils.Objects.GetValue;class Ad extends hd{constructor(t,e){void 0===e&&(e={});var i=Mh(e),s=zd(e,"panel",void 0);void 0===s&&(s={}),s.scrollMode=i,s.clampChildOY=zd(e,"clampChildOY",!1),s.clampChildOX=zd(e,"clampChildOX",!1);var r,n,h=new Rd(t,s);switch(t.add.existing(h),i){case 0:r=zd(e,"expand.panel",!0),n=!0;break;case 1:r=!0,n=zd(e,"expand.panel",!0);break;default:r=!0,n=!0}e.type="rexScrollablePanel",e.child={gameObject:h,expandWidth:r,expandHeight:n,align:zd(e,"align.panel","center")};var a=zd(e,"space",void 0);a&&(a.child=zd(a,"panel",0)),super(t,e),this.addChildrenMap("panel",h.child),this.addChildrenMap("panelLayer",h.maskLayer),this.addChildrenMap("mask",h.maskGameObject),this.addChildrenMap("scrollableBlock",h)}setChildrenInteractive(t){return void 0===t&&(t={}),t.hasOwnProperty("eventEmitter")||(t.eventEmitter=this),t.hasOwnProperty("targets")||(t.targets=[this.childrenMap.panel]),Zn(this.childrenMap.child,t),this}}var jd={scrollToChild:function(t,e){if(!this.hasChild(t))return this;switch(this.scrollMode){case 0:Yd.call(this,t,"y",e);break;case 1:Yd.call(this,t,"x",e);break;default:Yd.call(this,t,"y",e),Yd.call(this,t,"x",e)}return this}};return Object.assign(Ad.prototype,jd),Ad},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rexscrollablepanel=e(); +var t,e;t=void 0,e=function(){var t,e=!1;e||(void 0===t&&(t=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const O=Phaser.Math.DegToRad;var E={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=O(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},k={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=x(t.scaleX,i.scaleX),e.scaleY=x(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},M={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},T={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=x(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},D={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},R={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},L={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},X={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(t){void 0===t&&(t=!1);var e=this;return this._mask=null,this.setChildMaskVisible(this),this.children.forEach((function(t){t.clearMask&&t.clearMask(!1),t.hasOwnProperty("isRexContainerLite")||e.setChildMaskVisible(t)})),t&&this.mask&&this.mask.destroy(),this}},Y=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},j=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const W=Phaser.Utils.Array;var F={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Me=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const Te=/(\S+)\[(\d+)\]/i,De=Phaser.Utils.Objects.GetValue;var Re=function(t,e){return void 0===e?t:t[e]},Le=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=De(e,"left",0),t.right=De(e,"right",0),t.top=De(e,"top",0),t.bottom=De(e,"bottom",0)),t},Xe={getInnerPadding(t){return Re(this.space,t)},setInnerPadding(t,e){return Le(this.space,t,e),this},getOuterPadding(t){return Re(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Le(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Re(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Le(this.getSizerConfig(t).padding,e,i),this}},Ye=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},ze=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Ae=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},je=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Ie=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},We=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Fe={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Ve=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?yi:mi,this.repeatCounter=0,this}stop(){return this.state=fi,this}update(t,e){this.state!==fi&&this.state!==Ci&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=bi)):(this.nowTime=this.duration,this.state=Ci):this.nowTime>=0&&(this.state=yi))}get t(){var t;switch(this.state){case fi:case mi:case bi:t=0;break;case yi:t=this.nowTime/this.duration;break;case Ci:t=1}return vi(t,0,1)}set t(t){(t=vi(t,-1,1))<0?(this.state=mi,this.nowTime=-this.delay*t):(this.state=yi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===fi}get isDelay(){return this.state===mi}get isCountDown(){return this.state===yi}get isRunning(){return this.state===mi||this.state===yi}get isDone(){return this.state===Ci}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const fi=0,mi=1,yi=2,bi=3,Ci=-1;class Si extends ci{constructor(t,e){super(t,e),this.timer=new gi}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const Pi=Phaser.Utils.Objects.GetValue,wi=Phaser.Utils.Objects.GetAdvancedValue,xi=Phaser.Tweens.Builders.GetEaseFunction;class _i extends Si{resetFromJSON(t){return this.timer.resetFromJSON(Pi(t,"timer")),this.setEnable(Pi(t,"enable",!0)),this.setTarget(Pi(t,"target",this.parent)),this.setDelay(wi(t,"delay",0)),this.setDuration(wi(t,"duration",1e3)),this.setEase(Pi(t,"ease","Linear")),this.setRepeat(Pi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=xi(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Oi=Phaser.Utils.Objects.GetValue,Ei=Phaser.Utils.Objects.GetAdvancedValue,ki=Phaser.Math.Linear;let Mi=class extends _i{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Oi(t,"mode",0)),this.setScaleRange(Ei(t,"start",void 0),Ei(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ti[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Ei(t,"x",this.parent.scaleX),this.startY=Ei(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Ei(e,"x",void 0),this.endY=Ei(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=ki(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=ki(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const Ti={stop:0,destroy:1,yoyo:2};var Di=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new Mi(t,a):r.resetFromJSON(a),r.restart(),r},Ri=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Mi&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new Mi(t,h):n.resetFromJSON(h),n.restart(),n},Li=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Xi=function(t){return Li(t,"complete")};const Yi=Phaser.Utils.Objects.IsPlainObject;var zi={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Yi(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Di(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Xi(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Yi(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Ri(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Xi(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Xi(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Yi(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new Mi(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Xi(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Ai={};Object.assign(Ai,zi),Ai.onInitScale=function(){zi.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=Se.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const ji=Phaser.Utils.Objects.GetValue,Ii=Phaser.Utils.Objects.GetAdvancedValue,Wi=Phaser.Math.Linear;class Fi extends _i{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(ji(t,"mode",0)),this.setAlphaRange(Ii(t,"start",this.parent.alpha),Ii(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Vi[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Wi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Vi={stop:0,destroy:1,yoyo:2},Bi=Phaser.Utils.Objects.IsPlainObject;var Ni=function(t,e,i,s){var r,n;Bi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Fi(t,h):s.resetFromJSON(h),s.restart(),s},Gi=function(t,e,i,s){i instanceof Fi&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Fi(t,r):s.resetFromJSON(r),s.restart(),s};const Ui=Phaser.Utils.Objects.IsPlainObject;var Hi={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Ui(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Ni(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Xi(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Ui(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Gi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Xi(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Xi(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},$i={};Object.assign($i,Hi),$i.onInitFade=function(){Hi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=Se.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Ji=Phaser.Utils.Objects.GetValue,qi=Phaser.Utils.Objects.GetAdvancedValue,Ki=Phaser.Math.Linear;class Zi extends _i{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Ji(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=qi(t,"x",void 0),i=qi(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Qi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=qi(i,"startX",void 0),this.startY=qi(i,"startY",void 0),this.endX=qi(i,"endX",void 0),this.endY=qi(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Ki(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ki(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Qi={stop:0,destroy:1,yoyo:2};var ts=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const es=Phaser.Utils.Objects.IsPlainObject,is=Phaser.Math.Distance.Between;var ss={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(es(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*is(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Zi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=ts(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=ts(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Zi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Xi(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Xi(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(es(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*is(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Zi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=ts(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=ts(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Zi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Xi(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Xi(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},rs={};Object.assign(rs,ss),rs.onInitEaseMove=function(){ss.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=Se.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const ns=Phaser.Utils.Objects.GetValue;class hs extends oi{constructor(t,e){super(t,e),this.timer=new gi,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(ns(t,"timer")),this.setEnable(ns(t,"enable",!0)),this.setMode(ns(t,"mode",1)),this.isRunning=ns(t,"isRunning",!1),this.setMagnitudeMode(ns(t,"magnitudeMode",1)),this.setAxisMode(ns(t,"axis",0)),this.setDuration(ns(t,"duration",500)),this.setMagnitude(ns(t,"magnitude",10)),this.ox=ns(t,"ox",void 0),this.oy=ns(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=as[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ls[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=os[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=ns(i,"magnitude",void 0),t=ns(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const as={effect:0,behavior:1},os={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ls={constant:0,decay:1},ds=Phaser.Utils.Objects.IsPlainObject;var cs={shake(t,e,i){if(ds(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new hs(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Xi(this._shake)}};const us=Phaser.Utils.Objects.GetValue,ps=Phaser.Math.Linear;class vs extends _i{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=us(t,"key","value");var i=e[this.propertyKey];return this.fromValue=us(t,"from",i),this.toValue=us(t,"to",i),this.setEase(us(t,"ease",this.ease)),this.setDuration(us(t,"duration",this.duration)),this.setRepeat(us(t,"repeat",0)),this.setDelay(us(t,"delay",0)),this.setRepeatDelay(us(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=ps(this.fromValue,this.toValue,i)}}const gs=Phaser.Utils.Objects.IsPlainObject;class fs extends si{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new vs(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(gs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(gs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var ms={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new fs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Li(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},ys=Phaser.Utils.Array.Remove,bs={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var Xs={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Ze(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Ys={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=jt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=jt),this.transitOutCallback=t,this}},zs={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},As={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},js={};Object.assign(js,Xs,Ys,zs,As);const Is=Phaser.Utils.Objects.GetValue;class Ws extends si{constructor(t,e){super(t,e),this.setTransitInTime(Is(e,"duration.in",200)),this.setTransitOutTime(Is(e,"duration.out",200)),this.setTransitInCallback(Is(e,"transitIn")),this.setTransitOutCallback(Is(e,"transitOut")),this.oneShotMode=Is(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Ls(this,{eventEmitter:!1,initState:Is(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Ws.prototype,js);var Fs=function(t){if(t.parentContainer)return Fs(t.parentContainer);var e=function(t){var e=t.displayList;return H(e)?e:null}(t);return e?Fs(e):t};class Vs extends si{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Fs(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Bs=Phaser.GameObjects.Rectangle;class Ns extends Bs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Vs(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Gs=Phaser.Utils.Objects.GetValue;class Us extends si{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Gs(t,"hitAreaMode",0)),this.setEnable(Gs(t,"enable",!0)),this.setStopMode(Gs(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Hs[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Hs={default:0,fullWindow:1};const $s=Phaser.Utils.Objects.GetValue;class Js extends Ns{constructor(t,e){super(t,$s(e,"color",0),$s(e,"alpha",.8)),this.touchEventStop=new Us(this,{hitAreaMode:1})}}var qs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Di(t,e)},scaleDown(t,e){Ri(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Ni(t,e)},fadeOut(t,e){Gi(t,e,!1)}},Ks=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Ni(t,e,t.alpha)},Zs=function(t,e){Gi(t,e,!1)},Qs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!nt(t,!0).contains(e,i)||r&&!r(t,e,i))};const tr=Phaser.Utils.Objects.GetValue;let er=class extends Ws{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=ir.popUp),null==e.transitOut&&(e.transitOut=ir.scaleDown),e.destroy=tr(e,"destroy",!0),super(t,e);var i=tr(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Js(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(tr(i,"transitIn",Ks)),this.setCoverTransitOutCallback(tr(i,"transitOut",Zs)));var s=tr(e,"touchOutsideClose",!1),r=tr(e,"duration.hold",-1),n=tr(e,"timeOutClose",r>=0),h=tr(e,"anyTouchClose",!1);tr(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),tr(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Qs(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=ir[t]),t){case ir.popUp:t=qs.popUp;break;case ir.fadeIn:t=qs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=ir[t]),t){case ir.scaleDown:t=qs.scaleDown;break;case ir.fadeOut:t=qs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const ir={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var sr=function(t){return t&&"function"==typeof t},rr={modal(t,e){return sr(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new er(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},nr=function(t,e,i,s,r){sr(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},hr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return nr.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return nr.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return nr.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return nr.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return nr.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return nr.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return nr.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return nr.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return nr.call(this,"shutdown",t,e,i,s),this}},ar=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=or),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},or={},lr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?Qs(t,e.x,e.y,i,s):!!(r=ar(e,n,!0))&&Qs(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const Cr={press:0,pointerdown:0,release:1,pointerup:1};var Sr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new br(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},Pr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!wr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return xr.length=0,!0;return xr.length=0,!1},xr=[];const _r=Phaser.Utils.Objects.GetValue;class Or extends si{constructor(t,e){super(t,e),this._enable=void 0;var i=_r(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(_r(t,"enable",!0)),this.setMode(_r(t,"mode",1)),this.setClickInterval(_r(t,"clickInterval",100)),this.setDragThreshold(_r(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Er[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?Pr:lr)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Er={press:0,pointerdown:0,release:1,pointerup:1};var kr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Or(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Mr extends Rs{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Tr=Phaser.Utils.Objects.GetValue;class Dr extends si{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Mr,this.parent.setInteractive(Tr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Tr(t,"enable",!0)),this.setCooldown(Tr(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Rr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&lr(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Dr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Dr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Lr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Xr=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=qr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Kr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=qr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Zr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&lr(t,s,e,i)}}const qr=0,Kr=1,Zr="IDLE",Qr=Phaser.Utils.Objects.GetValue,tn=Phaser.Math.Distance.Between;class en extends Jr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=sn},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Qr(t,"time",250)),this.setTapInterval(Qr(t,"tapInterval",200)),this.setDragThreshold(Qr(t,"threshold",9)),this.setTapOffset(Qr(t,"tapOffset",10));var e=Qr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Qr(t,"maxTaps",void 0)),this.setMinTaps(Qr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case sn:this.state=rn;break;case rn:var t=this.lastPointer;tn(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=nn,this.state=rn);break;case nn:this.state=rn}}onDragEnd(){this.state===rn&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=nn))}onDrag(){this.state!==sn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=sn)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===rn){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=sn):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=nn:this.state=sn)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===nn&&(this.state=sn)}get isTapped(){return this.state===nn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const sn="IDLE",rn="BEGIN",nn="RECOGNIZED",hn=Phaser.Utils.Objects.GetValue;class an extends Jr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=on},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(hn(t,"threshold",9)),this.setHoldTime(hn(t,"time",251)),this}onDragStart(){this.state=ln,0===this.holdTime&&(this.state=dn)}onDragEnd(){this.state=on}onDrag(){this.state!==on&&this.pointer.getDistance()>this.dragThreshold&&(this.state=on)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===ln&&t-this.pointer.downTime>=this.holdTime&&(this.state=dn)}get isPressed(){return this.state===dn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const on="IDLE",ln="BEGIN",dn="RECOGNIZED";Phaser.Utils.Objects.GetValue;var cn=function(t){return ei(t).loop.delta};const un=Phaser.Math.Distance.Between,pn=Phaser.Math.Angle.Between;var vn={getDt:function(){return cn(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return un(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return pn(e.x,e.y,t.x,t.y)}},gn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},fn={};const mn=Phaser.Utils.Objects.GetValue,yn=Phaser.Math.RadToDeg;class bn extends Jr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=Cn},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(mn(t,"threshold",10)),this.setVelocityThreshold(mn(t,"velocityThreshold",1e3)),this.setDirectionMode(mn(t,"dir","8dir")),this}onDragStart(){this.state=Sn}onDragEnd(){this.state=Cn}onDrag(){this.state===Sn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=Pn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Pn&&(this.state=Cn)}get isSwiped(){return this.state===Pn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=gn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=fn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(yn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(bn.prototype,vn);const Cn="IDLE",Sn="BEGIN",Pn="RECOGNIZED",wn=Phaser.Utils.Objects.GetValue,xn=Phaser.Utils.Array.SpliceOne,_n=Phaser.Math.Distance.Between,On=Phaser.Math.Angle.Between;class En{constructor(t,e){var i=Ze(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(wn(e,"inputConfig",void 0)),this.setEventEmitter(wn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(wn(t,"enable",!0)),this.bounds=wn(t,"bounds",void 0),this.tracerState=Mn,this.pointers.length=0,mt(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,mt(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case Mn:this.tracerState=Tn,this.onDrag1Start();break;case Tn:this.tracerState=Dn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],xn(this.pointers,e),this.tracerState){case Tn:this.tracerState=Mn,this.onDrag1End();break;case Dn:this.tracerState=Tn,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case Tn:this.onDrag1();break;case Dn:this.onDrag2()}}}dragCancel(){return this.tracerState===Dn&&this.onDrag2End(),this.pointers.length=0,mt(this.movedState),this.tracerState=Mn,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Dn)return 0;var t=this.pointers[0],e=this.pointers[1];return _n(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Dn)return 0;var t=this.pointers[0],e=this.pointers[1];return On(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;kn.x=e.x-i.x,kn.y=e.y-i.y}else kn.x=0,kn.y=0;return kn}get centerX(){if(this.tracerState!==Dn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Dn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Dn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Dn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Rn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&lr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&lr(t,s,e,i)}}Object.assign(En.prototype,Je);var kn={};const Mn=0,Tn=1,Dn=2,Rn="IDLE";Phaser.Utils.Objects.GetValue;const Ln=Phaser.Math.RotateAround;var Xn=function(t,e,i,s){return Ln(t,e,i,s),t.rotation+=s,t},Yn={};const zn=Phaser.Utils.Objects.GetValue,An=Phaser.Math.Angle.WrapDegrees,jn=Phaser.Math.Angle.ShortestBetween,In=Phaser.Math.RadToDeg,Wn=Phaser.Math.DegToRad;var Fn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Yn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=An(In(this.angleBetween));this.angle=jn(this.prevAngle,t),this.prevAngle=t,this.state=Nn}break;case Nn:t=An(In(this.angleBetween)),this.angle=jn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Nn}get rotation(){return Wn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Fn);const Vn="IDLE",Bn="BEGIN",Nn="RECOGNIZED",Gn=Phaser.Utils.Objects.GetValue;var Un=function(t){var e=Gn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new en(this,e),this._tap.on("tap",(function(t,e,s){Yr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Yr(i.eventEmitter,`${i.eventNamePrefix}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Hn=Phaser.Utils.Objects.GetValue;var $n=function(t){var e=Hn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new an(this,e),this._press.on("pressstart",(function(t,e,s){Yr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this).on("pressend",(function(t,e,s){Yr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Jn=Phaser.Utils.Objects.GetValue;var qn=function(t){var e=Jn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new bn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Yr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Yr(i.eventEmitter,`${i.eventNamePrefix}swipe`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Kn=Phaser.Utils.Objects.GetValue;var Zn=function(t,e){return t.setInteractive(),Kn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Kn(e,"targets",[t]),targetMode:Kn(e,"targetMode","parent"),eventEmitter:Kn(e,"eventEmitter",t),eventNamePrefix:Kn(e,"inputEventPrefix","child.")},Ar.call(t,e),Wr.call(t,e),Br.call(t,e),Hr.call(t,e),Un.call(t,e),$n.call(t,e),qn.call(t,e),t},Qn={getSizerConfig:function(t){return void 0===t&&(t=this),Dt(t)},getChildPrevState:function(t){var e=Dt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Xt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=le(e,"color"),s=le(e,"lineWidth");var o=le(e,"name",!1);o&&(r=le(o,"createTextCallback",ue),n=le(o,"createTextCallbackScope",void 0),"string"==typeof(h=le(o,"align","left-top"))&&(h=At[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new de(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}var d,c,u=this.getAllShownChildren([this]);pe(u,u);for(var p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const oh=Phaser.Utils.Objects.IsPlainObject,lh=Phaser.Utils.Objects.GetValue,dh=Phaser.Display.Align.CENTER,ch={min:0,full:-1};var uh=function(t,e,i,s,r,n,h,a,o,l){var d,c,u,p;ye.call(this,t);var v=t.isRexSpace,g=typeof e;if(null===e)return this;if("number"===g);else if("string"===g)e=ch[e];else if(oh(e)){var f;e=lh(f=e,"proportion",void 0),i=lh(f,"align",dh),s=lh(f,"padding",0),r=lh(f,"expand",!1),n=lh(f,"key",void 0),h=lh(f,"index",void 0),t.isRexSizer||(a=lh(f,"minWidth",void 0),o=lh(f,"minHeight",void 0)),l=lh(f,"fitRatio",0),d=lh(f,"offsetX",0),c=lh(f,"offsetY",0),u=lh(f,"offsetOriginX",0),p=lh(f,"offsetOriginY",0)}return"string"==typeof i&&(i=At[i]),void 0===e&&(e=v?1:0),void 0===i&&(i=dh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(v?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(v?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),(f=this.getSizerConfig(t)).proportion=e,f.align=i,f.padding=fe(s),f.expand=r,f.fitRatio=0===e?l:0,f.alignOffsetX=d,f.alignOffsetY=c,f.alignOffsetOriginX=u,f.alignOffsetOriginY=p,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},ph={add:uh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),uh.call(this,new hh(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return oh(i)&&(i.index=t),uh.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=ah.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const vh=Tt.prototype.clear;var gh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),vh.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,gh.call(this,t),this}},yh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=At[e]),this.getSizerConfig(t).align=e,this}},bh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},Ch={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},Sh={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},Ph={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Ge(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Ve.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d,c,u=this.sizerChildren,p=this.innerLeft,v=this.innerTop,g=this.innerWidth,f=this.innerHeight,m=p,y=v,b=this.startChildIndex,C=0,S=u.length;C0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=je.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||ze.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&rh.call(this,t,void 0),Ae.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Ie.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&rh.call(this,void 0,t),We.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(Ph,ph,mh,yh,bh,Ch,Sh);var wh=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},xh={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const _h=Phaser.Utils.Objects.IsPlainObject,Oh=Phaser.Utils.Objects.GetValue;class Eh extends eh{constructor(t,e,i,s,r,n,h){_h(e)?(e=Oh(h=e,"x",0),i=Oh(h,"y",0),s=Oh(h,"width",void 0),r=Oh(h,"height",void 0),n=Oh(h,"orientation",0)):_h(s)?(s=Oh(h=s,"width",void 0),r=Oh(h,"height",void 0),n=Oh(h,"orientation",0)):_h(n)&&(n=Oh(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Oh(h,"space.item",0)),this.setStartChildIndex(Oh(h,"startChildIndex",0)),this.setRTL(Oh(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=xh[t]),t}(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=wh.call(this)),this._childrenProportion}}Object.assign(Eh.prototype,Ph);var kh={v:0,vertical:0,y:0,h:1,horizontal:1,x:1,xy:2,vh:2},Mh=function(t,e){void 0===e&&(e="scrollMode"),t.hasOwnProperty(e)||(t[e]=Th(t));var i=t[e];return"string"==typeof i&&(i=kh[i]),i},Th=function(t){var e=!!t.sliderY||!!t.scrollerY,i=!!t.sliderX||!!t.scrollerX;return e&&i?2:e?0:i?1:0},Dh=function(){return Array.prototype.reduce.call(arguments,Rh,0)},Rh=function(t,e){return t+e};const Lh=Phaser.Utils.Objects.IsPlainObject,Xh=Phaser.Utils.Objects.GetValue,Yh=Phaser.Display.Align.CENTER;var zh=function(t,e,i,s,r){if("number"==typeof t||"number"==typeof e){if(void 0===t){for(var n=0;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return jh(this.sizerChildren,null),gh.call(this,t),this}},Wh={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)jh(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},Nh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=je.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,jh(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)jh(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},Uh=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const Hh=Phaser.Utils.Objects.IsPlainObject,$h=Phaser.Utils.Objects.GetValue;class Jh extends eh{constructor(t,e,i,s,r,n,h,a,o,l){Hh(e)?(e=$h(l=e,"x",0),i=$h(l,"y",0),s=$h(l,"width",void 0),r=$h(l,"height",void 0),n=$h(l,"column",l.col||0),h=$h(l,"row",0),a=$h(l,"columnProportions",0),o=$h(l,"rowProportions",0)):Hh(s)?(s=$h(l=s,"width",void 0),r=$h(l,"height",void 0),n=$h(l,"column",l.col||0),h=$h(l,"row",0),a=$h(l,"columnProportions",0),o=$h(l,"rowProportions",0)):Hh(n)?(n=$h(l=n,"column",l.col||0),h=$h(l,"row",0),a=$h(l,"columnProportions",0),o=$h(l,"rowProportions",0)):Hh(a)&&(a=$h(l=a,"columnProportions",0),o=$h(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback($h(l,"createCellContainerCallback")),this.setIndentLeft($h(l,"space.indentLeftOdd",0),$h(l,"space.indentLeftEven",0)),this.setIndentTop($h(l,"space.indentTopOdd",0),$h(l,"space.indentTopEven",0)),this.resetGrid(n,h,a,o,$h(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=Gh.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=Uh.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(Jh.prototype,Nh);const qh=Phaser.Utils.Objects.GetValue;var Kh=Phaser.Renderer.WebGL.Utils,Zh=function(t,e,i,s,r,n){for(var h=Kh.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),a=i.pathData,o=i.pathIndexes,l=0;l>>16,a=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+h+","+a+","+o+","+n+")"},sa=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,h=(16711680&r)>>>16,a=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+h+","+a+","+o+","+n+")",t.lineWidth=e.lineWidth};const ra=Phaser.Renderer.Canvas.SetTransform;var na={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=ea(e,i,s),h=r.calcMatrix.copyFrom(n.calc),a=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&Zh(r,h,e,l,a,o),e.isStroked&&ta(r,e,l,a,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(ra(t,r,e,i,s)){var n=e._displayOriginX,h=e._displayOriginY,a=e.pathData,o=a.length-1,l=a[0]-n,d=a[1]-h;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(aa.prototype,na);const oa=Phaser.Utils.Objects.GetValue;let la=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=oa(t,"x",0),i=oa(t,"y",0));var s=this.cornerRadius;s.tl=da(oa(t,"tl",void 0),e,i),s.tr=da(oa(t,"tr",void 0),e,i),s.bl=da(oa(t,"bl",void 0),e,i),s.br=da(oa(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){ca(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){ca(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){ca(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){ca(this.cornerRadius.br,t)}};var da=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),ua(t),t},ca=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=oa(e,"x",0),t.y=oa(e,"y",0)),ua(t)},ua=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},pa=function(t){return t.x>0&&t.y>0},va=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const ga=Phaser.Math.DegToRad;var fa=function(t,e,i,s,r,n,h,a,o){h&&n>r?n-=360:!h&&n0,h=0,a=e.length;h=0?t.startAt(h+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(h+n,i):t.startAt(h,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(h,i),t.close(),t};const yo=Phaser.Utils.Objects.GetValue,bo=Phaser.Utils.Objects.IsPlainObject;class Co extends(Ba(Ya)){constructor(t,e,i,s,r,n,h,a){bo(e)?(e=(a=e).x,i=a.y,s=a.width,r=a.height,n=a.barColor,h=a.value):bo(s)?(s=(a=s).width,r=a.height,n=a.barColor,h=a.value):bo(n)&&(n=(a=n).barColor,h=a.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===h&&(h=0),super(t,e,i,s,r,a),this.type="rexLineProgress",this.bootProgressBase(a),this.addShape((new fo).setName("trackFill")).addShape((new fo).setName("bar")).addShape((new fo).setName("trackStroke")),this.setTrackColor(yo(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(yo(a,"trackStrokeThickness",2),yo(a,"trackStrokeColor",void 0)),this.setSkewX(yo(a,"skewX",0)),this.setRTL(yo(a,"rtl",!1)),this.setValue(h)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var So={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&mo(s,0,0,e,i,t);var r,n,h=this.getShape("bar");h.fillStyle(this.barColor),h.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),mo(h,r,0,n,i,t));var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&mo(a,0,0,e,i,t)}};Object.assign(Co.prototype,So);var Po=function(t){return null==t||""===t||0===t.length},wo=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(Po(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(Po(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,h=e.length;nFo(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=Fo(t[i]));return e}const Vo=Phaser.Utils.Objects.IsPlainObject,Bo=Phaser.Utils.Objects.GetValue;var No=function(t){return"string"==typeof t&&(t=Go[t]),t};const Go={scale:0,repeat:1};var Uo=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},Ho={_beginDraw:jt,_drawImage:jt,_drawTileSprite:jt,_endDraw:jt,setGetFrameNameCallback:function(t){return void 0===t&&(t=Wo),this.getFrameNameCallback=t,this},setBaseTexture:function(t,e,i,s){Array.isArray(e)&&(s=i,i=e,e=void 0),null==e&&(e="__BASE"),"number"==typeof i&&arguments.length>=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=Fo(i),s=Fo(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),h=n.width,a=0,o=0,l=i.length;o0?h/a:0,c=n.height,u=0;for(o=0,l=s.length;o0?0:g,b=0,o=0;for(var w=i.length;o0?0:f),f>=1&&g>=1){var x=typeof(m=this.getFrameNameCallback(o,S,e));"string"!==x&&"number"!==x||r.add(m,0,b+n.cutX,C+n.cutY,f,g)}b+=f}C+=g}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,h,a,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/o,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(u,p);if(u>v){var g=(u-v)*o;d>=0?d+=g:d=g,u=v}if(p>v){var f=(p-v)*l;c>=0?c+=f:c=f,p=v}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,C=this.rows.count;b0&&a>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(S,b)?0:1)?this._drawImage(this.textureKey,s,m,y,h,a):this._drawTileSprite(this.textureKey,s,m,y,h,a)),m+=h;y+=a}this._endDraw()},setStretchMode:function(t){return Vo(t)?(this.stretchMode.edge=No(Bo(t,"edge",0)),this.stretchMode.internal=No(Bo(t,"internal",0))):(t=No(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Uo.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const $o=Phaser.Utils.Objects.IsPlainObject,Jo=Phaser.Utils.Objects.GetValue,qo=Phaser.GameObjects;var Ko=void 0,Zo=function(t,e){if(Ko||(Ko={},ei(t).events.once("destroy",(function(){for(var t in Ko)Ko[t].destroy();Ko=void 0}))),!Ko.hasOwnProperty(e)){var i=ei(t).scene.systemScene;(t=new qo[e](i)).setOrigin(0),Ko[e]=t}return Ko[e]};const Qo=Phaser.GameObjects.RenderTexture;class tl extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if($o(i)?(i=Jo(d=i,"x",0),s=Jo(d,"y",0),r=Jo(d,"width",1),n=Jo(d,"height",1),h=Jo(d,"key",void 0),a=Jo(d,"baseFrame",void 0),o=Jo(d,"columns",void 0),l=Jo(d,"rows",void 0)):$o(r)?(r=Jo(d=r,"width",1),n=Jo(d,"height",1),h=Jo(d,"key",void 0),a=Jo(d,"baseFrame",void 0),o=Jo(d,"columns",void 0),l=Jo(d,"rows",void 0)):$o(h)?(h=Jo(d=h,"key",void 0),a=Jo(d,"baseFrame",void 0),o=Jo(d,"columns",void 0),l=Jo(d,"rows",void 0)):$o(a)?(a=Jo(d=a,"baseFrame",void 0),o=Jo(d,"columns",void 0),l=Jo(d,"rows",void 0)):Array.isArray(a)?(d=l,l=o,o=a,a=Jo(d,"baseFrame",void 0)):$o(o)&&(o=Jo(d=o,"columns",void 0),l=Jo(d,"rows",void 0)),void 0===a&&(a=Jo(d,"frame",void 0)),void 0===o){var c=Jo(d,"leftWidth",void 0),u=Jo(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=Jo(d,"topHeight",void 0),v=Jo(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(Jo(d,"getFrameNameCallback",void 0)),this.setStretchMode(Jo(d,"stretchMode",0)),this.setPreserveRatio(Jo(d,"preserveRatio",!0));var g=Jo(d,"maxFixedPartScale",1),f=Jo(d,"maxFixedPartScaleX",g),m=Jo(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(h,a,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,Ho),i}(Qo,"rexNinePatch")){}var el={_drawImage:function(t,e,i,s,r,n){var h=Zo(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=Zo(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(tl.prototype,el);class il extends si{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Oo(t,e))return t[e];var i=t.parent;return Oo(i,e)?i[e]:void 0}set(t,e,i){return Oo(t,e)?t[e]=i:Oo(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}}const sl=Phaser.Utils.Objects.GetValue;class rl extends tl{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=sl(e,"effects",!0);i&&Do(this,i),this.style=new il(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(rl.prototype,Ea);const nl=["alpha","tint","flipX","flipY"];var hl=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("barColor")?i="bar":e.hasOwnProperty("leftWidth")?i="nineSlice":e.hasOwnProperty("key")&&(i="image")),i){case"bar":s=new xo(t,e);break;case"image":s=new Io(t,e);break;case"nineSlice":s=e.hasOwnProperty("stretchMode")?new rl(t,e):new Yo(t,e);break;default:s=new ka(t,e)}return function(t,e){if(!e)return t;for(var i=0,s=nl.length;i=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const Al=Phaser.Utils.Objects.GetValue,jl=Phaser.Math.Distance.Between;class Il extends si{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=Al(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(Al(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(Al(t,"enable",!0)),this.holdThreshold=Al(t,"holdThreshold",50),this.pointerOutReleaseEnable=Al(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return cn(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:jl(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!lr(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!lr(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const Wl=Phaser.Utils.Objects.GetValue;class Fl{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(Wl(t,"value",0)),this.setSpeed(Wl(t,"speed",0)),this.setAcceleration(Wl(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class Vl{constructor(){this.value,this.dir,this.movement=new Fl}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const Ul={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},Hl=Phaser.Utils.Objects.GetValue;class $l extends si{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=Hl(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(Hl(e,"speed",.1)),this.setEnable(Hl(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(Hl(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||lr(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const Jl=Phaser.Utils.Objects.GetValue;var ql=function(t,e,i,s){var r,n,h="Y"===(i=i.toUpperCase()),a=2===t.scrollMode,o=t.childrenMap.child,l=`slider${i}`;if(r=a||s.hasOwnProperty(l)?Jl(s,l,void 0):Jl(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=h?1:0,n=function(t,e){void 0===e&&(e={});var i=yt(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new Yl(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r),n.tickLength=Jl(r,"tickLength",void 0);var p=Jl(r,"position",0);"string"==typeof p&&(p=Kl[p]);var v,g,f=Jl(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=Jl(s,"space.slider",void 0))&&(a?f=0:v=Jl(s,"space.child",0)),g=void 0===v?"number"==typeof f:"number"==typeof v,h?0===p?(d=2,c=1,u=void 0===v?g?{left:f}:f:{left:Jl(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:Jl(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:Jl(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:Jl(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=Jl(r,"hideUnscrollableSlider",!1),t[`disableUnscrollableDrag${i}`]=Jl(r,"disableUnscrollableDrag",!1),t[`adaptThumb${i}SizeMode`]=Jl(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=Jl(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`disableUnscrollableDrag${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=Jl(s,"scrollDetectionMode");"string"==typeof b&&(b=Zl[b]);var C=`scroller${i}`;(m=a||s.hasOwnProperty(C)?Jl(s,C,!0):Jl(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new Gl(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var S,P,w,x,_,O=Jl(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);O&&o&&(void 0!==b&&(O.focus=1===b?2:0),S=new $l(o,O)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,S),a&&!h||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.disableUnscrollableDrag=t[`disableUnscrollableDrag${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",S)),n&&(a?(P=h?"t":"s",x=`scroll${i}`):(P="t",x="scroll"),n.on("valuechange",(function(e){t[P]=e,t.emit(x,t)}))),y&&(a?(w=`childO${i}`,x=`scroll${i}`):(w="childOY",x="scroll"),y.on("valuechange",(function(e){t[w]=e,t.emit(x,t)}))),S&&(_=a?`addChildO${i}`:"addChildOY",S.on("scroll",(function(e){t[_](-e,!0)})))};const Kl={right:0,left:1,bottom:0,top:1},Zl={gameObject:0,rectBounds:1},Ql=Phaser.Utils.Objects.GetValue;var td=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=Ql(e,"width"),h=Ql(e,"height");n||Ql(e,"child.expandWidth",!0)||(s[1]=0),h||Ql(e,"child.expandHeight",!0)||(r[1]=0);var a=new Jh(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=qh(i,"child"),r=qh(s,"gameObject",void 0);if(r){var n=qh(i,"space.child",0);t.childMargin={};var h=t.childMargin,a={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:h.top=0,h.bottom=0,h.left=0,h.right=0;break;default:h.top=n,h.bottom=n,h.left=n,h.right=n}else switch(t.scrollMode){case 0:h.top=qh(n,"top",0),h.bottom=qh(n,"bottom",0),a.left=qh(n,"left",0),a.right=qh(n,"right",0);break;case 1:h.top=qh(n,"left",0),h.bottom=qh(n,"right",0),a.top=qh(n,"top",0),a.bottom=qh(n,"bottom",0);break;default:h.top=qh(n,"top",0),h.bottom=qh(n,"bottom",0),h.left=qh(n,"left",0),h.right=qh(n,"right",0)}e.add(r,{column:1,row:1,align:qh(s,"align","center"),padding:a,expand:{width:qh(s,"expandWidth",!0),height:qh(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:ql(t,a,"y",e);break;case 1:ql(t,a,"x",e);break;default:ql(t,a,"y",e),ql(t,a,"x",e)}return a},ed=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}i*="Y"===t?this.scaleY:this.scaleX,s&&s.setBounds(e,i),r&&(r.setEnable(e!==i),r.tickLength&&r.setTick(r.tickLength,e,i))},id=function(t){switch(this.scrollMode){case 0:case 1:(i=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(i,this.isOverflow),(r=this.childrenMap.scroller)&&this.disableUnscrollableDrag&&r.setEnable(this.isOverflow);break;default:var e=this[`isOverflow${t=t.toUpperCase()}`],i=this.childrenMap[`slider${t}`],s=this[`hideUnscrollableSlider${t}`];i&&s&&this.setChildVisible(i,e);var r=this.childrenMap.scroller,n=this[`disableUnscrollableDrag${t}`];r&&n&&r.setEnable(e)}},sd=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(a=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=a.childrenMap.track,s=a.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&nthis.topChildOY}childOYExeceedBottom(t){return void 0===t&&(t=this.childOY),tthis.leftChildOX}childOXExeceedRight(t){return void 0===t&&(t=this.childOX),tthis.childHeight?t=0:s?t=e:r&&(t=i)),this._childOY!==t&&(this._childOY=t,this.resetChildPosition()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}get childOX(){return this._childOX}set childOX(t){var e=this.leftChildOX,i=this.rightChildOX,s=this.childOXExceedLeft(t),r=this.childOXExeceedRight(t);this.clampChildOX&&(this.childVisibleWidth>this.childWidth?t=0:s?t=e:r&&(t=i)),this._childOX!==t&&(this._childOX=t,this.resetChildPosition()),s&&(this.execeedLeftState||this.emit("execeedleft",this,t,e)),this.execeedLeftState=s,r&&(this.execeedRightState||this.emit("execeedright",this,t,i)),this.execeedRightState=r}setChildOY(t){return this.childOY=t,this}setChildOX(t){return this.childOX=t,this}set t(t){this.childOY=-this.visibleHeight*t}get t(){var t=this.visibleHeight;return 0===t?0:this.childOY/-t}set s(t){this.childOX=-this.visibleWidth*t}get s(){var t=this.visibleWidth;return 0===t?0:this.childOX/-t}setChildOYByPercentage(t){return this.t=t,this}setChildOXByPercentage(t){return this.s=t,this}}Object.assign(Ld.prototype,Md);const Xd=["top","bottom","centerY","center"],Yd=["left","right","centerX","center"];var zd=function(t,e,i){var s,r="Y"===(e=e.toUpperCase()),n=this.childrenMap.child;if(r){if(i)for(var h=0,a=Xd.length;h=0?0:Math.abs(l)<=Math.abs(d)?l:d}}else{if(i)for(h=0,a=Yd.length;h=0?0:Math.abs(c)<=Math.abs(u)?c:u}}switch(this.scrollMode){case 0:case 1:this.childOY+=s;break;default:this[`childO${e}`]+=s}};const Ad=Phaser.Utils.Objects.GetValue;class jd extends ad{constructor(t,e){void 0===e&&(e={});var i=Mh(e),s=Ad(e,"panel",void 0);void 0===s&&(s={}),s.scrollMode=i,s.clampChildOY=Ad(e,"clampChildOY",!1),s.clampChildOX=Ad(e,"clampChildOX",!1);var r,n,h=new Ld(t,s);switch(t.add.existing(h),i){case 0:r=Ad(e,"expand.panel",!0),n=!0;break;case 1:r=!0,n=Ad(e,"expand.panel",!0);break;default:r=!0,n=!0}e.type="rexScrollablePanel",e.child={gameObject:h,expandWidth:r,expandHeight:n,align:Ad(e,"align.panel","center")};var a=Ad(e,"space",void 0);a&&(a.child=Ad(a,"panel",0)),super(t,e),this.addChildrenMap("panel",h.child),this.addChildrenMap("panelLayer",h.maskLayer),this.addChildrenMap("mask",h.maskGameObject),this.addChildrenMap("scrollableBlock",h)}setChildrenInteractive(t){return void 0===t&&(t={}),t.hasOwnProperty("eventEmitter")||(t.eventEmitter=this),t.hasOwnProperty("targets")||(t.targets=[this.childrenMap.panel]),Zn(this.childrenMap.child,t),this}}var Id={scrollToChild:function(t,e){if(!this.hasChild(t))return this;switch(this.scrollMode){case 0:zd.call(this,t,"y",e);break;case 1:zd.call(this,t,"x",e);break;default:zd.call(this,t,"y",e),zd.call(this,t,"x",e)}return this}};return Object.assign(jd.prototype,Id),jd},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rexscrollablepanel=e(); diff --git a/dist/rexscrollbar.js b/dist/rexscrollbar.js index 445d38fe38..9abf25bae3 100644 --- a/dist/rexscrollbar.js +++ b/dist/rexscrollbar.js @@ -14774,6 +14774,32 @@ return pathData; }; + //import CatmullRomInterpolation from '../../utils/math/interpolation/CatmullRomInterpolation.js'; + + const CatmullRomInterpolation = Phaser.Math.Interpolation.CatmullRom; + + var CatmullRomTo = function (points, iterations, pathData) { + var pathDataCnt = pathData.length; + var p0x = pathData[pathDataCnt - 2]; + var p0y = pathData[pathDataCnt - 1]; + + var xList = [p0x]; + var yList = [p0y]; + for (var i = 0, cnt = points.length; i < cnt; i += 2) { + xList.push(points[i]); + yList.push(points[i + 1]); + } + + for (var i = 1, last = iterations - 1; i <= last; i++) { + var t = i / last; + pathData.push( + CatmullRomInterpolation(xList, t), + CatmullRomInterpolation(yList, t) + ); + } + return pathData; + }; + var DuplicateLast = function (pathData) { var len = pathData.length; if (len < 2) { @@ -14885,6 +14911,18 @@ return this; }, + catmullRomTo(...points) { + CatmullRomTo( + points, + this.iterations, + this.pathData + ); + + this.lastPointX = points[points.length-2]; + this.lastPointY = points[points.length-1]; + return this; + }, + close() { // Line to first point var startX = this.pathData[0], @@ -15322,6 +15360,13 @@ return this; } + catmullRomTo(...points) { + this.builder.catmullRomTo(...points); + + this.dirty = true; + return this; + } + close() { this.builder.close(); diff --git a/dist/rexscrollbar.min.js b/dist/rexscrollbar.min.js index e0531d2ffe..9d47523193 100644 --- a/dist/rexscrollbar.min.js +++ b/dist/rexscrollbar.min.js @@ -1 +1 @@ -var t,e;t=void 0,e=function(){var t,e=!1;e||(void 0===t&&(t=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const O=Phaser.Math.DegToRad;var E={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=O(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},T={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=w(t.scaleX,i.scaleX),e.scaleY=w(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},k={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},D={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=w(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},M={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},R={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},L={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},A={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(t){void 0===t&&(t=!1);var e=this;return this._mask=null,this.setChildMaskVisible(this),this.children.forEach((function(t){t.clearMask&&t.clearMask(!1),t.hasOwnProperty("isRexContainerLite")||e.setChildMaskVisible(t)})),t&&this.mask&&this.mask.destroy(),this}},j=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},F=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const Y=Phaser.Utils.Array;var N={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Ee=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const Te=/(\S+)\[(\d+)\]/i,ke=Phaser.Utils.Objects.GetValue;var De=function(t,e){return void 0===e?t:t[e]},Me=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=ke(e,"left",0),t.right=ke(e,"right",0),t.top=ke(e,"top",0),t.bottom=ke(e,"bottom",0)),t},Re={getInnerPadding(t){return De(this.space,t)},setInnerPadding(t,e){return Me(this.space,t,e),this},getOuterPadding(t){return De(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Me(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),De(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Me(this.getSizerConfig(t).padding,e,i),this}},Le=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Ae=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},je=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},ze=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Xe=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},Fe=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Ie={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Ye=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?gi:fi,this.repeatCounter=0,this}stop(){return this.state=vi,this}update(t,e){this.state!==vi&&this.state!==yi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=mi)):(this.nowTime=this.duration,this.state=yi):this.nowTime>=0&&(this.state=gi))}get t(){var t;switch(this.state){case vi:case fi:case mi:t=0;break;case gi:t=this.nowTime/this.duration;break;case yi:t=1}return ui(t,0,1)}set t(t){(t=ui(t,-1,1))<0?(this.state=fi,this.nowTime=-this.delay*t):(this.state=gi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===vi}get isDelay(){return this.state===fi}get isCountDown(){return this.state===gi}get isRunning(){return this.state===fi||this.state===gi}get isDone(){return this.state===yi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const vi=0,fi=1,gi=2,mi=3,yi=-1;class bi extends li{constructor(t,e){super(t,e),this.timer=new pi}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const Ci=Phaser.Utils.Objects.GetValue,_i=Phaser.Utils.Objects.GetAdvancedValue,Si=Phaser.Tweens.Builders.GetEaseFunction;class Pi extends bi{resetFromJSON(t){return this.timer.resetFromJSON(Ci(t,"timer")),this.setEnable(Ci(t,"enable",!0)),this.setTarget(Ci(t,"target",this.parent)),this.setDelay(_i(t,"delay",0)),this.setDuration(_i(t,"duration",1e3)),this.setEase(Ci(t,"ease","Linear")),this.setRepeat(Ci(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Si(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const wi=Phaser.Utils.Objects.GetValue,xi=Phaser.Utils.Objects.GetAdvancedValue,Oi=Phaser.Math.Linear;let Ei=class extends Pi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(wi(t,"mode",0)),this.setScaleRange(xi(t,"start",void 0),xi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ti[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=xi(t,"x",this.parent.scaleX),this.startY=xi(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=xi(e,"x",void 0),this.endY=xi(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Oi(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Oi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const Ti={stop:0,destroy:1,yoyo:2};var ki=function(t,e,i,s,r){var n,a;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},a={x:t.scaleX};break;case 1:case"y":n={y:0},a={y:t.scaleY};break;default:n=0,a=t.scale}var h={mode:0,start:n,end:a,duration:e,ease:s};return void 0===r?r=new Ei(t,h):r.resetFromJSON(h),r.restart(),r},Di=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Ei&&(n=r,r=void 0),void 0===r&&(r=!0);var a={};switch(a.mode=r?1:0,i){case 0:case"x":a.end={x:0};break;case 1:case"y":a.end={y:0};break;default:a.end=0}return a.duration=e,a.ease=s,void 0===n?n=new Ei(t,a):n.resetFromJSON(a),n.restart(),n},Mi=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Ri=function(t){return Mi(t,"complete")};const Li=Phaser.Utils.Objects.IsPlainObject;var Ai={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Li(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=ki(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Ri(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Li(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Di(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Ri(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Ri(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Li(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var a=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,a){var h,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":h={x:t.scaleX},o={x:i};break;case 1:case"y":h={y:t.scaleX},o={y:i};break;default:h=t.scaleX,o=i}var l={mode:2,start:h,end:o,duration:e/2,ease:n,repeat:s};return void 0===a?a=new Ei(t,l):a.resetFromJSON(l),a.restart(),a}(this,t,e,i,s,r,this._scaleBehavior),a&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Ri(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},ji={};Object.assign(ji,Ai),ji.onInitScale=function(){Ai.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=be.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const zi=Phaser.Utils.Objects.GetValue,Xi=Phaser.Utils.Objects.GetAdvancedValue,Fi=Phaser.Math.Linear;class Ii extends Pi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(zi(t,"mode",0)),this.setAlphaRange(Xi(t,"start",this.parent.alpha),Xi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Yi[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Fi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Yi={stop:0,destroy:1,yoyo:2},Ni=Phaser.Utils.Objects.IsPlainObject;var Wi=function(t,e,i,s){var r,n;Ni(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var a={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Ii(t,a):s.resetFromJSON(a),s.restart(),s},Vi=function(t,e,i,s){i instanceof Ii&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Ii(t,r):s.resetFromJSON(r),s.restart(),s};const Bi=Phaser.Utils.Objects.IsPlainObject;var Gi={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Bi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Wi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Ri(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Bi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Vi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Ri(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Ri(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Ui={};Object.assign(Ui,Gi),Ui.onInitFade=function(){Gi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=be.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Hi=Phaser.Utils.Objects.GetValue,Ji=Phaser.Utils.Objects.GetAdvancedValue,$i=Phaser.Math.Linear;class qi extends Pi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Hi(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ji(t,"x",void 0),i=Ji(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Ki[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Ji(i,"startX",void 0),this.startY=Ji(i,"startY",void 0),this.endX=Ji(i,"endX",void 0),this.endY=Ji(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=$i(this.startX,this.endX,i)),this.hasMoveY&&(t.y=$i(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ki={stop:0,destroy:1,yoyo:2};var Zi=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const Qi=Phaser.Utils.Objects.IsPlainObject,ts=Phaser.Math.Distance.Between;var es={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(Qi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*ts(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var a=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,a){n instanceof qi&&(a=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=Zi(i,t.x),h.endX=t.x),void 0!==s&&(h.startY=Zi(s,t.y),h.endY=t.y),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===a?a=new qi(t,h):a.resetFromJSON(h),a.restart(),a}(this,t,e,i,s,r,this._easeMove),a&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Ri(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Ri(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(Qi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*ts(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var a=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,a){n instanceof qi&&(a=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=t.x,h.endX=Zi(i,t.x)),void 0!==s&&(h.startY=t.y,h.endY=Zi(s,t.y)),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===a?a=new qi(t,h):a.resetFromJSON(h),a.restart(),a}(this,t,e,i,s,r,this._easeMove),a&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Ri(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Ri(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},is={};Object.assign(is,es),is.onInitEaseMove=function(){es.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=be.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const ss=Phaser.Utils.Objects.GetValue;class rs extends ai{constructor(t,e){super(t,e),this.timer=new pi,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(ss(t,"timer")),this.setEnable(ss(t,"enable",!0)),this.setMode(ss(t,"mode",1)),this.isRunning=ss(t,"isRunning",!1),this.setMagnitudeMode(ss(t,"magnitudeMode",1)),this.setAxisMode(ss(t,"axis",0)),this.setDuration(ss(t,"duration",500)),this.setMagnitude(ss(t,"magnitude",10)),this.ox=ss(t,"ox",void 0),this.oy=ss(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=ns[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=hs[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=as[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=ss(i,"magnitude",void 0),t=ss(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,a=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=a;break;default:i.x=n,i.y=a}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const ns={effect:0,behavior:1},as={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},hs={constant:0,decay:1},os=Phaser.Utils.Objects.IsPlainObject;var ls={shake(t,e,i){if(os(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new rs(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Ri(this._shake)}};const ds=Phaser.Utils.Objects.GetValue,cs=Phaser.Math.Linear;class us extends Pi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=ds(t,"key","value");var i=e[this.propertyKey];return this.fromValue=ds(t,"from",i),this.toValue=ds(t,"to",i),this.setEase(ds(t,"ease",this.ease)),this.setDuration(ds(t,"duration",this.duration)),this.setRepeat(ds(t,"repeat",0)),this.setDelay(ds(t,"delay",0)),this.setRepeatDelay(ds(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=cs(this.fromValue,this.toValue,i)}}const ps=Phaser.Utils.Objects.IsPlainObject;class vs extends ei{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new us(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(ps(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(ps(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var fs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new vs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Mi(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},gs=Phaser.Utils.Array.Remove,ms={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}}var Rs={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=qe(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Ls={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=zt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=zt),this.transitOutCallback=t,this}},As={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},js={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},zs={};Object.assign(zs,Rs,Ls,As,js);const Xs=Phaser.Utils.Objects.GetValue;class Fs extends ei{constructor(t,e){super(t,e),this.setTransitInTime(Xs(e,"duration.in",200)),this.setTransitOutTime(Xs(e,"duration.out",200)),this.setTransitInCallback(Xs(e,"transitIn")),this.setTransitOutCallback(Xs(e,"transitOut")),this.oneShotMode=Xs(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Ms(this,{eventEmitter:!1,initState:Xs(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Fs.prototype,zs);var Is=function(t){if(t.parentContainer)return Is(t.parentContainer);var e=function(t){var e=t.displayList;return H(e)?e:null}(t);return e?Is(e):t};class Ys extends ei{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Is(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,a=1/i.zoom,h=r/2,o=n/2,l=r*a,d=n*a;e.x===h&&e.y===o||e.setPosition(h,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Ns=Phaser.GameObjects.Rectangle;class Ws extends Ns{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Ys(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Vs=Phaser.Utils.Objects.GetValue;class Bs extends ei{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Vs(t,"hitAreaMode",0)),this.setEnable(Vs(t,"enable",!0)),this.setStopMode(Vs(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Gs[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Gs={default:0,fullWindow:1};const Us=Phaser.Utils.Objects.GetValue;class Hs extends Ws{constructor(t,e){super(t,Us(e,"color",0),Us(e,"alpha",.8)),this.touchEventStop=new Bs(this,{hitAreaMode:1})}}var Js={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,ki(t,e)},scaleDown(t,e){Di(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Wi(t,e)},fadeOut(t,e){Vi(t,e,!1)}},$s=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Wi(t,e,t.alpha)},qs=function(t,e){Vi(t,e,!1)},Ks=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!nt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Zs=Phaser.Utils.Objects.GetValue;let Qs=class extends Fs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=tr.popUp),null==e.transitOut&&(e.transitOut=tr.scaleDown),e.destroy=Zs(e,"destroy",!0),super(t,e);var i=Zs(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Hs(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Zs(i,"transitIn",$s)),this.setCoverTransitOutCallback(Zs(i,"transitOut",qs)));var s=Zs(e,"touchOutsideClose",!1),r=Zs(e,"duration.hold",-1),n=Zs(e,"timeOutClose",r>=0),a=Zs(e,"anyTouchClose",!1);Zs(e,"manualClose",!1)&&(s=!1,a=!1,n=!1),a&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),a?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Zs(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Ks(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=tr[t]),t){case tr.popUp:t=Js.popUp;break;case tr.fadeIn:t=Js.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=tr[t]),t){case tr.scaleDown:t=Js.scaleDown;break;case tr.fadeOut:t=Js.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const tr={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var er=function(t){return t&&"function"==typeof t},ir={modal(t,e){return er(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new Qs(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},sr=function(t,e,i,s,r){er(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},rr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return sr.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return sr.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return sr.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return sr.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return sr.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return sr.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return sr.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return sr.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return sr.call(this,"shutdown",t,e,i,s),this}},nr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=ar),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},ar={},hr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,a=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return a?Ks(t,e.x,e.y,i,s):!!(r=nr(e,n,!0))&&Ks(t,r.x,r.y,i,s);for(var h=t.scene.input.manager,o=h.pointersTotal,l=h.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const yr={press:0,pointerdown:0,release:1,pointerup:1};var br={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new mr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},Cr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!_r(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,a=n.pointersTotal,h=n.pointers,o=0;o0)return Sr.length=0,!0;return Sr.length=0,!1},Sr=[];const Pr=Phaser.Utils.Objects.GetValue;class wr extends ei{constructor(t,e){super(t,e),this._enable=void 0;var i=Pr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Pr(t,"enable",!0)),this.setMode(Pr(t,"mode",1)),this.setClickInterval(Pr(t,"clickInterval",100)),this.setDragThreshold(Pr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=xr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?Cr:hr)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const xr={press:0,pointerdown:0,release:1,pointerup:1};var Or={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new wr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Er extends Ds{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Tr=Phaser.Utils.Objects.GetValue;class kr extends ei{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Er,this.parent.setInteractive(Tr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Tr(t,"enable",!0)),this.setCooldown(Tr(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Dr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&hr(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new kr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new kr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Mr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Rr=function(t,e,i,s){if("parent"===t){for(var r,n=0,a=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Jr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===$r&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Jr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=qr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&hr(t,s,e,i)}}const Jr=0,$r=1,qr="IDLE",Kr=Phaser.Utils.Objects.GetValue,Zr=Phaser.Math.Distance.Between;class Qr extends Hr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=tn},eventEmitter:!1};this.setRecongizedStateObject(new Ds(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Kr(t,"time",250)),this.setTapInterval(Kr(t,"tapInterval",200)),this.setDragThreshold(Kr(t,"threshold",9)),this.setTapOffset(Kr(t,"tapOffset",10));var e=Kr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Kr(t,"maxTaps",void 0)),this.setMinTaps(Kr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case tn:this.state=en;break;case en:var t=this.lastPointer;Zr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=sn,this.state=en);break;case sn:this.state=en}}onDragEnd(){this.state===en&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=sn))}onDrag(){this.state!==tn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=tn)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===en){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=tn):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=sn:this.state=tn)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===sn&&(this.state=tn)}get isTapped(){return this.state===sn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const tn="IDLE",en="BEGIN",sn="RECOGNIZED",rn=Phaser.Utils.Objects.GetValue;class nn extends Hr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=an},eventEmitter:!1};this.setRecongizedStateObject(new Ds(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(rn(t,"threshold",9)),this.setHoldTime(rn(t,"time",251)),this}onDragStart(){this.state=hn,0===this.holdTime&&(this.state=on)}onDragEnd(){this.state=an}onDrag(){this.state!==an&&this.pointer.getDistance()>this.dragThreshold&&(this.state=an)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===hn&&t-this.pointer.downTime>=this.holdTime&&(this.state=on)}get isPressed(){return this.state===on}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const an="IDLE",hn="BEGIN",on="RECOGNIZED";Phaser.Utils.Objects.GetValue;const ln=Phaser.Math.Distance.Between,dn=Phaser.Math.Angle.Between;var cn={getDt:function(){var t;return t=this.scene,Qe(t).loop.delta},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return ln(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return dn(e.x,e.y,t.x,t.y)}},un={"up&down":0,"left&right":1,"4dir":2,"8dir":3},pn={};const vn=Phaser.Utils.Objects.GetValue,fn=Phaser.Math.RadToDeg;class gn extends Hr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=mn},eventEmitter:!1};this.setRecongizedStateObject(new Ds(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(vn(t,"threshold",10)),this.setVelocityThreshold(vn(t,"velocityThreshold",1e3)),this.setDirectionMode(vn(t,"dir","8dir")),this}onDragStart(){this.state=yn}onDragEnd(){this.state=mn}onDrag(){this.state===yn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=bn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===bn&&(this.state=mn)}get isSwiped(){return this.state===bn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=un[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=pn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(fn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(gn.prototype,cn);const mn="IDLE",yn="BEGIN",bn="RECOGNIZED",Cn=Phaser.Utils.Objects.GetValue,_n=Phaser.Utils.Array.SpliceOne,Sn=Phaser.Math.Distance.Between,Pn=Phaser.Math.Angle.Between;class wn{constructor(t,e){var i=qe(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(Cn(e,"inputConfig",void 0)),this.setEventEmitter(Cn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(Cn(t,"enable",!0)),this.bounds=Cn(t,"bounds",void 0),this.tracerState=On,this.pointers.length=0,gt(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,gt(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case On:this.tracerState=En,this.onDrag1Start();break;case En:this.tracerState=Tn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],_n(this.pointers,e),this.tracerState){case En:this.tracerState=On,this.onDrag1End();break;case Tn:this.tracerState=En,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case En:this.onDrag1();break;case Tn:this.onDrag2()}}}dragCancel(){return this.tracerState===Tn&&this.onDrag2End(),this.pointers.length=0,gt(this.movedState),this.tracerState=On,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0],e=this.pointers[1];return Sn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0],e=this.pointers[1];return Pn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;xn.x=e.x-i.x,xn.y=e.y-i.y}else xn.x=0,xn.y=0;return xn}get centerX(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Tn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Tn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=kn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&hr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&hr(t,s,e,i)}}Object.assign(wn.prototype,He);var xn={};const On=0,En=1,Tn=2,kn="IDLE";Phaser.Utils.Objects.GetValue;const Dn=Phaser.Math.RotateAround;var Mn=function(t,e,i,s){return Dn(t,e,i,s),t.rotation+=s,t},Rn={};const Ln=Phaser.Utils.Objects.GetValue,An=Phaser.Math.Angle.WrapDegrees,jn=Phaser.Math.Angle.ShortestBetween,zn=Phaser.Math.RadToDeg,Xn=Phaser.Math.DegToRad;var Fn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Rn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,a=r.y,h=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=An(zn(this.angleBetween));this.angle=jn(this.prevAngle,t),this.prevAngle=t,this.state=Nn}break;case Nn:t=An(zn(this.angleBetween)),this.angle=jn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Nn}get rotation(){return Xn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Fn);const In="IDLE",Yn="BEGIN",Nn="RECOGNIZED",Wn=Phaser.Utils.Objects.GetValue;var Vn=function(t){var e=Wn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new Qr(this,e),this._tap.on("tap",(function(t,e,s){Lr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Lr(i.eventEmitter,`${i.eventNamePrefix}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Bn=Phaser.Utils.Objects.GetValue;var Gn=function(t){var e=Bn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new nn(this,e),this._press.on("pressstart",(function(t,e,s){Lr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this).on("pressend",(function(t,e,s){Lr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Un=Phaser.Utils.Objects.GetValue;var Hn=function(t){var e=Un(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new gn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Lr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Lr(i.eventEmitter,`${i.eventNamePrefix}swipe`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Jn=Phaser.Utils.Objects.GetValue;var $n=function(t,e){return t.setInteractive(),Jn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Jn(e,"targets",[t]),targetMode:Jn(e,"targetMode","parent"),eventEmitter:Jn(e,"eventEmitter",t),eventNamePrefix:Jn(e,"inputEventPrefix","child.")},jr.call(t,e),Fr.call(t,e),Nr.call(t,e),Gr.call(t,e),Vn.call(t,e),Gn.call(t,e),Hn.call(t,e),t},qn={getSizerConfig:function(t){return void 0===t&&(t=this),kt(t)},getChildPrevState:function(t){var e=kt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Rt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,a,h=t.scene;if("number"==typeof e)i=e;else{i=he(e,"color"),s=he(e,"lineWidth");var o=he(e,"name",!1);o&&(r=he(o,"createTextCallback",de),n=he(o,"createTextCallbackScope",void 0),"string"==typeof(a=he(o,"align","left-top"))&&(a=jt[a]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new oe(h),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}var d,c,u=this.getAllShownChildren([this]);ce(u,u);for(var p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=a)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=a+1),r};const na=Phaser.Utils.Objects.IsPlainObject,aa=Phaser.Utils.Objects.GetValue,ha=Phaser.Display.Align.CENTER,oa={min:0,full:-1};var la=function(t,e,i,s,r,n,a,h,o,l){var d,c,u,p;ge.call(this,t);var v=t.isRexSpace,f=typeof e;if(null===e)return this;if("number"===f);else if("string"===f)e=oa[e];else if(na(e)){var g;e=aa(g=e,"proportion",void 0),i=aa(g,"align",ha),s=aa(g,"padding",0),r=aa(g,"expand",!1),n=aa(g,"key",void 0),a=aa(g,"index",void 0),t.isRexSizer||(h=aa(g,"minWidth",void 0),o=aa(g,"minHeight",void 0)),l=aa(g,"fitRatio",0),d=aa(g,"offsetX",0),c=aa(g,"offsetY",0),u=aa(g,"offsetOriginX",0),p=aa(g,"offsetOriginY",0)}return"string"==typeof i&&(i=jt[i]),void 0===e&&(e=v?1:0),void 0===i&&(i=ha),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===h&&(v?h=0:t.isRexSizer||(h=t._minWidth)),void 0===o&&(v?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),(g=this.getSizerConfig(t)).proportion=e,g.align=i,g.padding=ve(s),g.expand=r,g.fitRatio=0===e?l:0,g.alignOffsetX=d,g.alignOffsetY=c,g.alignOffsetOriginX=u,g.alignOffsetOriginY=p,void 0===a||a>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(a,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===h?Q(t):h:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=h)),void 0!==n&&this.addChildrenMap(n,t),this},da={add:la,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),la.call(this,new sa(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,h){return na(i)&&(i.index=t),la.call(this,e,i,s,r,n,a,t,h),this},insertAtPosition(t,e,i,s,r,n,a,h,o){var l=ra.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,h,o),this}};const ca=Tt.prototype.clear;var ua=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),ca.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,ua.call(this,t),this}},fa={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=jt[e]),this.getSizerConfig(t).align=e,this}},ga={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},ma={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},ya={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},ba={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,h=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=h.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,a+=n)));else for(d=0,c=h.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,a+=n)))}return o?void 0:a+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,a=s.padding;i=n-(a.left+a.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,a=s.padding;i=n-(a.top+a.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Ve(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Ye.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,h,o,l,d,c,u=this.sizerChildren,p=this.innerLeft,v=this.innerTop,f=this.innerWidth,g=this.innerHeight,m=p,y=v,b=this.startChildIndex,C=0,_=u.length;C<_;C++)c=0===b?C:ta(C+b,0,_),this.rtl&&(c=_-c-1),(t=u[c]).rexSizer.hidden||(i=(e=t.rexSizer).padding,ur.call(this,t),t.isRexSpace?(l=0,d=0):(l=this.getExpandedChildWidth(t),d=this.getExpandedChildHeight(t)),t.isRexSizer?(t.runLayout(this,l,d),Qn(t,this)):Ve(t,l,d),void 0===l&&(l=Q(t)),void 0===d&&(d=tt(t)),0===this.orientation?(s=m+i.left*this.scaleX,n=0===e.proportion||0===this.proportionLength?l:e.proportion*this.proportionLength,r=y+i.top*this.scaleY,a=g-(i.top+i.bottom)*this.scaleY):(s=m+i.left*this.scaleX,n=f-(i.left+i.right)*this.scaleX,r=y+i.top*this.scaleY,a=0===e.proportion||0===this.proportionLength?d:e.proportion*this.proportionLength),void 0===l&&(l=Q(t)),void 0===d&&(d=tt(t)),h=(e.alignOffsetX+e.alignOffsetOriginX*l)*this.scaleX,o=(e.alignOffsetY+e.alignOffsetOriginY*d)*this.scaleY,pr.call(this,t,s,r,n,a,e.align,h,o),0===this.orientation?m+=n+(i.left+i.right)*this.scaleX+this.space.item*this.scaleX:y+=a+(i.top+i.bottom)*this.scaleY+this.space.item*this.scaleY)},resolveWidth:function(t){if(void 0!==(t=Le.call(this,t))&&0===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenWidth;e>0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=ze.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Ae.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&ea.call(this,t,void 0),je.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Xe.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&ea.call(this,void 0,t),Fe.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],a=n&&n.isRexSpace;return"center"===t?a||this.insertSpace(r+1):a&&this.remove(n,!0),this}};Object.assign(ba,da,va,fa,ga,ma,ya);var Ca=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},_a={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const Sa=Phaser.Utils.Objects.IsPlainObject,Pa=Phaser.Utils.Objects.GetValue;class wa extends Zn{constructor(t,e,i,s,r,n,a){Sa(e)?(e=Pa(a=e,"x",0),i=Pa(a,"y",0),s=Pa(a,"width",void 0),r=Pa(a,"height",void 0),n=Pa(a,"orientation",0)):Sa(s)?(s=Pa(a=s,"width",void 0),r=Pa(a,"height",void 0),n=Pa(a,"orientation",0)):Sa(n)&&(n=Pa(a=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,a),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Pa(a,"space.item",0)),this.setStartChildIndex(Pa(a,"startChildIndex",0)),this.setRTL(Pa(a,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=_a[t]),t}(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=Ca.call(this)),this._childrenProportion}}Object.assign(wa.prototype,ba);var xa=Phaser.Renderer.WebGL.Utils,Oa=function(t,e,i,s,r,n){for(var a=xa.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),h=i.pathData,o=i.pathIndexes,l=0;l>>16,h=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+a+","+h+","+o+","+n+")"},Ma=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,a=(16711680&r)>>>16,h=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+a+","+h+","+o+","+n+")",t.lineWidth=e.lineWidth};const Ra=Phaser.Renderer.Canvas.SetTransform;var La={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=ka(e,i,s),a=r.calcMatrix.copyFrom(n.calc),h=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&Oa(r,a,e,l,h,o),e.isStroked&&Ta(r,e,l,h,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(Ra(t,r,e,i,s)){var n=e._displayOriginX,a=e._displayOriginY,h=e.pathData,o=h.length-1,l=h[0]-n,d=h[1]-a;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(ja.prototype,La);const za=Phaser.Utils.Objects.GetValue;let Xa=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=za(t,"x",0),i=za(t,"y",0));var s=this.cornerRadius;s.tl=Fa(za(t,"tl",void 0),e,i),s.tr=Fa(za(t,"tr",void 0),e,i),s.bl=Fa(za(t,"bl",void 0),e,i),s.br=Fa(za(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Ia(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Ia(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Ia(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Ia(this.cornerRadius.br,t)}};var Fa=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Ya(t),t},Ia=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=za(e,"x",0),t.y=za(e,"y",0)),Ya(t)},Ya=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},Na=function(t){return t.x>0&&t.y>0},Wa=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const Va=Phaser.Math.DegToRad;var Ba=function(t,e,i,s,r,n,a,h,o){a&&n>r?n-=360:!a&&n0,a=0,h=e.length;a=0?t.startAt(a+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(a+n,i):t.startAt(a,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(a,i),t.close(),t};const Vh=Phaser.Utils.Objects.GetValue,Bh=Phaser.Utils.Objects.IsPlainObject;class Gh extends(gh(oh)){constructor(t,e,i,s,r,n,a,h){Bh(e)?(e=(h=e).x,i=h.y,s=h.width,r=h.height,n=h.barColor,a=h.value):Bh(s)?(s=(h=s).width,r=h.height,n=h.barColor,a=h.value):Bh(n)&&(n=(h=n).barColor,a=h.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===a&&(a=0),super(t,e,i,s,r,h),this.type="rexLineProgress",this.bootProgressBase(h),this.addShape((new Nh).setName("trackFill")).addShape((new Nh).setName("bar")).addShape((new Nh).setName("trackStroke")),this.setTrackColor(Vh(h,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(Vh(h,"trackStrokeThickness",2),Vh(h,"trackStrokeColor",void 0)),this.setSkewX(Vh(h,"skewX",0)),this.setRTL(Vh(h,"rtl",!1)),this.setValue(a)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var Uh={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&Wh(s,0,0,e,i,t);var r,n,a=this.getShape("bar");a.fillStyle(this.barColor),a.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),Wh(a,r,0,n,i,t));var h=this.getShape("trackStroke");h.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),h.isStroked&&Wh(h,0,0,e,i,t)}};Object.assign(Gh.prototype,Uh);var Hh=function(t){return null==t||""===t||0===t.length},Jh=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(Hh(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(Hh(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,a=e.length;npo(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=po(t[i]));return e}const vo=Phaser.Utils.Objects.IsPlainObject,fo=Phaser.Utils.Objects.GetValue;var go=function(t){return"string"==typeof t&&(t=mo[t]),t};const mo={scale:0,repeat:1};var yo=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},bo={_beginDraw:zt,_drawImage:zt,_drawTileSprite:zt,_endDraw:zt,setGetFrameNameCallback:function(t){return void 0===t&&(t=uo),this.getFrameNameCallback=t,this},setBaseTexture:function(t,e,i,s){Array.isArray(e)&&(s=i,i=e,e=void 0),null==e&&(e="__BASE"),"number"==typeof i&&arguments.length>=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=po(i),s=po(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),a=n.width,h=0,o=0,l=i.length;o0?a/h:0,c=n.height,u=0;for(o=0,l=s.length;o0?0:f,b=0,o=0;for(var P=i.length;o0?0:g),g>=1&&f>=1){var w=typeof(m=this.getFrameNameCallback(o,_,e));"string"!==w&&"number"!==w||r.add(m,0,b+n.cutX,C+n.cutY,g,f)}b+=g}C+=f}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,a,h,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/o,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(u,p);if(u>v){var f=(u-v)*o;d>=0?d+=f:d=f,u=v}if(p>v){var g=(p-v)*l;c>=0?c+=g:c=g,p=v}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,C=this.rows.count;b0&&h>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(_,b)?0:1)?this._drawImage(this.textureKey,s,m,y,a,h):this._drawTileSprite(this.textureKey,s,m,y,a,h)),m+=a;y+=h}this._endDraw()},setStretchMode:function(t){return vo(t)?(this.stretchMode.edge=go(fo(t,"edge",0)),this.stretchMode.internal=go(fo(t,"internal",0))):(t=go(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return yo.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const Co=Phaser.Utils.Objects.IsPlainObject,_o=Phaser.Utils.Objects.GetValue,So=Phaser.GameObjects;var Po=void 0,wo=function(t,e){if(Po||(Po={},Qe(t).events.once("destroy",(function(){for(var t in Po)Po[t].destroy();Po=void 0}))),!Po.hasOwnProperty(e)){var i=Qe(t).scene.systemScene;(t=new So[e](i)).setOrigin(0),Po[e]=t}return Po[e]};const xo=Phaser.GameObjects.RenderTexture;class Oo extends(function(t,e){class i extends t{constructor(t,i,s,r,n,a,h,o,l,d){if(Co(i)?(i=_o(d=i,"x",0),s=_o(d,"y",0),r=_o(d,"width",1),n=_o(d,"height",1),a=_o(d,"key",void 0),h=_o(d,"baseFrame",void 0),o=_o(d,"columns",void 0),l=_o(d,"rows",void 0)):Co(r)?(r=_o(d=r,"width",1),n=_o(d,"height",1),a=_o(d,"key",void 0),h=_o(d,"baseFrame",void 0),o=_o(d,"columns",void 0),l=_o(d,"rows",void 0)):Co(a)?(a=_o(d=a,"key",void 0),h=_o(d,"baseFrame",void 0),o=_o(d,"columns",void 0),l=_o(d,"rows",void 0)):Co(h)?(h=_o(d=h,"baseFrame",void 0),o=_o(d,"columns",void 0),l=_o(d,"rows",void 0)):Array.isArray(h)?(d=l,l=o,o=h,h=_o(d,"baseFrame",void 0)):Co(o)&&(o=_o(d=o,"columns",void 0),l=_o(d,"rows",void 0)),void 0===h&&(h=_o(d,"frame",void 0)),void 0===o){var c=_o(d,"leftWidth",void 0),u=_o(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=_o(d,"topHeight",void 0),v=_o(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(_o(d,"getFrameNameCallback",void 0)),this.setStretchMode(_o(d,"stretchMode",0)),this.setPreserveRatio(_o(d,"preserveRatio",!0));var f=_o(d,"maxFixedPartScale",1),g=_o(d,"maxFixedPartScaleX",f),m=_o(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(g,m),this.setBaseTexture(a,h,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,bo),i}(xo,"rexNinePatch")){}var Eo={_drawImage:function(t,e,i,s,r,n){var a=wo(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(a,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var a=wo(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(a,i,s)}};Object.assign(Oo.prototype,Eo);class To extends ei{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Kh(t,e))return t[e];var i=t.parent;return Kh(i,e)?i[e]:void 0}set(t,e,i){return Kh(t,e)?t[e]=i:Kh(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}}const ko=Phaser.Utils.Objects.GetValue;class Do extends Oo{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=ko(e,"effects",!0);i&&io(this,i),this.style=new To(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Do.prototype,th);const Mo=["alpha","tint","flipX","flipY"];var Ro=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("barColor")?i="bar":e.hasOwnProperty("leftWidth")?i="nineSlice":e.hasOwnProperty("key")&&(i="image")),i){case"bar":s=new $h(t,e);break;case"image":s=new co(t,e);break;case"nineSlice":s=e.hasOwnProperty("stretchMode")?new Do(t,e):new ao(t,e);break;default:s=new eh(t,e)}return function(t,e){if(!e)return t;for(var i=0,s=Mo.length;i=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const O=Phaser.Math.DegToRad;var E={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=O(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},T={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=w(t.scaleX,i.scaleX),e.scaleY=w(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},k={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},D={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=w(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},M={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},R={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},L={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},A={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(t){void 0===t&&(t=!1);var e=this;return this._mask=null,this.setChildMaskVisible(this),this.children.forEach((function(t){t.clearMask&&t.clearMask(!1),t.hasOwnProperty("isRexContainerLite")||e.setChildMaskVisible(t)})),t&&this.mask&&this.mask.destroy(),this}},j=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},F=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const Y=Phaser.Utils.Array;var N={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Ee=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const Te=/(\S+)\[(\d+)\]/i,ke=Phaser.Utils.Objects.GetValue;var De=function(t,e){return void 0===e?t:t[e]},Me=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=ke(e,"left",0),t.right=ke(e,"right",0),t.top=ke(e,"top",0),t.bottom=ke(e,"bottom",0)),t},Re={getInnerPadding(t){return De(this.space,t)},setInnerPadding(t,e){return Me(this.space,t,e),this},getOuterPadding(t){return De(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Me(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),De(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Me(this.getSizerConfig(t).padding,e,i),this}},Le=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Ae=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},je=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},ze=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Xe=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},Fe=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Ie={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Ye=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?gi:fi,this.repeatCounter=0,this}stop(){return this.state=vi,this}update(t,e){this.state!==vi&&this.state!==yi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=mi)):(this.nowTime=this.duration,this.state=yi):this.nowTime>=0&&(this.state=gi))}get t(){var t;switch(this.state){case vi:case fi:case mi:t=0;break;case gi:t=this.nowTime/this.duration;break;case yi:t=1}return ci(t,0,1)}set t(t){(t=ci(t,-1,1))<0?(this.state=fi,this.nowTime=-this.delay*t):(this.state=gi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===vi}get isDelay(){return this.state===fi}get isCountDown(){return this.state===gi}get isRunning(){return this.state===fi||this.state===gi}get isDone(){return this.state===yi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const vi=0,fi=1,gi=2,mi=3,yi=-1;class bi extends li{constructor(t,e){super(t,e),this.timer=new pi}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const Ci=Phaser.Utils.Objects.GetValue,_i=Phaser.Utils.Objects.GetAdvancedValue,Si=Phaser.Tweens.Builders.GetEaseFunction;class Pi extends bi{resetFromJSON(t){return this.timer.resetFromJSON(Ci(t,"timer")),this.setEnable(Ci(t,"enable",!0)),this.setTarget(Ci(t,"target",this.parent)),this.setDelay(_i(t,"delay",0)),this.setDuration(_i(t,"duration",1e3)),this.setEase(Ci(t,"ease","Linear")),this.setRepeat(Ci(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Si(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const wi=Phaser.Utils.Objects.GetValue,xi=Phaser.Utils.Objects.GetAdvancedValue,Oi=Phaser.Math.Linear;let Ei=class extends Pi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(wi(t,"mode",0)),this.setScaleRange(xi(t,"start",void 0),xi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ti[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=xi(t,"x",this.parent.scaleX),this.startY=xi(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=xi(e,"x",void 0),this.endY=xi(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Oi(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Oi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const Ti={stop:0,destroy:1,yoyo:2};var ki=function(t,e,i,s,r){var n,a;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},a={x:t.scaleX};break;case 1:case"y":n={y:0},a={y:t.scaleY};break;default:n=0,a=t.scale}var h={mode:0,start:n,end:a,duration:e,ease:s};return void 0===r?r=new Ei(t,h):r.resetFromJSON(h),r.restart(),r},Di=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Ei&&(n=r,r=void 0),void 0===r&&(r=!0);var a={};switch(a.mode=r?1:0,i){case 0:case"x":a.end={x:0};break;case 1:case"y":a.end={y:0};break;default:a.end=0}return a.duration=e,a.ease=s,void 0===n?n=new Ei(t,a):n.resetFromJSON(a),n.restart(),n},Mi=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Ri=function(t){return Mi(t,"complete")};const Li=Phaser.Utils.Objects.IsPlainObject;var Ai={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Li(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=ki(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Ri(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Li(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Di(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Ri(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Ri(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Li(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var a=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,a){var h,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":h={x:t.scaleX},o={x:i};break;case 1:case"y":h={y:t.scaleX},o={y:i};break;default:h=t.scaleX,o=i}var l={mode:2,start:h,end:o,duration:e/2,ease:n,repeat:s};return void 0===a?a=new Ei(t,l):a.resetFromJSON(l),a.restart(),a}(this,t,e,i,s,r,this._scaleBehavior),a&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Ri(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},ji={};Object.assign(ji,Ai),ji.onInitScale=function(){Ai.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=be.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const zi=Phaser.Utils.Objects.GetValue,Xi=Phaser.Utils.Objects.GetAdvancedValue,Fi=Phaser.Math.Linear;class Ii extends Pi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(zi(t,"mode",0)),this.setAlphaRange(Xi(t,"start",this.parent.alpha),Xi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Yi[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Fi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Yi={stop:0,destroy:1,yoyo:2},Ni=Phaser.Utils.Objects.IsPlainObject;var Wi=function(t,e,i,s){var r,n;Ni(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var a={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Ii(t,a):s.resetFromJSON(a),s.restart(),s},Vi=function(t,e,i,s){i instanceof Ii&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Ii(t,r):s.resetFromJSON(r),s.restart(),s};const Bi=Phaser.Utils.Objects.IsPlainObject;var Gi={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Bi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Wi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Ri(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Bi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Vi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Ri(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Ri(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Ui={};Object.assign(Ui,Gi),Ui.onInitFade=function(){Gi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=be.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Hi=Phaser.Utils.Objects.GetValue,Ji=Phaser.Utils.Objects.GetAdvancedValue,$i=Phaser.Math.Linear;class qi extends Pi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Hi(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ji(t,"x",void 0),i=Ji(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Ki[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Ji(i,"startX",void 0),this.startY=Ji(i,"startY",void 0),this.endX=Ji(i,"endX",void 0),this.endY=Ji(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=$i(this.startX,this.endX,i)),this.hasMoveY&&(t.y=$i(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ki={stop:0,destroy:1,yoyo:2};var Zi=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const Qi=Phaser.Utils.Objects.IsPlainObject,ts=Phaser.Math.Distance.Between;var es={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(Qi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*ts(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var a=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,a){n instanceof qi&&(a=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=Zi(i,t.x),h.endX=t.x),void 0!==s&&(h.startY=Zi(s,t.y),h.endY=t.y),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===a?a=new qi(t,h):a.resetFromJSON(h),a.restart(),a}(this,t,e,i,s,r,this._easeMove),a&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Ri(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Ri(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(Qi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*ts(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var a=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,a){n instanceof qi&&(a=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=t.x,h.endX=Zi(i,t.x)),void 0!==s&&(h.startY=t.y,h.endY=Zi(s,t.y)),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===a?a=new qi(t,h):a.resetFromJSON(h),a.restart(),a}(this,t,e,i,s,r,this._easeMove),a&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Ri(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Ri(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},is={};Object.assign(is,es),is.onInitEaseMove=function(){es.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=be.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const ss=Phaser.Utils.Objects.GetValue;class rs extends ai{constructor(t,e){super(t,e),this.timer=new pi,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(ss(t,"timer")),this.setEnable(ss(t,"enable",!0)),this.setMode(ss(t,"mode",1)),this.isRunning=ss(t,"isRunning",!1),this.setMagnitudeMode(ss(t,"magnitudeMode",1)),this.setAxisMode(ss(t,"axis",0)),this.setDuration(ss(t,"duration",500)),this.setMagnitude(ss(t,"magnitude",10)),this.ox=ss(t,"ox",void 0),this.oy=ss(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=ns[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=hs[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=as[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=ss(i,"magnitude",void 0),t=ss(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,a=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=a;break;default:i.x=n,i.y=a}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const ns={effect:0,behavior:1},as={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},hs={constant:0,decay:1},os=Phaser.Utils.Objects.IsPlainObject;var ls={shake(t,e,i){if(os(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new rs(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Ri(this._shake)}};const ds=Phaser.Utils.Objects.GetValue,us=Phaser.Math.Linear;class cs extends Pi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=ds(t,"key","value");var i=e[this.propertyKey];return this.fromValue=ds(t,"from",i),this.toValue=ds(t,"to",i),this.setEase(ds(t,"ease",this.ease)),this.setDuration(ds(t,"duration",this.duration)),this.setRepeat(ds(t,"repeat",0)),this.setDelay(ds(t,"delay",0)),this.setRepeatDelay(ds(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=us(this.fromValue,this.toValue,i)}}const ps=Phaser.Utils.Objects.IsPlainObject;class vs extends ei{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new cs(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(ps(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(ps(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var fs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new vs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Mi(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},gs=Phaser.Utils.Array.Remove,ms={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}}var Rs={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=qe(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Ls={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=zt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=zt),this.transitOutCallback=t,this}},As={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},js={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},zs={};Object.assign(zs,Rs,Ls,As,js);const Xs=Phaser.Utils.Objects.GetValue;class Fs extends ei{constructor(t,e){super(t,e),this.setTransitInTime(Xs(e,"duration.in",200)),this.setTransitOutTime(Xs(e,"duration.out",200)),this.setTransitInCallback(Xs(e,"transitIn")),this.setTransitOutCallback(Xs(e,"transitOut")),this.oneShotMode=Xs(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Ms(this,{eventEmitter:!1,initState:Xs(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Fs.prototype,zs);var Is=function(t){if(t.parentContainer)return Is(t.parentContainer);var e=function(t){var e=t.displayList;return H(e)?e:null}(t);return e?Is(e):t};class Ys extends ei{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Is(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,a=1/i.zoom,h=r/2,o=n/2,l=r*a,d=n*a;e.x===h&&e.y===o||e.setPosition(h,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Ns=Phaser.GameObjects.Rectangle;class Ws extends Ns{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Ys(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Vs=Phaser.Utils.Objects.GetValue;class Bs extends ei{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Vs(t,"hitAreaMode",0)),this.setEnable(Vs(t,"enable",!0)),this.setStopMode(Vs(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Gs[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Gs={default:0,fullWindow:1};const Us=Phaser.Utils.Objects.GetValue;class Hs extends Ws{constructor(t,e){super(t,Us(e,"color",0),Us(e,"alpha",.8)),this.touchEventStop=new Bs(this,{hitAreaMode:1})}}var Js={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,ki(t,e)},scaleDown(t,e){Di(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Wi(t,e)},fadeOut(t,e){Vi(t,e,!1)}},$s=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Wi(t,e,t.alpha)},qs=function(t,e){Vi(t,e,!1)},Ks=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!nt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Zs=Phaser.Utils.Objects.GetValue;let Qs=class extends Fs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=tr.popUp),null==e.transitOut&&(e.transitOut=tr.scaleDown),e.destroy=Zs(e,"destroy",!0),super(t,e);var i=Zs(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Hs(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Zs(i,"transitIn",$s)),this.setCoverTransitOutCallback(Zs(i,"transitOut",qs)));var s=Zs(e,"touchOutsideClose",!1),r=Zs(e,"duration.hold",-1),n=Zs(e,"timeOutClose",r>=0),a=Zs(e,"anyTouchClose",!1);Zs(e,"manualClose",!1)&&(s=!1,a=!1,n=!1),a&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),a?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Zs(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Ks(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=tr[t]),t){case tr.popUp:t=Js.popUp;break;case tr.fadeIn:t=Js.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=tr[t]),t){case tr.scaleDown:t=Js.scaleDown;break;case tr.fadeOut:t=Js.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const tr={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var er=function(t){return t&&"function"==typeof t},ir={modal(t,e){return er(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new Qs(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},sr=function(t,e,i,s,r){er(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},rr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return sr.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return sr.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return sr.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return sr.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return sr.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return sr.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return sr.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return sr.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return sr.call(this,"shutdown",t,e,i,s),this}},nr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=ar),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},ar={},hr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,a=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return a?Ks(t,e.x,e.y,i,s):!!(r=nr(e,n,!0))&&Ks(t,r.x,r.y,i,s);for(var h=t.scene.input.manager,o=h.pointersTotal,l=h.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const yr={press:0,pointerdown:0,release:1,pointerup:1};var br={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new mr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},Cr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!_r(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,a=n.pointersTotal,h=n.pointers,o=0;o0)return Sr.length=0,!0;return Sr.length=0,!1},Sr=[];const Pr=Phaser.Utils.Objects.GetValue;class wr extends ei{constructor(t,e){super(t,e),this._enable=void 0;var i=Pr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Pr(t,"enable",!0)),this.setMode(Pr(t,"mode",1)),this.setClickInterval(Pr(t,"clickInterval",100)),this.setDragThreshold(Pr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=xr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?Cr:hr)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const xr={press:0,pointerdown:0,release:1,pointerup:1};var Or={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new wr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Er extends Ds{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Tr=Phaser.Utils.Objects.GetValue;class kr extends ei{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Er,this.parent.setInteractive(Tr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Tr(t,"enable",!0)),this.setCooldown(Tr(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Dr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&hr(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new kr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new kr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Mr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Rr=function(t,e,i,s){if("parent"===t){for(var r,n=0,a=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Jr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===$r&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Jr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=qr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&hr(t,s,e,i)}}const Jr=0,$r=1,qr="IDLE",Kr=Phaser.Utils.Objects.GetValue,Zr=Phaser.Math.Distance.Between;class Qr extends Hr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=tn},eventEmitter:!1};this.setRecongizedStateObject(new Ds(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Kr(t,"time",250)),this.setTapInterval(Kr(t,"tapInterval",200)),this.setDragThreshold(Kr(t,"threshold",9)),this.setTapOffset(Kr(t,"tapOffset",10));var e=Kr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Kr(t,"maxTaps",void 0)),this.setMinTaps(Kr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case tn:this.state=en;break;case en:var t=this.lastPointer;Zr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=sn,this.state=en);break;case sn:this.state=en}}onDragEnd(){this.state===en&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=sn))}onDrag(){this.state!==tn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=tn)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===en){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=tn):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=sn:this.state=tn)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===sn&&(this.state=tn)}get isTapped(){return this.state===sn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const tn="IDLE",en="BEGIN",sn="RECOGNIZED",rn=Phaser.Utils.Objects.GetValue;class nn extends Hr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=an},eventEmitter:!1};this.setRecongizedStateObject(new Ds(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(rn(t,"threshold",9)),this.setHoldTime(rn(t,"time",251)),this}onDragStart(){this.state=hn,0===this.holdTime&&(this.state=on)}onDragEnd(){this.state=an}onDrag(){this.state!==an&&this.pointer.getDistance()>this.dragThreshold&&(this.state=an)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===hn&&t-this.pointer.downTime>=this.holdTime&&(this.state=on)}get isPressed(){return this.state===on}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const an="IDLE",hn="BEGIN",on="RECOGNIZED";Phaser.Utils.Objects.GetValue;const ln=Phaser.Math.Distance.Between,dn=Phaser.Math.Angle.Between;var un={getDt:function(){var t;return t=this.scene,Qe(t).loop.delta},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return ln(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return dn(e.x,e.y,t.x,t.y)}},cn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},pn={};const vn=Phaser.Utils.Objects.GetValue,fn=Phaser.Math.RadToDeg;class gn extends Hr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=mn},eventEmitter:!1};this.setRecongizedStateObject(new Ds(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(vn(t,"threshold",10)),this.setVelocityThreshold(vn(t,"velocityThreshold",1e3)),this.setDirectionMode(vn(t,"dir","8dir")),this}onDragStart(){this.state=yn}onDragEnd(){this.state=mn}onDrag(){this.state===yn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=bn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===bn&&(this.state=mn)}get isSwiped(){return this.state===bn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=cn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=pn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(fn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(gn.prototype,un);const mn="IDLE",yn="BEGIN",bn="RECOGNIZED",Cn=Phaser.Utils.Objects.GetValue,_n=Phaser.Utils.Array.SpliceOne,Sn=Phaser.Math.Distance.Between,Pn=Phaser.Math.Angle.Between;class wn{constructor(t,e){var i=qe(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(Cn(e,"inputConfig",void 0)),this.setEventEmitter(Cn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(Cn(t,"enable",!0)),this.bounds=Cn(t,"bounds",void 0),this.tracerState=On,this.pointers.length=0,gt(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,gt(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case On:this.tracerState=En,this.onDrag1Start();break;case En:this.tracerState=Tn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],_n(this.pointers,e),this.tracerState){case En:this.tracerState=On,this.onDrag1End();break;case Tn:this.tracerState=En,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case En:this.onDrag1();break;case Tn:this.onDrag2()}}}dragCancel(){return this.tracerState===Tn&&this.onDrag2End(),this.pointers.length=0,gt(this.movedState),this.tracerState=On,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0],e=this.pointers[1];return Sn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0],e=this.pointers[1];return Pn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;xn.x=e.x-i.x,xn.y=e.y-i.y}else xn.x=0,xn.y=0;return xn}get centerX(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Tn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Tn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=kn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&hr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&hr(t,s,e,i)}}Object.assign(wn.prototype,He);var xn={};const On=0,En=1,Tn=2,kn="IDLE";Phaser.Utils.Objects.GetValue;const Dn=Phaser.Math.RotateAround;var Mn=function(t,e,i,s){return Dn(t,e,i,s),t.rotation+=s,t},Rn={};const Ln=Phaser.Utils.Objects.GetValue,An=Phaser.Math.Angle.WrapDegrees,jn=Phaser.Math.Angle.ShortestBetween,zn=Phaser.Math.RadToDeg,Xn=Phaser.Math.DegToRad;var Fn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Rn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,a=r.y,h=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=An(zn(this.angleBetween));this.angle=jn(this.prevAngle,t),this.prevAngle=t,this.state=Nn}break;case Nn:t=An(zn(this.angleBetween)),this.angle=jn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Nn}get rotation(){return Xn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Fn);const In="IDLE",Yn="BEGIN",Nn="RECOGNIZED",Wn=Phaser.Utils.Objects.GetValue;var Vn=function(t){var e=Wn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new Qr(this,e),this._tap.on("tap",(function(t,e,s){Lr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Lr(i.eventEmitter,`${i.eventNamePrefix}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Bn=Phaser.Utils.Objects.GetValue;var Gn=function(t){var e=Bn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new nn(this,e),this._press.on("pressstart",(function(t,e,s){Lr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this).on("pressend",(function(t,e,s){Lr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Un=Phaser.Utils.Objects.GetValue;var Hn=function(t){var e=Un(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new gn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Lr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Lr(i.eventEmitter,`${i.eventNamePrefix}swipe`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Jn=Phaser.Utils.Objects.GetValue;var $n=function(t,e){return t.setInteractive(),Jn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Jn(e,"targets",[t]),targetMode:Jn(e,"targetMode","parent"),eventEmitter:Jn(e,"eventEmitter",t),eventNamePrefix:Jn(e,"inputEventPrefix","child.")},jr.call(t,e),Fr.call(t,e),Nr.call(t,e),Gr.call(t,e),Vn.call(t,e),Gn.call(t,e),Hn.call(t,e),t},qn={getSizerConfig:function(t){return void 0===t&&(t=this),kt(t)},getChildPrevState:function(t){var e=kt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Rt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,a,h=t.scene;if("number"==typeof e)i=e;else{i=he(e,"color"),s=he(e,"lineWidth");var o=he(e,"name",!1);o&&(r=he(o,"createTextCallback",de),n=he(o,"createTextCallbackScope",void 0),"string"==typeof(a=he(o,"align","left-top"))&&(a=jt[a]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new oe(h),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}var d,u,c=this.getAllShownChildren([this]);ue(c,c);for(var p=0,v=c.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=a)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=a+1),r};const na=Phaser.Utils.Objects.IsPlainObject,aa=Phaser.Utils.Objects.GetValue,ha=Phaser.Display.Align.CENTER,oa={min:0,full:-1};var la=function(t,e,i,s,r,n,a,h,o,l){var d,u,c,p;ge.call(this,t);var v=t.isRexSpace,f=typeof e;if(null===e)return this;if("number"===f);else if("string"===f)e=oa[e];else if(na(e)){var g;e=aa(g=e,"proportion",void 0),i=aa(g,"align",ha),s=aa(g,"padding",0),r=aa(g,"expand",!1),n=aa(g,"key",void 0),a=aa(g,"index",void 0),t.isRexSizer||(h=aa(g,"minWidth",void 0),o=aa(g,"minHeight",void 0)),l=aa(g,"fitRatio",0),d=aa(g,"offsetX",0),u=aa(g,"offsetY",0),c=aa(g,"offsetOriginX",0),p=aa(g,"offsetOriginY",0)}return"string"==typeof i&&(i=jt[i]),void 0===e&&(e=v?1:0),void 0===i&&(i=ha),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===h&&(v?h=0:t.isRexSizer||(h=t._minWidth)),void 0===o&&(v?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===u&&(u=0),void 0===c&&(c=0),void 0===p&&(p=0),(g=this.getSizerConfig(t)).proportion=e,g.align=i,g.padding=ve(s),g.expand=r,g.fitRatio=0===e?l:0,g.alignOffsetX=d,g.alignOffsetY=u,g.alignOffsetOriginX=c,g.alignOffsetOriginY=p,void 0===a||a>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(a,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===h?Q(t):h:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=h)),void 0!==n&&this.addChildrenMap(n,t),this},da={add:la,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),la.call(this,new sa(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,h){return na(i)&&(i.index=t),la.call(this,e,i,s,r,n,a,t,h),this},insertAtPosition(t,e,i,s,r,n,a,h,o){var l=ra.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,h,o),this}};const ua=Tt.prototype.clear;var ca=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),ua.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,ca.call(this,t),this}},fa={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=jt[e]),this.getSizerConfig(t).align=e,this}},ga={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},ma={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},ya={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},ba={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,h=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,u=h.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,a+=n)));else for(d=0,u=h.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,u?u=!1:n+=this.space.item*this.scaleY,a+=n)))}return o?void 0:a+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,a=s.padding;i=n-(a.left+a.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,a=s.padding;i=n-(a.top+a.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Ve(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Ye.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,h,o,l,d,u,c=this.sizerChildren,p=this.innerLeft,v=this.innerTop,f=this.innerWidth,g=this.innerHeight,m=p,y=v,b=this.startChildIndex,C=0,_=c.length;C<_;C++)u=0===b?C:ta(C+b,0,_),this.rtl&&(u=_-u-1),(t=c[u]).rexSizer.hidden||(i=(e=t.rexSizer).padding,cr.call(this,t),t.isRexSpace?(l=0,d=0):(l=this.getExpandedChildWidth(t),d=this.getExpandedChildHeight(t)),t.isRexSizer?(t.runLayout(this,l,d),Qn(t,this)):Ve(t,l,d),void 0===l&&(l=Q(t)),void 0===d&&(d=tt(t)),0===this.orientation?(s=m+i.left*this.scaleX,n=0===e.proportion||0===this.proportionLength?l:e.proportion*this.proportionLength,r=y+i.top*this.scaleY,a=g-(i.top+i.bottom)*this.scaleY):(s=m+i.left*this.scaleX,n=f-(i.left+i.right)*this.scaleX,r=y+i.top*this.scaleY,a=0===e.proportion||0===this.proportionLength?d:e.proportion*this.proportionLength),void 0===l&&(l=Q(t)),void 0===d&&(d=tt(t)),h=(e.alignOffsetX+e.alignOffsetOriginX*l)*this.scaleX,o=(e.alignOffsetY+e.alignOffsetOriginY*d)*this.scaleY,pr.call(this,t,s,r,n,a,e.align,h,o),0===this.orientation?m+=n+(i.left+i.right)*this.scaleX+this.space.item*this.scaleX:y+=a+(i.top+i.bottom)*this.scaleY+this.space.item*this.scaleY)},resolveWidth:function(t){if(void 0!==(t=Le.call(this,t))&&0===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenWidth;e>0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=ze.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Ae.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&ea.call(this,t,void 0),je.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Xe.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&ea.call(this,void 0,t),Fe.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],a=n&&n.isRexSpace;return"center"===t?a||this.insertSpace(r+1):a&&this.remove(n,!0),this}};Object.assign(ba,da,va,fa,ga,ma,ya);var Ca=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},_a={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const Sa=Phaser.Utils.Objects.IsPlainObject,Pa=Phaser.Utils.Objects.GetValue;class wa extends Zn{constructor(t,e,i,s,r,n,a){Sa(e)?(e=Pa(a=e,"x",0),i=Pa(a,"y",0),s=Pa(a,"width",void 0),r=Pa(a,"height",void 0),n=Pa(a,"orientation",0)):Sa(s)?(s=Pa(a=s,"width",void 0),r=Pa(a,"height",void 0),n=Pa(a,"orientation",0)):Sa(n)&&(n=Pa(a=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,a),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Pa(a,"space.item",0)),this.setStartChildIndex(Pa(a,"startChildIndex",0)),this.setRTL(Pa(a,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=_a[t]),t}(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=Ca.call(this)),this._childrenProportion}}Object.assign(wa.prototype,ba);var xa=Phaser.Renderer.WebGL.Utils,Oa=function(t,e,i,s,r,n){for(var a=xa.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),h=i.pathData,o=i.pathIndexes,l=0;l>>16,h=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+a+","+h+","+o+","+n+")"},Ma=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,a=(16711680&r)>>>16,h=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+a+","+h+","+o+","+n+")",t.lineWidth=e.lineWidth};const Ra=Phaser.Renderer.Canvas.SetTransform;var La={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=ka(e,i,s),a=r.calcMatrix.copyFrom(n.calc),h=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&Oa(r,a,e,l,h,o),e.isStroked&&Ta(r,e,l,h,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(Ra(t,r,e,i,s)){var n=e._displayOriginX,a=e._displayOriginY,h=e.pathData,o=h.length-1,l=h[0]-n,d=h[1]-a;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var u=2;u0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(ja.prototype,La);const za=Phaser.Utils.Objects.GetValue;let Xa=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=za(t,"x",0),i=za(t,"y",0));var s=this.cornerRadius;s.tl=Fa(za(t,"tl",void 0),e,i),s.tr=Fa(za(t,"tr",void 0),e,i),s.bl=Fa(za(t,"bl",void 0),e,i),s.br=Fa(za(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Ia(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Ia(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Ia(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Ia(this.cornerRadius.br,t)}};var Fa=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Ya(t),t},Ia=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=za(e,"x",0),t.y=za(e,"y",0)),Ya(t)},Ya=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},Na=function(t){return t.x>0&&t.y>0},Wa=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const Va=Phaser.Math.DegToRad;var Ba=function(t,e,i,s,r,n,a,h,o){a&&n>r?n-=360:!a&&n0,a=0,h=e.length;a=0?t.startAt(a+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(a+n,i):t.startAt(a,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(a,i),t.close(),t};const Bh=Phaser.Utils.Objects.GetValue,Gh=Phaser.Utils.Objects.IsPlainObject;class Uh extends(gh(oh)){constructor(t,e,i,s,r,n,a,h){Gh(e)?(e=(h=e).x,i=h.y,s=h.width,r=h.height,n=h.barColor,a=h.value):Gh(s)?(s=(h=s).width,r=h.height,n=h.barColor,a=h.value):Gh(n)&&(n=(h=n).barColor,a=h.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===a&&(a=0),super(t,e,i,s,r,h),this.type="rexLineProgress",this.bootProgressBase(h),this.addShape((new Wh).setName("trackFill")).addShape((new Wh).setName("bar")).addShape((new Wh).setName("trackStroke")),this.setTrackColor(Bh(h,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(Bh(h,"trackStrokeThickness",2),Bh(h,"trackStrokeColor",void 0)),this.setSkewX(Bh(h,"skewX",0)),this.setRTL(Bh(h,"rtl",!1)),this.setValue(a)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var Hh={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&Vh(s,0,0,e,i,t);var r,n,a=this.getShape("bar");a.fillStyle(this.barColor),a.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),Vh(a,r,0,n,i,t));var h=this.getShape("trackStroke");h.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),h.isStroked&&Vh(h,0,0,e,i,t)}};Object.assign(Uh.prototype,Hh);var Jh=function(t){return null==t||""===t||0===t.length},$h=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(Jh(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(Jh(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,a=e.length;nvo(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=vo(t[i]));return e}const fo=Phaser.Utils.Objects.IsPlainObject,go=Phaser.Utils.Objects.GetValue;var mo=function(t){return"string"==typeof t&&(t=yo[t]),t};const yo={scale:0,repeat:1};var bo=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},Co={_beginDraw:zt,_drawImage:zt,_drawTileSprite:zt,_endDraw:zt,setGetFrameNameCallback:function(t){return void 0===t&&(t=po),this.getFrameNameCallback=t,this},setBaseTexture:function(t,e,i,s){Array.isArray(e)&&(s=i,i=e,e=void 0),null==e&&(e="__BASE"),"number"==typeof i&&arguments.length>=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=vo(i),s=vo(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),a=n.width,h=0,o=0,l=i.length;o0?a/h:0,u=n.height,c=0;for(o=0,l=s.length;o0?0:f,b=0,o=0;for(var P=i.length;o0?0:g),g>=1&&f>=1){var w=typeof(m=this.getFrameNameCallback(o,_,e));"string"!==w&&"number"!==w||r.add(m,0,b+n.cutX,C+n.cutY,g,f)}b+=g}C+=f}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,a,h,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,u=this.height-l,c=d>=0?this.maxFixedPartScaleX:this.width/o,p=u>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(c,p);if(c>v){var f=(c-v)*o;d>=0?d+=f:d=f,c=v}if(p>v){var g=(p-v)*l;u>=0?u+=g:u=g,p=v}}this.columns.scale=c,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=u>0&&this.rows.stretch>0?u/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,C=this.rows.count;b0&&h>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(_,b)?0:1)?this._drawImage(this.textureKey,s,m,y,a,h):this._drawTileSprite(this.textureKey,s,m,y,a,h)),m+=a;y+=h}this._endDraw()},setStretchMode:function(t){return fo(t)?(this.stretchMode.edge=mo(go(t,"edge",0)),this.stretchMode.internal=mo(go(t,"internal",0))):(t=mo(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return bo.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const _o=Phaser.Utils.Objects.IsPlainObject,So=Phaser.Utils.Objects.GetValue,Po=Phaser.GameObjects;var wo=void 0,xo=function(t,e){if(wo||(wo={},Qe(t).events.once("destroy",(function(){for(var t in wo)wo[t].destroy();wo=void 0}))),!wo.hasOwnProperty(e)){var i=Qe(t).scene.systemScene;(t=new Po[e](i)).setOrigin(0),wo[e]=t}return wo[e]};const Oo=Phaser.GameObjects.RenderTexture;class Eo extends(function(t,e){class i extends t{constructor(t,i,s,r,n,a,h,o,l,d){if(_o(i)?(i=So(d=i,"x",0),s=So(d,"y",0),r=So(d,"width",1),n=So(d,"height",1),a=So(d,"key",void 0),h=So(d,"baseFrame",void 0),o=So(d,"columns",void 0),l=So(d,"rows",void 0)):_o(r)?(r=So(d=r,"width",1),n=So(d,"height",1),a=So(d,"key",void 0),h=So(d,"baseFrame",void 0),o=So(d,"columns",void 0),l=So(d,"rows",void 0)):_o(a)?(a=So(d=a,"key",void 0),h=So(d,"baseFrame",void 0),o=So(d,"columns",void 0),l=So(d,"rows",void 0)):_o(h)?(h=So(d=h,"baseFrame",void 0),o=So(d,"columns",void 0),l=So(d,"rows",void 0)):Array.isArray(h)?(d=l,l=o,o=h,h=So(d,"baseFrame",void 0)):_o(o)&&(o=So(d=o,"columns",void 0),l=So(d,"rows",void 0)),void 0===h&&(h=So(d,"frame",void 0)),void 0===o){var u=So(d,"leftWidth",void 0),c=So(d,"rightWidth",void 0);void 0!==u&&void 0!==c&&(o=[u,void 0,c])}if(void 0===l){var p=So(d,"topHeight",void 0),v=So(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(So(d,"getFrameNameCallback",void 0)),this.setStretchMode(So(d,"stretchMode",0)),this.setPreserveRatio(So(d,"preserveRatio",!0));var f=So(d,"maxFixedPartScale",1),g=So(d,"maxFixedPartScaleX",f),m=So(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(g,m),this.setBaseTexture(a,h,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,Co),i}(Oo,"rexNinePatch")){}var To={_drawImage:function(t,e,i,s,r,n){var a=xo(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(a,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var a=xo(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(a,i,s)}};Object.assign(Eo.prototype,To);class ko extends ei{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Zh(t,e))return t[e];var i=t.parent;return Zh(i,e)?i[e]:void 0}set(t,e,i){return Zh(t,e)?t[e]=i:Zh(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}}const Do=Phaser.Utils.Objects.GetValue;class Mo extends Eo{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=Do(e,"effects",!0);i&&so(this,i),this.style=new ko(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Mo.prototype,th);const Ro=["alpha","tint","flipX","flipY"];var Lo=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("barColor")?i="bar":e.hasOwnProperty("leftWidth")?i="nineSlice":e.hasOwnProperty("key")&&(i="image")),i){case"bar":s=new qh(t,e);break;case"image":s=new co(t,e);break;case"nineSlice":s=e.hasOwnProperty("stretchMode")?new Mo(t,e):new ho(t,e);break;default:s=new eh(t,e)}return function(t,e){if(!e)return t;for(var i=0,s=Ro.length;i=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const P=Phaser.Math.DegToRad;var _={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=P(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},T={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=O(t.scaleX,i.scaleX),e.scaleY=O(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},E={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=O(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},L={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},D={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},Y={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(t){void 0===t&&(t=!1);var e=this;return this._mask=null,this.setChildMaskVisible(this),this.children.forEach((function(t){t.clearMask&&t.clearMask(!1),t.hasOwnProperty("isRexContainerLite")||e.setChildMaskVisible(t)})),t&&this.mask&&this.mask.destroy(),this}},X=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},W=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const j=Phaser.Utils.Array;var I={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Ee=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const Me=/(\S+)\[(\d+)\]/i,Re=Phaser.Utils.Objects.GetValue;var Le=function(t,e){return void 0===e?t:t[e]},De=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Re(e,"left",0),t.right=Re(e,"right",0),t.top=Re(e,"top",0),t.bottom=Re(e,"bottom",0)),t},Ye={getInnerPadding(t){return Le(this.space,t)},setInnerPadding(t,e){return De(this.space,t,e),this},getOuterPadding(t){return Le(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return De(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Le(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),De(this.getSizerConfig(t).padding,e,i),this}},Xe=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Ae=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},ze=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},We=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Be=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},je=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Ie={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Fe=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?yi:mi,this.repeatCounter=0,this}stop(){return this.state=fi,this}update(t,e){this.state!==fi&&this.state!==xi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=bi)):(this.nowTime=this.duration,this.state=xi):this.nowTime>=0&&(this.state=yi))}get t(){var t;switch(this.state){case fi:case mi:case bi:t=0;break;case yi:t=this.nowTime/this.duration;break;case xi:t=1}return vi(t,0,1)}set t(t){(t=vi(t,-1,1))<0?(this.state=mi,this.nowTime=-this.delay*t):(this.state=yi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===fi}get isDelay(){return this.state===mi}get isCountDown(){return this.state===yi}get isRunning(){return this.state===mi||this.state===yi}get isDone(){return this.state===xi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const fi=0,mi=1,yi=2,bi=3,xi=-1;class Ci extends ci{constructor(t,e){super(t,e),this.timer=new gi}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const wi=Phaser.Utils.Objects.GetValue,Si=Phaser.Utils.Objects.GetAdvancedValue,Oi=Phaser.Tweens.Builders.GetEaseFunction;class ki extends Ci{resetFromJSON(t){return this.timer.resetFromJSON(wi(t,"timer")),this.setEnable(wi(t,"enable",!0)),this.setTarget(wi(t,"target",this.parent)),this.setDelay(Si(t,"delay",0)),this.setDuration(Si(t,"duration",1e3)),this.setEase(wi(t,"ease","Linear")),this.setRepeat(wi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Oi(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Pi=Phaser.Utils.Objects.GetValue,_i=Phaser.Utils.Objects.GetAdvancedValue,Ti=Phaser.Math.Linear;let Ei=class extends ki{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Pi(t,"mode",0)),this.setScaleRange(_i(t,"start",void 0),_i(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Mi[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=_i(t,"x",this.parent.scaleX),this.startY=_i(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=_i(e,"x",void 0),this.endY=_i(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Ti(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Ti(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const Mi={stop:0,destroy:1,yoyo:2};var Ri=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new Ei(t,a):r.resetFromJSON(a),r.restart(),r},Li=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Ei&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new Ei(t,h):n.resetFromJSON(h),n.restart(),n},Di=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Yi=function(t){return Di(t,"complete")};const Xi=Phaser.Utils.Objects.IsPlainObject;var Ai={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Xi(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Ri(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Yi(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Xi(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Li(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Yi(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Yi(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Xi(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new Ei(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Yi(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},zi={};Object.assign(zi,Ai),zi.onInitScale=function(){Ai.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=Ce.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Wi=Phaser.Utils.Objects.GetValue,Bi=Phaser.Utils.Objects.GetAdvancedValue,ji=Phaser.Math.Linear;class Ii extends ki{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Wi(t,"mode",0)),this.setAlphaRange(Bi(t,"start",this.parent.alpha),Bi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Fi[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=ji(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Fi={stop:0,destroy:1,yoyo:2},Hi=Phaser.Utils.Objects.IsPlainObject;var Gi=function(t,e,i,s){var r,n;Hi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Ii(t,h):s.resetFromJSON(h),s.restart(),s},Ni=function(t,e,i,s){i instanceof Ii&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Ii(t,r):s.resetFromJSON(r),s.restart(),s};const Vi=Phaser.Utils.Objects.IsPlainObject;var Ui={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Vi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Gi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Yi(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Vi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Ni(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Yi(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Yi(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},$i={};Object.assign($i,Ui),$i.onInitFade=function(){Ui.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=Ce.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Ji=Phaser.Utils.Objects.GetValue,Ki=Phaser.Utils.Objects.GetAdvancedValue,qi=Phaser.Math.Linear;class Zi extends ki{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Ji(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ki(t,"x",void 0),i=Ki(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Qi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Ki(i,"startX",void 0),this.startY=Ki(i,"startY",void 0),this.endX=Ki(i,"endX",void 0),this.endY=Ki(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=qi(this.startX,this.endX,i)),this.hasMoveY&&(t.y=qi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Qi={stop:0,destroy:1,yoyo:2};var ts=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const es=Phaser.Utils.Objects.IsPlainObject,is=Phaser.Math.Distance.Between;var ss={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(es(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*is(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Zi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=ts(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=ts(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Zi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Yi(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Yi(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(es(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*is(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Zi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=ts(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=ts(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Zi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Yi(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Yi(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},rs={};Object.assign(rs,ss),rs.onInitEaseMove=function(){ss.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=Ce.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const ns=Phaser.Utils.Objects.GetValue;class hs extends oi{constructor(t,e){super(t,e),this.timer=new gi,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(ns(t,"timer")),this.setEnable(ns(t,"enable",!0)),this.setMode(ns(t,"mode",1)),this.isRunning=ns(t,"isRunning",!1),this.setMagnitudeMode(ns(t,"magnitudeMode",1)),this.setAxisMode(ns(t,"axis",0)),this.setDuration(ns(t,"duration",500)),this.setMagnitude(ns(t,"magnitude",10)),this.ox=ns(t,"ox",void 0),this.oy=ns(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=as[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ls[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=os[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=ns(i,"magnitude",void 0),t=ns(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const as={effect:0,behavior:1},os={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ls={constant:0,decay:1},ds=Phaser.Utils.Objects.IsPlainObject;var cs={shake(t,e,i){if(ds(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new hs(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Yi(this._shake)}};const us=Phaser.Utils.Objects.GetValue,ps=Phaser.Math.Linear;class vs extends ki{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=us(t,"key","value");var i=e[this.propertyKey];return this.fromValue=us(t,"from",i),this.toValue=us(t,"to",i),this.setEase(us(t,"ease",this.ease)),this.setDuration(us(t,"duration",this.duration)),this.setRepeat(us(t,"repeat",0)),this.setDelay(us(t,"delay",0)),this.setRepeatDelay(us(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=ps(this.fromValue,this.toValue,i)}}const gs=Phaser.Utils.Objects.IsPlainObject;class fs extends si{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new vs(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(gs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(gs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var ms={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new fs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Di(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},ys=Phaser.Utils.Array.Remove,bs={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var zs={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Ze(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Ws={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=Wt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=Wt),this.transitOutCallback=t,this}},Bs={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},js={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Is={};Object.assign(Is,zs,Ws,Bs,js);const Fs=Phaser.Utils.Objects.GetValue;class Hs extends si{constructor(t,e){super(t,e),this.setTransitInTime(Fs(e,"duration.in",200)),this.setTransitOutTime(Fs(e,"duration.out",200)),this.setTransitInCallback(Fs(e,"transitIn")),this.setTransitOutCallback(Fs(e,"transitOut")),this.oneShotMode=Fs(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new As(this,{eventEmitter:!1,initState:Fs(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Hs.prototype,Is);var Gs=function(t){if(t.parentContainer)return Gs(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?Gs(e):t};class Ns extends si{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Gs(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Vs=Phaser.GameObjects.Rectangle;class Us extends Vs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Ns(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const $s=Phaser.Utils.Objects.GetValue;class Js extends si{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode($s(t,"hitAreaMode",0)),this.setEnable($s(t,"enable",!0)),this.setStopMode($s(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Ks[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Ks={default:0,fullWindow:1};const qs=Phaser.Utils.Objects.GetValue;class Zs extends Us{constructor(t,e){super(t,qs(e,"color",0),qs(e,"alpha",.8)),this.touchEventStop=new Js(this,{hitAreaMode:1})}}var Qs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Ri(t,e)},scaleDown(t,e){Li(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Gi(t,e)},fadeOut(t,e){Ni(t,e,!1)}},tr=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Gi(t,e,t.alpha)},er=function(t,e){Ni(t,e,!1)},ir=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!nt(t,!0).contains(e,i)||r&&!r(t,e,i))};const sr=Phaser.Utils.Objects.GetValue;let rr=class extends Hs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=nr.popUp),null==e.transitOut&&(e.transitOut=nr.scaleDown),e.destroy=sr(e,"destroy",!0),super(t,e);var i=sr(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Zs(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(sr(i,"transitIn",tr)),this.setCoverTransitOutCallback(sr(i,"transitOut",er)));var s=sr(e,"touchOutsideClose",!1),r=sr(e,"duration.hold",-1),n=sr(e,"timeOutClose",r>=0),h=sr(e,"anyTouchClose",!1);sr(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),sr(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&ir(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=nr[t]),t){case nr.popUp:t=Qs.popUp;break;case nr.fadeIn:t=Qs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=nr[t]),t){case nr.scaleDown:t=Qs.scaleDown;break;case nr.fadeOut:t=Qs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const nr={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var hr=function(t){return t&&"function"==typeof t},ar={modal(t,e){return hr(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new rr(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},or=function(t,e,i,s,r){hr(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},lr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return or.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return or.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return or.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return or.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return or.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return or.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return or.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return or.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return or.call(this,"shutdown",t,e,i,s),this}},dr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=cr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},cr={},ur=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?ir(t,e.x,e.y,i,s):!!(r=dr(e,n,!0))&&ir(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const Or={press:0,pointerdown:0,release:1,pointerup:1};var kr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new Sr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},Pr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!_r(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return Tr.length=0,!0;return Tr.length=0,!1},Tr=[];const Er=Phaser.Utils.Objects.GetValue;class Mr extends si{constructor(t,e){super(t,e),this._enable=void 0;var i=Er(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Er(t,"enable",!0)),this.setMode(Er(t,"mode",1)),this.setClickInterval(Er(t,"clickInterval",100)),this.setDragThreshold(Er(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Rr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?Pr:ur)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Rr={press:0,pointerdown:0,release:1,pointerup:1};var Lr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Mr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Dr extends Xs{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Yr=Phaser.Utils.Objects.GetValue;class Xr extends si{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Dr,this.parent.setInteractive(Yr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Yr(t,"enable",!0)),this.setCooldown(Yr(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Ar={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&ur(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Xr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Xr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},zr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Wr=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=tn,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===en&&this.onDragEnd(),this.pointer=void 0,this.tracerState=tn,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=sn,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&ur(t,s,e,i)}}const tn=0,en=1,sn="IDLE",rn=Phaser.Utils.Objects.GetValue,nn=Phaser.Math.Distance.Between;class hn extends Qr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=an},eventEmitter:!1};this.setRecongizedStateObject(new Xs(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(rn(t,"time",250)),this.setTapInterval(rn(t,"tapInterval",200)),this.setDragThreshold(rn(t,"threshold",9)),this.setTapOffset(rn(t,"tapOffset",10));var e=rn(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(rn(t,"maxTaps",void 0)),this.setMinTaps(rn(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case an:this.state=on;break;case on:var t=this.lastPointer;nn(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=ln,this.state=on);break;case ln:this.state=on}}onDragEnd(){this.state===on&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=ln))}onDrag(){this.state!==an&&this.pointer.getDistance()>this.dragThreshold&&(this.state=an)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===on){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=an):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=ln:this.state=an)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===ln&&(this.state=an)}get isTapped(){return this.state===ln}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const an="IDLE",on="BEGIN",ln="RECOGNIZED",dn=Phaser.Utils.Objects.GetValue;class cn extends Qr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=un},eventEmitter:!1};this.setRecongizedStateObject(new Xs(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(dn(t,"threshold",9)),this.setHoldTime(dn(t,"time",251)),this}onDragStart(){this.state=pn,0===this.holdTime&&(this.state=vn)}onDragEnd(){this.state=un}onDrag(){this.state!==un&&this.pointer.getDistance()>this.dragThreshold&&(this.state=un)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===pn&&t-this.pointer.downTime>=this.holdTime&&(this.state=vn)}get isPressed(){return this.state===vn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const un="IDLE",pn="BEGIN",vn="RECOGNIZED";Phaser.Utils.Objects.GetValue;var gn=function(t){return ei(t).loop.delta};const fn=Phaser.Math.Distance.Between,mn=Phaser.Math.Angle.Between;var yn={getDt:function(){return gn(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return fn(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return mn(e.x,e.y,t.x,t.y)}},bn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},xn={};const Cn=Phaser.Utils.Objects.GetValue,wn=Phaser.Math.RadToDeg;class Sn extends Qr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=On},eventEmitter:!1};this.setRecongizedStateObject(new Xs(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Cn(t,"threshold",10)),this.setVelocityThreshold(Cn(t,"velocityThreshold",1e3)),this.setDirectionMode(Cn(t,"dir","8dir")),this}onDragStart(){this.state=kn}onDragEnd(){this.state=On}onDrag(){this.state===kn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=Pn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Pn&&(this.state=On)}get isSwiped(){return this.state===Pn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=bn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=xn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(wn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(Sn.prototype,yn);const On="IDLE",kn="BEGIN",Pn="RECOGNIZED",_n=Phaser.Utils.Objects.GetValue,Tn=Phaser.Utils.Array.SpliceOne,En=Phaser.Math.Distance.Between,Mn=Phaser.Math.Angle.Between;class Rn{constructor(t,e){var i=Ze(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(_n(e,"inputConfig",void 0)),this.setEventEmitter(_n(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(_n(t,"enable",!0)),this.bounds=_n(t,"bounds",void 0),this.tracerState=Dn,this.pointers.length=0,mt(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,mt(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case Dn:this.tracerState=Yn,this.onDrag1Start();break;case Yn:this.tracerState=Xn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],Tn(this.pointers,e),this.tracerState){case Yn:this.tracerState=Dn,this.onDrag1End();break;case Xn:this.tracerState=Yn,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case Yn:this.onDrag1();break;case Xn:this.onDrag2()}}}dragCancel(){return this.tracerState===Xn&&this.onDrag2End(),this.pointers.length=0,mt(this.movedState),this.tracerState=Dn,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Xn)return 0;var t=this.pointers[0],e=this.pointers[1];return En(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Xn)return 0;var t=this.pointers[0],e=this.pointers[1];return Mn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Ln.x=e.x-i.x,Ln.y=e.y-i.y}else Ln.x=0,Ln.y=0;return Ln}get centerX(){if(this.tracerState!==Xn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Xn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Xn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Xn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=An,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&ur(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&ur(t,s,e,i)}}Object.assign(Rn.prototype,Je);var Ln={};const Dn=0,Yn=1,Xn=2,An="IDLE";Phaser.Utils.Objects.GetValue;const zn=Phaser.Math.RotateAround;var Wn=function(t,e,i,s){return zn(t,e,i,s),t.rotation+=s,t},Bn={};const jn=Phaser.Utils.Objects.GetValue,In=Phaser.Math.Angle.WrapDegrees,Fn=Phaser.Math.Angle.ShortestBetween,Hn=Phaser.Math.RadToDeg,Gn=Phaser.Math.DegToRad;var Nn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Bn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=In(Hn(this.angleBetween));this.angle=Fn(this.prevAngle,t),this.prevAngle=t,this.state=$n}break;case $n:t=In(Hn(this.angleBetween)),this.angle=Fn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===$n}get rotation(){return Gn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Nn);const Vn="IDLE",Un="BEGIN",$n="RECOGNIZED",Jn=Phaser.Utils.Objects.GetValue;var Kn=function(t){var e=Jn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new hn(this,e),this._tap.on("tap",(function(t,e,s){Br(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Br(i.eventEmitter,`${i.eventNamePrefix}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const qn=Phaser.Utils.Objects.GetValue;var Zn=function(t){var e=qn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new cn(this,e),this._press.on("pressstart",(function(t,e,s){Br(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this).on("pressend",(function(t,e,s){Br(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Qn=Phaser.Utils.Objects.GetValue;var th=function(t){var e=Qn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new Sn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Br(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Br(i.eventEmitter,`${i.eventNamePrefix}swipe`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const eh=Phaser.Utils.Objects.GetValue;var ih=function(t,e){return t.setInteractive(),eh(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:eh(e,"targets",[t]),targetMode:eh(e,"targetMode","parent"),eventEmitter:eh(e,"eventEmitter",t),eventNamePrefix:eh(e,"inputEventPrefix","child.")},Ir.call(t,e),Gr.call(t,e),Ur.call(t,e),qr.call(t,e),Kn.call(t,e),Zn.call(t,e),th.call(t,e),t},sh={getSizerConfig:function(t){return void 0===t&&(t=this),Rt(t)},getChildPrevState:function(t){var e=Rt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Yt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=le(e,"color"),s=le(e,"lineWidth");var o=le(e,"name",!1);o&&(r=le(o,"createTextCallback",ue),n=le(o,"createTextCallbackScope",void 0),"string"==typeof(h=le(o,"align","left-top"))&&(h=zt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new de(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}var d,c,u=this.getAllShownChildren([this]);pe(u,u);for(var p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const uh=Phaser.Utils.Objects.IsPlainObject,ph=Phaser.Utils.Objects.GetValue,vh=Phaser.Display.Align.CENTER,gh={min:0,full:-1};var fh=function(t,e,i,s,r,n,h,a,o,l){var d,c,u,p;ye.call(this,t);var v=t.isRexSpace,g=typeof e;if(null===e)return this;if("number"===g);else if("string"===g)e=gh[e];else if(uh(e)){var f;e=ph(f=e,"proportion",void 0),i=ph(f,"align",vh),s=ph(f,"padding",0),r=ph(f,"expand",!1),n=ph(f,"key",void 0),h=ph(f,"index",void 0),t.isRexSizer||(a=ph(f,"minWidth",void 0),o=ph(f,"minHeight",void 0)),l=ph(f,"fitRatio",0),d=ph(f,"offsetX",0),c=ph(f,"offsetY",0),u=ph(f,"offsetOriginX",0),p=ph(f,"offsetOriginY",0)}return"string"==typeof i&&(i=zt[i]),void 0===e&&(e=v?1:0),void 0===i&&(i=vh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(v?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(v?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),(f=this.getSizerConfig(t)).proportion=e,f.align=i,f.padding=fe(s),f.expand=r,f.fitRatio=0===e?l:0,f.alignOffsetX=d,f.alignOffsetY=c,f.alignOffsetOriginX=u,f.alignOffsetOriginY=p,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},mh={add:fh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),fh.call(this,new dh(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return uh(i)&&(i.index=t),fh.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=ch.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const yh=Mt.prototype.clear;var bh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),yh.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,bh.call(this,t),this}},wh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=zt[e]),this.getSizerConfig(t).align=e,this}},Sh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},Oh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},kh={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},Ph={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Ne(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Fe.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d,c,u=this.sizerChildren,p=this.innerLeft,v=this.innerTop,g=this.innerWidth,f=this.innerHeight,m=p,y=v,b=this.startChildIndex,x=0,C=u.length;x0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=We.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Ae.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&oh.call(this,t,void 0),ze.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Be.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&oh.call(this,void 0,t),je.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(Ph,mh,Ch,wh,Sh,Oh,kh);var _h=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},Th={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},Eh=function(t){return"string"==typeof t&&(t=Th[t]),t};const Mh=Phaser.Utils.Objects.IsPlainObject,Rh=Phaser.Utils.Objects.GetValue;class Lh extends nh{constructor(t,e,i,s,r,n,h){Mh(e)?(e=Rh(h=e,"x",0),i=Rh(h,"y",0),s=Rh(h,"width",void 0),r=Rh(h,"height",void 0),n=Rh(h,"orientation",0)):Mh(s)?(s=Rh(h=s,"width",void 0),r=Rh(h,"height",void 0),n=Rh(h,"orientation",0)):Mh(n)&&(n=Rh(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Rh(h,"space.item",0)),this.setStartChildIndex(Rh(h,"startChildIndex",0)),this.setRTL(Rh(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=Eh(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=_h.call(this)),this._childrenProportion}}Object.assign(Lh.prototype,Ph);var Dh=function(t,e,i){if(t){var s=null==e,r=null==i;return s&&r||(s||(t.displayWidth=e),r||(t.displayHeight=i),s&&(t.scaleX=t.scaleY),r&&(t.scaleY=t.scaleX)),t}},Yh=function(t,e){var i;return t||0===t||(t=""),void 0===e&&(e=!0),Array.isArray(t)&&(t=t.join("\n")),(i=e?`${this.text}\n${t}`:`${this.text}${t}`)!=this.text&&this.setText(i),this},Xh={appendText:Yh,resetDisplayContent:function(t){void 0===t?t={}:"string"==typeof t&&(t={text:t});var e=t.text||"";this.setText(e);var i=this.childrenMap.icon;if(i){t.icon?this.show(i):this.hide(i);var s=t.iconSize;s&&(this.setChildDisplaySize(i,s,s),void 0!==this.iconWidth&&this.setIconSize(s)),!0!==t.icon&&this.setIconTexture(t.icon,t.iconFrame)}var r=this.childrenMap.action;if(r){t.action?this.show(r):this.hide(r);var n=t.actionSize;n&&(this.setChildDisplaySize(r,n,n),void 0!==this.actionWidth&&this.setActionSize(n)),!0!==t.action&&this.setActionTexture(t.action,t.actionFrame)}return this}};class Ah extends Lh{get text(){var t=this.childrenMap.text;return t?t.text:""}set text(t){var e=this.childrenMap.text;e&&e.setText(t)}setText(t){return this.text=t,this}setIconTexture(t,e){var i=this.childrenMap.icon;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.iconWidth&&void 0!==this.iconHeight&&(Dh(i,this.iconWidth,this.iconHeight),this.resetChildScaleState(i)),this):this}setTexture(t,e){return this.setIconTexture(t,e),this}setIconSize(t,e){return void 0===e&&(e=t),this.iconWidth=t,this.iconHeight=e,this}get texture(){var t=this.childrenMap.icon;if(t)return t.texture}get frame(){var t=this.childrenMap.icon;if(t)return t.frame}setActionTexture(t,e){var i=this.childrenMap.action;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.actionWidth&&void 0!==this.actionHeight&&(Dh(i,this.actionWidth,this.actionHeight),this.resetChildScaleState(i)),this):this}get actionTexture(){var t=this.childrenMap.action;if(t)return t.texture}get actionFrame(){var t=this.childrenMap.action;if(t)return t.frame}setActionSize(t,e){return void 0===e&&(e=t),this.actionWidth=t,this.actionHeight=e,this}preLayout(){var t=this.childrenMap.icon;t&&void 0!==this.iconWidth&&void 0!==this.iconHeight&&Dh(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&Dh(e,this.actionWidth,this.actionHeight),super.preLayout()}postLayout(t,e,i){var s=this.childrenMap.iconMask;s&&(s.setPosition(),this.resetChildPositionState(s));var r=this.childrenMap.actionMask;return r&&(r.setPosition(),this.resetChildPositionState(r)),super.postLayout(t,e,i),this}resize(t,e){super.resize(t,e);var i=this.childrenMap.iconMask;i&&i.resize();var s=this.childrenMap.actionMask;return s&&s.resize(),this}}Object.assign(Ah.prototype,Xh);const zh=Phaser.GameObjects.Graphics.prototype.setPosition,Wh=Phaser.Geom.Rectangle,Bh=Phaser.Geom.Circle;var jh=function(t,e,i,s,r){this.geom=function(t,e,i,s,r,n,h){if(1===t){s=s.left;var a=-e*(r-.5),o=-i*(n-.5),l=Math.min(e,i)/2+s;void 0!==h&&h instanceof Bh||(h=new Bh),h.setTo(a,o,l)}else{var d=-e*r-s.left,c=-i*n-s.top,u=e+s.left+s.right,p=i+s.top+s.bottom;void 0!==h&&h instanceof Wh||(h=new Wh),h.setTo(d,c,u,p)}return h}(this.shapeType,t,e,i,s,r,this.geom),this.clear().fillStyle(16777215),1===this.shapeType?this.fillCircleShape(this.geom):this.fillRectShape(this.geom)},Ih=function(t,e){for(var i in t){if(!(i in e))return!1;if(t[i]!==e[i])return!1}for(var i in e)if(!(i in t))return!1;return!0},Fh={setPosition:function(t,e){var i=this.parent;return void 0===t&&(t=i.x),void 0===e&&(e=i.y),zh.call(this,t,e),this},resize:function(t,e,i){var s=this.parent;void 0===t&&(t=s.width),void 0===e&&(e=s.height),void 0===i?i=this.padding:"number"==typeof i&&(i=GetBoundsConfig(i));var r=this.width!==t||this.height!==e,n=this.padding!==i&&!Ih(this.padding,i);return r||n?(this.width=t,this.height=e,n&&yt(i,this.padding),this.originX=s.originX,this.originY=s.originY,jh.call(this,t,e,i,s.originX,s.originY),this):this},setOrigin:function(t,e){void 0===e&&(e=t);var i=this.parent;return void 0===t&&(t=i.originX),void 0===e&&(e=i.originY),this.originX===t&&this.originY===e||(this.originX=t,this.originY=e,jh.call(this,this.width,this.height,this.padding,t,e)),this},contains:function(t,e){return t-=this.x,e-=this.y,this.geom.contains(t,e)}};const Hh=Phaser.GameObjects.Graphics;class Gh extends Hh{constructor(t,e,i){void 0===e&&(e=0),"string"==typeof e&&(e=Nh[e]),super(t.scene),this.parent=t,this.shapeType=e,this.padding=fe(i),this.setPosition().resize().setVisible(!1)}destroy(){return this.parent=void 0,super.destroy(),this}}const Nh={rectangle:0,circle:1};Object.assign(Gh.prototype,Fh);var Vh=function(t,e,i,s){var r=new Gh(e,i,s);if(t&&!t.isRexSizer){var n=r.createGeometryMask();t.setMask(n),this.once("destroy",(function(){t.setMask(),n.destroy()}))}return this.pin(r),r};const Uh=Phaser.GameObjects.Text;var $h=function(t){return t instanceof Uh};const Jh=Phaser.GameObjects.BitmapText;var Kh=function(t){return t instanceof Jh},qh=function(t){return Kh(t)?2:$h(t)?0:1},Zh=/^[\x00-\x7F]+$/,Qh=function(t){return Zh.test(t)},ta=function(t,e){for(var i=[],s=t.split("\n"),r=e.style,n=r.wordWrapWidth,h=r.hasOwnProperty("wrapMode")?r.wrapMode:3,a=e.context,o=0,l=s.length;o0&&r.push(o.join("")),r},ia=0,sa=1,ra=2,na=0,ha=1,aa=2,oa=/(?:\r\n|\r|\n)/;const la={none:na,word:ha,char:aa,character:aa,mix:3},da=Phaser.Renderer.WebGL.Utils;var ca={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,h=r.height,a=da.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,h,e.x,e.y,n/e.resolution,h/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,h,a(e.tintTopLeft,i.alpha*e._alphaTL),a(e.tintTopRight,i.alpha*e._alphaTR),a(e.tintBottomLeft,i.alpha*e._alphaBL),a(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const ua=Phaser.Display.Color;var pa={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,h,a,o,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===h&&(h=0),void 0===a&&(a=0),void 0===o&&(o=c),void 0===l&&(l=u);var p=d.cutX+h,v=d.cutY+a;return this.context.drawImage(d.source.image,p,v,o,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new ua);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var h=i;i=h.red,s=h.green,r=h.blue,n=h.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var a=this.context.createImageData(1,1);return a.data[0]=i,a.data[1]=s,a.data[2]=r,a.data[3]=n,this.context.putImageData(a,t,e),this.dirty=!0,this}},va=function(t,e,i,s,r,n,h){var a,o=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===h&&(h=e.height);var d=(a=o.exists(i)?o.get(i):o.createCanvas(i,n,h)).getSourceImage();d.width!==n&&(d.width=n),d.height!==h&&(d.height=h);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,h),c.drawImage(e,s,r,n,h),l.gl&&a&&l.canvasToTexture(d,a.source[0].glTexture,!0,0)},ga={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,va(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};e();const fa=Phaser.Display.Canvas.CanvasPool,ma=Phaser.GameObjects.GameObject,ya=Phaser.Utils.String.UUID;class ba extends ma{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=fa.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=ya(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){fa.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}}const xa=Phaser.GameObjects.Components;Phaser.Class.mixin(ba,[xa.Alpha,xa.BlendMode,xa.Crop,xa.Depth,xa.Flip,xa.GetBounds,xa.Mask,xa.Origin,xa.Pipeline,xa.PostPipeline,xa.ScrollFactor,xa.Tint,xa.Transform,xa.Visible,ca,pa,ga]);var Ca={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:Ms(this.data,t,e)},incData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)+e),this},mulData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)*e),this},clearData(){return this.data&&mt(this.data),this}};class wa{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}}Object.assign(wa.prototype,Ca);var Sa={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const Oa=Phaser.Math.RotateAround;var ka;const Pa=Phaser.Geom.Rectangle;var _a,Ta=function(t){void 0===_a&&(_a=new Pa);var e=t.drawTLX,i=t.drawTLY;return _a.setTo(e,i,t.drawTRX-e,t.drawBLY-i),_a};const Ea=Phaser.Math.RotateAround;var Ma,Ra=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Ma&&(Ma={}),s=Ma),s.x=e,s.y=i,0!==t.rotation&&Ea(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const La=Phaser.GameObjects.Components.TransformMatrix;var Da,Ya,Xa={},Aa=function(t,e,i,s,r){var n=Ra(e,i,s,!0),h=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=Xa);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===Da&&(Da=new La,Ya=new La),t.parentContainer?t.getWorldTransformMatrix(Da,Ya):Da.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),Da.transformPoint(r,n,s),s}(t,n.x,n.y,r);return h},za=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,h=e.drawCenterY+s;return Aa(t,e,n,h,r)},Wa={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===ka&&(ka={}),s=ka),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&Oa(s,0,0,-i.rotation),s}(t,e,this,!0);return Ta(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return za(this.parent,this,t,e,i)}};Object.assign(Wa,Sa);const Ba=Phaser.Math.DegToRad,ja=Phaser.Math.RadToDeg,Ia=Phaser.Utils.Objects.GetValue;class Fa extends wa{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return ja(this._rotation)}set angle(t){this.rotation=Ba(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=Ia(t,"width",void 0),i=Ia(t,"height",void 0),s=Ia(t,"scaleX",void 0),r=Ia(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(Fa.prototype,Wa);const Ha=Phaser.Utils.String.Pad;var Ga=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${Ha(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},Na=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Va=Phaser.Utils.Objects.GetValue;let Ua=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=Va(t,"x",0),i=Va(t,"y",0));var s=this.cornerRadius;s.tl=$a(Va(t,"tl",void 0),e,i),s.tr=$a(Va(t,"tr",void 0),e,i),s.bl=$a(Va(t,"bl",void 0),e,i),s.br=$a(Va(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Ja(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Ja(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Ja(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Ja(this.cornerRadius.br,t)}};var $a=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Ka(t),t},Ja=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Va(e,"x",0),t.y=Va(e,"y",0)),Ka(t)},Ka=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const qa=Phaser.Math.DegToRad;var Za=function(t){return!t.hasOwnProperty("convex")||t.convex},Qa=function(t){return t.x>0&&t.y>0},to=function(t,e,i,s,r,n,h,a,o){if(a&&h>n?h-=360:!a&&h=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=m.tl,Qa(a)?(o=a.x*g,l=a.y*f,Za(a)?to(t,o,l,o,l,180,270,!1,h):to(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,Qa(a)?(o=a.x*g,l=a.y*f,Za(a)?to(t,s-o,l,o,l,270,360,!1,h):to(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,Qa(a)?(o=a.x*g,l=a.y*f,Za(a)?to(t,s-o,r-l,o,l,0,90,!1,h):to(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,Qa(a)?(o=a.x*g,l=a.y*f,Za(a)?to(t,o,r-l,o,l,90,180,!1,h):to(t,0,r,o,l,360,270,!0,h)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,h,u),null!=a)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,a),p.addColorStop(1,d),a=p),e.fillStyle=a,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())},io=function(t,e,i,s,r,n,h,a){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),eo(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}};const so=Phaser.Utils.Objects.GetValue;class ro extends Fa{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(so(e,"color",null),so(e,"color2",null),so(e,"horizontalGradient",!0)),this.setStroke(so(e,"stroke",null),so(e,"strokeThickness",2)),this.setCornerRadius(so(e,"cornerRadius",0),so(e,"cornerIteration",null))}set color(t){t=Ga(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Ga(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Ga(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,Na("color2",t,this),Na("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Na("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Na("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){io(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const no=Phaser.Utils.Objects.GetValue;class ho extends Fa{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(no(e,"color",null),no(e,"color2",null),no(e,"horizontalGradient",!0)),this.setStroke(no(e,"stroke",null),no(e,"strokeThickness",2))}set color(t){t=Ga(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Ga(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Ga(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,no(t,"color2",null),no(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,no(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,h=this.parent.height-i.top-i.bottom,a=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?a.createLinearGradient(0,0,n,0):a.createLinearGradient(0,0,0,h)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,a.fillStyle=t,a.fillRect(s,r,n,h));null!=this.stroke&&this.strokeThickness>0&&(a.strokeStyle=this.stroke,a.lineWidth=this.strokeThickness,a.strokeRect(s,r,n,h))}}const ao=Phaser.Utils.Objects.GetValue;let oo=class t{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(ao(t,"bold",!1)),this.setItalic(ao(t,"italic",!1)),this.setFontSize(ao(t,"fontSize","16px")),this.setFontFamily(ao(t,"fontFamily","Courier")),this.setColor(ao(t,"color","#fff")),this.setStrokeStyle(ao(t,"stroke",null),ao(t,"strokeThickness",0)),this.setShadow(ao(t,"shadowColor",null),ao(t,"shadowOffsetX",0),ao(t,"shadowOffsetY",0),ao(t,"shadowBlur",0)),this.setOffset(ao(t,"offsetX",0),ao(t,"offsetY",0)),this.setSpace(ao(t,"leftSpace",0),ao(t,"rightSpace",0)),this.setAlign(ao(t,"align",void 0)),this.setBackgroundColor(ao(t,"backgroundColor",null)),this.setBackgroundHeight(ao(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(ao(t,"backgroundBottomY",void 0)),this.setBackgroundLeftX(ao(t,"backgroundLeftX",0)),this.setBackgroundRightX(ao(t,"backgroundRightX",0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(Na("stroke",t,this),Na("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Na("shadowOffsetX",t,this),Na("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),t.hasOwnProperty("backgroundLeftX")&&this.setBackgroundLeftX(t.backgroundLeftX),t.hasOwnProperty("backgroundRightX")&&this.setBackgroundRightX(t.backgroundRightX),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new t(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=Ga(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=Ga(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=Ga(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=Ga(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setBackgroundLeftX(t){return this.backgroundLeftX=t,this}setBackgroundRightX(t){return this.backgroundRightX=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}};const lo=Phaser.Utils.Array.Remove,co=Phaser.Utils.Array.Remove,uo="text",po="image",vo="drawer",go="space",fo="command";var mo=function(t){return t.type===uo&&"\n"===t.text},yo=function(t){return t.type===uo&&"\f"===t.text},bo=function(t){return t.type===uo};class xo extends Fa{constructor(t,e,i){super(t,uo),this.updateTextFlag=!1,this.style=new oo(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX+e.backgroundLeftX,s=i,r=this.drawTRX+e.backgroundRightX-i+1;if(r>0){var n=e.backgroundBottomY;null==n&&(n=this.drawBLY);var h=e.backgroundHeight;null==h&&(h=n-this.drawTLY);var a=n-h;t.fillRect(s,a,r,h)}}var o=e.hasFill,l=e.hasStroke;(o||l)&&(e.syncFont(t).syncStyle(t),l&&(e.syncShadow(t),t.strokeText(this.text,0,0)),o&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var Co=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const wo=Phaser.Display.Canvas.CanvasPool;var So=function(t,e,i,s,r,n,h,a){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===a&&(a=!1),a&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(h){var l=wo.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=h,d.fillRect(0,0,r,n),o.drawImage(l,0,0,r,n,i,s,r,n),wo.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)};Phaser.Display.Canvas.CanvasPool;class Oo extends Fa{constructor(t,e,i){super(t,po),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){So(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class ko extends Fa{constructor(t,e,i,s){super(t,vo),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class Po extends Fa{constructor(t,e){super(t,go),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class _o extends wa{constructor(t,e,i,s,r){super(t,fo),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}function To(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>To(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=To(t[i]));return e}var Eo=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const Mo={none:0,word:1,char:2,character:2,mix:3};var Ro=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,h=!r&&!n,a=t.length,o=e,l=s.word,d=0,c=!1;o0&&!a){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=Xo.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=Xo.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=zo(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=zo(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=zo(t,"wrapMode");void 0===c&&(c=zo(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=Mo[c]);var u=zo(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=zo(t,"letterSpacing",0),v=zo(t,"hAlign",0),g=zo(t,"vAlign",0),f=zo(t,"justifyPercentage",.25),m=Eo({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:h,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,b=0,x=y.length;b0&&(E.push({children:M,width:R}),L=Math.max(L,R)),m.start+=T.length,m.isLastPage=!D&&m.start===_,m.maxLineWidth=L,m.linesHeight=E.length*n;var j=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,I=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,h=t.vAlign,a=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(h=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=jo(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=jo(t,"maxLines",0);var a=0===i,o=jo(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=jo(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=jo(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=jo(t,"letterSpacing",0),p=jo(t,"rtl",!0),v=jo(t,"hAlign",p?2:0),g=jo(t,"vAlign",0),f=Eo({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:o,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(T.push({children:E,height:M}),R=Math.max(R,M)),f.start+=_.length,f.isLastPage=f.start===P,f.maxLineHeight=R,f.linesWidth=T.length*n;var z=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,W=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,h=t.vAlign,a=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}a&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,h=i.bottom;return De(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return Le(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),lo(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return co(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(uo);return null===i?i=new xo(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),za(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const cl=Phaser.Utils.Objects.GetFastValue;var ul={};class pl{constructor(t){this.pools=cl(t,"pools",ul)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new dl),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;ei&&(r=Math.floor(i));for(var n={},h=Cl(t,r,e,i,n),a=0;a<=yl&&0!==h;a++){if((r+=h)<0){r=0;break}h=Cl(t,r,e,i,n)}return a===yl&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),wl(t,e,i),t},xl=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},Cl=function(t,e,i,s,r){var n,h=xl(t,e,r),a=xl(t,e+1,r);if(void 0!==s)if(h.height<=s&&a.height>s)n=0;else{if(h.height>s)return-1;n=Math.floor(s-h.height)}if(h.width<=i&&a.width>i)return 0;if(h.width>i)return-1;var o=Math.floor(i-h.width);return void 0===n?o:Math.min(o,n)},wl=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const Sl=Phaser.Utils.Objects.GetValue,Ol=Phaser.Utils.Objects.GetValue;class kl extends Ah{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=Ol(e,"background",void 0),r=Ol(e,"icon",void 0),n=Ol(e,"iconMask",void 0),h=Ol(e,"text",void 0),a=Ol(e,"action",void 0),o=Ol(e,"actionMask",void 0),l=Ol(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(h||a)&&(i={right:Ol(e,"space.icon",0),top:Ol(e,"space.iconTop",0),bottom:Ol(e,"space.iconBottom",0),left:Ol(e,"space.iconLeft",0)}):(h||a)&&(i={bottom:Ol(e,"space.icon",0),left:Ol(e,"space.iconLeft",0),right:Ol(e,"space.iconRight",0),top:Ol(e,"space.iconTop",0)});var d=Ol(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=Vh.call(this,r,r,1)),!d){var c=Ol(e,"iconSize",void 0);this.setIconSize(Ol(e,"iconWidth",c),Ol(e,"iconHeight",c))}}if(h){var u=Ol(e,"wrapText",!1),p=Ol(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),function(t,e){switch(qh(t)){case 0:switch("string"==typeof e&&(e=la[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=ta;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=la[e]||0),t.style.wrapMode=e}}(h,u),e.expandTextWidth=!0,ml(h)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=Sl(e,"minWidth",0),s=Sl(e,"minHeight",0),r=Sl(e,"fitHeight",!1);t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return bl(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),bl(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t})}(h,{fitHeight:!0}));var v,g,f=Ol(e,"space.text",0),m=Ol(e,"expandTextWidth",!1),y=Ol(e,"expandTextHeight",!1);0===this.orientation?(v=m?1:0,a&&(i={right:f}),g=y):(v=y?1:0,a&&(i={bottom:f}),g=m),this.add(h,{proportion:v,expand:g,padding:i})}if(a&&(i=0===this.orientation?{top:Ol(e,"space.actionTop",0),bottom:Ol(e,"space.actionBottom",0),right:Ol(e,"space.actionRight",0)}:{left:Ol(e,"space.actionLeft",0),right:Ol(e,"space.actionRight",0),bottom:Ol(e,"space.actionBottom",0)},d=Ol(e,"squareFitAction",!1)?1:0,this.add(a,{proportion:0,padding:i,fitRatio:d}),o&&(o=Vh.call(this,a,a,1)),!d)){var b=Ol(e,"actionSize");this.setActionSize(Ol(e,"actionWidth",b),Ol(e,"actionHeight",b))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",h),this.addChildrenMap("action",a),this.addChildrenMap("actionMask",o)}}var Pl={setWrapEnable(t){return void 0===t&&(t=!0),this.listWrapEnable=t,this},setCreateButtonCallback(t){return this.listCreateButtonCallback=t,this},setCreateListBackgroundCallback(t){return this.listCreateBackgroundCallback=t,this},setCreateListSliderTrackCallback(t){return this.listCreateSliderTrackCallback=t,this},setCreateListSliderThumbCallback(t){return this.listCreateSliderThumbCallback=t,this},setListSliderAdaptThumbSizeEnable(t){return void 0===t&&(t=!0),this.listSliderAdaptThumbSizeEnable=t,this},setListScrollerConfig(t){return void 0===t&&(t={}),this.listScrollerConfig=t,this},setListMouseWheelScrollerConfig(t){return this.listMouseWheelScrollerConfig=t,this},setButtonClickCallback(t){return this.listOnButtonClick=t,this},setButtonOverCallback(t){return this.listOnButtonOver=t,this},setButtonOutCallback(t){return this.listOnButtonOut=t,this},setListExpandDirection(t){return"string"==typeof t&&(t=_l[t]),this.listExpandDirection=t,this},setListEaseInDuration(t){return void 0===t&&(t=0),this.listEaseInDuration=t,this},setListEaseOutDuration(t){return void 0===t&&(t=0),this.listEaseOutDuration=t,this},setListTransitInCallback(t){return this.listTransitInCallback=t,this},settListTransitOutCallback(t){return this.listTransitOutCallback=t,this},setListBounds(t){return this.listBounds=t,this},setListWidth(t){return this.listWidth=t,this},setListHeight(t){return this.listHeight=t,this},setListSize(t,e){return this.setListWidth(t).setListHeight(e),this},setListMaxHeight(t){return this.listMaxHeight=t,this},setListAlignmentMode(t){return this.listAlignMode=t,this},setListAlignmentSide(t){return void 0===t&&(t=""),this.listAlignSide=t,this},setListSpace(t){return void 0===t&&(t={}),this.listSpace=t,this},setListDraggable(t){return void 0===t&&(t=!0),this.listDraggable=t,this}};const _l={down:0,up:1},Tl=Lh.prototype.add,El=Lh.prototype.addSpace;var Ml=function(t){var e=!t.isRexSpace,i=!e||this.buttonsExpand?1:0;if(0===this.sizerChildren.length)if(e){!this.buttonsExpand&&("right"===this.buttonsAlign||"center"===this.buttonsAlign||"bottom"===this.buttonsAlign)&&El.call(this),Tl.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&El.call(this),this.hasTailSpace=s}else Tl.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;Tl.call(this,t,{index:r,proportion:i,expand:!0})}else Tl.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},Rl={addButton(t){if(pr(t))for(var e=t,i=0,s=e.length;i=0;i--)Yl.call(this,e[i],t);return this}},Al=function(t,e,i){if(t){var s=this.setValueCallback,r=this.setValueCallbackScope;s&&(r?s.call(r,t,e,i):s(t,e,i)),this.fireEvent("button.statechange",t,e,i)}},zl=function(t){var e=this;t._selected=void 0,Object.defineProperty(t,"selected",{get:function(){return t._selected},set:function(i){if(t._selected!==i){var s=t._selected;t._selected=i,Al.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},Wl={add(t){return this.buttons.push(t),t._click||(t._click=new Sr(t,this.clickConfig),t._click.on("click",(function(t,e,i,s){this.fireEvent("button.click",e,i,s)}),this).on("enable",(function(t,e){this.fireEvent("button.enable",e)}),this).on("disable",(function(t,e){this.fireEvent("button.disable",e)}),this).on("over",(function(t,e,i,s){this.fireEvent("button.over",e,i,s)}),this).on("out",(function(t,e,i,s){this.fireEvent("button.out",e,i,s)}),this).on("down",(function(t,e,i,s){this.fireEvent("button.down",e,i,s)}),this).on("up",(function(t,e,i,s){this.fireEvent("button.up",e,i,s)}),this),t.isRexContainerLite&&t.sendChildToBack(t)),this.buttonsType&&(void 0===t.name&&console.error(`${this.parent.constructor.name}: Option button miss value`),zl.call(this,t)),this},addMultiple(t){for(var e=0,i=t.length;e0},setButtonEnable(t,e){var i=this.buttons;if(void 0===t||"boolean"==typeof t){e=t;for(var s=0,r=i.length;sa.height/2)){r>(o=Zl(a.left,a.centerY,t,e))&&(r=o,s=n);var o,l=i[n+1];l&&l.y===a.y||r>(o=Zl(a.right,a.centerY,t,e))&&(r=o,s=n+1)}}return s};const td=Phaser.Utils.Objects.IsPlainObject,ed=Phaser.Utils.Objects.GetValue,id=Phaser.Display.Align.CENTER;var sd=function(t,e,i,s){return"\n"===t?(this.addNewLine(),this):(ye.call(this,t),td(e)&&(e=ed(o=e,"padding",0),i=ed(o,"key",void 0),s=ed(o,"index",void 0),r=ed(o,"offsetX",0),n=ed(o,"offsetY",0),h=ed(o,"offsetOriginX",0),a=ed(o,"offsetOriginY",0)),void 0===e&&(e=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===h&&(h=0),void 0===a&&(a=0),(o=this.getSizerConfig(t)).align=id,o.padding=fe(e),o.alignOffsetX=r,o.alignOffsetY=n,o.alignOffsetOriginX=h,o.alignOffsetOriginY=a,void 0===s||s>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(s,0,t),void 0!==i&&this.addChildrenMap(i,t),this);var r,n,h,a,o},rd={add(t,e,i){if(pr(t))for(var s=t,r=0,n=s.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,bh.call(this,t),this}},ad={getChildrenWidth:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=0===this.orientation&&t?this.maxChildWidth:this.rexSizer.resolved?this.wrapResult.width:void 0)?e+(this.space.left+this.space.right)*this.scaleX:void 0);var e},getChildrenHeight:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=1===this.orientation&&t?this.maxChildHeight:this.rexSizer.resolved?this.wrapResult.height:void 0)?e+(this.space.top+this.space.bottom)*this.scaleY:void 0);var e},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;sr&&vd.addNewLine(this)}else for(n=0,h=t.length;n=0;i--)bd.call(this,e[i],t);return this}};const Cd=Phaser.Utils.Objects.GetValue;class wd extends ud{constructor(t,e){void 0===e&&(e={});var i=e.space;"number"==typeof i&&(e.space={item:i,line:i}),super(t,e),this.type="rexFixWidthButtons",this.buttonGroup=new Nl({parent:this,eventEmitter:Cd(e,"eventEmitter",this),groupName:Cd(e,"groupName",void 0),clickConfig:Cd(e,"click",void 0)}).setButtonsType(e);var s=Cd(e,"background",void 0),r=Cd(e,"buttons",void 0);this.buttonsAlign=Cd(e,"align",void 0),s&&this.addBackground(s),r&&this.addButtons(r),this.addChildrenMap("background",s),this.addChildrenMap("buttons",this.buttonGroup.buttons)}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.buttonGroup.destroy(),this.buttonGroup=void 0)}get buttons(){return this.buttonGroup.buttons}get groupName(){return this.buttonGroup.groupName}set groupName(t){this.buttonGroup.groupName=t}get eventEmitter(){return this.buttonGroup.eventEmitter}}Object.assign(wd.prototype,fd,xd,Gl,Ul);var Sd={v:0,vertical:0,y:0,h:1,horizontal:1,x:1,xy:2,vh:2},Od=function(t,e){void 0===e&&(e="scrollMode"),t.hasOwnProperty(e)||(t[e]=kd(t));var i=t[e];return"string"==typeof i&&(i=Sd[i]),i},kd=function(t){var e=!!t.sliderY||!!t.scrollerY,i=!!t.sliderX||!!t.scrollerX;return e&&i?2:e?0:i?1:0},Pd=function(){return Array.prototype.reduce.call(arguments,_d,0)},_d=function(t,e){return t+e};const Td=Phaser.Utils.Objects.IsPlainObject,Ed=Phaser.Utils.Objects.GetValue,Md=Phaser.Display.Align.CENTER;var Rd=function(t,e,i,s,r){if("number"==typeof t||"number"==typeof e){if(void 0===t){for(var n=0;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return Dd(this.sizerChildren,null),bh.call(this,t),this}},Xd={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)Dd(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},Bd={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=We.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,Dd(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Dd(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},Id=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const Fd=Phaser.Utils.Objects.IsPlainObject,Hd=Phaser.Utils.Objects.GetValue;class Gd extends nh{constructor(t,e,i,s,r,n,h,a,o,l){Fd(e)?(e=Hd(l=e,"x",0),i=Hd(l,"y",0),s=Hd(l,"width",void 0),r=Hd(l,"height",void 0),n=Hd(l,"column",l.col||0),h=Hd(l,"row",0),a=Hd(l,"columnProportions",0),o=Hd(l,"rowProportions",0)):Fd(s)?(s=Hd(l=s,"width",void 0),r=Hd(l,"height",void 0),n=Hd(l,"column",l.col||0),h=Hd(l,"row",0),a=Hd(l,"columnProportions",0),o=Hd(l,"rowProportions",0)):Fd(n)?(n=Hd(l=n,"column",l.col||0),h=Hd(l,"row",0),a=Hd(l,"columnProportions",0),o=Hd(l,"rowProportions",0)):Fd(a)&&(a=Hd(l=a,"columnProportions",0),o=Hd(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(Hd(l,"createCellContainerCallback")),this.setIndentLeft(Hd(l,"space.indentLeftOdd",0),Hd(l,"space.indentLeftEven",0)),this.setIndentTop(Hd(l,"space.indentTopOdd",0),Hd(l,"space.indentTopEven",0)),this.resetGrid(n,h,a,o,Hd(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=jd.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=Id.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(Gd.prototype,Bd);const Nd=Phaser.Utils.Objects.GetValue;var Vd=Phaser.Renderer.WebGL.Utils,Ud=function(t,e,i,s,r,n){for(var h=Vd.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),a=i.pathData,o=i.pathIndexes,l=0;l>>16,a=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+h+","+a+","+o+","+n+")"},Zd=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,h=(16711680&r)>>>16,a=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+h+","+a+","+o+","+n+")",t.lineWidth=e.lineWidth};const Qd=Phaser.Renderer.Canvas.SetTransform;var tc={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Kd(e,i,s),h=r.calcMatrix.copyFrom(n.calc),a=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&Ud(r,h,e,l,a,o),e.isStroked&&Jd(r,e,l,a,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(Qd(t,r,e,i,s)){var n=e._displayOriginX,h=e._displayOriginY,a=e.pathData,o=a.length-1,l=a[0]-n,d=a[1]-h;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(ic.prototype,tc);var sc=function(t){return t.x>0&&t.y>0},rc=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const nc=Phaser.Math.DegToRad;var hc=function(t,e,i,s,r,n,h,a,o){h&&n>r?n-=360:!h&&n0,h=0,a=e.length;h=0?t.startAt(h+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(h+n,i):t.startAt(h,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(h,i),t.close(),t};const ru=Phaser.Utils.Objects.GetValue,nu=Phaser.Utils.Objects.IsPlainObject;class hu extends(Lc(Oc)){constructor(t,e,i,s,r,n,h,a){nu(e)?(e=(a=e).x,i=a.y,s=a.width,r=a.height,n=a.barColor,h=a.value):nu(s)?(s=(a=s).width,r=a.height,n=a.barColor,h=a.value):nu(n)&&(n=(a=n).barColor,h=a.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===h&&(h=0),super(t,e,i,s,r,a),this.type="rexLineProgress",this.bootProgressBase(a),this.addShape((new iu).setName("trackFill")).addShape((new iu).setName("bar")).addShape((new iu).setName("trackStroke")),this.setTrackColor(ru(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(ru(a,"trackStrokeThickness",2),ru(a,"trackStrokeColor",void 0)),this.setSkewX(ru(a,"skewX",0)),this.setRTL(ru(a,"rtl",!1)),this.setValue(h)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var au={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&su(s,0,0,e,i,t);var r,n,h=this.getShape("bar");h.fillStyle(this.barColor),h.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),su(h,r,0,n,i,t));var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&su(a,0,0,e,i,t)}};Object.assign(hu.prototype,au);var ou=function(t){return null==t||""===t||0===t.length},lu=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(ou(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(ou(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,h=e.length;n=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=To(i),s=To(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),h=n.width,a=0,o=0,l=i.length;o0?h/a:0,c=n.height,u=0;for(o=0,l=s.length;o0?0:g,b=0,o=0;for(var S=i.length;o0?0:f),f>=1&&g>=1){var O=typeof(m=this.getFrameNameCallback(o,C,e));"string"!==O&&"number"!==O||r.add(m,0,b+n.cutX,x+n.cutY,f,g)}b+=f}x+=g}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,h,a,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/o,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(u,p);if(u>v){var g=(u-v)*o;d>=0?d+=g:d=g,u=v}if(p>v){var f=(p-v)*l;c>=0?c+=f:c=f,p=v}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,x=this.rows.count;b0&&a>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(C,b)?0:1)?this._drawImage(this.textureKey,s,m,y,h,a):this._drawTileSprite(this.textureKey,s,m,y,h,a)),m+=h;y+=a}this._endDraw()},setStretchMode:function(t){return _u(t)?(this.stretchMode.edge=Eu(Tu(t,"edge",0)),this.stretchMode.internal=Eu(Tu(t,"internal",0))):(t=Eu(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Ru.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const Du=Phaser.Utils.Objects.IsPlainObject,Yu=Phaser.Utils.Objects.GetValue,Xu=Phaser.GameObjects;var Au=void 0,zu=function(t,e){if(Au||(Au={},ei(t).events.once("destroy",(function(){for(var t in Au)Au[t].destroy();Au=void 0}))),!Au.hasOwnProperty(e)){var i=ei(t).scene.systemScene;(t=new Xu[e](i)).setOrigin(0),Au[e]=t}return Au[e]};const Wu=Phaser.GameObjects.RenderTexture;class Bu extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if(Du(i)?(i=Yu(d=i,"x",0),s=Yu(d,"y",0),r=Yu(d,"width",1),n=Yu(d,"height",1),h=Yu(d,"key",void 0),a=Yu(d,"baseFrame",void 0),o=Yu(d,"columns",void 0),l=Yu(d,"rows",void 0)):Du(r)?(r=Yu(d=r,"width",1),n=Yu(d,"height",1),h=Yu(d,"key",void 0),a=Yu(d,"baseFrame",void 0),o=Yu(d,"columns",void 0),l=Yu(d,"rows",void 0)):Du(h)?(h=Yu(d=h,"key",void 0),a=Yu(d,"baseFrame",void 0),o=Yu(d,"columns",void 0),l=Yu(d,"rows",void 0)):Du(a)?(a=Yu(d=a,"baseFrame",void 0),o=Yu(d,"columns",void 0),l=Yu(d,"rows",void 0)):Array.isArray(a)?(d=l,l=o,o=a,a=Yu(d,"baseFrame",void 0)):Du(o)&&(o=Yu(d=o,"columns",void 0),l=Yu(d,"rows",void 0)),void 0===a&&(a=Yu(d,"frame",void 0)),void 0===o){var c=Yu(d,"leftWidth",void 0),u=Yu(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=Yu(d,"topHeight",void 0),v=Yu(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(Yu(d,"getFrameNameCallback",void 0)),this.setStretchMode(Yu(d,"stretchMode",0)),this.setPreserveRatio(Yu(d,"preserveRatio",!0));var g=Yu(d,"maxFixedPartScale",1),f=Yu(d,"maxFixedPartScaleX",g),m=Yu(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(h,a,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,Lu),i}(Wu,"rexNinePatch")){}var ju={_drawImage:function(t,e,i,s,r,n){var h=zu(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=zu(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(Bu.prototype,ju);let Iu=class extends si{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(uu(t,e))return t[e];var i=t.parent;return uu(i,e)?i[e]:void 0}set(t,e,i){return uu(t,e)?t[e]=i:uu(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}};const Fu=Phaser.Utils.Objects.GetValue;class Hu extends Bu{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=Fu(e,"effects",!0);i&&mu(this,i),this.style=new Iu(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Hu.prototype,fc);const Gu=["alpha","tint","flipX","flipY"];var Nu=function(t,e){if(!e)return t;for(var i=0,s=Gu.length;i=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const Sp=Phaser.Utils.Objects.GetValue,Op=Phaser.Math.Distance.Between;class kp extends si{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=Sp(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(Sp(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(Sp(t,"enable",!0)),this.holdThreshold=Sp(t,"holdThreshold",50),this.pointerOutReleaseEnable=Sp(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return gn(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:Op(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!ur(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!ur(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const Pp=Phaser.Utils.Objects.GetValue;class _p{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(Pp(t,"value",0)),this.setSpeed(Pp(t,"speed",0)),this.setAcceleration(Pp(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class Tp{constructor(){this.value,this.dir,this.movement=new _p}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const Lp={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},Dp=Phaser.Utils.Objects.GetValue;class Yp extends si{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=Dp(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(Dp(e,"speed",.1)),this.setEnable(Dp(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(Dp(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||ur(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const Xp=Phaser.Utils.Objects.GetValue;var Ap=function(t,e,i,s){var r,n,h="Y"===(i=i.toUpperCase()),a=2===t.scrollMode,o=t.childrenMap.child,l=`slider${i}`;if(r=a||s.hasOwnProperty(l)?Xp(s,l,void 0):Xp(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=h?1:0,n=function(t,e){void 0===e&&(e={});var i=yt(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new Cp(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r),n.tickLength=Xp(r,"tickLength",void 0);var p=Xp(r,"position",0);"string"==typeof p&&(p=zp[p]);var v,g,f=Xp(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=Xp(s,"space.slider",void 0))&&(a?f=0:v=Xp(s,"space.child",0)),g=void 0===v?"number"==typeof f:"number"==typeof v,h?0===p?(d=2,c=1,u=void 0===v?g?{left:f}:f:{left:Xp(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:Xp(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:Xp(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:Xp(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=Xp(r,"hideUnscrollableSlider",!1),t[`disableUnscrollableDrag${i}`]=Xp(r,"disableUnscrollableDrag",!1),t[`adaptThumb${i}SizeMode`]=Xp(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=Xp(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`disableUnscrollableDrag${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=Xp(s,"scrollDetectionMode");"string"==typeof b&&(b=Wp[b]);var x=`scroller${i}`;(m=a||s.hasOwnProperty(x)?Xp(s,x,!0):Xp(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new Rp(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var C,w,S,O,k,P=Xp(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);P&&o&&(void 0!==b&&(P.focus=1===b?2:0),C=new Yp(o,P)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,C),a&&!h||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.disableUnscrollableDrag=t[`disableUnscrollableDrag${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",C)),n&&(a?(w=h?"t":"s",O=`scroll${i}`):(w="t",O="scroll"),n.on("valuechange",(function(e){t[w]=e,t.emit(O,t)}))),y&&(a?(S=`childO${i}`,O=`scroll${i}`):(S="childOY",O="scroll"),y.on("valuechange",(function(e){t[S]=e,t.emit(O,t)}))),C&&(k=a?`addChildO${i}`:"addChildOY",C.on("scroll",(function(e){t[k](-e,!0)})))};const zp={right:0,left:1,bottom:0,top:1},Wp={gameObject:0,rectBounds:1},Bp=Phaser.Utils.Objects.GetValue;var jp=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=Bp(e,"width"),h=Bp(e,"height");n||Bp(e,"child.expandWidth",!0)||(s[1]=0),h||Bp(e,"child.expandHeight",!0)||(r[1]=0);var a=new Gd(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=Nd(i,"child"),r=Nd(s,"gameObject",void 0);if(r){var n=Nd(i,"space.child",0);t.childMargin={};var h=t.childMargin,a={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:h.top=0,h.bottom=0,h.left=0,h.right=0;break;default:h.top=n,h.bottom=n,h.left=n,h.right=n}else switch(t.scrollMode){case 0:h.top=Nd(n,"top",0),h.bottom=Nd(n,"bottom",0),a.left=Nd(n,"left",0),a.right=Nd(n,"right",0);break;case 1:h.top=Nd(n,"left",0),h.bottom=Nd(n,"right",0),a.top=Nd(n,"top",0),a.bottom=Nd(n,"bottom",0);break;default:h.top=Nd(n,"top",0),h.bottom=Nd(n,"bottom",0),h.left=Nd(n,"left",0),h.right=Nd(n,"right",0)}e.add(r,{column:1,row:1,align:Nd(s,"align","center"),padding:a,expand:{width:Nd(s,"expandWidth",!0),height:Nd(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:Ap(t,a,"y",e);break;case 1:Ap(t,a,"x",e);break;default:Ap(t,a,"y",e),Ap(t,a,"x",e)}return a},Ip=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}i*="Y"===t?this.scaleY:this.scaleX,s&&s.setBounds(e,i),r&&(r.setEnable(e!==i),r.tickLength&&r.setTick(r.tickLength,e,i))},Fp=function(t){switch(this.scrollMode){case 0:case 1:(i=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(i,this.isOverflow),(r=this.childrenMap.scroller)&&this.disableUnscrollableDrag&&r.setEnable(this.isOverflow);break;default:var e=this[`isOverflow${t=t.toUpperCase()}`],i=this.childrenMap[`slider${t}`],s=this[`hideUnscrollableSlider${t}`];i&&s&&this.setChildVisible(i,e);var r=this.childrenMap.scroller,n=this[`disableUnscrollableDrag${t}`];r&&n&&r.setEnable(e)}},Hp=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(a=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=a.childrenMap.track,s=a.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&nthis.topChildOY}childOYExeceedBottom(t){return void 0===t&&(t=this.childOY),tthis.leftChildOX}childOXExeceedRight(t){return void 0===t&&(t=this.childOX),tthis.childHeight?t=0:s?t=e:r&&(t=i)),this._childOY!==t&&(this._childOY=t,this.resetChildPosition()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}get childOX(){return this._childOX}set childOX(t){var e=this.leftChildOX,i=this.rightChildOX,s=this.childOXExceedLeft(t),r=this.childOXExeceedRight(t);this.clampChildOX&&(this.childVisibleWidth>this.childWidth?t=0:s?t=e:r&&(t=i)),this._childOX!==t&&(this._childOX=t,this.resetChildPosition()),s&&(this.execeedLeftState||this.emit("execeedleft",this,t,e)),this.execeedLeftState=s,r&&(this.execeedRightState||this.emit("execeedright",this,t,i)),this.execeedRightState=r}setChildOY(t){return this.childOY=t,this}setChildOX(t){return this.childOX=t,this}set t(t){this.childOY=-this.visibleHeight*t}get t(){var t=this.visibleHeight;return 0===t?0:this.childOY/-t}set s(t){this.childOX=-this.visibleWidth*t}get s(){var t=this.visibleWidth;return 0===t?0:this.childOX/-t}setChildOYByPercentage(t){return this.t=t,this}setChildOXByPercentage(t){return this.s=t,this}}Object.assign(dv.prototype,hv);const cv=["top","bottom","centerY","center"],uv=["left","right","centerX","center"];var pv=function(t,e,i){var s,r="Y"===(e=e.toUpperCase()),n=this.childrenMap.child;if(r){if(i)for(var h=0,a=cv.length;h=0?0:Math.abs(l)<=Math.abs(d)?l:d}}else{if(i)for(h=0,a=uv.length;h=0?0:Math.abs(c)<=Math.abs(u)?c:u}}switch(this.scrollMode){case 0:case 1:this.childOY+=s;break;default:this[`childO${e}`]+=s}};const vv=Phaser.Utils.Objects.GetValue;class gv extends Up{constructor(t,e){void 0===e&&(e={});var i=Od(e),s=vv(e,"panel",void 0);void 0===s&&(s={}),s.scrollMode=i,s.clampChildOY=vv(e,"clampChildOY",!1),s.clampChildOX=vv(e,"clampChildOX",!1);var r,n,h=new dv(t,s);switch(t.add.existing(h),i){case 0:r=vv(e,"expand.panel",!0),n=!0;break;case 1:r=!0,n=vv(e,"expand.panel",!0);break;default:r=!0,n=!0}e.type="rexScrollablePanel",e.child={gameObject:h,expandWidth:r,expandHeight:n,align:vv(e,"align.panel","center")};var a=vv(e,"space",void 0);a&&(a.child=vv(a,"panel",0)),super(t,e),this.addChildrenMap("panel",h.child),this.addChildrenMap("panelLayer",h.maskLayer),this.addChildrenMap("mask",h.maskGameObject),this.addChildrenMap("scrollableBlock",h)}setChildrenInteractive(t){return void 0===t&&(t={}),t.hasOwnProperty("eventEmitter")||(t.eventEmitter=this),t.hasOwnProperty("targets")||(t.targets=[this.childrenMap.panel]),ih(this.childrenMap.child,t),this}}var fv={scrollToChild:function(t,e){if(!this.hasChild(t))return this;switch(this.scrollMode){case 0:pv.call(this,t,"y",e);break;case 1:pv.call(this,t,"x",e);break;default:pv.call(this,t,"y",e),pv.call(this,t,"x",e)}return this}};Object.assign(gv.prototype,fv);const mv=Phaser.Utils.Objects.GetValue;var yv=function(){var t,e=this.scene,i=this.listCreateBackgroundCallback;i&&(t=i.call(this,e),e.add.existing(t));var s=[],r=this.listCreateButtonCallback;if(r)for(var n=this.options,h=0,a=n.length;h0||this.listMaxHeight>0)){if(s=bv(e,u,this.listWrapEnable),this.listMaxHeight>0&&(s.layout(),s.height<=this.listMaxHeight&&(d=s)),!d){0===c&&(c=this.listMaxHeight);var p=xv(e,this.listCreateSliderTrackCallback),v=xv(e,this.listCreateSliderThumbCallback);d=new gv(e,{height:c,scrollMode:0,panel:{child:s,mask:{padding:1}},slider:{track:p,thumb:v,adaptThumbSize:this.listSliderAdaptThumbSizeEnable},scrollDetectionMode:1,scroller:this.listScrollerConfig,mouseWheelScroller:this.listMouseWheelScrollerConfig,space:{panel:mv(this.listSpace,"panel",0)}}),e.add.existing(d)}}else u.height=c,s=bv(e,u,this.listWrapEnable),d=s;return t&&d.addBackground(t,"background"),this.listDraggable&&d.setDraggable(!0),d!==s&&s.on("button.over",(function(t,e,i,s){d.emit("button.over",t,e,i,s)})).on("button.out",(function(t,e,i,s){d.emit("button.out",t,e,i,s)})).on("button.click",(function(t,e,i,s){d.emit("button.click",t,e,i,s)})),d},bv=function(t,e,i){var s;return i?(e.orientation="x",s=new wd(t,e)):(e.orientation="y",s=new Jl(t,e)),t.add.existing(s),s},xv=function(t,e,i){var s;return e&&(s=e.call(i,t),t.add.existing(s)),s},Cv=function(t,e){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return!0;if(-1!==e.indexOf(".")){for(var i=e.split("."),s=t,r=0;rx.bottom&&(l=c.getTopLeft().y,t.setOrigin(0,1).setPosition(o+u,l+p))};const Ov={down:0,up:1},kv=Phaser.Utils.Objects.GetValue;class Pv extends Hs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=function(t,e){Ri(t,e,"y","Cubic")}),null==e.transitOut&&(e.transitOut=function(t,e){!function(t,e,i,s,r){void 0===s&&(s="Linear");var n={mode:0};switch(i){case 0:case"x":n.end={x:0};break;case 1:case"y":n.end={y:0};break;default:n.end=0}n.duration=e,n.ease=s,void 0===r?r=new Ei(t,n):r.resetFromJSON(n),r.restart()}(t,e,"y","Linear")}),e.manualClose=!0,e.clickOutsideClose=!0,e.destroy=!0,super(t,e),Sv(t,e),t.isRexSizer&&t.layout();var i=kv(e,"touchOutsideClose",!1),s=kv(e,"anyTouchClose",!1);s&&(i=!1),s?this.once("open",this.anyTouchClose,this):i&&this.once("open",this.touchOutsideClose,this),this.requestOpen()}shutdown(t){this.isShutdown||(this.scene.input.off("pointerup",this.touchCloseCallback,this),super.shutdown(t))}touchOutsideClose(){return this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&ir(this.parent,t.worldX,t.worldY)||this.requestClose()}onOpen(){this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.parent,this),super.onClose()}}var _v={focusNextButton(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;return t=void 0===e?0:(e+1)%this.listPanel.getButtons().length,this.emitButtonOver(t),this},focusPrevButton(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;if(void 0===e)t=0;else{var i=this.listPanel.getButtons().length;t=(e-1+i)%i}return this.emitButtonOver(t),this}},Tv={openListPanel:function(){if(this.listPanel)return this;if(0===this.options.length)return this;var t,e=yv.call(this);e.on("button.over",(function(t,i,s,r){this.currentOverIndex=i,this.listOnButtonOver&&this.listOnButtonOver.call(this,t,i,s,r),this.emit("button.over",this,e,t,i,s,r)}),this).on("button.out",(function(t,i,s,r){this.currentOverIndex===i&&(this.currentOverIndex=void 0),this.listOnButtonOut&&this.listOnButtonOut.call(this,t,i,s,r),this.emit("button.out",this,e,t,i,s,r)}),this),t=this.listAlignMode&&"label"!==this.listAlignMode?this.getElement(this.listAlignMode):this;var i=new Pv(e,{duration:{in:this.listEaseInDuration,out:this.listEaseOutDuration},transitIn:this.listTransitInCallback,transitOut:this.listTransitOutCallback,expandDirection:this.listExpandDirection,alignTargetX:t,alignTargetY:this,alignSide:this.listAlignSide,bounds:this.listBounds}).on("open",(function(){e.on("button.click",(function(t,i,s,r){this.listOnButtonClick&&this.listOnButtonClick.call(this,t,i,s,r),this.emit("button.click",this,e,t,i,s,r),this.dropDownBehavior.requestClose()}),this),this.emit("list.open",this,e)}),this).on("close",(function(){this.listPanel=void 0,this.dropDownBehavior=void 0,this.emit("list.close",this)}),this);return e.onClickOutside((function(){i.requestClose()})),this.listPanel=e,this.dropDownBehavior=i,this.pin(e),this},closeListPanel:function(){return this.dropDownBehavior?(this.dropDownBehavior.requestClose(),this.currentOverIndex=void 0,this):this},toggleListPanel:function(){return this.listPanel?this.closeListPanel():this.openListPanel(),this},emitButtonClick:function(t){if(void 0===t&&(t=this.currentOverIndex),void 0===t)return this;var e=this.listPanel,i=e?e.getButton(t):this.options[t];return this.listOnButtonClick&&this.listOnButtonClick.call(this,i,t),this.emit("button.click",this,e,i,t),this},emitButtonOver:function(t){var e=this.listPanel;return e?(e.emitButtonOver(t),this):this}};Object.assign(Tv,Pl,_v);const Ev=Phaser.Utils.Objects.GetValue;class Mv extends kl{constructor(t,e){super(t,e),this.type="rexDropDownList",this.timer=void 0,this.listPanel=void 0,this.currentOverIndex=void 0,this.setOptions(Ev(e,"options"));var i=Ev(e,"list");this.setWrapEnable(Ev(i,"wrap",!1)),this.setCreateButtonCallback(Ev(i,"createButtonCallback")),this.setCreateListBackgroundCallback(Ev(i,"createBackgroundCallback")),this.setCreateListSliderTrackCallback(Ev(i,"createTrackCallback")),this.setCreateListSliderThumbCallback(Ev(i,"createThumbCallback")),this.setListSliderAdaptThumbSizeEnable(Ev(i,"sliderAdaptThumbSize",!1)),this.setListScrollerConfig(Ev(i,"scroller")),this.setListMouseWheelScrollerConfig(Ev(i,"mouseWheelScroller")),this.setButtonClickCallback(Ev(i,"onButtonClick")),this.setButtonOverCallback(Ev(i,"onButtonOver")),this.setButtonOutCallback(Ev(i,"onButtonOut")),this.setListExpandDirection(Ev(i,"expandDirection")),this.setListEaseInDuration(Ev(i,"easeIn",500)),this.setListEaseOutDuration(Ev(i,"easeOut",100)),this.setListTransitInCallback(Ev(i,"transitIn")),this.settListTransitOutCallback(Ev(i,"transitOut")),this.setListMaxHeight(Ev(i,"maxHeight",0)),this.setListSize(Ev(i,"width"),Ev(i,"height",0)),this.setListAlignmentMode(Ev(i,"alignParent","text")),this.setListAlignmentSide(Ev(i,"alignSide","")),this.setListBounds(Ev(i,"bounds")),this.setListSpace(Ev(i,"space")),this.setListDraggable(Ev(i,"draggable",!1)),this.setValueChangeCallback(Ev(e,"setValueCallback"),Ev(e,"setValueCallbackScope")),this.setValue(Ev(e,"value")),this.onClick(this.toggleListPanel,this)}destroy(t){this.scene&&!this.ignoreDestroy&&(this.listPanel&&(this.listPanel.destroy(t),this.listPanel=void 0),super.destroy(t))}get isOpened(){return!!this.listPanel}setOptions(t){return void 0===t&&(t=[]),this.options=t,this}setValueChangeCallback(t,e){return this.valueChangeCallback=t,this.valueChangeCallbackScope=e,this}setValue(t){return this.value=t,this}get value(){return this._value}set value(t){if(this._value!==t){var e=this._value;this._value=t;var i=this.valueChangeCallback,s=this.valueChangeCallbackScope;i&&(s?i.call(s,this,t,e):i(this,t,e)),this.emit("valuechange",this,t,e)}}}Object.assign(Mv.prototype,Tv);const Rv=Phaser.GameObjects.Text,Lv=Phaser.Utils.Objects.GetValue;class Dv extends Rv{constructor(t,e){void 0===e&&(e={}),super(t,Lv(e,"x",0),Lv(e,"y",0),Lv(e,"text",""),e),this.type="rexStatesText",e.style=this.style,e.onModifyStyle=function(t,e){var i=e.hasOwnProperty("fontStyle")||e.hasOwnProperty("fontSize")||e.hasOwnProperty("fontFamily");t.style.update(i)},this.addStyleManager(e),delete e.style}}Object.assign(Dv.prototype,fc);var Yv=Phaser.Renderer.WebGL.Utils,Xv={renderWebGL:function(t,e,i,s){if(0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,h=r.height,a=Yv.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,h,e.x,e.y,n/e.style.resolution,h/e.style.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,h,a(e.tintTopLeft,i.alpha*e._alphaTL),a(e.tintTopRight,i.alpha*e._alphaTR),a(e.tintBottomLeft,i.alpha*e._alphaBL),a(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const Av=Phaser.Display.Canvas.CanvasPool;e();const zv=Phaser.GameObjects.GameObject;class Wv extends zv{setStyle(t){return this.style.setStyle(t)}setFont(t){return this.style.setFont(t)}setFontFamily(t){return this.style.setFontFamily(t)}setFontSize(t){return this.style.setFontSize(t)}setFontStyle(t){return this.style.setFontStyle(t)}setTestString(t){return this.style.setTestString(t)}setFixedSize(t,e){return this.style.setFixedSize(t,e)}setBackgroundColor(t,e,i){return this.style.setBackgroundColor(t,e,i)}setBackgroundStrokeColor(t,e){return this.style.setBackgroundStrokeColor(t,e)}setBackgroundCornerRadius(t,e){return this.style.setBackgroundCornerRadius(t,e)}setFill(t){return this.style.setFill(t)}setColor(t){return this.style.setColor(t)}setStroke(t,e){return this.style.setStroke(t,e)}setShadow(t,e,i,s,r,n){return this.style.setShadow(t,e,i,s,r,n)}setShadowOffset(t,e){return this.style.setShadowOffset(t,e)}setShadowColor(t){return this.style.setShadowColor(t)}setShadowBlur(t){return this.style.setShadowBlur(t)}setShadowStroke(t){return this.style.setShadowStroke(t)}setShadowFill(t){return this.style.setShadowFill(t)}setUnderline(t,e,i){return this.style.setUnderline(t,e,i)}setUnderlineColor(t){return this.style.setUnderlineColor(t)}setUnderlineThickness(t){return this.style.setUnderlineThickness(t)}setUnderlineOffset(t){return this.style.setUnderlineOffset(t)}setStrikethrough(t,e,i){return this.style.setStrikethrough(t,e,i)}setStrikethroughColor(t){return this.style.setStrikethroughColor(t)}setStrikethroughThickness(t){return this.style.setStrikethroughThickness(t)}setStrikethroughOffset(t){return this.style.setStrikethroughOffset(t)}setWrapMode(t){return this.style.setWrapMode(t)}setWrapWidth(t){return this.style.setWrapWidth(t)}setWordWrapWidth(t){return this.style.setWrapWidth(t)}setAlign(t){return this.style.setHAlign(t)}setHAlign(t){return this.style.setHAlign(t)}setVAlign(t){return this.style.setVAlign(t)}get lineSpacing(){return this.style.lineSpacing}set lineSpacing(t){this.style.lineSpacing=t}setLineSpacing(t){return this.style.lineSpacing=t,this.updateText(!0),this}setXOffset(t){return this.style.setXOffset(t)}setMaxLines(t){return this.style.setMaxLines(t)}setResolution(t){return this.style.setResolution(t)}getTextMetrics(){return this.style.getTextMetrics()}setTextMetrics(t,e){return this.style.setTextMetrics(t,e)}measureTextMargins(t,e){return function(t,e,i){void 0===i&&(i={});var s=Av.create(this),r=s.getContext("2d",{willReadFrequently:!0});t.syncFont(s,r);var n=r.measureText(e),h=Math.ceil(n.width*t.baselineX),a=h,o=2*a;if(a=a*t.baselineY|0,s.width=h,s.height=o,r.fillStyle="#f00",r.fillRect(0,0,h,o),r.font=t._font,r.textBaseline="alphabetic",r.fillStyle="#000",r.fillText(t.testString,0,a),i.left=0,0===h||0===o||!r.getImageData(0,0,h,o))return Av.remove(s),i;for(var l=r.getImageData(0,0,h,o).data,d=!1,c=0;c=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const P=Phaser.Math.DegToRad;var _={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=P(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},T={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=O(t.scaleX,i.scaleX),e.scaleY=O(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},E={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=O(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},L={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},D={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},Y={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(t){void 0===t&&(t=!1);var e=this;return this._mask=null,this.setChildMaskVisible(this),this.children.forEach((function(t){t.clearMask&&t.clearMask(!1),t.hasOwnProperty("isRexContainerLite")||e.setChildMaskVisible(t)})),t&&this.mask&&this.mask.destroy(),this}},X=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},W=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const j=Phaser.Utils.Array;var I={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Ee=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const Me=/(\S+)\[(\d+)\]/i,Re=Phaser.Utils.Objects.GetValue;var Le=function(t,e){return void 0===e?t:t[e]},De=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Re(e,"left",0),t.right=Re(e,"right",0),t.top=Re(e,"top",0),t.bottom=Re(e,"bottom",0)),t},Ye={getInnerPadding(t){return Le(this.space,t)},setInnerPadding(t,e){return De(this.space,t,e),this},getOuterPadding(t){return Le(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return De(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Le(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),De(this.getSizerConfig(t).padding,e,i),this}},Xe=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Ae=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},ze=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},We=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Be=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},je=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Ie={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Fe=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?yi:mi,this.repeatCounter=0,this}stop(){return this.state=fi,this}update(t,e){this.state!==fi&&this.state!==xi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=bi)):(this.nowTime=this.duration,this.state=xi):this.nowTime>=0&&(this.state=yi))}get t(){var t;switch(this.state){case fi:case mi:case bi:t=0;break;case yi:t=this.nowTime/this.duration;break;case xi:t=1}return vi(t,0,1)}set t(t){(t=vi(t,-1,1))<0?(this.state=mi,this.nowTime=-this.delay*t):(this.state=yi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===fi}get isDelay(){return this.state===mi}get isCountDown(){return this.state===yi}get isRunning(){return this.state===mi||this.state===yi}get isDone(){return this.state===xi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const fi=0,mi=1,yi=2,bi=3,xi=-1;class Ci extends ci{constructor(t,e){super(t,e),this.timer=new gi}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const wi=Phaser.Utils.Objects.GetValue,Si=Phaser.Utils.Objects.GetAdvancedValue,Oi=Phaser.Tweens.Builders.GetEaseFunction;class ki extends Ci{resetFromJSON(t){return this.timer.resetFromJSON(wi(t,"timer")),this.setEnable(wi(t,"enable",!0)),this.setTarget(wi(t,"target",this.parent)),this.setDelay(Si(t,"delay",0)),this.setDuration(Si(t,"duration",1e3)),this.setEase(wi(t,"ease","Linear")),this.setRepeat(wi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Oi(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Pi=Phaser.Utils.Objects.GetValue,_i=Phaser.Utils.Objects.GetAdvancedValue,Ti=Phaser.Math.Linear;let Ei=class extends ki{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Pi(t,"mode",0)),this.setScaleRange(_i(t,"start",void 0),_i(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Mi[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=_i(t,"x",this.parent.scaleX),this.startY=_i(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=_i(e,"x",void 0),this.endY=_i(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Ti(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Ti(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const Mi={stop:0,destroy:1,yoyo:2};var Ri=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new Ei(t,a):r.resetFromJSON(a),r.restart(),r},Li=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Ei&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new Ei(t,h):n.resetFromJSON(h),n.restart(),n},Di=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Yi=function(t){return Di(t,"complete")};const Xi=Phaser.Utils.Objects.IsPlainObject;var Ai={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Xi(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Ri(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Yi(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Xi(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Li(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Yi(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Yi(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Xi(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new Ei(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Yi(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},zi={};Object.assign(zi,Ai),zi.onInitScale=function(){Ai.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=Ce.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Wi=Phaser.Utils.Objects.GetValue,Bi=Phaser.Utils.Objects.GetAdvancedValue,ji=Phaser.Math.Linear;class Ii extends ki{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Wi(t,"mode",0)),this.setAlphaRange(Bi(t,"start",this.parent.alpha),Bi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Fi[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=ji(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Fi={stop:0,destroy:1,yoyo:2},Hi=Phaser.Utils.Objects.IsPlainObject;var Gi=function(t,e,i,s){var r,n;Hi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Ii(t,h):s.resetFromJSON(h),s.restart(),s},Ni=function(t,e,i,s){i instanceof Ii&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Ii(t,r):s.resetFromJSON(r),s.restart(),s};const Vi=Phaser.Utils.Objects.IsPlainObject;var Ui={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Vi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Gi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Yi(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Vi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Ni(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Yi(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Yi(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},$i={};Object.assign($i,Ui),$i.onInitFade=function(){Ui.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=Ce.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Ji=Phaser.Utils.Objects.GetValue,Ki=Phaser.Utils.Objects.GetAdvancedValue,qi=Phaser.Math.Linear;class Zi extends ki{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Ji(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ki(t,"x",void 0),i=Ki(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Qi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Ki(i,"startX",void 0),this.startY=Ki(i,"startY",void 0),this.endX=Ki(i,"endX",void 0),this.endY=Ki(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=qi(this.startX,this.endX,i)),this.hasMoveY&&(t.y=qi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Qi={stop:0,destroy:1,yoyo:2};var ts=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const es=Phaser.Utils.Objects.IsPlainObject,is=Phaser.Math.Distance.Between;var ss={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(es(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*is(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Zi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=ts(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=ts(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Zi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Yi(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Yi(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(es(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*is(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Zi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=ts(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=ts(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Zi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Yi(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Yi(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},rs={};Object.assign(rs,ss),rs.onInitEaseMove=function(){ss.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=Ce.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const ns=Phaser.Utils.Objects.GetValue;class hs extends oi{constructor(t,e){super(t,e),this.timer=new gi,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(ns(t,"timer")),this.setEnable(ns(t,"enable",!0)),this.setMode(ns(t,"mode",1)),this.isRunning=ns(t,"isRunning",!1),this.setMagnitudeMode(ns(t,"magnitudeMode",1)),this.setAxisMode(ns(t,"axis",0)),this.setDuration(ns(t,"duration",500)),this.setMagnitude(ns(t,"magnitude",10)),this.ox=ns(t,"ox",void 0),this.oy=ns(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=as[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ls[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=os[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=ns(i,"magnitude",void 0),t=ns(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const as={effect:0,behavior:1},os={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ls={constant:0,decay:1},ds=Phaser.Utils.Objects.IsPlainObject;var cs={shake(t,e,i){if(ds(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new hs(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Yi(this._shake)}};const us=Phaser.Utils.Objects.GetValue,ps=Phaser.Math.Linear;class vs extends ki{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=us(t,"key","value");var i=e[this.propertyKey];return this.fromValue=us(t,"from",i),this.toValue=us(t,"to",i),this.setEase(us(t,"ease",this.ease)),this.setDuration(us(t,"duration",this.duration)),this.setRepeat(us(t,"repeat",0)),this.setDelay(us(t,"delay",0)),this.setRepeatDelay(us(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=ps(this.fromValue,this.toValue,i)}}const gs=Phaser.Utils.Objects.IsPlainObject;class fs extends si{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new vs(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(gs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(gs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var ms={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new fs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Di(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},ys=Phaser.Utils.Array.Remove,bs={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var zs={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Ze(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Ws={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=Wt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=Wt),this.transitOutCallback=t,this}},Bs={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},js={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Is={};Object.assign(Is,zs,Ws,Bs,js);const Fs=Phaser.Utils.Objects.GetValue;class Hs extends si{constructor(t,e){super(t,e),this.setTransitInTime(Fs(e,"duration.in",200)),this.setTransitOutTime(Fs(e,"duration.out",200)),this.setTransitInCallback(Fs(e,"transitIn")),this.setTransitOutCallback(Fs(e,"transitOut")),this.oneShotMode=Fs(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new As(this,{eventEmitter:!1,initState:Fs(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Hs.prototype,Is);var Gs=function(t){if(t.parentContainer)return Gs(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?Gs(e):t};class Ns extends si{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Gs(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Vs=Phaser.GameObjects.Rectangle;class Us extends Vs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Ns(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const $s=Phaser.Utils.Objects.GetValue;class Js extends si{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode($s(t,"hitAreaMode",0)),this.setEnable($s(t,"enable",!0)),this.setStopMode($s(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Ks[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Ks={default:0,fullWindow:1};const qs=Phaser.Utils.Objects.GetValue;class Zs extends Us{constructor(t,e){super(t,qs(e,"color",0),qs(e,"alpha",.8)),this.touchEventStop=new Js(this,{hitAreaMode:1})}}var Qs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Ri(t,e)},scaleDown(t,e){Li(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Gi(t,e)},fadeOut(t,e){Ni(t,e,!1)}},tr=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Gi(t,e,t.alpha)},er=function(t,e){Ni(t,e,!1)},ir=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!nt(t,!0).contains(e,i)||r&&!r(t,e,i))};const sr=Phaser.Utils.Objects.GetValue;let rr=class extends Hs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=nr.popUp),null==e.transitOut&&(e.transitOut=nr.scaleDown),e.destroy=sr(e,"destroy",!0),super(t,e);var i=sr(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Zs(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(sr(i,"transitIn",tr)),this.setCoverTransitOutCallback(sr(i,"transitOut",er)));var s=sr(e,"touchOutsideClose",!1),r=sr(e,"duration.hold",-1),n=sr(e,"timeOutClose",r>=0),h=sr(e,"anyTouchClose",!1);sr(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),sr(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&ir(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=nr[t]),t){case nr.popUp:t=Qs.popUp;break;case nr.fadeIn:t=Qs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=nr[t]),t){case nr.scaleDown:t=Qs.scaleDown;break;case nr.fadeOut:t=Qs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const nr={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var hr=function(t){return t&&"function"==typeof t},ar={modal(t,e){return hr(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new rr(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},or=function(t,e,i,s,r){hr(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},lr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return or.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return or.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return or.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return or.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return or.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return or.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return or.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return or.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return or.call(this,"shutdown",t,e,i,s),this}},dr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=cr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},cr={},ur=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?ir(t,e.x,e.y,i,s):!!(r=dr(e,n,!0))&&ir(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const Or={press:0,pointerdown:0,release:1,pointerup:1};var kr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new Sr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},Pr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!_r(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return Tr.length=0,!0;return Tr.length=0,!1},Tr=[];const Er=Phaser.Utils.Objects.GetValue;class Mr extends si{constructor(t,e){super(t,e),this._enable=void 0;var i=Er(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Er(t,"enable",!0)),this.setMode(Er(t,"mode",1)),this.setClickInterval(Er(t,"clickInterval",100)),this.setDragThreshold(Er(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Rr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?Pr:ur)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Rr={press:0,pointerdown:0,release:1,pointerup:1};var Lr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Mr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Dr extends Xs{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Yr=Phaser.Utils.Objects.GetValue;class Xr extends si{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Dr,this.parent.setInteractive(Yr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Yr(t,"enable",!0)),this.setCooldown(Yr(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Ar={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&ur(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Xr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Xr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},zr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Wr=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=tn,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===en&&this.onDragEnd(),this.pointer=void 0,this.tracerState=tn,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=sn,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&ur(t,s,e,i)}}const tn=0,en=1,sn="IDLE",rn=Phaser.Utils.Objects.GetValue,nn=Phaser.Math.Distance.Between;class hn extends Qr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=an},eventEmitter:!1};this.setRecongizedStateObject(new Xs(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(rn(t,"time",250)),this.setTapInterval(rn(t,"tapInterval",200)),this.setDragThreshold(rn(t,"threshold",9)),this.setTapOffset(rn(t,"tapOffset",10));var e=rn(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(rn(t,"maxTaps",void 0)),this.setMinTaps(rn(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case an:this.state=on;break;case on:var t=this.lastPointer;nn(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=ln,this.state=on);break;case ln:this.state=on}}onDragEnd(){this.state===on&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=ln))}onDrag(){this.state!==an&&this.pointer.getDistance()>this.dragThreshold&&(this.state=an)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===on){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=an):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=ln:this.state=an)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===ln&&(this.state=an)}get isTapped(){return this.state===ln}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const an="IDLE",on="BEGIN",ln="RECOGNIZED",dn=Phaser.Utils.Objects.GetValue;class cn extends Qr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=un},eventEmitter:!1};this.setRecongizedStateObject(new Xs(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(dn(t,"threshold",9)),this.setHoldTime(dn(t,"time",251)),this}onDragStart(){this.state=pn,0===this.holdTime&&(this.state=vn)}onDragEnd(){this.state=un}onDrag(){this.state!==un&&this.pointer.getDistance()>this.dragThreshold&&(this.state=un)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===pn&&t-this.pointer.downTime>=this.holdTime&&(this.state=vn)}get isPressed(){return this.state===vn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const un="IDLE",pn="BEGIN",vn="RECOGNIZED";Phaser.Utils.Objects.GetValue;var gn=function(t){return ei(t).loop.delta};const fn=Phaser.Math.Distance.Between,mn=Phaser.Math.Angle.Between;var yn={getDt:function(){return gn(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return fn(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return mn(e.x,e.y,t.x,t.y)}},bn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},xn={};const Cn=Phaser.Utils.Objects.GetValue,wn=Phaser.Math.RadToDeg;class Sn extends Qr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=On},eventEmitter:!1};this.setRecongizedStateObject(new Xs(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Cn(t,"threshold",10)),this.setVelocityThreshold(Cn(t,"velocityThreshold",1e3)),this.setDirectionMode(Cn(t,"dir","8dir")),this}onDragStart(){this.state=kn}onDragEnd(){this.state=On}onDrag(){this.state===kn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=Pn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Pn&&(this.state=On)}get isSwiped(){return this.state===Pn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=bn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=xn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(wn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(Sn.prototype,yn);const On="IDLE",kn="BEGIN",Pn="RECOGNIZED",_n=Phaser.Utils.Objects.GetValue,Tn=Phaser.Utils.Array.SpliceOne,En=Phaser.Math.Distance.Between,Mn=Phaser.Math.Angle.Between;class Rn{constructor(t,e){var i=Ze(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(_n(e,"inputConfig",void 0)),this.setEventEmitter(_n(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(_n(t,"enable",!0)),this.bounds=_n(t,"bounds",void 0),this.tracerState=Dn,this.pointers.length=0,mt(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,mt(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case Dn:this.tracerState=Yn,this.onDrag1Start();break;case Yn:this.tracerState=Xn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],Tn(this.pointers,e),this.tracerState){case Yn:this.tracerState=Dn,this.onDrag1End();break;case Xn:this.tracerState=Yn,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case Yn:this.onDrag1();break;case Xn:this.onDrag2()}}}dragCancel(){return this.tracerState===Xn&&this.onDrag2End(),this.pointers.length=0,mt(this.movedState),this.tracerState=Dn,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Xn)return 0;var t=this.pointers[0],e=this.pointers[1];return En(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Xn)return 0;var t=this.pointers[0],e=this.pointers[1];return Mn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Ln.x=e.x-i.x,Ln.y=e.y-i.y}else Ln.x=0,Ln.y=0;return Ln}get centerX(){if(this.tracerState!==Xn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Xn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Xn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Xn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=An,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&ur(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&ur(t,s,e,i)}}Object.assign(Rn.prototype,Je);var Ln={};const Dn=0,Yn=1,Xn=2,An="IDLE";Phaser.Utils.Objects.GetValue;const zn=Phaser.Math.RotateAround;var Wn=function(t,e,i,s){return zn(t,e,i,s),t.rotation+=s,t},Bn={};const jn=Phaser.Utils.Objects.GetValue,In=Phaser.Math.Angle.WrapDegrees,Fn=Phaser.Math.Angle.ShortestBetween,Hn=Phaser.Math.RadToDeg,Gn=Phaser.Math.DegToRad;var Nn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Bn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=In(Hn(this.angleBetween));this.angle=Fn(this.prevAngle,t),this.prevAngle=t,this.state=$n}break;case $n:t=In(Hn(this.angleBetween)),this.angle=Fn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===$n}get rotation(){return Gn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Nn);const Vn="IDLE",Un="BEGIN",$n="RECOGNIZED",Jn=Phaser.Utils.Objects.GetValue;var Kn=function(t){var e=Jn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new hn(this,e),this._tap.on("tap",(function(t,e,s){Br(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Br(i.eventEmitter,`${i.eventNamePrefix}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const qn=Phaser.Utils.Objects.GetValue;var Zn=function(t){var e=qn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new cn(this,e),this._press.on("pressstart",(function(t,e,s){Br(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this).on("pressend",(function(t,e,s){Br(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Qn=Phaser.Utils.Objects.GetValue;var th=function(t){var e=Qn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new Sn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Br(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Br(i.eventEmitter,`${i.eventNamePrefix}swipe`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const eh=Phaser.Utils.Objects.GetValue;var ih=function(t,e){return t.setInteractive(),eh(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:eh(e,"targets",[t]),targetMode:eh(e,"targetMode","parent"),eventEmitter:eh(e,"eventEmitter",t),eventNamePrefix:eh(e,"inputEventPrefix","child.")},Ir.call(t,e),Gr.call(t,e),Ur.call(t,e),qr.call(t,e),Kn.call(t,e),Zn.call(t,e),th.call(t,e),t},sh={getSizerConfig:function(t){return void 0===t&&(t=this),Rt(t)},getChildPrevState:function(t){var e=Rt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Yt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=le(e,"color"),s=le(e,"lineWidth");var o=le(e,"name",!1);o&&(r=le(o,"createTextCallback",ue),n=le(o,"createTextCallbackScope",void 0),"string"==typeof(h=le(o,"align","left-top"))&&(h=zt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new de(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}var d,c,u=this.getAllShownChildren([this]);pe(u,u);for(var p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const uh=Phaser.Utils.Objects.IsPlainObject,ph=Phaser.Utils.Objects.GetValue,vh=Phaser.Display.Align.CENTER,gh={min:0,full:-1};var fh=function(t,e,i,s,r,n,h,a,o,l){var d,c,u,p;ye.call(this,t);var v=t.isRexSpace,g=typeof e;if(null===e)return this;if("number"===g);else if("string"===g)e=gh[e];else if(uh(e)){var f;e=ph(f=e,"proportion",void 0),i=ph(f,"align",vh),s=ph(f,"padding",0),r=ph(f,"expand",!1),n=ph(f,"key",void 0),h=ph(f,"index",void 0),t.isRexSizer||(a=ph(f,"minWidth",void 0),o=ph(f,"minHeight",void 0)),l=ph(f,"fitRatio",0),d=ph(f,"offsetX",0),c=ph(f,"offsetY",0),u=ph(f,"offsetOriginX",0),p=ph(f,"offsetOriginY",0)}return"string"==typeof i&&(i=zt[i]),void 0===e&&(e=v?1:0),void 0===i&&(i=vh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(v?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(v?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),(f=this.getSizerConfig(t)).proportion=e,f.align=i,f.padding=fe(s),f.expand=r,f.fitRatio=0===e?l:0,f.alignOffsetX=d,f.alignOffsetY=c,f.alignOffsetOriginX=u,f.alignOffsetOriginY=p,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},mh={add:fh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),fh.call(this,new dh(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return uh(i)&&(i.index=t),fh.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=ch.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const yh=Mt.prototype.clear;var bh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),yh.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,bh.call(this,t),this}},wh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=zt[e]),this.getSizerConfig(t).align=e,this}},Sh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},Oh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},kh={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},Ph={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Ne(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Fe.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d,c,u=this.sizerChildren,p=this.innerLeft,v=this.innerTop,g=this.innerWidth,f=this.innerHeight,m=p,y=v,b=this.startChildIndex,x=0,C=u.length;x0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=We.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Ae.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&oh.call(this,t,void 0),ze.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Be.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&oh.call(this,void 0,t),je.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(Ph,mh,Ch,wh,Sh,Oh,kh);var _h=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},Th={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},Eh=function(t){return"string"==typeof t&&(t=Th[t]),t};const Mh=Phaser.Utils.Objects.IsPlainObject,Rh=Phaser.Utils.Objects.GetValue;class Lh extends nh{constructor(t,e,i,s,r,n,h){Mh(e)?(e=Rh(h=e,"x",0),i=Rh(h,"y",0),s=Rh(h,"width",void 0),r=Rh(h,"height",void 0),n=Rh(h,"orientation",0)):Mh(s)?(s=Rh(h=s,"width",void 0),r=Rh(h,"height",void 0),n=Rh(h,"orientation",0)):Mh(n)&&(n=Rh(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Rh(h,"space.item",0)),this.setStartChildIndex(Rh(h,"startChildIndex",0)),this.setRTL(Rh(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=Eh(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=_h.call(this)),this._childrenProportion}}Object.assign(Lh.prototype,Ph);var Dh=function(t,e,i){if(t){var s=null==e,r=null==i;return s&&r||(s||(t.displayWidth=e),r||(t.displayHeight=i),s&&(t.scaleX=t.scaleY),r&&(t.scaleY=t.scaleX)),t}},Yh=function(t,e){var i;return t||0===t||(t=""),void 0===e&&(e=!0),Array.isArray(t)&&(t=t.join("\n")),(i=e?`${this.text}\n${t}`:`${this.text}${t}`)!=this.text&&this.setText(i),this},Xh={appendText:Yh,resetDisplayContent:function(t){void 0===t?t={}:"string"==typeof t&&(t={text:t});var e=t.text||"";this.setText(e);var i=this.childrenMap.icon;if(i){t.icon?this.show(i):this.hide(i);var s=t.iconSize;s&&(this.setChildDisplaySize(i,s,s),void 0!==this.iconWidth&&this.setIconSize(s)),!0!==t.icon&&this.setIconTexture(t.icon,t.iconFrame)}var r=this.childrenMap.action;if(r){t.action?this.show(r):this.hide(r);var n=t.actionSize;n&&(this.setChildDisplaySize(r,n,n),void 0!==this.actionWidth&&this.setActionSize(n)),!0!==t.action&&this.setActionTexture(t.action,t.actionFrame)}return this}};class Ah extends Lh{get text(){var t=this.childrenMap.text;return t?t.text:""}set text(t){var e=this.childrenMap.text;e&&e.setText(t)}setText(t){return this.text=t,this}setIconTexture(t,e){var i=this.childrenMap.icon;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.iconWidth&&void 0!==this.iconHeight&&(Dh(i,this.iconWidth,this.iconHeight),this.resetChildScaleState(i)),this):this}setTexture(t,e){return this.setIconTexture(t,e),this}setIconSize(t,e){return void 0===e&&(e=t),this.iconWidth=t,this.iconHeight=e,this}get texture(){var t=this.childrenMap.icon;if(t)return t.texture}get frame(){var t=this.childrenMap.icon;if(t)return t.frame}setActionTexture(t,e){var i=this.childrenMap.action;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.actionWidth&&void 0!==this.actionHeight&&(Dh(i,this.actionWidth,this.actionHeight),this.resetChildScaleState(i)),this):this}get actionTexture(){var t=this.childrenMap.action;if(t)return t.texture}get actionFrame(){var t=this.childrenMap.action;if(t)return t.frame}setActionSize(t,e){return void 0===e&&(e=t),this.actionWidth=t,this.actionHeight=e,this}preLayout(){var t=this.childrenMap.icon;t&&void 0!==this.iconWidth&&void 0!==this.iconHeight&&Dh(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&Dh(e,this.actionWidth,this.actionHeight),super.preLayout()}postLayout(t,e,i){var s=this.childrenMap.iconMask;s&&(s.setPosition(),this.resetChildPositionState(s));var r=this.childrenMap.actionMask;return r&&(r.setPosition(),this.resetChildPositionState(r)),super.postLayout(t,e,i),this}resize(t,e){super.resize(t,e);var i=this.childrenMap.iconMask;i&&i.resize();var s=this.childrenMap.actionMask;return s&&s.resize(),this}}Object.assign(Ah.prototype,Xh);const zh=Phaser.GameObjects.Graphics.prototype.setPosition,Wh=Phaser.Geom.Rectangle,Bh=Phaser.Geom.Circle;var jh=function(t,e,i,s,r){this.geom=function(t,e,i,s,r,n,h){if(1===t){s=s.left;var a=-e*(r-.5),o=-i*(n-.5),l=Math.min(e,i)/2+s;void 0!==h&&h instanceof Bh||(h=new Bh),h.setTo(a,o,l)}else{var d=-e*r-s.left,c=-i*n-s.top,u=e+s.left+s.right,p=i+s.top+s.bottom;void 0!==h&&h instanceof Wh||(h=new Wh),h.setTo(d,c,u,p)}return h}(this.shapeType,t,e,i,s,r,this.geom),this.clear().fillStyle(16777215),1===this.shapeType?this.fillCircleShape(this.geom):this.fillRectShape(this.geom)},Ih=function(t,e){for(var i in t){if(!(i in e))return!1;if(t[i]!==e[i])return!1}for(var i in e)if(!(i in t))return!1;return!0},Fh={setPosition:function(t,e){var i=this.parent;return void 0===t&&(t=i.x),void 0===e&&(e=i.y),zh.call(this,t,e),this},resize:function(t,e,i){var s=this.parent;void 0===t&&(t=s.width),void 0===e&&(e=s.height),void 0===i?i=this.padding:"number"==typeof i&&(i=GetBoundsConfig(i));var r=this.width!==t||this.height!==e,n=this.padding!==i&&!Ih(this.padding,i);return r||n?(this.width=t,this.height=e,n&&yt(i,this.padding),this.originX=s.originX,this.originY=s.originY,jh.call(this,t,e,i,s.originX,s.originY),this):this},setOrigin:function(t,e){void 0===e&&(e=t);var i=this.parent;return void 0===t&&(t=i.originX),void 0===e&&(e=i.originY),this.originX===t&&this.originY===e||(this.originX=t,this.originY=e,jh.call(this,this.width,this.height,this.padding,t,e)),this},contains:function(t,e){return t-=this.x,e-=this.y,this.geom.contains(t,e)}};const Hh=Phaser.GameObjects.Graphics;class Gh extends Hh{constructor(t,e,i){void 0===e&&(e=0),"string"==typeof e&&(e=Nh[e]),super(t.scene),this.parent=t,this.shapeType=e,this.padding=fe(i),this.setPosition().resize().setVisible(!1)}destroy(){return this.parent=void 0,super.destroy(),this}}const Nh={rectangle:0,circle:1};Object.assign(Gh.prototype,Fh);var Vh=function(t,e,i,s){var r=new Gh(e,i,s);if(t&&!t.isRexSizer){var n=r.createGeometryMask();t.setMask(n),this.once("destroy",(function(){t.setMask(),n.destroy()}))}return this.pin(r),r};const Uh=Phaser.GameObjects.Text;var $h=function(t){return t instanceof Uh};const Jh=Phaser.GameObjects.BitmapText;var Kh=function(t){return t instanceof Jh},qh=function(t){return Kh(t)?2:$h(t)?0:1},Zh=/^[\x00-\x7F]+$/,Qh=function(t){return Zh.test(t)},ta=function(t,e){for(var i=[],s=t.split("\n"),r=e.style,n=r.wordWrapWidth,h=r.hasOwnProperty("wrapMode")?r.wrapMode:3,a=e.context,o=0,l=s.length;o0&&r.push(o.join("")),r},ia=0,sa=1,ra=2,na=0,ha=1,aa=2,oa=/(?:\r\n|\r|\n)/;const la={none:na,word:ha,char:aa,character:aa,mix:3},da=Phaser.Renderer.WebGL.Utils;var ca={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,h=r.height,a=da.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,h,e.x,e.y,n/e.resolution,h/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,h,a(e.tintTopLeft,i.alpha*e._alphaTL),a(e.tintTopRight,i.alpha*e._alphaTR),a(e.tintBottomLeft,i.alpha*e._alphaBL),a(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const ua=Phaser.Display.Color;var pa={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,h,a,o,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===h&&(h=0),void 0===a&&(a=0),void 0===o&&(o=c),void 0===l&&(l=u);var p=d.cutX+h,v=d.cutY+a;return this.context.drawImage(d.source.image,p,v,o,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new ua);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var h=i;i=h.red,s=h.green,r=h.blue,n=h.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var a=this.context.createImageData(1,1);return a.data[0]=i,a.data[1]=s,a.data[2]=r,a.data[3]=n,this.context.putImageData(a,t,e),this.dirty=!0,this}},va=function(t,e,i,s,r,n,h){var a,o=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===h&&(h=e.height);var d=(a=o.exists(i)?o.get(i):o.createCanvas(i,n,h)).getSourceImage();d.width!==n&&(d.width=n),d.height!==h&&(d.height=h);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,h),c.drawImage(e,s,r,n,h),l.gl&&a&&l.canvasToTexture(d,a.source[0].glTexture,!0,0)},ga={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,va(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};e();const fa=Phaser.Display.Canvas.CanvasPool,ma=Phaser.GameObjects.GameObject,ya=Phaser.Utils.String.UUID;class ba extends ma{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=fa.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=ya(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){fa.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}}const xa=Phaser.GameObjects.Components;Phaser.Class.mixin(ba,[xa.Alpha,xa.BlendMode,xa.Crop,xa.Depth,xa.Flip,xa.GetBounds,xa.Mask,xa.Origin,xa.Pipeline,xa.PostPipeline,xa.ScrollFactor,xa.Tint,xa.Transform,xa.Visible,ca,pa,ga]);var Ca={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:Ms(this.data,t,e)},incData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)+e),this},mulData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)*e),this},clearData(){return this.data&&mt(this.data),this}};class wa{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}}Object.assign(wa.prototype,Ca);var Sa={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const Oa=Phaser.Math.RotateAround;var ka;const Pa=Phaser.Geom.Rectangle;var _a,Ta=function(t){void 0===_a&&(_a=new Pa);var e=t.drawTLX,i=t.drawTLY;return _a.setTo(e,i,t.drawTRX-e,t.drawBLY-i),_a};const Ea=Phaser.Math.RotateAround;var Ma,Ra=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Ma&&(Ma={}),s=Ma),s.x=e,s.y=i,0!==t.rotation&&Ea(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const La=Phaser.GameObjects.Components.TransformMatrix;var Da,Ya,Xa={},Aa=function(t,e,i,s,r){var n=Ra(e,i,s,!0),h=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=Xa);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===Da&&(Da=new La,Ya=new La),t.parentContainer?t.getWorldTransformMatrix(Da,Ya):Da.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),Da.transformPoint(r,n,s),s}(t,n.x,n.y,r);return h},za=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,h=e.drawCenterY+s;return Aa(t,e,n,h,r)},Wa={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===ka&&(ka={}),s=ka),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&Oa(s,0,0,-i.rotation),s}(t,e,this,!0);return Ta(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return za(this.parent,this,t,e,i)}};Object.assign(Wa,Sa);const Ba=Phaser.Math.DegToRad,ja=Phaser.Math.RadToDeg,Ia=Phaser.Utils.Objects.GetValue;class Fa extends wa{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return ja(this._rotation)}set angle(t){this.rotation=Ba(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=Ia(t,"width",void 0),i=Ia(t,"height",void 0),s=Ia(t,"scaleX",void 0),r=Ia(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(Fa.prototype,Wa);const Ha=Phaser.Utils.String.Pad;var Ga=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${Ha(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},Na=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Va=Phaser.Utils.Objects.GetValue;let Ua=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=Va(t,"x",0),i=Va(t,"y",0));var s=this.cornerRadius;s.tl=$a(Va(t,"tl",void 0),e,i),s.tr=$a(Va(t,"tr",void 0),e,i),s.bl=$a(Va(t,"bl",void 0),e,i),s.br=$a(Va(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Ja(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Ja(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Ja(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Ja(this.cornerRadius.br,t)}};var $a=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Ka(t),t},Ja=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Va(e,"x",0),t.y=Va(e,"y",0)),Ka(t)},Ka=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const qa=Phaser.Math.DegToRad;var Za=function(t){return!t.hasOwnProperty("convex")||t.convex},Qa=function(t){return t.x>0&&t.y>0},to=function(t,e,i,s,r,n,h,a,o){if(a&&h>n?h-=360:!a&&h=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=m.tl,Qa(a)?(o=a.x*g,l=a.y*f,Za(a)?to(t,o,l,o,l,180,270,!1,h):to(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,Qa(a)?(o=a.x*g,l=a.y*f,Za(a)?to(t,s-o,l,o,l,270,360,!1,h):to(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,Qa(a)?(o=a.x*g,l=a.y*f,Za(a)?to(t,s-o,r-l,o,l,0,90,!1,h):to(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,Qa(a)?(o=a.x*g,l=a.y*f,Za(a)?to(t,o,r-l,o,l,90,180,!1,h):to(t,0,r,o,l,360,270,!0,h)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,h,u),null!=a)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,a),p.addColorStop(1,d),a=p),e.fillStyle=a,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())},io=function(t,e,i,s,r,n,h,a){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),eo(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}};const so=Phaser.Utils.Objects.GetValue;class ro extends Fa{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(so(e,"color",null),so(e,"color2",null),so(e,"horizontalGradient",!0)),this.setStroke(so(e,"stroke",null),so(e,"strokeThickness",2)),this.setCornerRadius(so(e,"cornerRadius",0),so(e,"cornerIteration",null))}set color(t){t=Ga(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Ga(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Ga(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,Na("color2",t,this),Na("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Na("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Na("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){io(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const no=Phaser.Utils.Objects.GetValue;class ho extends Fa{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(no(e,"color",null),no(e,"color2",null),no(e,"horizontalGradient",!0)),this.setStroke(no(e,"stroke",null),no(e,"strokeThickness",2))}set color(t){t=Ga(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Ga(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Ga(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,no(t,"color2",null),no(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,no(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,h=this.parent.height-i.top-i.bottom,a=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?a.createLinearGradient(0,0,n,0):a.createLinearGradient(0,0,0,h)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,a.fillStyle=t,a.fillRect(s,r,n,h));null!=this.stroke&&this.strokeThickness>0&&(a.strokeStyle=this.stroke,a.lineWidth=this.strokeThickness,a.strokeRect(s,r,n,h))}}const ao=Phaser.Utils.Objects.GetValue;let oo=class t{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(ao(t,"bold",!1)),this.setItalic(ao(t,"italic",!1)),this.setFontSize(ao(t,"fontSize","16px")),this.setFontFamily(ao(t,"fontFamily","Courier")),this.setColor(ao(t,"color","#fff")),this.setStrokeStyle(ao(t,"stroke",null),ao(t,"strokeThickness",0)),this.setShadow(ao(t,"shadowColor",null),ao(t,"shadowOffsetX",0),ao(t,"shadowOffsetY",0),ao(t,"shadowBlur",0)),this.setOffset(ao(t,"offsetX",0),ao(t,"offsetY",0)),this.setSpace(ao(t,"leftSpace",0),ao(t,"rightSpace",0)),this.setAlign(ao(t,"align",void 0)),this.setBackgroundColor(ao(t,"backgroundColor",null)),this.setBackgroundHeight(ao(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(ao(t,"backgroundBottomY",void 0)),this.setBackgroundLeftX(ao(t,"backgroundLeftX",0)),this.setBackgroundRightX(ao(t,"backgroundRightX",0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(Na("stroke",t,this),Na("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Na("shadowOffsetX",t,this),Na("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),t.hasOwnProperty("backgroundLeftX")&&this.setBackgroundLeftX(t.backgroundLeftX),t.hasOwnProperty("backgroundRightX")&&this.setBackgroundRightX(t.backgroundRightX),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new t(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=Ga(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=Ga(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=Ga(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=Ga(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setBackgroundLeftX(t){return this.backgroundLeftX=t,this}setBackgroundRightX(t){return this.backgroundRightX=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}};const lo=Phaser.Utils.Array.Remove,co=Phaser.Utils.Array.Remove,uo="text",po="image",vo="drawer",go="space",fo="command";var mo=function(t){return t.type===uo&&"\n"===t.text},yo=function(t){return t.type===uo&&"\f"===t.text},bo=function(t){return t.type===uo};class xo extends Fa{constructor(t,e,i){super(t,uo),this.updateTextFlag=!1,this.style=new oo(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX+e.backgroundLeftX,s=i,r=this.drawTRX+e.backgroundRightX-i+1;if(r>0){var n=e.backgroundBottomY;null==n&&(n=this.drawBLY);var h=e.backgroundHeight;null==h&&(h=n-this.drawTLY);var a=n-h;t.fillRect(s,a,r,h)}}var o=e.hasFill,l=e.hasStroke;(o||l)&&(e.syncFont(t).syncStyle(t),l&&(e.syncShadow(t),t.strokeText(this.text,0,0)),o&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var Co=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const wo=Phaser.Display.Canvas.CanvasPool;var So=function(t,e,i,s,r,n,h,a){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===a&&(a=!1),a&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(h){var l=wo.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=h,d.fillRect(0,0,r,n),o.drawImage(l,0,0,r,n,i,s,r,n),wo.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)};Phaser.Display.Canvas.CanvasPool;class Oo extends Fa{constructor(t,e,i){super(t,po),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){So(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class ko extends Fa{constructor(t,e,i,s){super(t,vo),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class Po extends Fa{constructor(t,e){super(t,go),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class _o extends wa{constructor(t,e,i,s,r){super(t,fo),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}function To(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>To(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=To(t[i]));return e}var Eo=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const Mo={none:0,word:1,char:2,character:2,mix:3};var Ro=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,h=!r&&!n,a=t.length,o=e,l=s.word,d=0,c=!1;o0&&!a){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=Xo.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=Xo.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=zo(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=zo(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=zo(t,"wrapMode");void 0===c&&(c=zo(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=Mo[c]);var u=zo(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=zo(t,"letterSpacing",0),v=zo(t,"hAlign",0),g=zo(t,"vAlign",0),f=zo(t,"justifyPercentage",.25),m=Eo({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:h,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,b=0,x=y.length;b0&&(E.push({children:M,width:R}),L=Math.max(L,R)),m.start+=T.length,m.isLastPage=!D&&m.start===_,m.maxLineWidth=L,m.linesHeight=E.length*n;var j=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,I=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,h=t.vAlign,a=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(h=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=jo(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=jo(t,"maxLines",0);var a=0===i,o=jo(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=jo(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=jo(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=jo(t,"letterSpacing",0),p=jo(t,"rtl",!0),v=jo(t,"hAlign",p?2:0),g=jo(t,"vAlign",0),f=Eo({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:o,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(T.push({children:E,height:M}),R=Math.max(R,M)),f.start+=_.length,f.isLastPage=f.start===P,f.maxLineHeight=R,f.linesWidth=T.length*n;var z=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,W=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,h=t.vAlign,a=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}a&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,h=i.bottom;return De(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return Le(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),lo(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return co(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(uo);return null===i?i=new xo(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),za(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const cl=Phaser.Utils.Objects.GetFastValue;var ul={};class pl{constructor(t){this.pools=cl(t,"pools",ul)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new dl),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;ei&&(r=Math.floor(i));for(var n={},h=Cl(t,r,e,i,n),a=0;a<=yl&&0!==h;a++){if((r+=h)<0){r=0;break}h=Cl(t,r,e,i,n)}return a===yl&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),wl(t,e,i),t},xl=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},Cl=function(t,e,i,s,r){var n,h=xl(t,e,r),a=xl(t,e+1,r);if(void 0!==s)if(h.height<=s&&a.height>s)n=0;else{if(h.height>s)return-1;n=Math.floor(s-h.height)}if(h.width<=i&&a.width>i)return 0;if(h.width>i)return-1;var o=Math.floor(i-h.width);return void 0===n?o:Math.min(o,n)},wl=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const Sl=Phaser.Utils.Objects.GetValue,Ol=Phaser.Utils.Objects.GetValue;class kl extends Ah{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=Ol(e,"background",void 0),r=Ol(e,"icon",void 0),n=Ol(e,"iconMask",void 0),h=Ol(e,"text",void 0),a=Ol(e,"action",void 0),o=Ol(e,"actionMask",void 0),l=Ol(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(h||a)&&(i={right:Ol(e,"space.icon",0),top:Ol(e,"space.iconTop",0),bottom:Ol(e,"space.iconBottom",0),left:Ol(e,"space.iconLeft",0)}):(h||a)&&(i={bottom:Ol(e,"space.icon",0),left:Ol(e,"space.iconLeft",0),right:Ol(e,"space.iconRight",0),top:Ol(e,"space.iconTop",0)});var d=Ol(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=Vh.call(this,r,r,1)),!d){var c=Ol(e,"iconSize",void 0);this.setIconSize(Ol(e,"iconWidth",c),Ol(e,"iconHeight",c))}}if(h){var u=Ol(e,"wrapText",!1),p=Ol(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),function(t,e){switch(qh(t)){case 0:switch("string"==typeof e&&(e=la[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=ta;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=la[e]||0),t.style.wrapMode=e}}(h,u),e.expandTextWidth=!0,ml(h)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=Sl(e,"minWidth",0),s=Sl(e,"minHeight",0),r=Sl(e,"fitHeight",!1);t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return bl(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),bl(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t})}(h,{fitHeight:!0}));var v,g,f=Ol(e,"space.text",0),m=Ol(e,"expandTextWidth",!1),y=Ol(e,"expandTextHeight",!1);0===this.orientation?(v=m?1:0,a&&(i={right:f}),g=y):(v=y?1:0,a&&(i={bottom:f}),g=m),this.add(h,{proportion:v,expand:g,padding:i})}if(a&&(i=0===this.orientation?{top:Ol(e,"space.actionTop",0),bottom:Ol(e,"space.actionBottom",0),right:Ol(e,"space.actionRight",0)}:{left:Ol(e,"space.actionLeft",0),right:Ol(e,"space.actionRight",0),bottom:Ol(e,"space.actionBottom",0)},d=Ol(e,"squareFitAction",!1)?1:0,this.add(a,{proportion:0,padding:i,fitRatio:d}),o&&(o=Vh.call(this,a,a,1)),!d)){var b=Ol(e,"actionSize");this.setActionSize(Ol(e,"actionWidth",b),Ol(e,"actionHeight",b))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",h),this.addChildrenMap("action",a),this.addChildrenMap("actionMask",o)}}var Pl={setWrapEnable(t){return void 0===t&&(t=!0),this.listWrapEnable=t,this},setCreateButtonCallback(t){return this.listCreateButtonCallback=t,this},setCreateListBackgroundCallback(t){return this.listCreateBackgroundCallback=t,this},setCreateListSliderTrackCallback(t){return this.listCreateSliderTrackCallback=t,this},setCreateListSliderThumbCallback(t){return this.listCreateSliderThumbCallback=t,this},setListSliderAdaptThumbSizeEnable(t){return void 0===t&&(t=!0),this.listSliderAdaptThumbSizeEnable=t,this},setListScrollerConfig(t){return void 0===t&&(t={}),this.listScrollerConfig=t,this},setListMouseWheelScrollerConfig(t){return this.listMouseWheelScrollerConfig=t,this},setButtonClickCallback(t){return this.listOnButtonClick=t,this},setButtonOverCallback(t){return this.listOnButtonOver=t,this},setButtonOutCallback(t){return this.listOnButtonOut=t,this},setListExpandDirection(t){return"string"==typeof t&&(t=_l[t]),this.listExpandDirection=t,this},setListEaseInDuration(t){return void 0===t&&(t=0),this.listEaseInDuration=t,this},setListEaseOutDuration(t){return void 0===t&&(t=0),this.listEaseOutDuration=t,this},setListTransitInCallback(t){return this.listTransitInCallback=t,this},settListTransitOutCallback(t){return this.listTransitOutCallback=t,this},setListBounds(t){return this.listBounds=t,this},setListWidth(t){return this.listWidth=t,this},setListHeight(t){return this.listHeight=t,this},setListSize(t,e){return this.setListWidth(t).setListHeight(e),this},setListMaxHeight(t){return this.listMaxHeight=t,this},setListAlignmentMode(t){return this.listAlignMode=t,this},setListAlignmentSide(t){return void 0===t&&(t=""),this.listAlignSide=t,this},setListSpace(t){return void 0===t&&(t={}),this.listSpace=t,this},setListDraggable(t){return void 0===t&&(t=!0),this.listDraggable=t,this}};const _l={down:0,up:1},Tl=Lh.prototype.add,El=Lh.prototype.addSpace;var Ml=function(t){var e=!t.isRexSpace,i=!e||this.buttonsExpand?1:0;if(0===this.sizerChildren.length)if(e){!this.buttonsExpand&&("right"===this.buttonsAlign||"center"===this.buttonsAlign||"bottom"===this.buttonsAlign)&&El.call(this),Tl.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&El.call(this),this.hasTailSpace=s}else Tl.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;Tl.call(this,t,{index:r,proportion:i,expand:!0})}else Tl.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},Rl={addButton(t){if(pr(t))for(var e=t,i=0,s=e.length;i=0;i--)Yl.call(this,e[i],t);return this}},Al=function(t,e,i){if(t){var s=this.setValueCallback,r=this.setValueCallbackScope;s&&(r?s.call(r,t,e,i):s(t,e,i)),this.fireEvent("button.statechange",t,e,i)}},zl=function(t){var e=this;t._selected=void 0,Object.defineProperty(t,"selected",{get:function(){return t._selected},set:function(i){if(t._selected!==i){var s=t._selected;t._selected=i,Al.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},Wl={add(t){return this.buttons.push(t),t._click||(t._click=new Sr(t,this.clickConfig),t._click.on("click",(function(t,e,i,s){this.fireEvent("button.click",e,i,s)}),this).on("enable",(function(t,e){this.fireEvent("button.enable",e)}),this).on("disable",(function(t,e){this.fireEvent("button.disable",e)}),this).on("over",(function(t,e,i,s){this.fireEvent("button.over",e,i,s)}),this).on("out",(function(t,e,i,s){this.fireEvent("button.out",e,i,s)}),this).on("down",(function(t,e,i,s){this.fireEvent("button.down",e,i,s)}),this).on("up",(function(t,e,i,s){this.fireEvent("button.up",e,i,s)}),this),t.isRexContainerLite&&t.sendChildToBack(t)),this.buttonsType&&(void 0===t.name&&console.error(`${this.parent.constructor.name}: Option button miss value`),zl.call(this,t)),this},addMultiple(t){for(var e=0,i=t.length;e0},setButtonEnable(t,e){var i=this.buttons;if(void 0===t||"boolean"==typeof t){e=t;for(var s=0,r=i.length;sa.height/2)){r>(o=Zl(a.left,a.centerY,t,e))&&(r=o,s=n);var o,l=i[n+1];l&&l.y===a.y||r>(o=Zl(a.right,a.centerY,t,e))&&(r=o,s=n+1)}}return s};const td=Phaser.Utils.Objects.IsPlainObject,ed=Phaser.Utils.Objects.GetValue,id=Phaser.Display.Align.CENTER;var sd=function(t,e,i,s){return"\n"===t?(this.addNewLine(),this):(ye.call(this,t),td(e)&&(e=ed(o=e,"padding",0),i=ed(o,"key",void 0),s=ed(o,"index",void 0),r=ed(o,"offsetX",0),n=ed(o,"offsetY",0),h=ed(o,"offsetOriginX",0),a=ed(o,"offsetOriginY",0)),void 0===e&&(e=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===h&&(h=0),void 0===a&&(a=0),(o=this.getSizerConfig(t)).align=id,o.padding=fe(e),o.alignOffsetX=r,o.alignOffsetY=n,o.alignOffsetOriginX=h,o.alignOffsetOriginY=a,void 0===s||s>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(s,0,t),void 0!==i&&this.addChildrenMap(i,t),this);var r,n,h,a,o},rd={add(t,e,i){if(pr(t))for(var s=t,r=0,n=s.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,bh.call(this,t),this}},ad={getChildrenWidth:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=0===this.orientation&&t?this.maxChildWidth:this.rexSizer.resolved?this.wrapResult.width:void 0)?e+(this.space.left+this.space.right)*this.scaleX:void 0);var e},getChildrenHeight:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=1===this.orientation&&t?this.maxChildHeight:this.rexSizer.resolved?this.wrapResult.height:void 0)?e+(this.space.top+this.space.bottom)*this.scaleY:void 0);var e},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;sr&&vd.addNewLine(this)}else for(n=0,h=t.length;n=0;i--)bd.call(this,e[i],t);return this}};const Cd=Phaser.Utils.Objects.GetValue;class wd extends ud{constructor(t,e){void 0===e&&(e={});var i=e.space;"number"==typeof i&&(e.space={item:i,line:i}),super(t,e),this.type="rexFixWidthButtons",this.buttonGroup=new Nl({parent:this,eventEmitter:Cd(e,"eventEmitter",this),groupName:Cd(e,"groupName",void 0),clickConfig:Cd(e,"click",void 0)}).setButtonsType(e);var s=Cd(e,"background",void 0),r=Cd(e,"buttons",void 0);this.buttonsAlign=Cd(e,"align",void 0),s&&this.addBackground(s),r&&this.addButtons(r),this.addChildrenMap("background",s),this.addChildrenMap("buttons",this.buttonGroup.buttons)}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.buttonGroup.destroy(),this.buttonGroup=void 0)}get buttons(){return this.buttonGroup.buttons}get groupName(){return this.buttonGroup.groupName}set groupName(t){this.buttonGroup.groupName=t}get eventEmitter(){return this.buttonGroup.eventEmitter}}Object.assign(wd.prototype,fd,xd,Gl,Ul);var Sd={v:0,vertical:0,y:0,h:1,horizontal:1,x:1,xy:2,vh:2},Od=function(t,e){void 0===e&&(e="scrollMode"),t.hasOwnProperty(e)||(t[e]=kd(t));var i=t[e];return"string"==typeof i&&(i=Sd[i]),i},kd=function(t){var e=!!t.sliderY||!!t.scrollerY,i=!!t.sliderX||!!t.scrollerX;return e&&i?2:e?0:i?1:0},Pd=function(){return Array.prototype.reduce.call(arguments,_d,0)},_d=function(t,e){return t+e};const Td=Phaser.Utils.Objects.IsPlainObject,Ed=Phaser.Utils.Objects.GetValue,Md=Phaser.Display.Align.CENTER;var Rd=function(t,e,i,s,r){if("number"==typeof t||"number"==typeof e){if(void 0===t){for(var n=0;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return Dd(this.sizerChildren,null),bh.call(this,t),this}},Xd={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)Dd(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},Bd={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=We.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,Dd(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Dd(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},Id=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const Fd=Phaser.Utils.Objects.IsPlainObject,Hd=Phaser.Utils.Objects.GetValue;class Gd extends nh{constructor(t,e,i,s,r,n,h,a,o,l){Fd(e)?(e=Hd(l=e,"x",0),i=Hd(l,"y",0),s=Hd(l,"width",void 0),r=Hd(l,"height",void 0),n=Hd(l,"column",l.col||0),h=Hd(l,"row",0),a=Hd(l,"columnProportions",0),o=Hd(l,"rowProportions",0)):Fd(s)?(s=Hd(l=s,"width",void 0),r=Hd(l,"height",void 0),n=Hd(l,"column",l.col||0),h=Hd(l,"row",0),a=Hd(l,"columnProportions",0),o=Hd(l,"rowProportions",0)):Fd(n)?(n=Hd(l=n,"column",l.col||0),h=Hd(l,"row",0),a=Hd(l,"columnProportions",0),o=Hd(l,"rowProportions",0)):Fd(a)&&(a=Hd(l=a,"columnProportions",0),o=Hd(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(Hd(l,"createCellContainerCallback")),this.setIndentLeft(Hd(l,"space.indentLeftOdd",0),Hd(l,"space.indentLeftEven",0)),this.setIndentTop(Hd(l,"space.indentTopOdd",0),Hd(l,"space.indentTopEven",0)),this.resetGrid(n,h,a,o,Hd(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=jd.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=Id.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(Gd.prototype,Bd);const Nd=Phaser.Utils.Objects.GetValue;var Vd=Phaser.Renderer.WebGL.Utils,Ud=function(t,e,i,s,r,n){for(var h=Vd.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),a=i.pathData,o=i.pathIndexes,l=0;l>>16,a=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+h+","+a+","+o+","+n+")"},Zd=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,h=(16711680&r)>>>16,a=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+h+","+a+","+o+","+n+")",t.lineWidth=e.lineWidth};const Qd=Phaser.Renderer.Canvas.SetTransform;var tc={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Kd(e,i,s),h=r.calcMatrix.copyFrom(n.calc),a=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&Ud(r,h,e,l,a,o),e.isStroked&&Jd(r,e,l,a,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(Qd(t,r,e,i,s)){var n=e._displayOriginX,h=e._displayOriginY,a=e.pathData,o=a.length-1,l=a[0]-n,d=a[1]-h;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(ic.prototype,tc);var sc=function(t){return t.x>0&&t.y>0},rc=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const nc=Phaser.Math.DegToRad;var hc=function(t,e,i,s,r,n,h,a,o){h&&n>r?n-=360:!h&&n0,h=0,a=e.length;h=0?t.startAt(h+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(h+n,i):t.startAt(h,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(h,i),t.close(),t};const nu=Phaser.Utils.Objects.GetValue,hu=Phaser.Utils.Objects.IsPlainObject;class au extends(Lc(Oc)){constructor(t,e,i,s,r,n,h,a){hu(e)?(e=(a=e).x,i=a.y,s=a.width,r=a.height,n=a.barColor,h=a.value):hu(s)?(s=(a=s).width,r=a.height,n=a.barColor,h=a.value):hu(n)&&(n=(a=n).barColor,h=a.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===h&&(h=0),super(t,e,i,s,r,a),this.type="rexLineProgress",this.bootProgressBase(a),this.addShape((new su).setName("trackFill")).addShape((new su).setName("bar")).addShape((new su).setName("trackStroke")),this.setTrackColor(nu(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(nu(a,"trackStrokeThickness",2),nu(a,"trackStrokeColor",void 0)),this.setSkewX(nu(a,"skewX",0)),this.setRTL(nu(a,"rtl",!1)),this.setValue(h)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var ou={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&ru(s,0,0,e,i,t);var r,n,h=this.getShape("bar");h.fillStyle(this.barColor),h.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),ru(h,r,0,n,i,t));var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&ru(a,0,0,e,i,t)}};Object.assign(au.prototype,ou);var lu=function(t){return null==t||""===t||0===t.length},du=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(lu(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(lu(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,h=e.length;n=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=To(i),s=To(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),h=n.width,a=0,o=0,l=i.length;o0?h/a:0,c=n.height,u=0;for(o=0,l=s.length;o0?0:g,b=0,o=0;for(var S=i.length;o0?0:f),f>=1&&g>=1){var O=typeof(m=this.getFrameNameCallback(o,C,e));"string"!==O&&"number"!==O||r.add(m,0,b+n.cutX,x+n.cutY,f,g)}b+=f}x+=g}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,h,a,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/o,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(u,p);if(u>v){var g=(u-v)*o;d>=0?d+=g:d=g,u=v}if(p>v){var f=(p-v)*l;c>=0?c+=f:c=f,p=v}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,x=this.rows.count;b0&&a>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(C,b)?0:1)?this._drawImage(this.textureKey,s,m,y,h,a):this._drawTileSprite(this.textureKey,s,m,y,h,a)),m+=h;y+=a}this._endDraw()},setStretchMode:function(t){return Tu(t)?(this.stretchMode.edge=Mu(Eu(t,"edge",0)),this.stretchMode.internal=Mu(Eu(t,"internal",0))):(t=Mu(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Lu.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const Yu=Phaser.Utils.Objects.IsPlainObject,Xu=Phaser.Utils.Objects.GetValue,Au=Phaser.GameObjects;var zu=void 0,Wu=function(t,e){if(zu||(zu={},ei(t).events.once("destroy",(function(){for(var t in zu)zu[t].destroy();zu=void 0}))),!zu.hasOwnProperty(e)){var i=ei(t).scene.systemScene;(t=new Au[e](i)).setOrigin(0),zu[e]=t}return zu[e]};const Bu=Phaser.GameObjects.RenderTexture;class ju extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if(Yu(i)?(i=Xu(d=i,"x",0),s=Xu(d,"y",0),r=Xu(d,"width",1),n=Xu(d,"height",1),h=Xu(d,"key",void 0),a=Xu(d,"baseFrame",void 0),o=Xu(d,"columns",void 0),l=Xu(d,"rows",void 0)):Yu(r)?(r=Xu(d=r,"width",1),n=Xu(d,"height",1),h=Xu(d,"key",void 0),a=Xu(d,"baseFrame",void 0),o=Xu(d,"columns",void 0),l=Xu(d,"rows",void 0)):Yu(h)?(h=Xu(d=h,"key",void 0),a=Xu(d,"baseFrame",void 0),o=Xu(d,"columns",void 0),l=Xu(d,"rows",void 0)):Yu(a)?(a=Xu(d=a,"baseFrame",void 0),o=Xu(d,"columns",void 0),l=Xu(d,"rows",void 0)):Array.isArray(a)?(d=l,l=o,o=a,a=Xu(d,"baseFrame",void 0)):Yu(o)&&(o=Xu(d=o,"columns",void 0),l=Xu(d,"rows",void 0)),void 0===a&&(a=Xu(d,"frame",void 0)),void 0===o){var c=Xu(d,"leftWidth",void 0),u=Xu(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=Xu(d,"topHeight",void 0),v=Xu(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(Xu(d,"getFrameNameCallback",void 0)),this.setStretchMode(Xu(d,"stretchMode",0)),this.setPreserveRatio(Xu(d,"preserveRatio",!0));var g=Xu(d,"maxFixedPartScale",1),f=Xu(d,"maxFixedPartScaleX",g),m=Xu(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(h,a,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,Du),i}(Bu,"rexNinePatch")){}var Iu={_drawImage:function(t,e,i,s,r,n){var h=Wu(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=Wu(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(ju.prototype,Iu);let Fu=class extends si{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(pu(t,e))return t[e];var i=t.parent;return pu(i,e)?i[e]:void 0}set(t,e,i){return pu(t,e)?t[e]=i:pu(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}};const Hu=Phaser.Utils.Objects.GetValue;class Gu extends ju{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=Hu(e,"effects",!0);i&&yu(this,i),this.style=new Fu(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Gu.prototype,fc);const Nu=["alpha","tint","flipX","flipY"];var Vu=function(t,e){if(!e)return t;for(var i=0,s=Nu.length;i=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const Op=Phaser.Utils.Objects.GetValue,kp=Phaser.Math.Distance.Between;class Pp extends si{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=Op(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(Op(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(Op(t,"enable",!0)),this.holdThreshold=Op(t,"holdThreshold",50),this.pointerOutReleaseEnable=Op(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return gn(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:kp(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!ur(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!ur(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const _p=Phaser.Utils.Objects.GetValue;class Tp{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(_p(t,"value",0)),this.setSpeed(_p(t,"speed",0)),this.setAcceleration(_p(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class Ep{constructor(){this.value,this.dir,this.movement=new Tp}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const Dp={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},Yp=Phaser.Utils.Objects.GetValue;class Xp extends si{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=Yp(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(Yp(e,"speed",.1)),this.setEnable(Yp(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(Yp(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||ur(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const Ap=Phaser.Utils.Objects.GetValue;var zp=function(t,e,i,s){var r,n,h="Y"===(i=i.toUpperCase()),a=2===t.scrollMode,o=t.childrenMap.child,l=`slider${i}`;if(r=a||s.hasOwnProperty(l)?Ap(s,l,void 0):Ap(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=h?1:0,n=function(t,e){void 0===e&&(e={});var i=yt(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new wp(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r),n.tickLength=Ap(r,"tickLength",void 0);var p=Ap(r,"position",0);"string"==typeof p&&(p=Wp[p]);var v,g,f=Ap(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=Ap(s,"space.slider",void 0))&&(a?f=0:v=Ap(s,"space.child",0)),g=void 0===v?"number"==typeof f:"number"==typeof v,h?0===p?(d=2,c=1,u=void 0===v?g?{left:f}:f:{left:Ap(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:Ap(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:Ap(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:Ap(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=Ap(r,"hideUnscrollableSlider",!1),t[`disableUnscrollableDrag${i}`]=Ap(r,"disableUnscrollableDrag",!1),t[`adaptThumb${i}SizeMode`]=Ap(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=Ap(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`disableUnscrollableDrag${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=Ap(s,"scrollDetectionMode");"string"==typeof b&&(b=Bp[b]);var x=`scroller${i}`;(m=a||s.hasOwnProperty(x)?Ap(s,x,!0):Ap(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new Lp(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var C,w,S,O,k,P=Ap(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);P&&o&&(void 0!==b&&(P.focus=1===b?2:0),C=new Xp(o,P)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,C),a&&!h||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.disableUnscrollableDrag=t[`disableUnscrollableDrag${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",C)),n&&(a?(w=h?"t":"s",O=`scroll${i}`):(w="t",O="scroll"),n.on("valuechange",(function(e){t[w]=e,t.emit(O,t)}))),y&&(a?(S=`childO${i}`,O=`scroll${i}`):(S="childOY",O="scroll"),y.on("valuechange",(function(e){t[S]=e,t.emit(O,t)}))),C&&(k=a?`addChildO${i}`:"addChildOY",C.on("scroll",(function(e){t[k](-e,!0)})))};const Wp={right:0,left:1,bottom:0,top:1},Bp={gameObject:0,rectBounds:1},jp=Phaser.Utils.Objects.GetValue;var Ip=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=jp(e,"width"),h=jp(e,"height");n||jp(e,"child.expandWidth",!0)||(s[1]=0),h||jp(e,"child.expandHeight",!0)||(r[1]=0);var a=new Gd(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=Nd(i,"child"),r=Nd(s,"gameObject",void 0);if(r){var n=Nd(i,"space.child",0);t.childMargin={};var h=t.childMargin,a={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:h.top=0,h.bottom=0,h.left=0,h.right=0;break;default:h.top=n,h.bottom=n,h.left=n,h.right=n}else switch(t.scrollMode){case 0:h.top=Nd(n,"top",0),h.bottom=Nd(n,"bottom",0),a.left=Nd(n,"left",0),a.right=Nd(n,"right",0);break;case 1:h.top=Nd(n,"left",0),h.bottom=Nd(n,"right",0),a.top=Nd(n,"top",0),a.bottom=Nd(n,"bottom",0);break;default:h.top=Nd(n,"top",0),h.bottom=Nd(n,"bottom",0),h.left=Nd(n,"left",0),h.right=Nd(n,"right",0)}e.add(r,{column:1,row:1,align:Nd(s,"align","center"),padding:a,expand:{width:Nd(s,"expandWidth",!0),height:Nd(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:zp(t,a,"y",e);break;case 1:zp(t,a,"x",e);break;default:zp(t,a,"y",e),zp(t,a,"x",e)}return a},Fp=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}i*="Y"===t?this.scaleY:this.scaleX,s&&s.setBounds(e,i),r&&(r.setEnable(e!==i),r.tickLength&&r.setTick(r.tickLength,e,i))},Hp=function(t){switch(this.scrollMode){case 0:case 1:(i=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(i,this.isOverflow),(r=this.childrenMap.scroller)&&this.disableUnscrollableDrag&&r.setEnable(this.isOverflow);break;default:var e=this[`isOverflow${t=t.toUpperCase()}`],i=this.childrenMap[`slider${t}`],s=this[`hideUnscrollableSlider${t}`];i&&s&&this.setChildVisible(i,e);var r=this.childrenMap.scroller,n=this[`disableUnscrollableDrag${t}`];r&&n&&r.setEnable(e)}},Gp=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(a=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=a.childrenMap.track,s=a.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&nthis.topChildOY}childOYExeceedBottom(t){return void 0===t&&(t=this.childOY),tthis.leftChildOX}childOXExeceedRight(t){return void 0===t&&(t=this.childOX),tthis.childHeight?t=0:s?t=e:r&&(t=i)),this._childOY!==t&&(this._childOY=t,this.resetChildPosition()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}get childOX(){return this._childOX}set childOX(t){var e=this.leftChildOX,i=this.rightChildOX,s=this.childOXExceedLeft(t),r=this.childOXExeceedRight(t);this.clampChildOX&&(this.childVisibleWidth>this.childWidth?t=0:s?t=e:r&&(t=i)),this._childOX!==t&&(this._childOX=t,this.resetChildPosition()),s&&(this.execeedLeftState||this.emit("execeedleft",this,t,e)),this.execeedLeftState=s,r&&(this.execeedRightState||this.emit("execeedright",this,t,i)),this.execeedRightState=r}setChildOY(t){return this.childOY=t,this}setChildOX(t){return this.childOX=t,this}set t(t){this.childOY=-this.visibleHeight*t}get t(){var t=this.visibleHeight;return 0===t?0:this.childOY/-t}set s(t){this.childOX=-this.visibleWidth*t}get s(){var t=this.visibleWidth;return 0===t?0:this.childOX/-t}setChildOYByPercentage(t){return this.t=t,this}setChildOXByPercentage(t){return this.s=t,this}}Object.assign(cv.prototype,av);const uv=["top","bottom","centerY","center"],pv=["left","right","centerX","center"];var vv=function(t,e,i){var s,r="Y"===(e=e.toUpperCase()),n=this.childrenMap.child;if(r){if(i)for(var h=0,a=uv.length;h=0?0:Math.abs(l)<=Math.abs(d)?l:d}}else{if(i)for(h=0,a=pv.length;h=0?0:Math.abs(c)<=Math.abs(u)?c:u}}switch(this.scrollMode){case 0:case 1:this.childOY+=s;break;default:this[`childO${e}`]+=s}};const gv=Phaser.Utils.Objects.GetValue;class fv extends $p{constructor(t,e){void 0===e&&(e={});var i=Od(e),s=gv(e,"panel",void 0);void 0===s&&(s={}),s.scrollMode=i,s.clampChildOY=gv(e,"clampChildOY",!1),s.clampChildOX=gv(e,"clampChildOX",!1);var r,n,h=new cv(t,s);switch(t.add.existing(h),i){case 0:r=gv(e,"expand.panel",!0),n=!0;break;case 1:r=!0,n=gv(e,"expand.panel",!0);break;default:r=!0,n=!0}e.type="rexScrollablePanel",e.child={gameObject:h,expandWidth:r,expandHeight:n,align:gv(e,"align.panel","center")};var a=gv(e,"space",void 0);a&&(a.child=gv(a,"panel",0)),super(t,e),this.addChildrenMap("panel",h.child),this.addChildrenMap("panelLayer",h.maskLayer),this.addChildrenMap("mask",h.maskGameObject),this.addChildrenMap("scrollableBlock",h)}setChildrenInteractive(t){return void 0===t&&(t={}),t.hasOwnProperty("eventEmitter")||(t.eventEmitter=this),t.hasOwnProperty("targets")||(t.targets=[this.childrenMap.panel]),ih(this.childrenMap.child,t),this}}var mv={scrollToChild:function(t,e){if(!this.hasChild(t))return this;switch(this.scrollMode){case 0:vv.call(this,t,"y",e);break;case 1:vv.call(this,t,"x",e);break;default:vv.call(this,t,"y",e),vv.call(this,t,"x",e)}return this}};Object.assign(fv.prototype,mv);const yv=Phaser.Utils.Objects.GetValue;var bv=function(){var t,e=this.scene,i=this.listCreateBackgroundCallback;i&&(t=i.call(this,e),e.add.existing(t));var s=[],r=this.listCreateButtonCallback;if(r)for(var n=this.options,h=0,a=n.length;h0||this.listMaxHeight>0)){if(s=xv(e,u,this.listWrapEnable),this.listMaxHeight>0&&(s.layout(),s.height<=this.listMaxHeight&&(d=s)),!d){0===c&&(c=this.listMaxHeight);var p=Cv(e,this.listCreateSliderTrackCallback),v=Cv(e,this.listCreateSliderThumbCallback);d=new fv(e,{height:c,scrollMode:0,panel:{child:s,mask:{padding:1}},slider:{track:p,thumb:v,adaptThumbSize:this.listSliderAdaptThumbSizeEnable},scrollDetectionMode:1,scroller:this.listScrollerConfig,mouseWheelScroller:this.listMouseWheelScrollerConfig,space:{panel:yv(this.listSpace,"panel",0)}}),e.add.existing(d)}}else u.height=c,s=xv(e,u,this.listWrapEnable),d=s;return t&&d.addBackground(t,"background"),this.listDraggable&&d.setDraggable(!0),d!==s&&s.on("button.over",(function(t,e,i,s){d.emit("button.over",t,e,i,s)})).on("button.out",(function(t,e,i,s){d.emit("button.out",t,e,i,s)})).on("button.click",(function(t,e,i,s){d.emit("button.click",t,e,i,s)})),d},xv=function(t,e,i){var s;return i?(e.orientation="x",s=new wd(t,e)):(e.orientation="y",s=new Jl(t,e)),t.add.existing(s),s},Cv=function(t,e,i){var s;return e&&(s=e.call(i,t),t.add.existing(s)),s},wv=function(t,e){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return!0;if(-1!==e.indexOf(".")){for(var i=e.split("."),s=t,r=0;rx.bottom&&(l=c.getTopLeft().y,t.setOrigin(0,1).setPosition(o+u,l+p))};const kv={down:0,up:1},Pv=Phaser.Utils.Objects.GetValue;class _v extends Hs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=function(t,e){Ri(t,e,"y","Cubic")}),null==e.transitOut&&(e.transitOut=function(t,e){!function(t,e,i,s,r){void 0===s&&(s="Linear");var n={mode:0};switch(i){case 0:case"x":n.end={x:0};break;case 1:case"y":n.end={y:0};break;default:n.end=0}n.duration=e,n.ease=s,void 0===r?r=new Ei(t,n):r.resetFromJSON(n),r.restart()}(t,e,"y","Linear")}),e.manualClose=!0,e.clickOutsideClose=!0,e.destroy=!0,super(t,e),Ov(t,e),t.isRexSizer&&t.layout();var i=Pv(e,"touchOutsideClose",!1),s=Pv(e,"anyTouchClose",!1);s&&(i=!1),s?this.once("open",this.anyTouchClose,this):i&&this.once("open",this.touchOutsideClose,this),this.requestOpen()}shutdown(t){this.isShutdown||(this.scene.input.off("pointerup",this.touchCloseCallback,this),super.shutdown(t))}touchOutsideClose(){return this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&ir(this.parent,t.worldX,t.worldY)||this.requestClose()}onOpen(){this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.parent,this),super.onClose()}}var Tv={focusNextButton(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;return t=void 0===e?0:(e+1)%this.listPanel.getButtons().length,this.emitButtonOver(t),this},focusPrevButton(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;if(void 0===e)t=0;else{var i=this.listPanel.getButtons().length;t=(e-1+i)%i}return this.emitButtonOver(t),this}},Ev={openListPanel:function(){if(this.listPanel)return this;if(0===this.options.length)return this;var t,e=bv.call(this);e.on("button.over",(function(t,i,s,r){this.currentOverIndex=i,this.listOnButtonOver&&this.listOnButtonOver.call(this,t,i,s,r),this.emit("button.over",this,e,t,i,s,r)}),this).on("button.out",(function(t,i,s,r){this.currentOverIndex===i&&(this.currentOverIndex=void 0),this.listOnButtonOut&&this.listOnButtonOut.call(this,t,i,s,r),this.emit("button.out",this,e,t,i,s,r)}),this),t=this.listAlignMode&&"label"!==this.listAlignMode?this.getElement(this.listAlignMode):this;var i=new _v(e,{duration:{in:this.listEaseInDuration,out:this.listEaseOutDuration},transitIn:this.listTransitInCallback,transitOut:this.listTransitOutCallback,expandDirection:this.listExpandDirection,alignTargetX:t,alignTargetY:this,alignSide:this.listAlignSide,bounds:this.listBounds}).on("open",(function(){e.on("button.click",(function(t,i,s,r){this.listOnButtonClick&&this.listOnButtonClick.call(this,t,i,s,r),this.emit("button.click",this,e,t,i,s,r),this.dropDownBehavior.requestClose()}),this),this.emit("list.open",this,e)}),this).on("close",(function(){this.listPanel=void 0,this.dropDownBehavior=void 0,this.emit("list.close",this)}),this);return e.onClickOutside((function(){i.requestClose()})),this.listPanel=e,this.dropDownBehavior=i,this.pin(e),this},closeListPanel:function(){return this.dropDownBehavior?(this.dropDownBehavior.requestClose(),this.currentOverIndex=void 0,this):this},toggleListPanel:function(){return this.listPanel?this.closeListPanel():this.openListPanel(),this},emitButtonClick:function(t){if(void 0===t&&(t=this.currentOverIndex),void 0===t)return this;var e=this.listPanel,i=e?e.getButton(t):this.options[t];return this.listOnButtonClick&&this.listOnButtonClick.call(this,i,t),this.emit("button.click",this,e,i,t),this},emitButtonOver:function(t){var e=this.listPanel;return e?(e.emitButtonOver(t),this):this}};Object.assign(Ev,Pl,Tv);const Mv=Phaser.Utils.Objects.GetValue;class Rv extends kl{constructor(t,e){super(t,e),this.type="rexDropDownList",this.timer=void 0,this.listPanel=void 0,this.currentOverIndex=void 0,this.setOptions(Mv(e,"options"));var i=Mv(e,"list");this.setWrapEnable(Mv(i,"wrap",!1)),this.setCreateButtonCallback(Mv(i,"createButtonCallback")),this.setCreateListBackgroundCallback(Mv(i,"createBackgroundCallback")),this.setCreateListSliderTrackCallback(Mv(i,"createTrackCallback")),this.setCreateListSliderThumbCallback(Mv(i,"createThumbCallback")),this.setListSliderAdaptThumbSizeEnable(Mv(i,"sliderAdaptThumbSize",!1)),this.setListScrollerConfig(Mv(i,"scroller")),this.setListMouseWheelScrollerConfig(Mv(i,"mouseWheelScroller")),this.setButtonClickCallback(Mv(i,"onButtonClick")),this.setButtonOverCallback(Mv(i,"onButtonOver")),this.setButtonOutCallback(Mv(i,"onButtonOut")),this.setListExpandDirection(Mv(i,"expandDirection")),this.setListEaseInDuration(Mv(i,"easeIn",500)),this.setListEaseOutDuration(Mv(i,"easeOut",100)),this.setListTransitInCallback(Mv(i,"transitIn")),this.settListTransitOutCallback(Mv(i,"transitOut")),this.setListMaxHeight(Mv(i,"maxHeight",0)),this.setListSize(Mv(i,"width"),Mv(i,"height",0)),this.setListAlignmentMode(Mv(i,"alignParent","text")),this.setListAlignmentSide(Mv(i,"alignSide","")),this.setListBounds(Mv(i,"bounds")),this.setListSpace(Mv(i,"space")),this.setListDraggable(Mv(i,"draggable",!1)),this.setValueChangeCallback(Mv(e,"setValueCallback"),Mv(e,"setValueCallbackScope")),this.setValue(Mv(e,"value")),this.onClick(this.toggleListPanel,this)}destroy(t){this.scene&&!this.ignoreDestroy&&(this.listPanel&&(this.listPanel.destroy(t),this.listPanel=void 0),super.destroy(t))}get isOpened(){return!!this.listPanel}setOptions(t){return void 0===t&&(t=[]),this.options=t,this}setValueChangeCallback(t,e){return this.valueChangeCallback=t,this.valueChangeCallbackScope=e,this}setValue(t){return this.value=t,this}get value(){return this._value}set value(t){if(this._value!==t){var e=this._value;this._value=t;var i=this.valueChangeCallback,s=this.valueChangeCallbackScope;i&&(s?i.call(s,this,t,e):i(this,t,e)),this.emit("valuechange",this,t,e)}}}Object.assign(Rv.prototype,Ev);const Lv=Phaser.GameObjects.Text,Dv=Phaser.Utils.Objects.GetValue;class Yv extends Lv{constructor(t,e){void 0===e&&(e={}),super(t,Dv(e,"x",0),Dv(e,"y",0),Dv(e,"text",""),e),this.type="rexStatesText",e.style=this.style,e.onModifyStyle=function(t,e){var i=e.hasOwnProperty("fontStyle")||e.hasOwnProperty("fontSize")||e.hasOwnProperty("fontFamily");t.style.update(i)},this.addStyleManager(e),delete e.style}}Object.assign(Yv.prototype,fc);var Xv=Phaser.Renderer.WebGL.Utils,Av={renderWebGL:function(t,e,i,s){if(0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,h=r.height,a=Xv.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,h,e.x,e.y,n/e.style.resolution,h/e.style.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,h,a(e.tintTopLeft,i.alpha*e._alphaTL),a(e.tintTopRight,i.alpha*e._alphaTR),a(e.tintBottomLeft,i.alpha*e._alphaBL),a(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const zv=Phaser.Display.Canvas.CanvasPool;e();const Wv=Phaser.GameObjects.GameObject;class Bv extends Wv{setStyle(t){return this.style.setStyle(t)}setFont(t){return this.style.setFont(t)}setFontFamily(t){return this.style.setFontFamily(t)}setFontSize(t){return this.style.setFontSize(t)}setFontStyle(t){return this.style.setFontStyle(t)}setTestString(t){return this.style.setTestString(t)}setFixedSize(t,e){return this.style.setFixedSize(t,e)}setBackgroundColor(t,e,i){return this.style.setBackgroundColor(t,e,i)}setBackgroundStrokeColor(t,e){return this.style.setBackgroundStrokeColor(t,e)}setBackgroundCornerRadius(t,e){return this.style.setBackgroundCornerRadius(t,e)}setFill(t){return this.style.setFill(t)}setColor(t){return this.style.setColor(t)}setStroke(t,e){return this.style.setStroke(t,e)}setShadow(t,e,i,s,r,n){return this.style.setShadow(t,e,i,s,r,n)}setShadowOffset(t,e){return this.style.setShadowOffset(t,e)}setShadowColor(t){return this.style.setShadowColor(t)}setShadowBlur(t){return this.style.setShadowBlur(t)}setShadowStroke(t){return this.style.setShadowStroke(t)}setShadowFill(t){return this.style.setShadowFill(t)}setUnderline(t,e,i){return this.style.setUnderline(t,e,i)}setUnderlineColor(t){return this.style.setUnderlineColor(t)}setUnderlineThickness(t){return this.style.setUnderlineThickness(t)}setUnderlineOffset(t){return this.style.setUnderlineOffset(t)}setStrikethrough(t,e,i){return this.style.setStrikethrough(t,e,i)}setStrikethroughColor(t){return this.style.setStrikethroughColor(t)}setStrikethroughThickness(t){return this.style.setStrikethroughThickness(t)}setStrikethroughOffset(t){return this.style.setStrikethroughOffset(t)}setWrapMode(t){return this.style.setWrapMode(t)}setWrapWidth(t){return this.style.setWrapWidth(t)}setWordWrapWidth(t){return this.style.setWrapWidth(t)}setAlign(t){return this.style.setHAlign(t)}setHAlign(t){return this.style.setHAlign(t)}setVAlign(t){return this.style.setVAlign(t)}get lineSpacing(){return this.style.lineSpacing}set lineSpacing(t){this.style.lineSpacing=t}setLineSpacing(t){return this.style.lineSpacing=t,this.updateText(!0),this}setXOffset(t){return this.style.setXOffset(t)}setMaxLines(t){return this.style.setMaxLines(t)}setResolution(t){return this.style.setResolution(t)}getTextMetrics(){return this.style.getTextMetrics()}setTextMetrics(t,e){return this.style.setTextMetrics(t,e)}measureTextMargins(t,e){return function(t,e,i){void 0===i&&(i={});var s=zv.create(this),r=s.getContext("2d",{willReadFrequently:!0});t.syncFont(s,r);var n=r.measureText(e),h=Math.ceil(n.width*t.baselineX),a=h,o=2*a;if(a=a*t.baselineY|0,s.width=h,s.height=o,r.fillStyle="#f00",r.fillRect(0,0,h,o),r.font=t._font,r.textBaseline="alphabetic",r.fillStyle="#000",r.fillText(t.testString,0,a),i.left=0,0===h||0===o||!r.getImageData(0,0,h,o))return zv.remove(s),i;for(var l=r.getImageData(0,0,h,o).data,d=!1,c=0;c * @copyright 2018 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */const Iv=Phaser.Display.Canvas.CanvasPool;var Fv=function(t){var e=Iv.create(this),i=e.getContext("2d",{willReadFrequently:!0});t.syncFont(e,i);var s=i.measureText(t.testString);if("actualBoundingBoxAscent"in s){var r=s.actualBoundingBoxAscent,n=s.actualBoundingBoxDescent,h={ascent:r,descent:n,fontSize:r+n};return Iv.remove(e),h}var a=Math.ceil(s.width*t.baselineX),o=a,l=2*o;if(o=o*t.baselineY|0,e.width=a,e.height=l,i.fillStyle="#f00",i.fillRect(0,0,a,l),i.font=t._font,i.textBaseline="alphabetic",i.fillStyle="#000",i.fillText(t.testString,0,o),h={ascent:0,descent:0,fontSize:0},!i.getImageData(0,0,a,l))return h.ascent=o,h.descent=o+6,h.fontSize=h.ascent+h.descent,Iv.remove(e),h;var d,c,u=i.getImageData(0,0,a,l).data,p=u.length,v=4*a,g=0,f=!1;for(d=0;do;d--){for(c=0;c0&&this.wrapMode!==na&&0===this.wrapWidth}setStyle(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wordWrap")){var s=t.wordWrap;s.hasOwnProperty("width")&&(t.wrap={mode:"word",width:s.width})}if(t&&t.hasOwnProperty("wrap")){var r=t.wrap;if(r.hasOwnProperty("mode")){var n=r.mode;"string"==typeof n&&(r.mode=la[n])}else r.hasOwnProperty("width")&&(r.mode=1)}t&&t.rtl&&i&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var h=this.propertyMap;for(var a in h){var o=h[a],l=o[0],d=i?o[1]:this[a],c=o[2];if("wrapCallback"===a||"wrapCallbackScope"===a)this[a]=Gv(t,l,d);else{var u=Hv(t,l,d);c&&(u=c(u)),this[a]=u}}var p=Gv(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var v=Gv(t,"fill",null);null!==v&&(this.color=Ga(v));var g=Gv(t,"metrics",!1);return g?this.metrics={ascent:Gv(g,"ascent",0),descent:Gv(g,"descent",0),fontSize:Gv(g,"fontSize",0)}:!e&&this.metrics||(this.metrics=Fv(this)),e?this.parent.updateText():this.parent}syncFont(t,e){e.font=this._font}syncStyle(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"}syncShadow(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)}update(t){return t&&(this._font=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim(),this.metrics=Fv(this)),this.parent.updateText(t)}buildFont(){var t=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim();return t!==this._font&&(this._font=t),this}setFont(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=Gv(t,"fontFamily","Courier"),this.fontSize=Gv(t,"fontSize","16px"),this.fontStyle=Gv(t,"fontStyle","")),this.update(!0)}setFontFamily(t){return this.fontFamily=t,this.update(!0)}setFontStyle(t){return this.fontStyle=t,this.update(!0)}setFontSize(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}setTestString(t){return this.testString=t,this.update(!0)}setFixedSize(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}setResolution(t){return this.resolution=t,this.update(!1)}setXOffset(t){return this.xOffset=t,this.update(!1)}setBackgroundColor(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=Ga(t,this.parent.canvas,this.parent.context),this.backgroundColor2=Ga(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=Ga(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}setBackgroundCornerRadius(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}setFill(t){return this.color=Ga(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=Ga(t,this.parent.canvas,this.parent.context),this.update(!1)}setStroke(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=Ga(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}setShadow(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===n&&(n=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=Ga(i,this.parent.canvas,this.parent.context),this.shadowBlur=s,this.shadowStroke=r,this.shadowFill=n,this.update(!1)}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}setShadowColor(t){return void 0===t&&(t="#000"),this.shadowColor=Ga(t,this.parent.canvas,this.parent.context),this.update(!1)}setShadowBlur(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}setShadowStroke(t){return this.shadowStroke=t,this.update(!1)}setShadowFill(t){return this.shadowFill=t,this.update(!1)}setUnderline(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=Ga(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}setUnderlineColor(t){return void 0===t&&(t="#000"),this.underlineColor=Ga(t,this.parent.canvas,this.parent.context),this.update(!1)}setUnderlineThickness(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}setUnderlineOffset(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}setStrikethrough(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=Ga(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}setStrikethroughColor(t){return void 0===t&&(t="#000"),this.strikethroughColor=Ga(t,this.parent.canvas,this.parent.context),this.update(!1)}setStrikethroughThickness(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}setStrikethroughOffset(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}setWrapMode(t){return"string"==typeof t&&(t=la[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}setWrapWidth(t){return this.wrapWidth=t,this.update(!1)}setAlign(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}setHAlign(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}setVAlign(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}setMaxLines(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}getTextMetrics(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}setTextMetrics(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=Gv(e,"fontFamily",this.fontFamily),this.fontSize=Gv(e,"fontSize",this.fontSize),this.fontStyle=Gv(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}get lineHeight(){return this.metrics.fontSize+this.parent.lineSpacing}toJSON(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}destroy(){this.parent=void 0}}var Vv={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var h=this.defaultStyle;this.clear(),io(this,h.backgroundColor,h.backgroundStrokeColor,h.backgroundStrokeLineWidth,h.backgroundCornerRadius,h.backgroundColor2,h.backgroundHorizontalGradient,h.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var a,o,l,d,c,u,p=h.halign,v=h.valign,g=h.lineHeight,f=r.lines,m=f.length,y=h.maxLines;y>0&&m>y?(o=y,l="center"===v?Math.floor((m-o)/2):"bottom"===v?m-o:0):(o=m,l=0),d=l+o;var b=this.rtl,x=b?this.parent.width:void 0;u="center"===v?Math.max((s-o*g)/2,0):"bottom"===v?Math.max(s-o*g-2,0):0,u+=e;for(var C=l;C0){var a=this.defaultStyle.metrics,o=i-a.ascent,l=a.fontSize;this.drawRectangle(e,o,t.width,l,h.bgcolor,h)}if(h.underlineThickness>0&&t.width>0){var d=i+h.underlineOffset-h.underlineThickness/2;this.drawLine(e,d,t.width,h.underlineThickness,h.underlineColor,h)}if(t.isTextPen&&(h.buildFont(),h.syncFont(r,n),h.syncStyle(r,n),this.drawText(e,i,t.text,h)),t.isImagePen&&this.drawImage(e,i,t.prop.img,t.prop.color,h),h.strikethroughThickness>0&&t.width>0&&(d=i+h.strikethroughOffset-h.strikethroughThickness/2,this.drawLine(e,d,t.width,h.strikethroughThickness,h.strikethroughColor,h)),n.restore(),t.hasAreaMarker&&t.width>0){var c,u=t.prop.area;if(u)c={key:u};else{var p=t.prop.url;c={key:`url:${p}`,url:p}}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,c)}},clear(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawRectangle(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var h=this.context;h.fillStyle=r,h.fillRect(t,e,i,s)},drawLine(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var h=this.context;n.syncShadow(h,n.shadowStroke);var a=h.lineCap;h.lineCap="butt",h.strokeStyle=r,h.lineWidth=s,h.beginPath(),h.moveTo(t,e),h.lineTo(t+i,e),h.stroke(),h.lineCap=a},drawText(t,e,i,s){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;s.stroke&&"none"!==s.stroke&&s.strokeThickness>0&&(s.syncShadow(r,s.shadowStroke),r.strokeText(i,t,e)),s.color&&"none"!==s.color&&(s.syncShadow(r,s.shadowFill),r.fillText(i,t,e))},drawImage(t,e,i,s,r){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,s,this.autoRound)}};const Uv=Phaser.Utils.Objects.GetValue,$v=ia,Jv=sa;class Kv{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=Uv(t,"text",""),this.x=Uv(t,"x",0),this.y=Uv(t,"y",0),this.width=Uv(t,"width",0);var e=Uv(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=Uv(t,"newLineMode",0),this.startIndex=Uv(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===Jv&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==$v&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===Jv&&(t+=1),t}get endIndex(){return this.startIndex+this.rawTextLength}get lastX(){return this.x+this.width}get isTextPen(){return""!==this.text}get isImagePen(){return!!this.prop.img}get hasAreaMarker(){return!!this.prop.area||!!this.prop.url}}const qv=Phaser.Utils.Objects.GetFastValue,Zv=ia,Qv=ra;class tg{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=qv(t,"tagToText",Wt),this.tagToTextScope=qv(t,"tagToTextScope",void 0)}destroy(){this.clear(),this.tagToText=void 0,this.tagToTextScope=void 0}clear(){for(var t=0,e=this.lines.length;t=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}getLineEndIndex(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,s=!1;for(e=t;e>=0&&!(s=null!=(i=this.lines[e])&&i.length>0);e--);return s?i[i.length-1].endIndex:0}getLineWidth(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}getMaxLineWidth(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,s=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}getLineWidths(){for(var t=[],e=0,i=this.lines.length;e=t&&o<=e||(h=h.substring(t-a,e-a)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,h,l,d):c+=this.tagToText(h,l,d),d=l,!(o>=e)));u++);return c}get length(){return this.lines.length}set length(t){this.clear()}}var eg={};const ig=Phaser.Geom.Rectangle;var sg=new dl;class rg{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&yg(g)){""!==b?h.push(n.getLine(b,x,cg)):0===C&&r>0&&h.push(n.getLine("",0,cg)),h.push(...fg(g,e,vg,s,0,n));var S=h.pop();b=S.text,x=S.width,n.freeLine(S)," "===b&&(b="",x=0)}else(m=x+f)>o?(h.push(n.getLine(b,x,cg)),b=g,x=f,o=s):(b+=g,x=m),C===w-1&&h.push(n.getLine(b,x,l))}return h},mg=function(t,e){var i;switch(e){case pg:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==xg&&i0&&t>e&&(t=e),t}get linesWidth(){return Math.ceil(this.penManager.getMaxLineWidth())}get linesHeight(){var t=this.displayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}get imageManager(){return this.parent.imageManager}get rtl(){return this.parent.style.rtl}newPenManager(){return new tg({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}get tmpPenManager(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}getPlainText(t,e,i){var s;if(null==t)s=this.penManager.plainText;else{var r=this.parser.splitText(t,1);s="";for(var n=0,h=r.length;n0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n")}return i}(this.textObject,this.text,this.lines),this.linesCount=this.lines.length,this._textHeight=void 0,this._textVisibleHeight=void 0,this.updateTextObject(),this},updateTextObject:function(){var t=Math.max(Math.floor(xf.call(this,-this.textOY)),0),e=Cf.call(this,t)+this.textOY,i=wf.call(this,t);return function(t,e){switch(qh(t)){case 0:var i=(r=t.style).wordWrapWidth,s=r.wordWrapCallback;r.wordWrapWidth=0,r.wordWrapCallback=void 0,t.setText(e),r.wordWrapWidth=i,r.wordWrapCallback=s;break;case 1:var r,n=(r=t.style).wrapMode;r.wrapMode=0,t.setText(e),r.wrapMode=n;break;case 2:var h=t._maxWidth;t._maxWidth=0,t.setText(e),t._maxWidth=h}}(this.textObject,i),this.textObject.rexSizer.offsetY=e,Sf.call(this),this},preLayout:function(){return this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,Fe.call(this),this},layoutChildren:function(){var t,e,i,s,r,n,h,a=this.left,o=this.top;(t=this.textObject).rexSizer.hidden||(s=a+(i=(e=t.rexSizer).padding).left*this.scaleX,r=o+i.top*this.scaleY,n=this.width*this.scaleX-(i.left+i.right)*this.scaleX,h=this.height*this.scaleY-(i.top+i.bottom)*this.scaleY,kf.call(this,t,n,h),oe(t,s,r,n,h,e.align),e.preOffsetY=0,Sf.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const _f=Phaser.Utils.Objects.IsPlainObject,Tf=Phaser.Utils.Objects.GetValue,Ef=Phaser.Display.Align.TOP_LEFT;class Mf extends nh{constructor(t,e,i,s,r,n){_f(e)?(e=Tf(n=e,"x",0),i=Tf(n,"y",0),s=Tf(n,"width",void 0),r=Tf(n,"height",void 0)):_f(s)&&(s=Tf(n=s,"width",void 0),r=Tf(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexTextBlock",this.textObject=void 0,this.linesCount=0,this.textMask=void 0,this.textObjectType=void 0,this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,this._textObjectRealHeight=0,this.lines=void 0,this.text=Tf(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode(Tf(n,"clampTextOY",!0)),this.alwaysScrollable=Tf(n,"alwaysScrollable",!1);var h=Tf(n,"background",void 0),a=Tf(n,"text",void 0);void 0===a&&(a=Rf(t)),this.textCropEnable=Tf(n,"textCrop",!!a.setCrop);var o=Tf(n,"textMask",!this.textCropEnable);h&&this.addBackground(h),this.add(a),this.sizerChildren=[a];var l=this.getSizerConfig(a);l.align=Ef,l.padding=fe(0),l.expand=!0,this.textObject=a,this.textObjectType=qh(a),l.preOffsetY=0,l.offsetY=0,o&&(this.textMask=Vh.call(this,this.textObject,this)),this.addChildrenMap("background",h),this.addChildrenMap("text",a)}destroy(t){if(this.scene&&!this.ignoreDestroy){if(this.textObject=void 0,this.textMask=void 0,this.lines){switch(this.textObjectType){case 0:case 2:this.lines.length=0;break;case 1:this.lines.destroy()}this.lines=void 0}super.destroy(t)}}setClampMode(t){return void 0===t&&(t=!0),this.clampTextOY=t,this}get textLineHeight(){if(void 0===this._textLineHeight){var t;switch(this.textObjectType){case 0:case 1:var e=this.textObject.style;t=e.metrics.fontSize+e.strokeThickness;break;case 2:var i=this.textObject.fontSize/this.textObject.fontData.size;t=this.textObject.fontData.lineHeight*i}this._textLineHeight=t}return this._textLineHeight}get textLineSpacing(){if(void 0===this._textLineSpacing){var t;switch(this.textObjectType){case 0:case 1:t=this.textObject.lineSpacing;break;case 2:t=0}this._textLineSpacing=t}return this._textLineSpacing}get visibleLinesCount(){return void 0===this._visibleLinesCount&&(this._visibleLinesCount=Math.floor(xf.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=Cf.call(this,this.linesCount)),this._textHeight}get textObjectHeight(){return this._textObjectRealHeight-(this.textLineHeight+this.textLineSpacing)}get textVisibleHeight(){if(void 0===this._textVisibleHeight){var t=this.textHeight-this.textObjectHeight;!this.alwaysScrollable&&t<0&&(t=0),this._textVisibleHeight=t}return this._textVisibleHeight}textOYExceedTop(t){return void 0===t&&(t=this.textOY),t>this.topTextOY}textOYExeceedBottom(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:s?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}setTextOY(t){return this.textOY=t,this}set t(t){this.textOY=-this.textVisibleHeight*t}get t(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t}setTextOYByPercentage(t){return this.t=t,this}}var Rf=function(t){return t.add.text(0,0,"")};Object.assign(Mf.prototype,Pf);var Lf={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},Df={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const Yf=Phaser.Utils.Objects.GetValue;class Xf extends Up{constructor(t,e){void 0===e&&(e={});var i=Yf(e,"text",void 0),s=Yf(e,"textWidth",void 0),r=Yf(e,"textHeight",void 0),n=Yf(e,"textCrop",!!i.setCrop),h=Yf(e,"textMask",!n),a=Yf(e,"content",""),o=new Mf(t,{width:s,height:r,text:i,textMask:h,textCrop:n&&!h,content:a,clampTextOY:Yf(e,"clampChildOY",!1),alwaysScrollable:Yf(e,"alwaysScrollable",!1)});t.add.existing(o),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textObjectHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.textHeight}})}(o),e.scrollMode=0,e.type="rexTextArea",e.child={gameObject:o,expandWidth:void 0===s,expandHeight:void 0===r};var l=Yf(e,"space",void 0);l&&(l.child=Yf(l,"text",0)),super(t,e),this.addChildrenMap("text",i)}get text(){return this.childrenMap.child.text}get lineHeight(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.textHeight}}Object.assign(Xf.prototype,Lf,Df);const Af=Phaser.Utils.Objects.GetValue;var zf=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("key")&&(i="bitmaptext",e.font=e.key)),i){case"bitmaptext":case"bitmap":s=new mf(t,e);break;case"bbcodetext":case"bbcode":s=new pf(t,0,0,"",e);break;case"label":s=new yf(t,e);break;case"textarea":s=function(t,e,i){e=e?To(e):{};var s=Af(i,"background",Vu),r=Af(i,"text",zf),n=Af(i,"track",Vu),h=Af(i,"thumb",Vu);s?e.background=s(t,e.background):delete e.background,r?e.text=r(t,e.text):delete e.text;var a=e.slider;!1!==a&&null!==a&&(void 0===a&&(a={}),n?a.track=n(t,a.track):delete a.track,h?a.thumb=h(t,a.thumb):delete a.thumb,e.slider=a);var o=new Xf(t,e);return t.add.existing(o),o}(t,e);break;default:s=new Dv(t,e)}return Nu(s,e),t.add.existing(s),s},Wf=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("leftWidth")?i="nineSlice":(e.hasOwnProperty("color")||e.hasOwnProperty("strokeColor"))&&(i="roundRectangle")),i){case"nineSlice":s=e.hasOwnProperty("stretchMode")?new Hu(t,e):new Cu(t,e);break;case"roundRectangle":s=new mc(t,e);break;default:s=new ku(t,e)}return Nu(s,e),t.add.existing(s),s};const Bf=Phaser.Utils.Objects.GetValue;var jf=function(t,e,i){e=e?To(e):{};var s=Bf(i,"background",Vu),r=Bf(i,"text",zf),n=Bf(i,"icon",Wf),h=Bf(i,"action",Wf);return null!==e.background&&s?e.background=s(t,e.background):delete e.background,null!==e.text&&r?e.text=r(t,e.text):delete e.text,null!==e.icon&&n?e.icon=n(t,e.icon):delete e.icon,null!==e.action&&h?e.action=h(t,e.action):delete e.action,e},If=function(t,e,i){void 0===i&&(i={});var s=(e=e?To(e):{}).label||e.button,r=e.button||e.label;delete e.label,delete e.button;var n=i.label||i.button||i,h=i.button||i.label||i,a=jf(t,s,n);a.list=e.list||{},a.list.createButtonCallback=function(t,e){var i=function(t,e,i){var s=new yf(t,e,i);return t.add.existing(s),s}(t,r,h).resetDisplayContent(e);return e.hasOwnProperty("value")&&(i.value=e.value),i};var o=e.track;o&&(a.list.createTrackCallback=function(t){return Vu(t,o)},delete e.track);var l=e.thumb;return l&&(a.list.createThumbCallback=function(t){return Vu(t,l)},delete e.thumb),a.list.onButtonOver=function(t,e,i,s){t.setHoverState&&t.setHoverState(!0)},a.list.onButtonOut=function(t,e,i,s){t.setHoverState&&t.setHoverState(!1)},a};return class extends Mv{constructor(t,e,i){super(t,e=If(t,e,i)),this.type="rexSimpleDropDownList"}setOptions(t){void 0===t&&(t=[]);for(var e=0,i=t.length;eo;d--){for(c=0;c0&&this.wrapMode!==na&&0===this.wrapWidth}setStyle(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wordWrap")){var s=t.wordWrap;s.hasOwnProperty("width")&&(t.wrap={mode:"word",width:s.width})}if(t&&t.hasOwnProperty("wrap")){var r=t.wrap;if(r.hasOwnProperty("mode")){var n=r.mode;"string"==typeof n&&(r.mode=la[n])}else r.hasOwnProperty("width")&&(r.mode=1)}t&&t.rtl&&i&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var h=this.propertyMap;for(var a in h){var o=h[a],l=o[0],d=i?o[1]:this[a],c=o[2];if("wrapCallback"===a||"wrapCallbackScope"===a)this[a]=Nv(t,l,d);else{var u=Gv(t,l,d);c&&(u=c(u)),this[a]=u}}var p=Nv(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var v=Nv(t,"fill",null);null!==v&&(this.color=Ga(v));var g=Nv(t,"metrics",!1);return g?this.metrics={ascent:Nv(g,"ascent",0),descent:Nv(g,"descent",0),fontSize:Nv(g,"fontSize",0)}:!e&&this.metrics||(this.metrics=Hv(this)),e?this.parent.updateText():this.parent}syncFont(t,e){e.font=this._font}syncStyle(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"}syncShadow(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)}update(t){return t&&(this._font=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim(),this.metrics=Hv(this)),this.parent.updateText(t)}buildFont(){var t=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim();return t!==this._font&&(this._font=t),this}setFont(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=Nv(t,"fontFamily","Courier"),this.fontSize=Nv(t,"fontSize","16px"),this.fontStyle=Nv(t,"fontStyle","")),this.update(!0)}setFontFamily(t){return this.fontFamily=t,this.update(!0)}setFontStyle(t){return this.fontStyle=t,this.update(!0)}setFontSize(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}setTestString(t){return this.testString=t,this.update(!0)}setFixedSize(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}setResolution(t){return this.resolution=t,this.update(!1)}setXOffset(t){return this.xOffset=t,this.update(!1)}setBackgroundColor(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=Ga(t,this.parent.canvas,this.parent.context),this.backgroundColor2=Ga(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=Ga(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}setBackgroundCornerRadius(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}setFill(t){return this.color=Ga(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=Ga(t,this.parent.canvas,this.parent.context),this.update(!1)}setStroke(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=Ga(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}setShadow(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===n&&(n=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=Ga(i,this.parent.canvas,this.parent.context),this.shadowBlur=s,this.shadowStroke=r,this.shadowFill=n,this.update(!1)}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}setShadowColor(t){return void 0===t&&(t="#000"),this.shadowColor=Ga(t,this.parent.canvas,this.parent.context),this.update(!1)}setShadowBlur(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}setShadowStroke(t){return this.shadowStroke=t,this.update(!1)}setShadowFill(t){return this.shadowFill=t,this.update(!1)}setUnderline(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=Ga(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}setUnderlineColor(t){return void 0===t&&(t="#000"),this.underlineColor=Ga(t,this.parent.canvas,this.parent.context),this.update(!1)}setUnderlineThickness(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}setUnderlineOffset(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}setStrikethrough(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=Ga(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}setStrikethroughColor(t){return void 0===t&&(t="#000"),this.strikethroughColor=Ga(t,this.parent.canvas,this.parent.context),this.update(!1)}setStrikethroughThickness(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}setStrikethroughOffset(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}setWrapMode(t){return"string"==typeof t&&(t=la[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}setWrapWidth(t){return this.wrapWidth=t,this.update(!1)}setAlign(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}setHAlign(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}setVAlign(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}setMaxLines(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}getTextMetrics(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}setTextMetrics(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=Nv(e,"fontFamily",this.fontFamily),this.fontSize=Nv(e,"fontSize",this.fontSize),this.fontStyle=Nv(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}get lineHeight(){return this.metrics.fontSize+this.parent.lineSpacing}toJSON(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}destroy(){this.parent=void 0}}var Uv={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var h=this.defaultStyle;this.clear(),io(this,h.backgroundColor,h.backgroundStrokeColor,h.backgroundStrokeLineWidth,h.backgroundCornerRadius,h.backgroundColor2,h.backgroundHorizontalGradient,h.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var a,o,l,d,c,u,p=h.halign,v=h.valign,g=h.lineHeight,f=r.lines,m=f.length,y=h.maxLines;y>0&&m>y?(o=y,l="center"===v?Math.floor((m-o)/2):"bottom"===v?m-o:0):(o=m,l=0),d=l+o;var b=this.rtl,x=b?this.parent.width:void 0;u="center"===v?Math.max((s-o*g)/2,0):"bottom"===v?Math.max(s-o*g-2,0):0,u+=e;for(var C=l;C0){var a=this.defaultStyle.metrics,o=i-a.ascent,l=a.fontSize;this.drawRectangle(e,o,t.width,l,h.bgcolor,h)}if(h.underlineThickness>0&&t.width>0){var d=i+h.underlineOffset-h.underlineThickness/2;this.drawLine(e,d,t.width,h.underlineThickness,h.underlineColor,h)}if(t.isTextPen&&(h.buildFont(),h.syncFont(r,n),h.syncStyle(r,n),this.drawText(e,i,t.text,h)),t.isImagePen&&this.drawImage(e,i,t.prop.img,t.prop.color,h),h.strikethroughThickness>0&&t.width>0&&(d=i+h.strikethroughOffset-h.strikethroughThickness/2,this.drawLine(e,d,t.width,h.strikethroughThickness,h.strikethroughColor,h)),n.restore(),t.hasAreaMarker&&t.width>0){var c,u=t.prop.area;if(u)c={key:u};else{var p=t.prop.url;c={key:`url:${p}`,url:p}}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,c)}},clear(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawRectangle(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var h=this.context;h.fillStyle=r,h.fillRect(t,e,i,s)},drawLine(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var h=this.context;n.syncShadow(h,n.shadowStroke);var a=h.lineCap;h.lineCap="butt",h.strokeStyle=r,h.lineWidth=s,h.beginPath(),h.moveTo(t,e),h.lineTo(t+i,e),h.stroke(),h.lineCap=a},drawText(t,e,i,s){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;s.stroke&&"none"!==s.stroke&&s.strokeThickness>0&&(s.syncShadow(r,s.shadowStroke),r.strokeText(i,t,e)),s.color&&"none"!==s.color&&(s.syncShadow(r,s.shadowFill),r.fillText(i,t,e))},drawImage(t,e,i,s,r){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,s,this.autoRound)}};const $v=Phaser.Utils.Objects.GetValue,Jv=ia,Kv=sa;class qv{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=$v(t,"text",""),this.x=$v(t,"x",0),this.y=$v(t,"y",0),this.width=$v(t,"width",0);var e=$v(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=$v(t,"newLineMode",0),this.startIndex=$v(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===Kv&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==Jv&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===Kv&&(t+=1),t}get endIndex(){return this.startIndex+this.rawTextLength}get lastX(){return this.x+this.width}get isTextPen(){return""!==this.text}get isImagePen(){return!!this.prop.img}get hasAreaMarker(){return!!this.prop.area||!!this.prop.url}}const Zv=Phaser.Utils.Objects.GetFastValue,Qv=ia,tg=ra;class eg{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=Zv(t,"tagToText",Wt),this.tagToTextScope=Zv(t,"tagToTextScope",void 0)}destroy(){this.clear(),this.tagToText=void 0,this.tagToTextScope=void 0}clear(){for(var t=0,e=this.lines.length;t=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}getLineEndIndex(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,s=!1;for(e=t;e>=0&&!(s=null!=(i=this.lines[e])&&i.length>0);e--);return s?i[i.length-1].endIndex:0}getLineWidth(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}getMaxLineWidth(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,s=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}getLineWidths(){for(var t=[],e=0,i=this.lines.length;e=t&&o<=e||(h=h.substring(t-a,e-a)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,h,l,d):c+=this.tagToText(h,l,d),d=l,!(o>=e)));u++);return c}get length(){return this.lines.length}set length(t){this.clear()}}var ig={};const sg=Phaser.Geom.Rectangle;var rg=new dl;class ng{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&bg(g)){""!==b?h.push(n.getLine(b,x,ug)):0===C&&r>0&&h.push(n.getLine("",0,ug)),h.push(...mg(g,e,gg,s,0,n));var S=h.pop();b=S.text,x=S.width,n.freeLine(S)," "===b&&(b="",x=0)}else(m=x+f)>o?(h.push(n.getLine(b,x,ug)),b=g,x=f,o=s):(b+=g,x=m),C===w-1&&h.push(n.getLine(b,x,l))}return h},yg=function(t,e){var i;switch(e){case vg:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==Cg&&i0&&t>e&&(t=e),t}get linesWidth(){return Math.ceil(this.penManager.getMaxLineWidth())}get linesHeight(){var t=this.displayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}get imageManager(){return this.parent.imageManager}get rtl(){return this.parent.style.rtl}newPenManager(){return new eg({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}get tmpPenManager(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}getPlainText(t,e,i){var s;if(null==t)s=this.penManager.plainText;else{var r=this.parser.splitText(t,1);s="";for(var n=0,h=r.length;n0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n")}return i}(this.textObject,this.text,this.lines),this.linesCount=this.lines.length,this._textHeight=void 0,this._textVisibleHeight=void 0,this.updateTextObject(),this},updateTextObject:function(){var t=Math.max(Math.floor(Cf.call(this,-this.textOY)),0),e=wf.call(this,t)+this.textOY,i=Sf.call(this,t);return function(t,e){switch(qh(t)){case 0:var i=(r=t.style).wordWrapWidth,s=r.wordWrapCallback;r.wordWrapWidth=0,r.wordWrapCallback=void 0,t.setText(e),r.wordWrapWidth=i,r.wordWrapCallback=s;break;case 1:var r,n=(r=t.style).wrapMode;r.wrapMode=0,t.setText(e),r.wrapMode=n;break;case 2:var h=t._maxWidth;t._maxWidth=0,t.setText(e),t._maxWidth=h}}(this.textObject,i),this.textObject.rexSizer.offsetY=e,Of.call(this),this},preLayout:function(){return this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,Fe.call(this),this},layoutChildren:function(){var t,e,i,s,r,n,h,a=this.left,o=this.top;(t=this.textObject).rexSizer.hidden||(s=a+(i=(e=t.rexSizer).padding).left*this.scaleX,r=o+i.top*this.scaleY,n=this.width*this.scaleX-(i.left+i.right)*this.scaleX,h=this.height*this.scaleY-(i.top+i.bottom)*this.scaleY,Pf.call(this,t,n,h),oe(t,s,r,n,h,e.align),e.preOffsetY=0,Of.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const Tf=Phaser.Utils.Objects.IsPlainObject,Ef=Phaser.Utils.Objects.GetValue,Mf=Phaser.Display.Align.TOP_LEFT;class Rf extends nh{constructor(t,e,i,s,r,n){Tf(e)?(e=Ef(n=e,"x",0),i=Ef(n,"y",0),s=Ef(n,"width",void 0),r=Ef(n,"height",void 0)):Tf(s)&&(s=Ef(n=s,"width",void 0),r=Ef(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexTextBlock",this.textObject=void 0,this.linesCount=0,this.textMask=void 0,this.textObjectType=void 0,this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,this._textObjectRealHeight=0,this.lines=void 0,this.text=Ef(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode(Ef(n,"clampTextOY",!0)),this.alwaysScrollable=Ef(n,"alwaysScrollable",!1);var h=Ef(n,"background",void 0),a=Ef(n,"text",void 0);void 0===a&&(a=Lf(t)),this.textCropEnable=Ef(n,"textCrop",!!a.setCrop);var o=Ef(n,"textMask",!this.textCropEnable);h&&this.addBackground(h),this.add(a),this.sizerChildren=[a];var l=this.getSizerConfig(a);l.align=Mf,l.padding=fe(0),l.expand=!0,this.textObject=a,this.textObjectType=qh(a),l.preOffsetY=0,l.offsetY=0,o&&(this.textMask=Vh.call(this,this.textObject,this)),this.addChildrenMap("background",h),this.addChildrenMap("text",a)}destroy(t){if(this.scene&&!this.ignoreDestroy){if(this.textObject=void 0,this.textMask=void 0,this.lines){switch(this.textObjectType){case 0:case 2:this.lines.length=0;break;case 1:this.lines.destroy()}this.lines=void 0}super.destroy(t)}}setClampMode(t){return void 0===t&&(t=!0),this.clampTextOY=t,this}get textLineHeight(){if(void 0===this._textLineHeight){var t;switch(this.textObjectType){case 0:case 1:var e=this.textObject.style;t=e.metrics.fontSize+e.strokeThickness;break;case 2:var i=this.textObject.fontSize/this.textObject.fontData.size;t=this.textObject.fontData.lineHeight*i}this._textLineHeight=t}return this._textLineHeight}get textLineSpacing(){if(void 0===this._textLineSpacing){var t;switch(this.textObjectType){case 0:case 1:t=this.textObject.lineSpacing;break;case 2:t=0}this._textLineSpacing=t}return this._textLineSpacing}get visibleLinesCount(){return void 0===this._visibleLinesCount&&(this._visibleLinesCount=Math.floor(Cf.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=wf.call(this,this.linesCount)),this._textHeight}get textObjectHeight(){return this._textObjectRealHeight-(this.textLineHeight+this.textLineSpacing)}get textVisibleHeight(){if(void 0===this._textVisibleHeight){var t=this.textHeight-this.textObjectHeight;!this.alwaysScrollable&&t<0&&(t=0),this._textVisibleHeight=t}return this._textVisibleHeight}textOYExceedTop(t){return void 0===t&&(t=this.textOY),t>this.topTextOY}textOYExeceedBottom(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:s?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}setTextOY(t){return this.textOY=t,this}set t(t){this.textOY=-this.textVisibleHeight*t}get t(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t}setTextOYByPercentage(t){return this.t=t,this}}var Lf=function(t){return t.add.text(0,0,"")};Object.assign(Rf.prototype,_f);var Df={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},Yf={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const Xf=Phaser.Utils.Objects.GetValue;class Af extends $p{constructor(t,e){void 0===e&&(e={});var i=Xf(e,"text",void 0),s=Xf(e,"textWidth",void 0),r=Xf(e,"textHeight",void 0),n=Xf(e,"textCrop",!!i.setCrop),h=Xf(e,"textMask",!n),a=Xf(e,"content",""),o=new Rf(t,{width:s,height:r,text:i,textMask:h,textCrop:n&&!h,content:a,clampTextOY:Xf(e,"clampChildOY",!1),alwaysScrollable:Xf(e,"alwaysScrollable",!1)});t.add.existing(o),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textObjectHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.textHeight}})}(o),e.scrollMode=0,e.type="rexTextArea",e.child={gameObject:o,expandWidth:void 0===s,expandHeight:void 0===r};var l=Xf(e,"space",void 0);l&&(l.child=Xf(l,"text",0)),super(t,e),this.addChildrenMap("text",i)}get text(){return this.childrenMap.child.text}get lineHeight(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.textHeight}}Object.assign(Af.prototype,Df,Yf);const zf=Phaser.Utils.Objects.GetValue;var Wf=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("key")&&(i="bitmaptext",e.font=e.key)),i){case"bitmaptext":case"bitmap":s=new yf(t,e);break;case"bbcodetext":case"bbcode":s=new vf(t,0,0,"",e);break;case"label":s=new bf(t,e);break;case"textarea":s=function(t,e,i){e=e?To(e):{};var s=zf(i,"background",Uu),r=zf(i,"text",Wf),n=zf(i,"track",Uu),h=zf(i,"thumb",Uu);s?e.background=s(t,e.background):delete e.background,r?e.text=r(t,e.text):delete e.text;var a=e.slider;!1!==a&&null!==a&&(void 0===a&&(a={}),n?a.track=n(t,a.track):delete a.track,h?a.thumb=h(t,a.thumb):delete a.thumb,e.slider=a);var o=new Af(t,e);return t.add.existing(o),o}(t,e);break;default:s=new Yv(t,e)}return Vu(s,e),t.add.existing(s),s},Bf=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("leftWidth")?i="nineSlice":(e.hasOwnProperty("color")||e.hasOwnProperty("strokeColor"))&&(i="roundRectangle")),i){case"nineSlice":s=e.hasOwnProperty("stretchMode")?new Gu(t,e):new wu(t,e);break;case"roundRectangle":s=new mc(t,e);break;default:s=new Pu(t,e)}return Vu(s,e),t.add.existing(s),s};const jf=Phaser.Utils.Objects.GetValue;var If=function(t,e,i){e=e?To(e):{};var s=jf(i,"background",Uu),r=jf(i,"text",Wf),n=jf(i,"icon",Bf),h=jf(i,"action",Bf);return null!==e.background&&s?e.background=s(t,e.background):delete e.background,null!==e.text&&r?e.text=r(t,e.text):delete e.text,null!==e.icon&&n?e.icon=n(t,e.icon):delete e.icon,null!==e.action&&h?e.action=h(t,e.action):delete e.action,e},Ff=function(t,e,i){void 0===i&&(i={});var s=(e=e?To(e):{}).label||e.button,r=e.button||e.label;delete e.label,delete e.button;var n=i.label||i.button||i,h=i.button||i.label||i,a=If(t,s,n);a.list=e.list||{},a.list.createButtonCallback=function(t,e){var i=function(t,e,i){var s=new bf(t,e,i);return t.add.existing(s),s}(t,r,h).resetDisplayContent(e);return e.hasOwnProperty("value")&&(i.value=e.value),i};var o=e.track;o&&(a.list.createTrackCallback=function(t){return Uu(t,o)},delete e.track);var l=e.thumb;return l&&(a.list.createThumbCallback=function(t){return Uu(t,l)},delete e.thumb),a.list.onButtonOver=function(t,e,i,s){t.setHoverState&&t.setHoverState(!0)},a.list.onButtonOut=function(t,e,i,s){t.setHoverState&&t.setHoverState(!1)},a};return class extends Rv{constructor(t,e,i){super(t,e=Ff(t,e,i)),this.type="rexSimpleDropDownList"}setOptions(t){void 0===t&&(t=[]);for(var e=0,i=t.length;e=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const _=Phaser.Math.DegToRad;var T={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=_(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},k={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=O(t.scaleX,i.scaleX),e.scaleY=O(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},E={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=O(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},L={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},D={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},A={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(t){void 0===t&&(t=!1);var e=this;return this._mask=null,this.setChildMaskVisible(this),this.children.forEach((function(t){t.clearMask&&t.clearMask(!1),t.hasOwnProperty("isRexContainerLite")||e.setChildMaskVisible(t)})),t&&this.mask&&this.mask.destroy(),this}},Y=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},z=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const j=Phaser.Utils.Array;var I={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},ke=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const Ee=/(\S+)\[(\d+)\]/i,Me=Phaser.Utils.Objects.GetValue;var Re=function(t,e){return void 0===e?t:t[e]},Le=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Me(e,"left",0),t.right=Me(e,"right",0),t.top=Me(e,"top",0),t.bottom=Me(e,"bottom",0)),t},De={getInnerPadding(t){return Re(this.space,t)},setInnerPadding(t,e){return Le(this.space,t,e),this},getOuterPadding(t){return Re(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Le(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Re(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Le(this.getSizerConfig(t).padding,e,i),this}},Ae=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Ye=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Xe=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},We=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},ze=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},Fe=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},je={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Ie=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?mi:fi,this.repeatCounter=0,this}stop(){return this.state=gi,this}update(t,e){this.state!==gi&&this.state!==bi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=yi)):(this.nowTime=this.duration,this.state=bi):this.nowTime>=0&&(this.state=mi))}get t(){var t;switch(this.state){case gi:case fi:case yi:t=0;break;case mi:t=this.nowTime/this.duration;break;case bi:t=1}return pi(t,0,1)}set t(t){(t=pi(t,-1,1))<0?(this.state=fi,this.nowTime=-this.delay*t):(this.state=mi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===gi}get isDelay(){return this.state===fi}get isCountDown(){return this.state===mi}get isRunning(){return this.state===fi||this.state===mi}get isDone(){return this.state===bi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const gi=0,fi=1,mi=2,yi=3,bi=-1;class xi extends di{constructor(t,e){super(t,e),this.timer=new vi}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const wi=Phaser.Utils.Objects.GetValue,Si=Phaser.Utils.Objects.GetAdvancedValue,Ci=Phaser.Tweens.Builders.GetEaseFunction;class Oi extends xi{resetFromJSON(t){return this.timer.resetFromJSON(wi(t,"timer")),this.setEnable(wi(t,"enable",!0)),this.setTarget(wi(t,"target",this.parent)),this.setDelay(Si(t,"delay",0)),this.setDuration(Si(t,"duration",1e3)),this.setEase(wi(t,"ease","Linear")),this.setRepeat(wi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Ci(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Pi=Phaser.Utils.Objects.GetValue,_i=Phaser.Utils.Objects.GetAdvancedValue,Ti=Phaser.Math.Linear;let ki=class extends Oi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Pi(t,"mode",0)),this.setScaleRange(_i(t,"start",void 0),_i(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ei[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=_i(t,"x",this.parent.scaleX),this.startY=_i(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=_i(e,"x",void 0),this.endY=_i(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Ti(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Ti(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const Ei={stop:0,destroy:1,yoyo:2};var Mi=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new ki(t,a):r.resetFromJSON(a),r.restart(),r},Ri=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof ki&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new ki(t,h):n.resetFromJSON(h),n.restart(),n},Li=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Di=function(t){return Li(t,"complete")};const Ai=Phaser.Utils.Objects.IsPlainObject;var Yi={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Ai(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Mi(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Di(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Ai(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Ri(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Di(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Di(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Ai(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new ki(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Di(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Xi={};Object.assign(Xi,Yi),Xi.onInitScale=function(){Yi.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=xe.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Wi=Phaser.Utils.Objects.GetValue,zi=Phaser.Utils.Objects.GetAdvancedValue,Fi=Phaser.Math.Linear;class ji extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Wi(t,"mode",0)),this.setAlphaRange(zi(t,"start",this.parent.alpha),zi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ii[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Fi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ii={stop:0,destroy:1,yoyo:2},Bi=Phaser.Utils.Objects.IsPlainObject;var Hi=function(t,e,i,s){var r,n;Bi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new ji(t,h):s.resetFromJSON(h),s.restart(),s},Ni=function(t,e,i,s){i instanceof ji&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new ji(t,r):s.resetFromJSON(r),s.restart(),s};const Gi=Phaser.Utils.Objects.IsPlainObject;var Vi={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Gi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Hi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Di(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Gi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Ni(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Di(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Di(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Ui={};Object.assign(Ui,Vi),Ui.onInitFade=function(){Vi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=xe.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const $i=Phaser.Utils.Objects.GetValue,Ji=Phaser.Utils.Objects.GetAdvancedValue,Ki=Phaser.Math.Linear;class qi extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode($i(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ji(t,"x",void 0),i=Ji(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Zi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Ji(i,"startX",void 0),this.startY=Ji(i,"startY",void 0),this.endX=Ji(i,"endX",void 0),this.endY=Ji(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Ki(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ki(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Zi={stop:0,destroy:1,yoyo:2};var Qi=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const ts=Phaser.Utils.Objects.IsPlainObject,es=Phaser.Math.Distance.Between;var is={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(ts(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*es(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof qi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=Qi(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=Qi(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new qi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Di(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Di(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(ts(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*es(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof qi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=Qi(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=Qi(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new qi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Di(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Di(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},ss={};Object.assign(ss,is),ss.onInitEaseMove=function(){is.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=xe.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const rs=Phaser.Utils.Objects.GetValue;class ns extends ai{constructor(t,e){super(t,e),this.timer=new vi,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(rs(t,"timer")),this.setEnable(rs(t,"enable",!0)),this.setMode(rs(t,"mode",1)),this.isRunning=rs(t,"isRunning",!1),this.setMagnitudeMode(rs(t,"magnitudeMode",1)),this.setAxisMode(rs(t,"axis",0)),this.setDuration(rs(t,"duration",500)),this.setMagnitude(rs(t,"magnitude",10)),this.ox=rs(t,"ox",void 0),this.oy=rs(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=hs[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=os[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=as[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=rs(i,"magnitude",void 0),t=rs(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const hs={effect:0,behavior:1},as={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},os={constant:0,decay:1},ls=Phaser.Utils.Objects.IsPlainObject;var ds={shake(t,e,i){if(ls(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new ns(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Di(this._shake)}};const cs=Phaser.Utils.Objects.GetValue,us=Phaser.Math.Linear;class ps extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=cs(t,"key","value");var i=e[this.propertyKey];return this.fromValue=cs(t,"from",i),this.toValue=cs(t,"to",i),this.setEase(cs(t,"ease",this.ease)),this.setDuration(cs(t,"duration",this.duration)),this.setRepeat(cs(t,"repeat",0)),this.setDelay(cs(t,"delay",0)),this.setRepeatDelay(cs(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=us(this.fromValue,this.toValue,i)}}const vs=Phaser.Utils.Objects.IsPlainObject;class gs extends ii{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new ps(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(vs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(vs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var fs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new gs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Li(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},ms=Phaser.Utils.Array.Remove,ys={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var Ds={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=qe(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},As={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=Wt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=Wt),this.transitOutCallback=t,this}},Ys={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Xs={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Ws={};Object.assign(Ws,Ds,As,Ys,Xs);const zs=Phaser.Utils.Objects.GetValue;class Fs extends ii{constructor(t,e){super(t,e),this.setTransitInTime(zs(e,"duration.in",200)),this.setTransitOutTime(zs(e,"duration.out",200)),this.setTransitInCallback(zs(e,"transitIn")),this.setTransitOutCallback(zs(e,"transitOut")),this.oneShotMode=zs(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Ls(this,{eventEmitter:!1,initState:zs(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Fs.prototype,Ws);var js=function(t){if(t.parentContainer)return js(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?js(e):t};class Is extends ii{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=js(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Bs=Phaser.GameObjects.Rectangle;class Hs extends Bs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Is(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Ns=Phaser.Utils.Objects.GetValue;class Gs extends ii{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Ns(t,"hitAreaMode",0)),this.setEnable(Ns(t,"enable",!0)),this.setStopMode(Ns(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Vs[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Vs={default:0,fullWindow:1};const Us=Phaser.Utils.Objects.GetValue;class $s extends Hs{constructor(t,e){super(t,Us(e,"color",0),Us(e,"alpha",.8)),this.touchEventStop=new Gs(this,{hitAreaMode:1})}}var Js={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Mi(t,e)},scaleDown(t,e){Ri(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Hi(t,e)},fadeOut(t,e){Ni(t,e,!1)}},Ks=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Hi(t,e,t.alpha)},qs=function(t,e){Ni(t,e,!1)},Zs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!nt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Qs=Phaser.Utils.Objects.GetValue;let tr=class extends Fs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=er.popUp),null==e.transitOut&&(e.transitOut=er.scaleDown),e.destroy=Qs(e,"destroy",!0),super(t,e);var i=Qs(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new $s(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Qs(i,"transitIn",Ks)),this.setCoverTransitOutCallback(Qs(i,"transitOut",qs)));var s=Qs(e,"touchOutsideClose",!1),r=Qs(e,"duration.hold",-1),n=Qs(e,"timeOutClose",r>=0),h=Qs(e,"anyTouchClose",!1);Qs(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Qs(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Zs(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=er[t]),t){case er.popUp:t=Js.popUp;break;case er.fadeIn:t=Js.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=er[t]),t){case er.scaleDown:t=Js.scaleDown;break;case er.fadeOut:t=Js.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const er={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var ir=function(t){return t&&"function"==typeof t},sr={modal(t,e){return ir(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new tr(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},rr=function(t,e,i,s,r){ir(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},nr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return rr.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return rr.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return rr.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return rr.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return rr.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return rr.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return rr.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return rr.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return rr.call(this,"shutdown",t,e,i,s),this}},hr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=ar),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},ar={},or=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?Zs(t,e.x,e.y,i,s):!!(r=hr(e,n,!0))&&Zs(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const br={press:0,pointerdown:0,release:1,pointerup:1};var xr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new yr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},wr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!Sr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return Cr.length=0,!0;return Cr.length=0,!1},Cr=[];const Or=Phaser.Utils.Objects.GetValue;class Pr extends ii{constructor(t,e){super(t,e),this._enable=void 0;var i=Or(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Or(t,"enable",!0)),this.setMode(Or(t,"mode",1)),this.setClickInterval(Or(t,"clickInterval",100)),this.setDragThreshold(Or(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=_r[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?wr:or)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const _r={press:0,pointerdown:0,release:1,pointerup:1};var Tr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Pr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class kr extends Rs{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Er=Phaser.Utils.Objects.GetValue;class Mr extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new kr,this.parent.setInteractive(Er(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Er(t,"enable",!0)),this.setCooldown(Er(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Rr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&or(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Mr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Mr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Lr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Dr=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Jr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Kr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Jr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=qr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&or(t,s,e,i)}}const Jr=0,Kr=1,qr="IDLE",Zr=Phaser.Utils.Objects.GetValue,Qr=Phaser.Math.Distance.Between;class tn extends $r{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=en},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Zr(t,"time",250)),this.setTapInterval(Zr(t,"tapInterval",200)),this.setDragThreshold(Zr(t,"threshold",9)),this.setTapOffset(Zr(t,"tapOffset",10));var e=Zr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Zr(t,"maxTaps",void 0)),this.setMinTaps(Zr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case en:this.state=sn;break;case sn:var t=this.lastPointer;Qr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=rn,this.state=sn);break;case rn:this.state=sn}}onDragEnd(){this.state===sn&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=rn))}onDrag(){this.state!==en&&this.pointer.getDistance()>this.dragThreshold&&(this.state=en)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===sn){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=en):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=rn:this.state=en)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===rn&&(this.state=en)}get isTapped(){return this.state===rn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const en="IDLE",sn="BEGIN",rn="RECOGNIZED",nn=Phaser.Utils.Objects.GetValue;class hn extends $r{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=an},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(nn(t,"threshold",9)),this.setHoldTime(nn(t,"time",251)),this}onDragStart(){this.state=on,0===this.holdTime&&(this.state=ln)}onDragEnd(){this.state=an}onDrag(){this.state!==an&&this.pointer.getDistance()>this.dragThreshold&&(this.state=an)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===on&&t-this.pointer.downTime>=this.holdTime&&(this.state=ln)}get isPressed(){return this.state===ln}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const an="IDLE",on="BEGIN",ln="RECOGNIZED";Phaser.Utils.Objects.GetValue;var dn=function(t){return ti(t).loop.delta};const cn=Phaser.Math.Distance.Between,un=Phaser.Math.Angle.Between;var pn={getDt:function(){return dn(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return cn(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return un(e.x,e.y,t.x,t.y)}},vn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},gn={};const fn=Phaser.Utils.Objects.GetValue,mn=Phaser.Math.RadToDeg;class yn extends $r{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=bn},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(fn(t,"threshold",10)),this.setVelocityThreshold(fn(t,"velocityThreshold",1e3)),this.setDirectionMode(fn(t,"dir","8dir")),this}onDragStart(){this.state=xn}onDragEnd(){this.state=bn}onDrag(){this.state===xn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=wn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===wn&&(this.state=bn)}get isSwiped(){return this.state===wn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=vn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=gn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(mn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(yn.prototype,pn);const bn="IDLE",xn="BEGIN",wn="RECOGNIZED",Sn=Phaser.Utils.Objects.GetValue,Cn=Phaser.Utils.Array.SpliceOne,On=Phaser.Math.Distance.Between,Pn=Phaser.Math.Angle.Between;class _n{constructor(t,e){var i=qe(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(Sn(e,"inputConfig",void 0)),this.setEventEmitter(Sn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(Sn(t,"enable",!0)),this.bounds=Sn(t,"bounds",void 0),this.tracerState=kn,this.pointers.length=0,ft(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,ft(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case kn:this.tracerState=En,this.onDrag1Start();break;case En:this.tracerState=Mn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],Cn(this.pointers,e),this.tracerState){case En:this.tracerState=kn,this.onDrag1End();break;case Mn:this.tracerState=En,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case En:this.onDrag1();break;case Mn:this.onDrag2()}}}dragCancel(){return this.tracerState===Mn&&this.onDrag2End(),this.pointers.length=0,ft(this.movedState),this.tracerState=kn,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0],e=this.pointers[1];return On(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0],e=this.pointers[1];return Pn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Tn.x=e.x-i.x,Tn.y=e.y-i.y}else Tn.x=0,Tn.y=0;return Tn}get centerX(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Mn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Mn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Rn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&or(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&or(t,s,e,i)}}Object.assign(_n.prototype,$e);var Tn={};const kn=0,En=1,Mn=2,Rn="IDLE";Phaser.Utils.Objects.GetValue;const Ln=Phaser.Math.RotateAround;var Dn=function(t,e,i,s){return Ln(t,e,i,s),t.rotation+=s,t},An={};const Yn=Phaser.Utils.Objects.GetValue,Xn=Phaser.Math.Angle.WrapDegrees,Wn=Phaser.Math.Angle.ShortestBetween,zn=Phaser.Math.RadToDeg,Fn=Phaser.Math.DegToRad;var jn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=An),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Xn(zn(this.angleBetween));this.angle=Wn(this.prevAngle,t),this.prevAngle=t,this.state=Hn}break;case Hn:t=Xn(zn(this.angleBetween)),this.angle=Wn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Hn}get rotation(){return Fn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,jn);const In="IDLE",Bn="BEGIN",Hn="RECOGNIZED",Nn=Phaser.Utils.Objects.GetValue;var Gn=function(t){var e=Nn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new tn(this,e),this._tap.on("tap",(function(t,e,s){Ar(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Ar(i.eventEmitter,`${i.eventNamePrefix}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Vn=Phaser.Utils.Objects.GetValue;var Un=function(t){var e=Vn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new hn(this,e),this._press.on("pressstart",(function(t,e,s){Ar(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this).on("pressend",(function(t,e,s){Ar(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const $n=Phaser.Utils.Objects.GetValue;var Jn=function(t){var e=$n(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new yn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Ar(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Ar(i.eventEmitter,`${i.eventNamePrefix}swipe`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Kn=Phaser.Utils.Objects.GetValue;var qn=function(t,e){return t.setInteractive(),Kn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Kn(e,"targets",[t]),targetMode:Kn(e,"targetMode","parent"),eventEmitter:Kn(e,"eventEmitter",t),eventNamePrefix:Kn(e,"inputEventPrefix","child.")},Xr.call(t,e),Fr.call(t,e),Br.call(t,e),Vr.call(t,e),Gn.call(t,e),Un.call(t,e),Jn.call(t,e),t},Zn={getSizerConfig:function(t){return void 0===t&&(t=this),Mt(t)},getChildPrevState:function(t){var e=Mt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Dt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=oe(e,"color"),s=oe(e,"lineWidth");var o=oe(e,"name",!1);o&&(r=oe(o,"createTextCallback",ce),n=oe(o,"createTextCallbackScope",void 0),"string"==typeof(h=oe(o,"align","left-top"))&&(h=Xt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new le(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}var d,c,u=this.getAllShownChildren([this]);ue(u,u);for(var p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const ah=Phaser.Utils.Objects.IsPlainObject,oh=Phaser.Utils.Objects.GetValue,lh=Phaser.Display.Align.CENTER,dh={min:0,full:-1};var ch=function(t,e,i,s,r,n,h,a,o,l){var d,c,u,p;me.call(this,t);var v=t.isRexSpace,g=typeof e;if(null===e)return this;if("number"===g);else if("string"===g)e=dh[e];else if(ah(e)){var f;e=oh(f=e,"proportion",void 0),i=oh(f,"align",lh),s=oh(f,"padding",0),r=oh(f,"expand",!1),n=oh(f,"key",void 0),h=oh(f,"index",void 0),t.isRexSizer||(a=oh(f,"minWidth",void 0),o=oh(f,"minHeight",void 0)),l=oh(f,"fitRatio",0),d=oh(f,"offsetX",0),c=oh(f,"offsetY",0),u=oh(f,"offsetOriginX",0),p=oh(f,"offsetOriginY",0)}return"string"==typeof i&&(i=Xt[i]),void 0===e&&(e=v?1:0),void 0===i&&(i=lh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(v?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(v?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),(f=this.getSizerConfig(t)).proportion=e,f.align=i,f.padding=ge(s),f.expand=r,f.fitRatio=0===e?l:0,f.alignOffsetX=d,f.alignOffsetY=c,f.alignOffsetOriginX=u,f.alignOffsetOriginY=p,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},uh={add:ch,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),ch.call(this,new nh(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return ah(i)&&(i.index=t),ch.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=hh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const ph=Et.prototype.clear;var vh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),ph.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,vh.call(this,t),this}},mh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=Xt[e]),this.getSizerConfig(t).align=e,this}},yh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},bh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},xh={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},wh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Ne(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Ie.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d,c,u=this.sizerChildren,p=this.innerLeft,v=this.innerTop,g=this.innerWidth,f=this.innerHeight,m=p,y=v,b=this.startChildIndex,x=0,w=u.length;x0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=We.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Ye.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&sh.call(this,t,void 0),Xe.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||ze.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&sh.call(this,void 0,t),Fe.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(wh,uh,fh,mh,yh,bh,xh);var Sh=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},Ch={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const Oh=Phaser.Utils.Objects.IsPlainObject,Ph=Phaser.Utils.Objects.GetValue;class _h extends th{constructor(t,e,i,s,r,n,h){Oh(e)?(e=Ph(h=e,"x",0),i=Ph(h,"y",0),s=Ph(h,"width",void 0),r=Ph(h,"height",void 0),n=Ph(h,"orientation",0)):Oh(s)?(s=Ph(h=s,"width",void 0),r=Ph(h,"height",void 0),n=Ph(h,"orientation",0)):Oh(n)&&(n=Ph(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Ph(h,"space.item",0)),this.setStartChildIndex(Ph(h,"startChildIndex",0)),this.setRTL(Ph(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=Ch[t]),t}(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=Sh.call(this)),this._childrenProportion}}Object.assign(_h.prototype,wh);var Th=function(t,e,i){if(t){var s=null==e,r=null==i;return s&&r||(s||(t.displayWidth=e),r||(t.displayHeight=i),s&&(t.scaleX=t.scaleY),r&&(t.scaleY=t.scaleX)),t}},kh=function(t,e){var i;return t||0===t||(t=""),void 0===e&&(e=!0),Array.isArray(t)&&(t=t.join("\n")),(i=e?`${this.text}\n${t}`:`${this.text}${t}`)!=this.text&&this.setText(i),this},Eh={appendText:kh,resetDisplayContent:function(t){void 0===t?t={}:"string"==typeof t&&(t={text:t});var e=t.text||"";this.setText(e);var i=this.childrenMap.icon;if(i){t.icon?this.show(i):this.hide(i);var s=t.iconSize;s&&(this.setChildDisplaySize(i,s,s),void 0!==this.iconWidth&&this.setIconSize(s)),!0!==t.icon&&this.setIconTexture(t.icon,t.iconFrame)}var r=this.childrenMap.action;if(r){t.action?this.show(r):this.hide(r);var n=t.actionSize;n&&(this.setChildDisplaySize(r,n,n),void 0!==this.actionWidth&&this.setActionSize(n)),!0!==t.action&&this.setActionTexture(t.action,t.actionFrame)}return this}};class Mh extends _h{get text(){var t=this.childrenMap.text;return t?t.text:""}set text(t){var e=this.childrenMap.text;e&&e.setText(t)}setText(t){return this.text=t,this}setIconTexture(t,e){var i=this.childrenMap.icon;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.iconWidth&&void 0!==this.iconHeight&&(Th(i,this.iconWidth,this.iconHeight),this.resetChildScaleState(i)),this):this}setTexture(t,e){return this.setIconTexture(t,e),this}setIconSize(t,e){return void 0===e&&(e=t),this.iconWidth=t,this.iconHeight=e,this}get texture(){var t=this.childrenMap.icon;if(t)return t.texture}get frame(){var t=this.childrenMap.icon;if(t)return t.frame}setActionTexture(t,e){var i=this.childrenMap.action;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.actionWidth&&void 0!==this.actionHeight&&(Th(i,this.actionWidth,this.actionHeight),this.resetChildScaleState(i)),this):this}get actionTexture(){var t=this.childrenMap.action;if(t)return t.texture}get actionFrame(){var t=this.childrenMap.action;if(t)return t.frame}setActionSize(t,e){return void 0===e&&(e=t),this.actionWidth=t,this.actionHeight=e,this}preLayout(){var t=this.childrenMap.icon;t&&void 0!==this.iconWidth&&void 0!==this.iconHeight&&Th(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&Th(e,this.actionWidth,this.actionHeight),super.preLayout()}postLayout(t,e,i){var s=this.childrenMap.iconMask;s&&(s.setPosition(),this.resetChildPositionState(s));var r=this.childrenMap.actionMask;return r&&(r.setPosition(),this.resetChildPositionState(r)),super.postLayout(t,e,i),this}resize(t,e){super.resize(t,e);var i=this.childrenMap.iconMask;i&&i.resize();var s=this.childrenMap.actionMask;return s&&s.resize(),this}}Object.assign(Mh.prototype,Eh);const Rh=Phaser.GameObjects.Graphics.prototype.setPosition,Lh=Phaser.Geom.Rectangle,Dh=Phaser.Geom.Circle;var Ah=function(t,e,i,s,r){this.geom=function(t,e,i,s,r,n,h){if(1===t){s=s.left;var a=-e*(r-.5),o=-i*(n-.5),l=Math.min(e,i)/2+s;void 0!==h&&h instanceof Dh||(h=new Dh),h.setTo(a,o,l)}else{var d=-e*r-s.left,c=-i*n-s.top,u=e+s.left+s.right,p=i+s.top+s.bottom;void 0!==h&&h instanceof Lh||(h=new Lh),h.setTo(d,c,u,p)}return h}(this.shapeType,t,e,i,s,r,this.geom),this.clear().fillStyle(16777215),1===this.shapeType?this.fillCircleShape(this.geom):this.fillRectShape(this.geom)},Yh=function(t,e){for(var i in t){if(!(i in e))return!1;if(t[i]!==e[i])return!1}for(var i in e)if(!(i in t))return!1;return!0},Xh={setPosition:function(t,e){var i=this.parent;return void 0===t&&(t=i.x),void 0===e&&(e=i.y),Rh.call(this,t,e),this},resize:function(t,e,i){var s=this.parent;void 0===t&&(t=s.width),void 0===e&&(e=s.height),void 0===i?i=this.padding:"number"==typeof i&&(i=GetBoundsConfig(i));var r=this.width!==t||this.height!==e,n=this.padding!==i&&!Yh(this.padding,i);return r||n?(this.width=t,this.height=e,n&&mt(i,this.padding),this.originX=s.originX,this.originY=s.originY,Ah.call(this,t,e,i,s.originX,s.originY),this):this},setOrigin:function(t,e){void 0===e&&(e=t);var i=this.parent;return void 0===t&&(t=i.originX),void 0===e&&(e=i.originY),this.originX===t&&this.originY===e||(this.originX=t,this.originY=e,Ah.call(this,this.width,this.height,this.padding,t,e)),this},contains:function(t,e){return t-=this.x,e-=this.y,this.geom.contains(t,e)}};const Wh=Phaser.GameObjects.Graphics;class zh extends Wh{constructor(t,e,i){void 0===e&&(e=0),"string"==typeof e&&(e=Fh[e]),super(t.scene),this.parent=t,this.shapeType=e,this.padding=ge(i),this.setPosition().resize().setVisible(!1)}destroy(){return this.parent=void 0,super.destroy(),this}}const Fh={rectangle:0,circle:1};Object.assign(zh.prototype,Xh);var jh=function(t,e,i,s){var r=new zh(e,i,s);if(t&&!t.isRexSizer){var n=r.createGeometryMask();t.setMask(n),this.once("destroy",(function(){t.setMask(),n.destroy()}))}return this.pin(r),r};const Ih=Phaser.GameObjects.Text;var Bh=function(t){return t instanceof Ih};const Hh=Phaser.GameObjects.BitmapText;var Nh=function(t){return t instanceof Hh},Gh=function(t){return Nh(t)?2:Bh(t)?0:1},Vh=/^[\x00-\x7F]+$/,Uh=function(t){return Vh.test(t)},$h=function(t,e){for(var i=[],s=t.split("\n"),r=e.style,n=r.wordWrapWidth,h=r.hasOwnProperty("wrapMode")?r.wrapMode:3,a=e.context,o=0,l=s.length;o0&&r.push(o.join("")),r},Kh=0,qh=1,Zh=2,Qh=0,ta=1,ea=2,ia=/(?:\r\n|\r|\n)/;const sa={none:Qh,word:ta,char:ea,character:ea,mix:3},ra=Phaser.Renderer.WebGL.Utils;var na={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,h=r.height,a=ra.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,h,e.x,e.y,n/e.resolution,h/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,h,a(e.tintTopLeft,i.alpha*e._alphaTL),a(e.tintTopRight,i.alpha*e._alphaTR),a(e.tintBottomLeft,i.alpha*e._alphaBL),a(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const ha=Phaser.Display.Color;var aa={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,h,a,o,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===h&&(h=0),void 0===a&&(a=0),void 0===o&&(o=c),void 0===l&&(l=u);var p=d.cutX+h,v=d.cutY+a;return this.context.drawImage(d.source.image,p,v,o,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new ha);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var h=i;i=h.red,s=h.green,r=h.blue,n=h.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var a=this.context.createImageData(1,1);return a.data[0]=i,a.data[1]=s,a.data[2]=r,a.data[3]=n,this.context.putImageData(a,t,e),this.dirty=!0,this}},oa=function(t,e,i,s,r,n,h){var a,o=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===h&&(h=e.height);var d=(a=o.exists(i)?o.get(i):o.createCanvas(i,n,h)).getSourceImage();d.width!==n&&(d.width=n),d.height!==h&&(d.height=h);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,h),c.drawImage(e,s,r,n,h),l.gl&&a&&l.canvasToTexture(d,a.source[0].glTexture,!0,0)},la={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,oa(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};e();const da=Phaser.Display.Canvas.CanvasPool,ca=Phaser.GameObjects.GameObject,ua=Phaser.Utils.String.UUID;class pa extends ca{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=da.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=ua(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){da.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}}const va=Phaser.GameObjects.Components;Phaser.Class.mixin(pa,[va.Alpha,va.BlendMode,va.Crop,va.Depth,va.Flip,va.GetBounds,va.Mask,va.Origin,va.Pipeline,va.PostPipeline,va.ScrollFactor,va.Tint,va.Transform,va.Visible,na,aa,la]);var ga={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:_s(this.data,t,e)},incData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)+e),this},mulData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)*e),this},clearData(){return this.data&&ft(this.data),this}};class fa{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}}Object.assign(fa.prototype,ga);var ma={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const ya=Phaser.Math.RotateAround;var ba;const xa=Phaser.Geom.Rectangle;var wa,Sa=function(t){void 0===wa&&(wa=new xa);var e=t.drawTLX,i=t.drawTLY;return wa.setTo(e,i,t.drawTRX-e,t.drawBLY-i),wa};const Ca=Phaser.Math.RotateAround;var Oa,Pa=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Oa&&(Oa={}),s=Oa),s.x=e,s.y=i,0!==t.rotation&&Ca(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const _a=Phaser.GameObjects.Components.TransformMatrix;var Ta,ka,Ea={},Ma=function(t,e,i,s,r){var n=Pa(e,i,s,!0),h=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=Ea);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===Ta&&(Ta=new _a,ka=new _a),t.parentContainer?t.getWorldTransformMatrix(Ta,ka):Ta.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),Ta.transformPoint(r,n,s),s}(t,n.x,n.y,r);return h},Ra=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,h=e.drawCenterY+s;return Ma(t,e,n,h,r)},La={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===ba&&(ba={}),s=ba),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&ya(s,0,0,-i.rotation),s}(t,e,this,!0);return Sa(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return Ra(this.parent,this,t,e,i)}};Object.assign(La,ma);const Da=Phaser.Math.DegToRad,Aa=Phaser.Math.RadToDeg,Ya=Phaser.Utils.Objects.GetValue;class Xa extends fa{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return Aa(this._rotation)}set angle(t){this.rotation=Da(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=Ya(t,"width",void 0),i=Ya(t,"height",void 0),s=Ya(t,"scaleX",void 0),r=Ya(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(Xa.prototype,La);const Wa=Phaser.Utils.String.Pad;var za=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${Wa(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},Fa=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const ja=Phaser.Utils.Objects.GetValue;let Ia=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=ja(t,"x",0),i=ja(t,"y",0));var s=this.cornerRadius;s.tl=Ba(ja(t,"tl",void 0),e,i),s.tr=Ba(ja(t,"tr",void 0),e,i),s.bl=Ba(ja(t,"bl",void 0),e,i),s.br=Ba(ja(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Ha(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Ha(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Ha(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Ha(this.cornerRadius.br,t)}};var Ba=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Na(t),t},Ha=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=ja(e,"x",0),t.y=ja(e,"y",0)),Na(t)},Na=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const Ga=Phaser.Math.DegToRad;var Va=function(t){return!t.hasOwnProperty("convex")||t.convex},Ua=function(t){return t.x>0&&t.y>0},$a=function(t,e,i,s,r,n,h,a,o){if(a&&h>n?h-=360:!a&&h=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=m.tl,Ua(a)?(o=a.x*g,l=a.y*f,Va(a)?$a(t,o,l,o,l,180,270,!1,h):$a(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,Ua(a)?(o=a.x*g,l=a.y*f,Va(a)?$a(t,s-o,l,o,l,270,360,!1,h):$a(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,Ua(a)?(o=a.x*g,l=a.y*f,Va(a)?$a(t,s-o,r-l,o,l,0,90,!1,h):$a(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,Ua(a)?(o=a.x*g,l=a.y*f,Va(a)?$a(t,o,r-l,o,l,90,180,!1,h):$a(t,0,r,o,l,360,270,!0,h)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,h,u),null!=a)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,a),p.addColorStop(1,d),a=p),e.fillStyle=a,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())},Ka=function(t,e,i,s,r,n,h,a){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),Ja(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}};const qa=Phaser.Utils.Objects.GetValue;class Za extends Xa{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(qa(e,"color",null),qa(e,"color2",null),qa(e,"horizontalGradient",!0)),this.setStroke(qa(e,"stroke",null),qa(e,"strokeThickness",2)),this.setCornerRadius(qa(e,"cornerRadius",0),qa(e,"cornerIteration",null))}set color(t){t=za(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=za(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=za(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,Fa("color2",t,this),Fa("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Fa("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Fa("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){Ka(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Qa=Phaser.Utils.Objects.GetValue;class to extends Xa{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(Qa(e,"color",null),Qa(e,"color2",null),Qa(e,"horizontalGradient",!0)),this.setStroke(Qa(e,"stroke",null),Qa(e,"strokeThickness",2))}set color(t){t=za(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=za(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=za(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,Qa(t,"color2",null),Qa(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Qa(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,h=this.parent.height-i.top-i.bottom,a=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?a.createLinearGradient(0,0,n,0):a.createLinearGradient(0,0,0,h)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,a.fillStyle=t,a.fillRect(s,r,n,h));null!=this.stroke&&this.strokeThickness>0&&(a.strokeStyle=this.stroke,a.lineWidth=this.strokeThickness,a.strokeRect(s,r,n,h))}}const eo=Phaser.Utils.Objects.GetValue;let io=class t{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(eo(t,"bold",!1)),this.setItalic(eo(t,"italic",!1)),this.setFontSize(eo(t,"fontSize","16px")),this.setFontFamily(eo(t,"fontFamily","Courier")),this.setColor(eo(t,"color","#fff")),this.setStrokeStyle(eo(t,"stroke",null),eo(t,"strokeThickness",0)),this.setShadow(eo(t,"shadowColor",null),eo(t,"shadowOffsetX",0),eo(t,"shadowOffsetY",0),eo(t,"shadowBlur",0)),this.setOffset(eo(t,"offsetX",0),eo(t,"offsetY",0)),this.setSpace(eo(t,"leftSpace",0),eo(t,"rightSpace",0)),this.setAlign(eo(t,"align",void 0)),this.setBackgroundColor(eo(t,"backgroundColor",null)),this.setBackgroundHeight(eo(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(eo(t,"backgroundBottomY",void 0)),this.setBackgroundLeftX(eo(t,"backgroundLeftX",0)),this.setBackgroundRightX(eo(t,"backgroundRightX",0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(Fa("stroke",t,this),Fa("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Fa("shadowOffsetX",t,this),Fa("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),t.hasOwnProperty("backgroundLeftX")&&this.setBackgroundLeftX(t.backgroundLeftX),t.hasOwnProperty("backgroundRightX")&&this.setBackgroundRightX(t.backgroundRightX),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new t(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=za(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=za(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=za(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=za(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setBackgroundLeftX(t){return this.backgroundLeftX=t,this}setBackgroundRightX(t){return this.backgroundRightX=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}};const so=Phaser.Utils.Array.Remove,ro=Phaser.Utils.Array.Remove,no="text",ho="image",ao="drawer",oo="space",lo="command";var co=function(t){return t.type===no&&"\n"===t.text},uo=function(t){return t.type===no&&"\f"===t.text},po=function(t){return t.type===no};class vo extends Xa{constructor(t,e,i){super(t,no),this.updateTextFlag=!1,this.style=new io(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX+e.backgroundLeftX,s=i,r=this.drawTRX+e.backgroundRightX-i+1;if(r>0){var n=e.backgroundBottomY;null==n&&(n=this.drawBLY);var h=e.backgroundHeight;null==h&&(h=n-this.drawTLY);var a=n-h;t.fillRect(s,a,r,h)}}var o=e.hasFill,l=e.hasStroke;(o||l)&&(e.syncFont(t).syncStyle(t),l&&(e.syncShadow(t),t.strokeText(this.text,0,0)),o&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var go=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const fo=Phaser.Display.Canvas.CanvasPool;var mo=function(t,e,i,s,r,n,h,a){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===a&&(a=!1),a&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(h){var l=fo.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=h,d.fillRect(0,0,r,n),o.drawImage(l,0,0,r,n,i,s,r,n),fo.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)};Phaser.Display.Canvas.CanvasPool;class yo extends Xa{constructor(t,e,i){super(t,ho),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){mo(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class bo extends Xa{constructor(t,e,i,s){super(t,ao),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class xo extends Xa{constructor(t,e){super(t,oo),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class wo extends fa{constructor(t,e,i,s,r){super(t,lo),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}function So(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>So(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=So(t[i]));return e}var Co=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const Oo={none:0,word:1,char:2,character:2,mix:3};var Po=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,h=!r&&!n,a=t.length,o=e,l=s.word,d=0,c=!1;o0&&!a){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=Eo.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=Eo.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=Ro(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=Ro(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=Ro(t,"wrapMode");void 0===c&&(c=Ro(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=Oo[c]);var u=Ro(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=Ro(t,"letterSpacing",0),v=Ro(t,"hAlign",0),g=Ro(t,"vAlign",0),f=Ro(t,"justifyPercentage",.25),m=Co({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:h,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,b=0,x=y.length;b0&&(E.push({children:M,width:R}),L=Math.max(L,R)),m.start+=k.length,m.isLastPage=!D&&m.start===T,m.maxLineWidth=L,m.linesHeight=E.length*n;var j=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,I=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,h=t.vAlign,a=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(h=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=Ao(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=Ao(t,"maxLines",0);var a=0===i,o=Ao(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=Ao(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=Ao(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=Ao(t,"letterSpacing",0),p=Ao(t,"rtl",!0),v=Ao(t,"hAlign",p?2:0),g=Ao(t,"vAlign",0),f=Co({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:o,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(k.push({children:E,height:M}),R=Math.max(R,M)),f.start+=T.length,f.isLastPage=f.start===_,f.maxLineHeight=R,f.linesWidth=k.length*n;var W=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,z=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,h=t.vAlign,a=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}a&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,h=i.bottom;return Le(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return Re(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),so(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return ro(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(no);return null===i?i=new vo(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),Ra(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const nl=Phaser.Utils.Objects.GetFastValue;var hl={};class al{constructor(t){this.pools=nl(t,"pools",hl)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new rl),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;ei&&(r=Math.floor(i));for(var n={},h=gl(t,r,e,i,n),a=0;a<=ul&&0!==h;a++){if((r+=h)<0){r=0;break}h=gl(t,r,e,i,n)}return a===ul&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),fl(t,e,i),t},vl=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},gl=function(t,e,i,s,r){var n,h=vl(t,e,r),a=vl(t,e+1,r);if(void 0!==s)if(h.height<=s&&a.height>s)n=0;else{if(h.height>s)return-1;n=Math.floor(s-h.height)}if(h.width<=i&&a.width>i)return 0;if(h.width>i)return-1;var o=Math.floor(i-h.width);return void 0===n?o:Math.min(o,n)},fl=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const ml=Phaser.Utils.Objects.GetValue,yl=Phaser.Utils.Objects.GetValue;class bl extends Mh{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=yl(e,"background",void 0),r=yl(e,"icon",void 0),n=yl(e,"iconMask",void 0),h=yl(e,"text",void 0),a=yl(e,"action",void 0),o=yl(e,"actionMask",void 0),l=yl(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(h||a)&&(i={right:yl(e,"space.icon",0),top:yl(e,"space.iconTop",0),bottom:yl(e,"space.iconBottom",0),left:yl(e,"space.iconLeft",0)}):(h||a)&&(i={bottom:yl(e,"space.icon",0),left:yl(e,"space.iconLeft",0),right:yl(e,"space.iconRight",0),top:yl(e,"space.iconTop",0)});var d=yl(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=jh.call(this,r,r,1)),!d){var c=yl(e,"iconSize",void 0);this.setIconSize(yl(e,"iconWidth",c),yl(e,"iconHeight",c))}}if(h){var u=yl(e,"wrapText",!1),p=yl(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),function(t,e){switch(Gh(t)){case 0:switch("string"==typeof e&&(e=sa[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=$h;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=sa[e]||0),t.style.wrapMode=e}}(h,u),e.expandTextWidth=!0,cl(h)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=ml(e,"minWidth",0),s=ml(e,"minHeight",0),r=ml(e,"fitHeight",!1);t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return pl(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),pl(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t})}(h,{fitHeight:!0}));var v,g,f=yl(e,"space.text",0),m=yl(e,"expandTextWidth",!1),y=yl(e,"expandTextHeight",!1);0===this.orientation?(v=m?1:0,a&&(i={right:f}),g=y):(v=y?1:0,a&&(i={bottom:f}),g=m),this.add(h,{proportion:v,expand:g,padding:i})}if(a&&(i=0===this.orientation?{top:yl(e,"space.actionTop",0),bottom:yl(e,"space.actionBottom",0),right:yl(e,"space.actionRight",0)}:{left:yl(e,"space.actionLeft",0),right:yl(e,"space.actionRight",0),bottom:yl(e,"space.actionBottom",0)},d=yl(e,"squareFitAction",!1)?1:0,this.add(a,{proportion:0,padding:i,fitRatio:d}),o&&(o=jh.call(this,a,a,1)),!d)){var b=yl(e,"actionSize");this.setActionSize(yl(e,"actionWidth",b),yl(e,"actionHeight",b))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",h),this.addChildrenMap("action",a),this.addChildrenMap("actionMask",o)}}var xl=Phaser.Renderer.WebGL.Utils,wl=function(t,e,i,s,r,n){for(var h=xl.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),a=i.pathData,o=i.pathIndexes,l=0;l>>16,a=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+h+","+a+","+o+","+n+")"},_l=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,h=(16711680&r)>>>16,a=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+h+","+a+","+o+","+n+")",t.lineWidth=e.lineWidth};const Tl=Phaser.Renderer.Canvas.SetTransform;var kl={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Ol(e,i,s),h=r.calcMatrix.copyFrom(n.calc),a=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&wl(r,h,e,l,a,o),e.isStroked&&Cl(r,e,l,a,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(Tl(t,r,e,i,s)){var n=e._displayOriginX,h=e._displayOriginY,a=e.pathData,o=a.length-1,l=a[0]-n,d=a[1]-h;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(Ml.prototype,kl);var Rl=function(t){return t.x>0&&t.y>0},Ll=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const Dl=Phaser.Math.DegToRad;var Al=function(t,e,i,s,r,n,h,a,o){h&&n>r?n-=360:!h&&n0,h=0,a=e.length;h=0?t.startAt(h+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(h+n,i):t.startAt(h,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(h,i),t.close(),t};const Ld=Phaser.Utils.Objects.GetValue,Dd=Phaser.Utils.Objects.IsPlainObject;class Ad extends(hd(Zl)){constructor(t,e,i,s,r,n,h,a){Dd(e)?(e=(a=e).x,i=a.y,s=a.width,r=a.height,n=a.barColor,h=a.value):Dd(s)?(s=(a=s).width,r=a.height,n=a.barColor,h=a.value):Dd(n)&&(n=(a=n).barColor,h=a.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===h&&(h=0),super(t,e,i,s,r,a),this.type="rexLineProgress",this.bootProgressBase(a),this.addShape((new Md).setName("trackFill")).addShape((new Md).setName("bar")).addShape((new Md).setName("trackStroke")),this.setTrackColor(Ld(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(Ld(a,"trackStrokeThickness",2),Ld(a,"trackStrokeColor",void 0)),this.setSkewX(Ld(a,"skewX",0)),this.setRTL(Ld(a,"rtl",!1)),this.setValue(h)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var Yd={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&Rd(s,0,0,e,i,t);var r,n,h=this.getShape("bar");h.fillStyle(this.barColor),h.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),Rd(h,r,0,n,i,t));var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&Rd(a,0,0,e,i,t)}};Object.assign(Ad.prototype,Yd);var Xd=function(t){return null==t||""===t||0===t.length},Wd=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(Xd(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(Xd(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,h=e.length;n=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=So(i),s=So(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),h=n.width,a=0,o=0,l=i.length;o0?h/a:0,c=n.height,u=0;for(o=0,l=s.length;o0?0:g,b=0,o=0;for(var C=i.length;o0?0:f),f>=1&&g>=1){var O=typeof(m=this.getFrameNameCallback(o,w,e));"string"!==O&&"number"!==O||r.add(m,0,b+n.cutX,x+n.cutY,f,g)}b+=f}x+=g}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,h,a,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/o,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(u,p);if(u>v){var g=(u-v)*o;d>=0?d+=g:d=g,u=v}if(p>v){var f=(p-v)*l;c>=0?c+=f:c=f,p=v}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,x=this.rows.count;b0&&a>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(w,b)?0:1)?this._drawImage(this.textureKey,s,m,y,h,a):this._drawTileSprite(this.textureKey,s,m,y,h,a)),m+=h;y+=a}this._endDraw()},setStretchMode:function(t){return ec(t)?(this.stretchMode.edge=sc(ic(t,"edge",0)),this.stretchMode.internal=sc(ic(t,"internal",0))):(t=sc(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return nc.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const ac=Phaser.Utils.Objects.IsPlainObject,oc=Phaser.Utils.Objects.GetValue,lc=Phaser.GameObjects;var dc=void 0,cc=function(t,e){if(dc||(dc={},ti(t).events.once("destroy",(function(){for(var t in dc)dc[t].destroy();dc=void 0}))),!dc.hasOwnProperty(e)){var i=ti(t).scene.systemScene;(t=new lc[e](i)).setOrigin(0),dc[e]=t}return dc[e]};const uc=Phaser.GameObjects.RenderTexture;class pc extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if(ac(i)?(i=oc(d=i,"x",0),s=oc(d,"y",0),r=oc(d,"width",1),n=oc(d,"height",1),h=oc(d,"key",void 0),a=oc(d,"baseFrame",void 0),o=oc(d,"columns",void 0),l=oc(d,"rows",void 0)):ac(r)?(r=oc(d=r,"width",1),n=oc(d,"height",1),h=oc(d,"key",void 0),a=oc(d,"baseFrame",void 0),o=oc(d,"columns",void 0),l=oc(d,"rows",void 0)):ac(h)?(h=oc(d=h,"key",void 0),a=oc(d,"baseFrame",void 0),o=oc(d,"columns",void 0),l=oc(d,"rows",void 0)):ac(a)?(a=oc(d=a,"baseFrame",void 0),o=oc(d,"columns",void 0),l=oc(d,"rows",void 0)):Array.isArray(a)?(d=l,l=o,o=a,a=oc(d,"baseFrame",void 0)):ac(o)&&(o=oc(d=o,"columns",void 0),l=oc(d,"rows",void 0)),void 0===a&&(a=oc(d,"frame",void 0)),void 0===o){var c=oc(d,"leftWidth",void 0),u=oc(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=oc(d,"topHeight",void 0),v=oc(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(oc(d,"getFrameNameCallback",void 0)),this.setStretchMode(oc(d,"stretchMode",0)),this.setPreserveRatio(oc(d,"preserveRatio",!0));var g=oc(d,"maxFixedPartScale",1),f=oc(d,"maxFixedPartScaleX",g),m=oc(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(h,a,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,hc),i}(uc,"rexNinePatch")){}var vc={_drawImage:function(t,e,i,s,r,n){var h=cc(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=cc(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(pc.prototype,vc);let gc=class extends ii{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(jd(t,e))return t[e];var i=t.parent;return jd(i,e)?i[e]:void 0}set(t,e,i){return jd(t,e)?t[e]=i:jd(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}};const fc=Phaser.Utils.Objects.GetValue;class mc extends pc{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=fc(e,"effects",!0);i&&Gd(this,i),this.style=new gc(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(mc.prototype,Nl);const yc=["alpha","tint","flipX","flipY"];var bc=function(t,e){if(!e)return t;for(var i=0,s=yc.length;i=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const _=Phaser.Math.DegToRad;var T={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=_(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},k={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=O(t.scaleX,i.scaleX),e.scaleY=O(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},E={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=O(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},L={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},D={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},A={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(t){void 0===t&&(t=!1);var e=this;return this._mask=null,this.setChildMaskVisible(this),this.children.forEach((function(t){t.clearMask&&t.clearMask(!1),t.hasOwnProperty("isRexContainerLite")||e.setChildMaskVisible(t)})),t&&this.mask&&this.mask.destroy(),this}},Y=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},z=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const j=Phaser.Utils.Array;var I={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},ke=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const Ee=/(\S+)\[(\d+)\]/i,Me=Phaser.Utils.Objects.GetValue;var Re=function(t,e){return void 0===e?t:t[e]},Le=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Me(e,"left",0),t.right=Me(e,"right",0),t.top=Me(e,"top",0),t.bottom=Me(e,"bottom",0)),t},De={getInnerPadding(t){return Re(this.space,t)},setInnerPadding(t,e){return Le(this.space,t,e),this},getOuterPadding(t){return Re(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Le(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Re(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Le(this.getSizerConfig(t).padding,e,i),this}},Ae=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Ye=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Xe=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},We=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},ze=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},Fe=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},je={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Ie=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?mi:fi,this.repeatCounter=0,this}stop(){return this.state=gi,this}update(t,e){this.state!==gi&&this.state!==bi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=yi)):(this.nowTime=this.duration,this.state=bi):this.nowTime>=0&&(this.state=mi))}get t(){var t;switch(this.state){case gi:case fi:case yi:t=0;break;case mi:t=this.nowTime/this.duration;break;case bi:t=1}return pi(t,0,1)}set t(t){(t=pi(t,-1,1))<0?(this.state=fi,this.nowTime=-this.delay*t):(this.state=mi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===gi}get isDelay(){return this.state===fi}get isCountDown(){return this.state===mi}get isRunning(){return this.state===fi||this.state===mi}get isDone(){return this.state===bi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const gi=0,fi=1,mi=2,yi=3,bi=-1;class xi extends di{constructor(t,e){super(t,e),this.timer=new vi}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const wi=Phaser.Utils.Objects.GetValue,Si=Phaser.Utils.Objects.GetAdvancedValue,Ci=Phaser.Tweens.Builders.GetEaseFunction;class Oi extends xi{resetFromJSON(t){return this.timer.resetFromJSON(wi(t,"timer")),this.setEnable(wi(t,"enable",!0)),this.setTarget(wi(t,"target",this.parent)),this.setDelay(Si(t,"delay",0)),this.setDuration(Si(t,"duration",1e3)),this.setEase(wi(t,"ease","Linear")),this.setRepeat(wi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Ci(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Pi=Phaser.Utils.Objects.GetValue,_i=Phaser.Utils.Objects.GetAdvancedValue,Ti=Phaser.Math.Linear;let ki=class extends Oi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Pi(t,"mode",0)),this.setScaleRange(_i(t,"start",void 0),_i(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ei[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=_i(t,"x",this.parent.scaleX),this.startY=_i(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=_i(e,"x",void 0),this.endY=_i(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Ti(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Ti(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const Ei={stop:0,destroy:1,yoyo:2};var Mi=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new ki(t,a):r.resetFromJSON(a),r.restart(),r},Ri=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof ki&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new ki(t,h):n.resetFromJSON(h),n.restart(),n},Li=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Di=function(t){return Li(t,"complete")};const Ai=Phaser.Utils.Objects.IsPlainObject;var Yi={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Ai(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Mi(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Di(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Ai(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Ri(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Di(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Di(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Ai(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new ki(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Di(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Xi={};Object.assign(Xi,Yi),Xi.onInitScale=function(){Yi.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=xe.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Wi=Phaser.Utils.Objects.GetValue,zi=Phaser.Utils.Objects.GetAdvancedValue,Fi=Phaser.Math.Linear;class ji extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Wi(t,"mode",0)),this.setAlphaRange(zi(t,"start",this.parent.alpha),zi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ii[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Fi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ii={stop:0,destroy:1,yoyo:2},Bi=Phaser.Utils.Objects.IsPlainObject;var Hi=function(t,e,i,s){var r,n;Bi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new ji(t,h):s.resetFromJSON(h),s.restart(),s},Ni=function(t,e,i,s){i instanceof ji&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new ji(t,r):s.resetFromJSON(r),s.restart(),s};const Gi=Phaser.Utils.Objects.IsPlainObject;var Vi={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Gi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Hi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Di(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Gi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Ni(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Di(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Di(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Ui={};Object.assign(Ui,Vi),Ui.onInitFade=function(){Vi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=xe.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const $i=Phaser.Utils.Objects.GetValue,Ji=Phaser.Utils.Objects.GetAdvancedValue,Ki=Phaser.Math.Linear;class qi extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode($i(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ji(t,"x",void 0),i=Ji(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Zi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Ji(i,"startX",void 0),this.startY=Ji(i,"startY",void 0),this.endX=Ji(i,"endX",void 0),this.endY=Ji(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Ki(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ki(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Zi={stop:0,destroy:1,yoyo:2};var Qi=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const ts=Phaser.Utils.Objects.IsPlainObject,es=Phaser.Math.Distance.Between;var is={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(ts(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*es(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof qi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=Qi(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=Qi(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new qi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Di(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Di(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(ts(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*es(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof qi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=Qi(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=Qi(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new qi(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Di(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Di(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},ss={};Object.assign(ss,is),ss.onInitEaseMove=function(){is.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=xe.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const rs=Phaser.Utils.Objects.GetValue;class ns extends ai{constructor(t,e){super(t,e),this.timer=new vi,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(rs(t,"timer")),this.setEnable(rs(t,"enable",!0)),this.setMode(rs(t,"mode",1)),this.isRunning=rs(t,"isRunning",!1),this.setMagnitudeMode(rs(t,"magnitudeMode",1)),this.setAxisMode(rs(t,"axis",0)),this.setDuration(rs(t,"duration",500)),this.setMagnitude(rs(t,"magnitude",10)),this.ox=rs(t,"ox",void 0),this.oy=rs(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=hs[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=os[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=as[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=rs(i,"magnitude",void 0),t=rs(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const hs={effect:0,behavior:1},as={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},os={constant:0,decay:1},ls=Phaser.Utils.Objects.IsPlainObject;var ds={shake(t,e,i){if(ls(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new ns(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Di(this._shake)}};const cs=Phaser.Utils.Objects.GetValue,us=Phaser.Math.Linear;class ps extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=cs(t,"key","value");var i=e[this.propertyKey];return this.fromValue=cs(t,"from",i),this.toValue=cs(t,"to",i),this.setEase(cs(t,"ease",this.ease)),this.setDuration(cs(t,"duration",this.duration)),this.setRepeat(cs(t,"repeat",0)),this.setDelay(cs(t,"delay",0)),this.setRepeatDelay(cs(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=us(this.fromValue,this.toValue,i)}}const vs=Phaser.Utils.Objects.IsPlainObject;class gs extends ii{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new ps(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(vs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(vs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var fs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new gs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Li(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},ms=Phaser.Utils.Array.Remove,ys={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var Ds={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=qe(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},As={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=Wt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=Wt),this.transitOutCallback=t,this}},Ys={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Xs={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Ws={};Object.assign(Ws,Ds,As,Ys,Xs);const zs=Phaser.Utils.Objects.GetValue;class Fs extends ii{constructor(t,e){super(t,e),this.setTransitInTime(zs(e,"duration.in",200)),this.setTransitOutTime(zs(e,"duration.out",200)),this.setTransitInCallback(zs(e,"transitIn")),this.setTransitOutCallback(zs(e,"transitOut")),this.oneShotMode=zs(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Ls(this,{eventEmitter:!1,initState:zs(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Fs.prototype,Ws);var js=function(t){if(t.parentContainer)return js(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?js(e):t};class Is extends ii{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=js(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Bs=Phaser.GameObjects.Rectangle;class Hs extends Bs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Is(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Ns=Phaser.Utils.Objects.GetValue;class Gs extends ii{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Ns(t,"hitAreaMode",0)),this.setEnable(Ns(t,"enable",!0)),this.setStopMode(Ns(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Vs[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Vs={default:0,fullWindow:1};const Us=Phaser.Utils.Objects.GetValue;class $s extends Hs{constructor(t,e){super(t,Us(e,"color",0),Us(e,"alpha",.8)),this.touchEventStop=new Gs(this,{hitAreaMode:1})}}var Js={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Mi(t,e)},scaleDown(t,e){Ri(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Hi(t,e)},fadeOut(t,e){Ni(t,e,!1)}},Ks=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Hi(t,e,t.alpha)},qs=function(t,e){Ni(t,e,!1)},Zs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!nt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Qs=Phaser.Utils.Objects.GetValue;let tr=class extends Fs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=er.popUp),null==e.transitOut&&(e.transitOut=er.scaleDown),e.destroy=Qs(e,"destroy",!0),super(t,e);var i=Qs(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new $s(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Qs(i,"transitIn",Ks)),this.setCoverTransitOutCallback(Qs(i,"transitOut",qs)));var s=Qs(e,"touchOutsideClose",!1),r=Qs(e,"duration.hold",-1),n=Qs(e,"timeOutClose",r>=0),h=Qs(e,"anyTouchClose",!1);Qs(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Qs(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Zs(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=er[t]),t){case er.popUp:t=Js.popUp;break;case er.fadeIn:t=Js.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=er[t]),t){case er.scaleDown:t=Js.scaleDown;break;case er.fadeOut:t=Js.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const er={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var ir=function(t){return t&&"function"==typeof t},sr={modal(t,e){return ir(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new tr(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},rr=function(t,e,i,s,r){ir(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},nr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return rr.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return rr.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return rr.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return rr.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return rr.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return rr.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return rr.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return rr.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return rr.call(this,"shutdown",t,e,i,s),this}},hr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=ar),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},ar={},or=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?Zs(t,e.x,e.y,i,s):!!(r=hr(e,n,!0))&&Zs(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const br={press:0,pointerdown:0,release:1,pointerup:1};var xr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new yr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},wr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!Sr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return Cr.length=0,!0;return Cr.length=0,!1},Cr=[];const Or=Phaser.Utils.Objects.GetValue;class Pr extends ii{constructor(t,e){super(t,e),this._enable=void 0;var i=Or(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Or(t,"enable",!0)),this.setMode(Or(t,"mode",1)),this.setClickInterval(Or(t,"clickInterval",100)),this.setDragThreshold(Or(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=_r[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?wr:or)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const _r={press:0,pointerdown:0,release:1,pointerup:1};var Tr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Pr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class kr extends Rs{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Er=Phaser.Utils.Objects.GetValue;class Mr extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new kr,this.parent.setInteractive(Er(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Er(t,"enable",!0)),this.setCooldown(Er(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Rr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&or(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Mr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Mr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Lr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Dr=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Jr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Kr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Jr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=qr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&or(t,s,e,i)}}const Jr=0,Kr=1,qr="IDLE",Zr=Phaser.Utils.Objects.GetValue,Qr=Phaser.Math.Distance.Between;class tn extends $r{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=en},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Zr(t,"time",250)),this.setTapInterval(Zr(t,"tapInterval",200)),this.setDragThreshold(Zr(t,"threshold",9)),this.setTapOffset(Zr(t,"tapOffset",10));var e=Zr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Zr(t,"maxTaps",void 0)),this.setMinTaps(Zr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case en:this.state=sn;break;case sn:var t=this.lastPointer;Qr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=rn,this.state=sn);break;case rn:this.state=sn}}onDragEnd(){this.state===sn&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=rn))}onDrag(){this.state!==en&&this.pointer.getDistance()>this.dragThreshold&&(this.state=en)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===sn){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=en):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=rn:this.state=en)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===rn&&(this.state=en)}get isTapped(){return this.state===rn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const en="IDLE",sn="BEGIN",rn="RECOGNIZED",nn=Phaser.Utils.Objects.GetValue;class hn extends $r{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=an},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(nn(t,"threshold",9)),this.setHoldTime(nn(t,"time",251)),this}onDragStart(){this.state=on,0===this.holdTime&&(this.state=ln)}onDragEnd(){this.state=an}onDrag(){this.state!==an&&this.pointer.getDistance()>this.dragThreshold&&(this.state=an)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===on&&t-this.pointer.downTime>=this.holdTime&&(this.state=ln)}get isPressed(){return this.state===ln}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const an="IDLE",on="BEGIN",ln="RECOGNIZED";Phaser.Utils.Objects.GetValue;var dn=function(t){return ti(t).loop.delta};const cn=Phaser.Math.Distance.Between,un=Phaser.Math.Angle.Between;var pn={getDt:function(){return dn(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return cn(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return un(e.x,e.y,t.x,t.y)}},vn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},gn={};const fn=Phaser.Utils.Objects.GetValue,mn=Phaser.Math.RadToDeg;class yn extends $r{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=bn},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(fn(t,"threshold",10)),this.setVelocityThreshold(fn(t,"velocityThreshold",1e3)),this.setDirectionMode(fn(t,"dir","8dir")),this}onDragStart(){this.state=xn}onDragEnd(){this.state=bn}onDrag(){this.state===xn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=wn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===wn&&(this.state=bn)}get isSwiped(){return this.state===wn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=vn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=gn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(mn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(yn.prototype,pn);const bn="IDLE",xn="BEGIN",wn="RECOGNIZED",Sn=Phaser.Utils.Objects.GetValue,Cn=Phaser.Utils.Array.SpliceOne,On=Phaser.Math.Distance.Between,Pn=Phaser.Math.Angle.Between;class _n{constructor(t,e){var i=qe(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(Sn(e,"inputConfig",void 0)),this.setEventEmitter(Sn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(Sn(t,"enable",!0)),this.bounds=Sn(t,"bounds",void 0),this.tracerState=kn,this.pointers.length=0,ft(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,ft(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case kn:this.tracerState=En,this.onDrag1Start();break;case En:this.tracerState=Mn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],Cn(this.pointers,e),this.tracerState){case En:this.tracerState=kn,this.onDrag1End();break;case Mn:this.tracerState=En,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case En:this.onDrag1();break;case Mn:this.onDrag2()}}}dragCancel(){return this.tracerState===Mn&&this.onDrag2End(),this.pointers.length=0,ft(this.movedState),this.tracerState=kn,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0],e=this.pointers[1];return On(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0],e=this.pointers[1];return Pn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Tn.x=e.x-i.x,Tn.y=e.y-i.y}else Tn.x=0,Tn.y=0;return Tn}get centerX(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Mn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Mn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Rn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&or(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&or(t,s,e,i)}}Object.assign(_n.prototype,$e);var Tn={};const kn=0,En=1,Mn=2,Rn="IDLE";Phaser.Utils.Objects.GetValue;const Ln=Phaser.Math.RotateAround;var Dn=function(t,e,i,s){return Ln(t,e,i,s),t.rotation+=s,t},An={};const Yn=Phaser.Utils.Objects.GetValue,Xn=Phaser.Math.Angle.WrapDegrees,Wn=Phaser.Math.Angle.ShortestBetween,zn=Phaser.Math.RadToDeg,Fn=Phaser.Math.DegToRad;var jn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=An),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Xn(zn(this.angleBetween));this.angle=Wn(this.prevAngle,t),this.prevAngle=t,this.state=Hn}break;case Hn:t=Xn(zn(this.angleBetween)),this.angle=Wn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Hn}get rotation(){return Fn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,jn);const In="IDLE",Bn="BEGIN",Hn="RECOGNIZED",Nn=Phaser.Utils.Objects.GetValue;var Gn=function(t){var e=Nn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new tn(this,e),this._tap.on("tap",(function(t,e,s){Ar(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Ar(i.eventEmitter,`${i.eventNamePrefix}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Vn=Phaser.Utils.Objects.GetValue;var Un=function(t){var e=Vn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new hn(this,e),this._press.on("pressstart",(function(t,e,s){Ar(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this).on("pressend",(function(t,e,s){Ar(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const $n=Phaser.Utils.Objects.GetValue;var Jn=function(t){var e=$n(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new yn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Ar(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Ar(i.eventEmitter,`${i.eventNamePrefix}swipe`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Kn=Phaser.Utils.Objects.GetValue;var qn=function(t,e){return t.setInteractive(),Kn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Kn(e,"targets",[t]),targetMode:Kn(e,"targetMode","parent"),eventEmitter:Kn(e,"eventEmitter",t),eventNamePrefix:Kn(e,"inputEventPrefix","child.")},Xr.call(t,e),Fr.call(t,e),Br.call(t,e),Vr.call(t,e),Gn.call(t,e),Un.call(t,e),Jn.call(t,e),t},Zn={getSizerConfig:function(t){return void 0===t&&(t=this),Mt(t)},getChildPrevState:function(t){var e=Mt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Dt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=oe(e,"color"),s=oe(e,"lineWidth");var o=oe(e,"name",!1);o&&(r=oe(o,"createTextCallback",ce),n=oe(o,"createTextCallbackScope",void 0),"string"==typeof(h=oe(o,"align","left-top"))&&(h=Xt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new le(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}var d,c,u=this.getAllShownChildren([this]);ue(u,u);for(var p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const ah=Phaser.Utils.Objects.IsPlainObject,oh=Phaser.Utils.Objects.GetValue,lh=Phaser.Display.Align.CENTER,dh={min:0,full:-1};var ch=function(t,e,i,s,r,n,h,a,o,l){var d,c,u,p;me.call(this,t);var v=t.isRexSpace,g=typeof e;if(null===e)return this;if("number"===g);else if("string"===g)e=dh[e];else if(ah(e)){var f;e=oh(f=e,"proportion",void 0),i=oh(f,"align",lh),s=oh(f,"padding",0),r=oh(f,"expand",!1),n=oh(f,"key",void 0),h=oh(f,"index",void 0),t.isRexSizer||(a=oh(f,"minWidth",void 0),o=oh(f,"minHeight",void 0)),l=oh(f,"fitRatio",0),d=oh(f,"offsetX",0),c=oh(f,"offsetY",0),u=oh(f,"offsetOriginX",0),p=oh(f,"offsetOriginY",0)}return"string"==typeof i&&(i=Xt[i]),void 0===e&&(e=v?1:0),void 0===i&&(i=lh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(v?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(v?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),(f=this.getSizerConfig(t)).proportion=e,f.align=i,f.padding=ge(s),f.expand=r,f.fitRatio=0===e?l:0,f.alignOffsetX=d,f.alignOffsetY=c,f.alignOffsetOriginX=u,f.alignOffsetOriginY=p,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},uh={add:ch,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),ch.call(this,new nh(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return ah(i)&&(i.index=t),ch.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=hh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const ph=Et.prototype.clear;var vh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),ph.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,vh.call(this,t),this}},mh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=Xt[e]),this.getSizerConfig(t).align=e,this}},yh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},bh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},xh={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},wh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Ne(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Ie.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d,c,u=this.sizerChildren,p=this.innerLeft,v=this.innerTop,g=this.innerWidth,f=this.innerHeight,m=p,y=v,b=this.startChildIndex,x=0,w=u.length;x0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=We.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Ye.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&sh.call(this,t,void 0),Xe.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||ze.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&sh.call(this,void 0,t),Fe.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(wh,uh,fh,mh,yh,bh,xh);var Sh=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},Ch={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const Oh=Phaser.Utils.Objects.IsPlainObject,Ph=Phaser.Utils.Objects.GetValue;class _h extends th{constructor(t,e,i,s,r,n,h){Oh(e)?(e=Ph(h=e,"x",0),i=Ph(h,"y",0),s=Ph(h,"width",void 0),r=Ph(h,"height",void 0),n=Ph(h,"orientation",0)):Oh(s)?(s=Ph(h=s,"width",void 0),r=Ph(h,"height",void 0),n=Ph(h,"orientation",0)):Oh(n)&&(n=Ph(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Ph(h,"space.item",0)),this.setStartChildIndex(Ph(h,"startChildIndex",0)),this.setRTL(Ph(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=Ch[t]),t}(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=Sh.call(this)),this._childrenProportion}}Object.assign(_h.prototype,wh);var Th=function(t,e,i){if(t){var s=null==e,r=null==i;return s&&r||(s||(t.displayWidth=e),r||(t.displayHeight=i),s&&(t.scaleX=t.scaleY),r&&(t.scaleY=t.scaleX)),t}},kh=function(t,e){var i;return t||0===t||(t=""),void 0===e&&(e=!0),Array.isArray(t)&&(t=t.join("\n")),(i=e?`${this.text}\n${t}`:`${this.text}${t}`)!=this.text&&this.setText(i),this},Eh={appendText:kh,resetDisplayContent:function(t){void 0===t?t={}:"string"==typeof t&&(t={text:t});var e=t.text||"";this.setText(e);var i=this.childrenMap.icon;if(i){t.icon?this.show(i):this.hide(i);var s=t.iconSize;s&&(this.setChildDisplaySize(i,s,s),void 0!==this.iconWidth&&this.setIconSize(s)),!0!==t.icon&&this.setIconTexture(t.icon,t.iconFrame)}var r=this.childrenMap.action;if(r){t.action?this.show(r):this.hide(r);var n=t.actionSize;n&&(this.setChildDisplaySize(r,n,n),void 0!==this.actionWidth&&this.setActionSize(n)),!0!==t.action&&this.setActionTexture(t.action,t.actionFrame)}return this}};class Mh extends _h{get text(){var t=this.childrenMap.text;return t?t.text:""}set text(t){var e=this.childrenMap.text;e&&e.setText(t)}setText(t){return this.text=t,this}setIconTexture(t,e){var i=this.childrenMap.icon;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.iconWidth&&void 0!==this.iconHeight&&(Th(i,this.iconWidth,this.iconHeight),this.resetChildScaleState(i)),this):this}setTexture(t,e){return this.setIconTexture(t,e),this}setIconSize(t,e){return void 0===e&&(e=t),this.iconWidth=t,this.iconHeight=e,this}get texture(){var t=this.childrenMap.icon;if(t)return t.texture}get frame(){var t=this.childrenMap.icon;if(t)return t.frame}setActionTexture(t,e){var i=this.childrenMap.action;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.actionWidth&&void 0!==this.actionHeight&&(Th(i,this.actionWidth,this.actionHeight),this.resetChildScaleState(i)),this):this}get actionTexture(){var t=this.childrenMap.action;if(t)return t.texture}get actionFrame(){var t=this.childrenMap.action;if(t)return t.frame}setActionSize(t,e){return void 0===e&&(e=t),this.actionWidth=t,this.actionHeight=e,this}preLayout(){var t=this.childrenMap.icon;t&&void 0!==this.iconWidth&&void 0!==this.iconHeight&&Th(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&Th(e,this.actionWidth,this.actionHeight),super.preLayout()}postLayout(t,e,i){var s=this.childrenMap.iconMask;s&&(s.setPosition(),this.resetChildPositionState(s));var r=this.childrenMap.actionMask;return r&&(r.setPosition(),this.resetChildPositionState(r)),super.postLayout(t,e,i),this}resize(t,e){super.resize(t,e);var i=this.childrenMap.iconMask;i&&i.resize();var s=this.childrenMap.actionMask;return s&&s.resize(),this}}Object.assign(Mh.prototype,Eh);const Rh=Phaser.GameObjects.Graphics.prototype.setPosition,Lh=Phaser.Geom.Rectangle,Dh=Phaser.Geom.Circle;var Ah=function(t,e,i,s,r){this.geom=function(t,e,i,s,r,n,h){if(1===t){s=s.left;var a=-e*(r-.5),o=-i*(n-.5),l=Math.min(e,i)/2+s;void 0!==h&&h instanceof Dh||(h=new Dh),h.setTo(a,o,l)}else{var d=-e*r-s.left,c=-i*n-s.top,u=e+s.left+s.right,p=i+s.top+s.bottom;void 0!==h&&h instanceof Lh||(h=new Lh),h.setTo(d,c,u,p)}return h}(this.shapeType,t,e,i,s,r,this.geom),this.clear().fillStyle(16777215),1===this.shapeType?this.fillCircleShape(this.geom):this.fillRectShape(this.geom)},Yh=function(t,e){for(var i in t){if(!(i in e))return!1;if(t[i]!==e[i])return!1}for(var i in e)if(!(i in t))return!1;return!0},Xh={setPosition:function(t,e){var i=this.parent;return void 0===t&&(t=i.x),void 0===e&&(e=i.y),Rh.call(this,t,e),this},resize:function(t,e,i){var s=this.parent;void 0===t&&(t=s.width),void 0===e&&(e=s.height),void 0===i?i=this.padding:"number"==typeof i&&(i=GetBoundsConfig(i));var r=this.width!==t||this.height!==e,n=this.padding!==i&&!Yh(this.padding,i);return r||n?(this.width=t,this.height=e,n&&mt(i,this.padding),this.originX=s.originX,this.originY=s.originY,Ah.call(this,t,e,i,s.originX,s.originY),this):this},setOrigin:function(t,e){void 0===e&&(e=t);var i=this.parent;return void 0===t&&(t=i.originX),void 0===e&&(e=i.originY),this.originX===t&&this.originY===e||(this.originX=t,this.originY=e,Ah.call(this,this.width,this.height,this.padding,t,e)),this},contains:function(t,e){return t-=this.x,e-=this.y,this.geom.contains(t,e)}};const Wh=Phaser.GameObjects.Graphics;class zh extends Wh{constructor(t,e,i){void 0===e&&(e=0),"string"==typeof e&&(e=Fh[e]),super(t.scene),this.parent=t,this.shapeType=e,this.padding=ge(i),this.setPosition().resize().setVisible(!1)}destroy(){return this.parent=void 0,super.destroy(),this}}const Fh={rectangle:0,circle:1};Object.assign(zh.prototype,Xh);var jh=function(t,e,i,s){var r=new zh(e,i,s);if(t&&!t.isRexSizer){var n=r.createGeometryMask();t.setMask(n),this.once("destroy",(function(){t.setMask(),n.destroy()}))}return this.pin(r),r};const Ih=Phaser.GameObjects.Text;var Bh=function(t){return t instanceof Ih};const Hh=Phaser.GameObjects.BitmapText;var Nh=function(t){return t instanceof Hh},Gh=function(t){return Nh(t)?2:Bh(t)?0:1},Vh=/^[\x00-\x7F]+$/,Uh=function(t){return Vh.test(t)},$h=function(t,e){for(var i=[],s=t.split("\n"),r=e.style,n=r.wordWrapWidth,h=r.hasOwnProperty("wrapMode")?r.wrapMode:3,a=e.context,o=0,l=s.length;o0&&r.push(o.join("")),r},Kh=0,qh=1,Zh=2,Qh=0,ta=1,ea=2,ia=/(?:\r\n|\r|\n)/;const sa={none:Qh,word:ta,char:ea,character:ea,mix:3},ra=Phaser.Renderer.WebGL.Utils;var na={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,h=r.height,a=ra.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,h,e.x,e.y,n/e.resolution,h/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,h,a(e.tintTopLeft,i.alpha*e._alphaTL),a(e.tintTopRight,i.alpha*e._alphaTR),a(e.tintBottomLeft,i.alpha*e._alphaBL),a(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const ha=Phaser.Display.Color;var aa={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,h,a,o,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===h&&(h=0),void 0===a&&(a=0),void 0===o&&(o=c),void 0===l&&(l=u);var p=d.cutX+h,v=d.cutY+a;return this.context.drawImage(d.source.image,p,v,o,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new ha);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var h=i;i=h.red,s=h.green,r=h.blue,n=h.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var a=this.context.createImageData(1,1);return a.data[0]=i,a.data[1]=s,a.data[2]=r,a.data[3]=n,this.context.putImageData(a,t,e),this.dirty=!0,this}},oa=function(t,e,i,s,r,n,h){var a,o=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===h&&(h=e.height);var d=(a=o.exists(i)?o.get(i):o.createCanvas(i,n,h)).getSourceImage();d.width!==n&&(d.width=n),d.height!==h&&(d.height=h);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,h),c.drawImage(e,s,r,n,h),l.gl&&a&&l.canvasToTexture(d,a.source[0].glTexture,!0,0)},la={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,oa(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};e();const da=Phaser.Display.Canvas.CanvasPool,ca=Phaser.GameObjects.GameObject,ua=Phaser.Utils.String.UUID;class pa extends ca{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=da.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=ua(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){da.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}}const va=Phaser.GameObjects.Components;Phaser.Class.mixin(pa,[va.Alpha,va.BlendMode,va.Crop,va.Depth,va.Flip,va.GetBounds,va.Mask,va.Origin,va.Pipeline,va.PostPipeline,va.ScrollFactor,va.Tint,va.Transform,va.Visible,na,aa,la]);var ga={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:_s(this.data,t,e)},incData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)+e),this},mulData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)*e),this},clearData(){return this.data&&ft(this.data),this}};class fa{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}}Object.assign(fa.prototype,ga);var ma={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const ya=Phaser.Math.RotateAround;var ba;const xa=Phaser.Geom.Rectangle;var wa,Sa=function(t){void 0===wa&&(wa=new xa);var e=t.drawTLX,i=t.drawTLY;return wa.setTo(e,i,t.drawTRX-e,t.drawBLY-i),wa};const Ca=Phaser.Math.RotateAround;var Oa,Pa=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Oa&&(Oa={}),s=Oa),s.x=e,s.y=i,0!==t.rotation&&Ca(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const _a=Phaser.GameObjects.Components.TransformMatrix;var Ta,ka,Ea={},Ma=function(t,e,i,s,r){var n=Pa(e,i,s,!0),h=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=Ea);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===Ta&&(Ta=new _a,ka=new _a),t.parentContainer?t.getWorldTransformMatrix(Ta,ka):Ta.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),Ta.transformPoint(r,n,s),s}(t,n.x,n.y,r);return h},Ra=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,h=e.drawCenterY+s;return Ma(t,e,n,h,r)},La={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===ba&&(ba={}),s=ba),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&ya(s,0,0,-i.rotation),s}(t,e,this,!0);return Sa(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return Ra(this.parent,this,t,e,i)}};Object.assign(La,ma);const Da=Phaser.Math.DegToRad,Aa=Phaser.Math.RadToDeg,Ya=Phaser.Utils.Objects.GetValue;class Xa extends fa{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return Aa(this._rotation)}set angle(t){this.rotation=Da(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=Ya(t,"width",void 0),i=Ya(t,"height",void 0),s=Ya(t,"scaleX",void 0),r=Ya(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(Xa.prototype,La);const Wa=Phaser.Utils.String.Pad;var za=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${Wa(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},Fa=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const ja=Phaser.Utils.Objects.GetValue;let Ia=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=ja(t,"x",0),i=ja(t,"y",0));var s=this.cornerRadius;s.tl=Ba(ja(t,"tl",void 0),e,i),s.tr=Ba(ja(t,"tr",void 0),e,i),s.bl=Ba(ja(t,"bl",void 0),e,i),s.br=Ba(ja(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Ha(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Ha(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Ha(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Ha(this.cornerRadius.br,t)}};var Ba=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Na(t),t},Ha=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=ja(e,"x",0),t.y=ja(e,"y",0)),Na(t)},Na=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const Ga=Phaser.Math.DegToRad;var Va=function(t){return!t.hasOwnProperty("convex")||t.convex},Ua=function(t){return t.x>0&&t.y>0},$a=function(t,e,i,s,r,n,h,a,o){if(a&&h>n?h-=360:!a&&h=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=m.tl,Ua(a)?(o=a.x*g,l=a.y*f,Va(a)?$a(t,o,l,o,l,180,270,!1,h):$a(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,Ua(a)?(o=a.x*g,l=a.y*f,Va(a)?$a(t,s-o,l,o,l,270,360,!1,h):$a(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,Ua(a)?(o=a.x*g,l=a.y*f,Va(a)?$a(t,s-o,r-l,o,l,0,90,!1,h):$a(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,Ua(a)?(o=a.x*g,l=a.y*f,Va(a)?$a(t,o,r-l,o,l,90,180,!1,h):$a(t,0,r,o,l,360,270,!0,h)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,h,u),null!=a)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,a),p.addColorStop(1,d),a=p),e.fillStyle=a,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())},Ka=function(t,e,i,s,r,n,h,a){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),Ja(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}};const qa=Phaser.Utils.Objects.GetValue;class Za extends Xa{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(qa(e,"color",null),qa(e,"color2",null),qa(e,"horizontalGradient",!0)),this.setStroke(qa(e,"stroke",null),qa(e,"strokeThickness",2)),this.setCornerRadius(qa(e,"cornerRadius",0),qa(e,"cornerIteration",null))}set color(t){t=za(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=za(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=za(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,Fa("color2",t,this),Fa("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Fa("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Fa("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){Ka(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Qa=Phaser.Utils.Objects.GetValue;class to extends Xa{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(Qa(e,"color",null),Qa(e,"color2",null),Qa(e,"horizontalGradient",!0)),this.setStroke(Qa(e,"stroke",null),Qa(e,"strokeThickness",2))}set color(t){t=za(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=za(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=za(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,Qa(t,"color2",null),Qa(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Qa(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,h=this.parent.height-i.top-i.bottom,a=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?a.createLinearGradient(0,0,n,0):a.createLinearGradient(0,0,0,h)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,a.fillStyle=t,a.fillRect(s,r,n,h));null!=this.stroke&&this.strokeThickness>0&&(a.strokeStyle=this.stroke,a.lineWidth=this.strokeThickness,a.strokeRect(s,r,n,h))}}const eo=Phaser.Utils.Objects.GetValue;let io=class t{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(eo(t,"bold",!1)),this.setItalic(eo(t,"italic",!1)),this.setFontSize(eo(t,"fontSize","16px")),this.setFontFamily(eo(t,"fontFamily","Courier")),this.setColor(eo(t,"color","#fff")),this.setStrokeStyle(eo(t,"stroke",null),eo(t,"strokeThickness",0)),this.setShadow(eo(t,"shadowColor",null),eo(t,"shadowOffsetX",0),eo(t,"shadowOffsetY",0),eo(t,"shadowBlur",0)),this.setOffset(eo(t,"offsetX",0),eo(t,"offsetY",0)),this.setSpace(eo(t,"leftSpace",0),eo(t,"rightSpace",0)),this.setAlign(eo(t,"align",void 0)),this.setBackgroundColor(eo(t,"backgroundColor",null)),this.setBackgroundHeight(eo(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(eo(t,"backgroundBottomY",void 0)),this.setBackgroundLeftX(eo(t,"backgroundLeftX",0)),this.setBackgroundRightX(eo(t,"backgroundRightX",0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(Fa("stroke",t,this),Fa("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Fa("shadowOffsetX",t,this),Fa("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),t.hasOwnProperty("backgroundLeftX")&&this.setBackgroundLeftX(t.backgroundLeftX),t.hasOwnProperty("backgroundRightX")&&this.setBackgroundRightX(t.backgroundRightX),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new t(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=za(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=za(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=za(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=za(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setBackgroundLeftX(t){return this.backgroundLeftX=t,this}setBackgroundRightX(t){return this.backgroundRightX=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}};const so=Phaser.Utils.Array.Remove,ro=Phaser.Utils.Array.Remove,no="text",ho="image",ao="drawer",oo="space",lo="command";var co=function(t){return t.type===no&&"\n"===t.text},uo=function(t){return t.type===no&&"\f"===t.text},po=function(t){return t.type===no};class vo extends Xa{constructor(t,e,i){super(t,no),this.updateTextFlag=!1,this.style=new io(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX+e.backgroundLeftX,s=i,r=this.drawTRX+e.backgroundRightX-i+1;if(r>0){var n=e.backgroundBottomY;null==n&&(n=this.drawBLY);var h=e.backgroundHeight;null==h&&(h=n-this.drawTLY);var a=n-h;t.fillRect(s,a,r,h)}}var o=e.hasFill,l=e.hasStroke;(o||l)&&(e.syncFont(t).syncStyle(t),l&&(e.syncShadow(t),t.strokeText(this.text,0,0)),o&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var go=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const fo=Phaser.Display.Canvas.CanvasPool;var mo=function(t,e,i,s,r,n,h,a){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===a&&(a=!1),a&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(h){var l=fo.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=h,d.fillRect(0,0,r,n),o.drawImage(l,0,0,r,n,i,s,r,n),fo.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)};Phaser.Display.Canvas.CanvasPool;class yo extends Xa{constructor(t,e,i){super(t,ho),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){mo(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class bo extends Xa{constructor(t,e,i,s){super(t,ao),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class xo extends Xa{constructor(t,e){super(t,oo),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class wo extends fa{constructor(t,e,i,s,r){super(t,lo),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}function So(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>So(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=So(t[i]));return e}var Co=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const Oo={none:0,word:1,char:2,character:2,mix:3};var Po=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,h=!r&&!n,a=t.length,o=e,l=s.word,d=0,c=!1;o0&&!a){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=Eo.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=Eo.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=Ro(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=Ro(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=Ro(t,"wrapMode");void 0===c&&(c=Ro(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=Oo[c]);var u=Ro(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=Ro(t,"letterSpacing",0),v=Ro(t,"hAlign",0),g=Ro(t,"vAlign",0),f=Ro(t,"justifyPercentage",.25),m=Co({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:h,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,b=0,x=y.length;b0&&(E.push({children:M,width:R}),L=Math.max(L,R)),m.start+=k.length,m.isLastPage=!D&&m.start===T,m.maxLineWidth=L,m.linesHeight=E.length*n;var j=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,I=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,h=t.vAlign,a=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(h=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=Ao(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=Ao(t,"maxLines",0);var a=0===i,o=Ao(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=Ao(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=Ao(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=Ao(t,"letterSpacing",0),p=Ao(t,"rtl",!0),v=Ao(t,"hAlign",p?2:0),g=Ao(t,"vAlign",0),f=Co({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:o,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(k.push({children:E,height:M}),R=Math.max(R,M)),f.start+=T.length,f.isLastPage=f.start===_,f.maxLineHeight=R,f.linesWidth=k.length*n;var W=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,z=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,h=t.vAlign,a=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}a&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,h=i.bottom;return Le(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return Re(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),so(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return ro(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(no);return null===i?i=new vo(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),Ra(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const nl=Phaser.Utils.Objects.GetFastValue;var hl={};class al{constructor(t){this.pools=nl(t,"pools",hl)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new rl),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;ei&&(r=Math.floor(i));for(var n={},h=gl(t,r,e,i,n),a=0;a<=ul&&0!==h;a++){if((r+=h)<0){r=0;break}h=gl(t,r,e,i,n)}return a===ul&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),fl(t,e,i),t},vl=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},gl=function(t,e,i,s,r){var n,h=vl(t,e,r),a=vl(t,e+1,r);if(void 0!==s)if(h.height<=s&&a.height>s)n=0;else{if(h.height>s)return-1;n=Math.floor(s-h.height)}if(h.width<=i&&a.width>i)return 0;if(h.width>i)return-1;var o=Math.floor(i-h.width);return void 0===n?o:Math.min(o,n)},fl=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const ml=Phaser.Utils.Objects.GetValue,yl=Phaser.Utils.Objects.GetValue;class bl extends Mh{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=yl(e,"background",void 0),r=yl(e,"icon",void 0),n=yl(e,"iconMask",void 0),h=yl(e,"text",void 0),a=yl(e,"action",void 0),o=yl(e,"actionMask",void 0),l=yl(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(h||a)&&(i={right:yl(e,"space.icon",0),top:yl(e,"space.iconTop",0),bottom:yl(e,"space.iconBottom",0),left:yl(e,"space.iconLeft",0)}):(h||a)&&(i={bottom:yl(e,"space.icon",0),left:yl(e,"space.iconLeft",0),right:yl(e,"space.iconRight",0),top:yl(e,"space.iconTop",0)});var d=yl(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=jh.call(this,r,r,1)),!d){var c=yl(e,"iconSize",void 0);this.setIconSize(yl(e,"iconWidth",c),yl(e,"iconHeight",c))}}if(h){var u=yl(e,"wrapText",!1),p=yl(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),function(t,e){switch(Gh(t)){case 0:switch("string"==typeof e&&(e=sa[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=$h;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=sa[e]||0),t.style.wrapMode=e}}(h,u),e.expandTextWidth=!0,cl(h)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=ml(e,"minWidth",0),s=ml(e,"minHeight",0),r=ml(e,"fitHeight",!1);t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return pl(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),pl(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t})}(h,{fitHeight:!0}));var v,g,f=yl(e,"space.text",0),m=yl(e,"expandTextWidth",!1),y=yl(e,"expandTextHeight",!1);0===this.orientation?(v=m?1:0,a&&(i={right:f}),g=y):(v=y?1:0,a&&(i={bottom:f}),g=m),this.add(h,{proportion:v,expand:g,padding:i})}if(a&&(i=0===this.orientation?{top:yl(e,"space.actionTop",0),bottom:yl(e,"space.actionBottom",0),right:yl(e,"space.actionRight",0)}:{left:yl(e,"space.actionLeft",0),right:yl(e,"space.actionRight",0),bottom:yl(e,"space.actionBottom",0)},d=yl(e,"squareFitAction",!1)?1:0,this.add(a,{proportion:0,padding:i,fitRatio:d}),o&&(o=jh.call(this,a,a,1)),!d)){var b=yl(e,"actionSize");this.setActionSize(yl(e,"actionWidth",b),yl(e,"actionHeight",b))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",h),this.addChildrenMap("action",a),this.addChildrenMap("actionMask",o)}}var xl=Phaser.Renderer.WebGL.Utils,wl=function(t,e,i,s,r,n){for(var h=xl.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),a=i.pathData,o=i.pathIndexes,l=0;l>>16,a=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+h+","+a+","+o+","+n+")"},_l=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,h=(16711680&r)>>>16,a=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+h+","+a+","+o+","+n+")",t.lineWidth=e.lineWidth};const Tl=Phaser.Renderer.Canvas.SetTransform;var kl={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Ol(e,i,s),h=r.calcMatrix.copyFrom(n.calc),a=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&wl(r,h,e,l,a,o),e.isStroked&&Cl(r,e,l,a,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(Tl(t,r,e,i,s)){var n=e._displayOriginX,h=e._displayOriginY,a=e.pathData,o=a.length-1,l=a[0]-n,d=a[1]-h;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(Ml.prototype,kl);var Rl=function(t){return t.x>0&&t.y>0},Ll=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const Dl=Phaser.Math.DegToRad;var Al=function(t,e,i,s,r,n,h,a,o){h&&n>r?n-=360:!h&&n0,h=0,a=e.length;h=0?t.startAt(h+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(h+n,i):t.startAt(h,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(h,i),t.close(),t};const Dd=Phaser.Utils.Objects.GetValue,Ad=Phaser.Utils.Objects.IsPlainObject;class Yd extends(hd(Zl)){constructor(t,e,i,s,r,n,h,a){Ad(e)?(e=(a=e).x,i=a.y,s=a.width,r=a.height,n=a.barColor,h=a.value):Ad(s)?(s=(a=s).width,r=a.height,n=a.barColor,h=a.value):Ad(n)&&(n=(a=n).barColor,h=a.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===h&&(h=0),super(t,e,i,s,r,a),this.type="rexLineProgress",this.bootProgressBase(a),this.addShape((new Rd).setName("trackFill")).addShape((new Rd).setName("bar")).addShape((new Rd).setName("trackStroke")),this.setTrackColor(Dd(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(Dd(a,"trackStrokeThickness",2),Dd(a,"trackStrokeColor",void 0)),this.setSkewX(Dd(a,"skewX",0)),this.setRTL(Dd(a,"rtl",!1)),this.setValue(h)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var Xd={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&Ld(s,0,0,e,i,t);var r,n,h=this.getShape("bar");h.fillStyle(this.barColor),h.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),Ld(h,r,0,n,i,t));var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&Ld(a,0,0,e,i,t)}};Object.assign(Yd.prototype,Xd);var Wd=function(t){return null==t||""===t||0===t.length},zd=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(Wd(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(Wd(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,h=e.length;n=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=So(i),s=So(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),h=n.width,a=0,o=0,l=i.length;o0?h/a:0,c=n.height,u=0;for(o=0,l=s.length;o0?0:g,b=0,o=0;for(var C=i.length;o0?0:f),f>=1&&g>=1){var O=typeof(m=this.getFrameNameCallback(o,w,e));"string"!==O&&"number"!==O||r.add(m,0,b+n.cutX,x+n.cutY,f,g)}b+=f}x+=g}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,h,a,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/o,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(u,p);if(u>v){var g=(u-v)*o;d>=0?d+=g:d=g,u=v}if(p>v){var f=(p-v)*l;c>=0?c+=f:c=f,p=v}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,x=this.rows.count;b0&&a>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(w,b)?0:1)?this._drawImage(this.textureKey,s,m,y,h,a):this._drawTileSprite(this.textureKey,s,m,y,h,a)),m+=h;y+=a}this._endDraw()},setStretchMode:function(t){return ic(t)?(this.stretchMode.edge=rc(sc(t,"edge",0)),this.stretchMode.internal=rc(sc(t,"internal",0))):(t=rc(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return hc.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const oc=Phaser.Utils.Objects.IsPlainObject,lc=Phaser.Utils.Objects.GetValue,dc=Phaser.GameObjects;var cc=void 0,uc=function(t,e){if(cc||(cc={},ti(t).events.once("destroy",(function(){for(var t in cc)cc[t].destroy();cc=void 0}))),!cc.hasOwnProperty(e)){var i=ti(t).scene.systemScene;(t=new dc[e](i)).setOrigin(0),cc[e]=t}return cc[e]};const pc=Phaser.GameObjects.RenderTexture;class vc extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if(oc(i)?(i=lc(d=i,"x",0),s=lc(d,"y",0),r=lc(d,"width",1),n=lc(d,"height",1),h=lc(d,"key",void 0),a=lc(d,"baseFrame",void 0),o=lc(d,"columns",void 0),l=lc(d,"rows",void 0)):oc(r)?(r=lc(d=r,"width",1),n=lc(d,"height",1),h=lc(d,"key",void 0),a=lc(d,"baseFrame",void 0),o=lc(d,"columns",void 0),l=lc(d,"rows",void 0)):oc(h)?(h=lc(d=h,"key",void 0),a=lc(d,"baseFrame",void 0),o=lc(d,"columns",void 0),l=lc(d,"rows",void 0)):oc(a)?(a=lc(d=a,"baseFrame",void 0),o=lc(d,"columns",void 0),l=lc(d,"rows",void 0)):Array.isArray(a)?(d=l,l=o,o=a,a=lc(d,"baseFrame",void 0)):oc(o)&&(o=lc(d=o,"columns",void 0),l=lc(d,"rows",void 0)),void 0===a&&(a=lc(d,"frame",void 0)),void 0===o){var c=lc(d,"leftWidth",void 0),u=lc(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=lc(d,"topHeight",void 0),v=lc(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(lc(d,"getFrameNameCallback",void 0)),this.setStretchMode(lc(d,"stretchMode",0)),this.setPreserveRatio(lc(d,"preserveRatio",!0));var g=lc(d,"maxFixedPartScale",1),f=lc(d,"maxFixedPartScaleX",g),m=lc(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(h,a,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,ac),i}(pc,"rexNinePatch")){}var gc={_drawImage:function(t,e,i,s,r,n){var h=uc(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=uc(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(vc.prototype,gc);let fc=class extends ii{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Id(t,e))return t[e];var i=t.parent;return Id(i,e)?i[e]:void 0}set(t,e,i){return Id(t,e)?t[e]=i:Id(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}};const mc=Phaser.Utils.Objects.GetValue;class yc extends vc{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=mc(e,"effects",!0);i&&Vd(this,i),this.style=new fc(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(yc.prototype,Nl);const bc=["alpha","tint","flipX","flipY"];var xc=function(t,e){if(!e)return t;for(var i=0,s=bc.length;i * @copyright 2018 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */const Rc=Phaser.Display.Canvas.CanvasPool;var Lc=function(t){var e=Rc.create(this),i=e.getContext("2d",{willReadFrequently:!0});t.syncFont(e,i);var s=i.measureText(t.testString);if("actualBoundingBoxAscent"in s){var r=s.actualBoundingBoxAscent,n=s.actualBoundingBoxDescent,h={ascent:r,descent:n,fontSize:r+n};return Rc.remove(e),h}var a=Math.ceil(s.width*t.baselineX),o=a,l=2*o;if(o=o*t.baselineY|0,e.width=a,e.height=l,i.fillStyle="#f00",i.fillRect(0,0,a,l),i.font=t._font,i.textBaseline="alphabetic",i.fillStyle="#000",i.fillText(t.testString,0,o),h={ascent:0,descent:0,fontSize:0},!i.getImageData(0,0,a,l))return h.ascent=o,h.descent=o+6,h.fontSize=h.ascent+h.descent,Rc.remove(e),h;var d,c,u=i.getImageData(0,0,a,l).data,p=u.length,v=4*a,g=0,f=!1;for(d=0;do;d--){for(c=0;c0&&this.wrapMode!==Qh&&0===this.wrapWidth}setStyle(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wordWrap")){var s=t.wordWrap;s.hasOwnProperty("width")&&(t.wrap={mode:"word",width:s.width})}if(t&&t.hasOwnProperty("wrap")){var r=t.wrap;if(r.hasOwnProperty("mode")){var n=r.mode;"string"==typeof n&&(r.mode=sa[n])}else r.hasOwnProperty("width")&&(r.mode=1)}t&&t.rtl&&i&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var h=this.propertyMap;for(var a in h){var o=h[a],l=o[0],d=i?o[1]:this[a],c=o[2];if("wrapCallback"===a||"wrapCallbackScope"===a)this[a]=Ac(t,l,d);else{var u=Dc(t,l,d);c&&(u=c(u)),this[a]=u}}var p=Ac(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var v=Ac(t,"fill",null);null!==v&&(this.color=za(v));var g=Ac(t,"metrics",!1);return g?this.metrics={ascent:Ac(g,"ascent",0),descent:Ac(g,"descent",0),fontSize:Ac(g,"fontSize",0)}:!e&&this.metrics||(this.metrics=Lc(this)),e?this.parent.updateText():this.parent}syncFont(t,e){e.font=this._font}syncStyle(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"}syncShadow(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)}update(t){return t&&(this._font=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim(),this.metrics=Lc(this)),this.parent.updateText(t)}buildFont(){var t=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim();return t!==this._font&&(this._font=t),this}setFont(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=Ac(t,"fontFamily","Courier"),this.fontSize=Ac(t,"fontSize","16px"),this.fontStyle=Ac(t,"fontStyle","")),this.update(!0)}setFontFamily(t){return this.fontFamily=t,this.update(!0)}setFontStyle(t){return this.fontStyle=t,this.update(!0)}setFontSize(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}setTestString(t){return this.testString=t,this.update(!0)}setFixedSize(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}setResolution(t){return this.resolution=t,this.update(!1)}setXOffset(t){return this.xOffset=t,this.update(!1)}setBackgroundColor(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=za(t,this.parent.canvas,this.parent.context),this.backgroundColor2=za(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=za(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}setBackgroundCornerRadius(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}setFill(t){return this.color=za(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=za(t,this.parent.canvas,this.parent.context),this.update(!1)}setStroke(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=za(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}setShadow(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===n&&(n=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=za(i,this.parent.canvas,this.parent.context),this.shadowBlur=s,this.shadowStroke=r,this.shadowFill=n,this.update(!1)}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}setShadowColor(t){return void 0===t&&(t="#000"),this.shadowColor=za(t,this.parent.canvas,this.parent.context),this.update(!1)}setShadowBlur(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}setShadowStroke(t){return this.shadowStroke=t,this.update(!1)}setShadowFill(t){return this.shadowFill=t,this.update(!1)}setUnderline(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=za(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}setUnderlineColor(t){return void 0===t&&(t="#000"),this.underlineColor=za(t,this.parent.canvas,this.parent.context),this.update(!1)}setUnderlineThickness(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}setUnderlineOffset(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}setStrikethrough(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=za(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}setStrikethroughColor(t){return void 0===t&&(t="#000"),this.strikethroughColor=za(t,this.parent.canvas,this.parent.context),this.update(!1)}setStrikethroughThickness(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}setStrikethroughOffset(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}setWrapMode(t){return"string"==typeof t&&(t=sa[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}setWrapWidth(t){return this.wrapWidth=t,this.update(!1)}setAlign(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}setHAlign(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}setVAlign(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}setMaxLines(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}getTextMetrics(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}setTextMetrics(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=Ac(e,"fontFamily",this.fontFamily),this.fontSize=Ac(e,"fontSize",this.fontSize),this.fontStyle=Ac(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}get lineHeight(){return this.metrics.fontSize+this.parent.lineSpacing}toJSON(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}destroy(){this.parent=void 0}}var Xc={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var h=this.defaultStyle;this.clear(),Ka(this,h.backgroundColor,h.backgroundStrokeColor,h.backgroundStrokeLineWidth,h.backgroundCornerRadius,h.backgroundColor2,h.backgroundHorizontalGradient,h.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var a,o,l,d,c,u,p=h.halign,v=h.valign,g=h.lineHeight,f=r.lines,m=f.length,y=h.maxLines;y>0&&m>y?(o=y,l="center"===v?Math.floor((m-o)/2):"bottom"===v?m-o:0):(o=m,l=0),d=l+o;var b=this.rtl,x=b?this.parent.width:void 0;u="center"===v?Math.max((s-o*g)/2,0):"bottom"===v?Math.max(s-o*g-2,0):0,u+=e;for(var w=l;w0){var a=this.defaultStyle.metrics,o=i-a.ascent,l=a.fontSize;this.drawRectangle(e,o,t.width,l,h.bgcolor,h)}if(h.underlineThickness>0&&t.width>0){var d=i+h.underlineOffset-h.underlineThickness/2;this.drawLine(e,d,t.width,h.underlineThickness,h.underlineColor,h)}if(t.isTextPen&&(h.buildFont(),h.syncFont(r,n),h.syncStyle(r,n),this.drawText(e,i,t.text,h)),t.isImagePen&&this.drawImage(e,i,t.prop.img,t.prop.color,h),h.strikethroughThickness>0&&t.width>0&&(d=i+h.strikethroughOffset-h.strikethroughThickness/2,this.drawLine(e,d,t.width,h.strikethroughThickness,h.strikethroughColor,h)),n.restore(),t.hasAreaMarker&&t.width>0){var c,u=t.prop.area;if(u)c={key:u};else{var p=t.prop.url;c={key:`url:${p}`,url:p}}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,c)}},clear(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawRectangle(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var h=this.context;h.fillStyle=r,h.fillRect(t,e,i,s)},drawLine(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var h=this.context;n.syncShadow(h,n.shadowStroke);var a=h.lineCap;h.lineCap="butt",h.strokeStyle=r,h.lineWidth=s,h.beginPath(),h.moveTo(t,e),h.lineTo(t+i,e),h.stroke(),h.lineCap=a},drawText(t,e,i,s){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;s.stroke&&"none"!==s.stroke&&s.strokeThickness>0&&(s.syncShadow(r,s.shadowStroke),r.strokeText(i,t,e)),s.color&&"none"!==s.color&&(s.syncShadow(r,s.shadowFill),r.fillText(i,t,e))},drawImage(t,e,i,s,r){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,s,this.autoRound)}};const Wc=Phaser.Utils.Objects.GetValue,zc=Kh,Fc=qh;class jc{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=Wc(t,"text",""),this.x=Wc(t,"x",0),this.y=Wc(t,"y",0),this.width=Wc(t,"width",0);var e=Wc(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=Wc(t,"newLineMode",0),this.startIndex=Wc(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===Fc&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==zc&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===Fc&&(t+=1),t}get endIndex(){return this.startIndex+this.rawTextLength}get lastX(){return this.x+this.width}get isTextPen(){return""!==this.text}get isImagePen(){return!!this.prop.img}get hasAreaMarker(){return!!this.prop.area||!!this.prop.url}}const Ic=Phaser.Utils.Objects.GetFastValue,Bc=Kh,Hc=Zh;class Nc{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=Ic(t,"tagToText",Wt),this.tagToTextScope=Ic(t,"tagToTextScope",void 0)}destroy(){this.clear(),this.tagToText=void 0,this.tagToTextScope=void 0}clear(){for(var t=0,e=this.lines.length;t=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}getLineEndIndex(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,s=!1;for(e=t;e>=0&&!(s=null!=(i=this.lines[e])&&i.length>0);e--);return s?i[i.length-1].endIndex:0}getLineWidth(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}getMaxLineWidth(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,s=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}getLineWidths(){for(var t=[],e=0,i=this.lines.length;e=t&&o<=e||(h=h.substring(t-a,e-a)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,h,l,d):c+=this.tagToText(h,l,d),d=l,!(o>=e)));u++);return c}get length(){return this.lines.length}set length(t){this.clear()}}var Gc={};const Vc=Phaser.Geom.Rectangle;var Uc=new rl;class $c{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&ou(g)){""!==b?h.push(n.getLine(b,x,eu)):0===w&&r>0&&h.push(n.getLine("",0,eu)),h.push(...hu(g,e,ru,s,0,n));var C=h.pop();b=C.text,x=C.width,n.freeLine(C)," "===b&&(b="",x=0)}else(m=x+f)>o?(h.push(n.getLine(b,x,eu)),b=g,x=f,o=s):(b+=g,x=m),w===S-1&&h.push(n.getLine(b,x,l))}return h},au=function(t,e){var i;switch(e){case su:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==du&&i0&&t>e&&(t=e),t}get linesWidth(){return Math.ceil(this.penManager.getMaxLineWidth())}get linesHeight(){var t=this.displayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}get imageManager(){return this.parent.imageManager}get rtl(){return this.parent.style.rtl}newPenManager(){return new Nc({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}get tmpPenManager(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}getPlainText(t,e,i){var s;if(null==t)s=this.penManager.plainText;else{var r=this.parser.splitText(t,1);s="";for(var n=0,h=r.length;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return fp(this.sizerChildren,null),vh.call(this,t),this}},yp={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)fp(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},Sp={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=We.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,fp(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)fp(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},Op=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const Pp=Phaser.Utils.Objects.IsPlainObject,_p=Phaser.Utils.Objects.GetValue;class Tp extends th{constructor(t,e,i,s,r,n,h,a,o,l){Pp(e)?(e=_p(l=e,"x",0),i=_p(l,"y",0),s=_p(l,"width",void 0),r=_p(l,"height",void 0),n=_p(l,"column",l.col||0),h=_p(l,"row",0),a=_p(l,"columnProportions",0),o=_p(l,"rowProportions",0)):Pp(s)?(s=_p(l=s,"width",void 0),r=_p(l,"height",void 0),n=_p(l,"column",l.col||0),h=_p(l,"row",0),a=_p(l,"columnProportions",0),o=_p(l,"rowProportions",0)):Pp(n)?(n=_p(l=n,"column",l.col||0),h=_p(l,"row",0),a=_p(l,"columnProportions",0),o=_p(l,"rowProportions",0)):Pp(a)&&(a=_p(l=a,"columnProportions",0),o=_p(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(_p(l,"createCellContainerCallback")),this.setIndentLeft(_p(l,"space.indentLeftOdd",0),_p(l,"space.indentLeftEven",0)),this.setIndentTop(_p(l,"space.indentTopOdd",0),_p(l,"space.indentTopEven",0)),this.resetGrid(n,h,a,o,_p(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=Cp.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=Op.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(Tp.prototype,Sp);const kp=Phaser.Utils.Objects.GetValue,Ep=Phaser.Math.Percent;var Mp=function(t,e,i){var s;return t.y===e.y?s=Ep(i.x,t.x,e.x):t.x===e.x&&(s=Ep(i.y,t.y,e.y)),s},Rp=function(t,e,i){var s,r;this.enable&&(Lp.x=e,Lp.y=i,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint()),this.value=Mp(s,r,Lp))},Lp={},Dp=function(t,e,i){if(this.enable&&t.isDown){var s,r;Ap.x=t.worldX,Ap.y=t.worldY,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint());var n=Mp(s,r,Ap);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-n)<.1?this.value=n:this.easeValueTo(n)}},Ap={},Yp=function(t,e){void 0===e&&(e=Xp);var i=this.childrenMap.thumb,s=i.x,r=i.y;return ae(i,this.innerLeft,this.innerTop,this.innerWidth,this.innerHeight,t),e.x=i.x,e.y=i.y,i.x=s,i.y=r,e},Xp={};const Wp=Phaser.Display.Align.LEFT_CENTER,zp=Phaser.Display.Align.TOP_CENTER;var Fp={};const jp=Phaser.Display.Align.RIGHT_CENTER,Ip=Phaser.Display.Align.BOTTOM_CENTER;var Bp={};const Hp=Phaser.Math.Linear;var Np={};const Gp=Phaser.Display.Align.LEFT_CENTER,Vp=Phaser.Display.Align.TOP_CENTER,Up=Phaser.Display.Align.RIGHT_CENTER,$p=Phaser.Display.Align.BOTTOM_CENTER,Jp=Phaser.Utils.Objects.GetValue,Kp=Phaser.Utils.Objects.IsPlainObject,qp=Phaser.Math.Clamp,Zp=Phaser.Math.Snap.To;class Qp extends(hd(_h)){constructor(t,e){super(t,e),this.type="rexSlider",this.bootProgressBase(e),this.reverseAxis=Jp(e,"reverseAxis",!1);var i=Jp(e,"background",void 0),s=Jp(e,"track",void 0),r=Jp(e,"indicator",void 0),n=Jp(e,"thumb",void 0);if(i&&(Kp(i)&&(i=xc(t,i)),this.addBackground(i)),s&&(Kp(s)&&(s=xc(t,s)),this.add(s,{proportion:1,expand:!0,minWidth:0===this.orientation?0:void 0,minHeight:1===this.orientation?0:void 0})),r&&(Kp(r)&&(r=xc(t,r)),this.pin(r)),n){Kp(n)&&(n=xc(t,n)),this.pin(n);var h=Jp(e,"thumbOffsetX",0),a=Jp(e,"thumbOffsetY",0);this.setThumbOffset(h,a)}var o=Jp(e,"input",0);switch("string"==typeof o&&(o=tv[o]),o){case 0:n&&(n.setInteractive(),this.scene.input.setDraggable(n),n.on("drag",Rp,this).on("dragstart",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("dragend",(function(t){this.eventEmitter.emit("inputend",t)}),this));break;case 1:this.on("pointerdown",Dp,this).on("pointermove",Dp,this).on("pointerdown",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("pointerup",(function(t){this.eventEmitter.emit("inputend",t)}),this).on("pointerover",(function(t){t.isDown&&this.eventEmitter.emit("inputstart",t)}),this).on("pointerout",(function(t){t.isDown&&this.eventEmitter.emit("inputend",t)}),this).setInteractive()}this.addChildrenMap("background",i),this.addChildrenMap("track",s),this.addChildrenMap("indicator",r),this.addChildrenMap("thumb",n),this.setEnable(Jp(e,"enable",void 0));var l=Jp(e,"tick",void 0);void 0===l&&(l=Jp(e,"gap",void 0)),this.setGap(l),this.setValue(Jp(e,"value",0),Jp(e,"min",void 0),Jp(e,"max",void 0))}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setGap(t,e,i){return t&&void 0!==e&&(t/=i-e),this.gap=t,this}setTick(t,e,i){return this.setGap(t,e,i),this}get tick(){return this.gap}set tick(t){this.gap=t}setThumbOffset(t,e){return this.thumbOffsetX=t,this.thumbOffsetY=e,this}get value(){return this._value}set value(t){void 0!==this.gap&&(t=Zp(t,this.gap));var e=this._value;this._value=qp(t,0,1),e!==this._value&&(this.updateThumb(this._value),this.updateIndicator(this._value),this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter))}postLayout(t,e,i){return this.updateThumb(),this.updateIndicator(),super.postLayout(t,e,i),this}}const tv={pan:0,drag:0,click:1,none:-1};var ev={getStartPoint:function(t){if(void 0===t&&(t=Fp),this.childrenMap.thumb){var e=0===this.orientation?Wp:zp;Yp.call(this,e,t)}else 0===this.orientation?(t.x=this.innerLeft+1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerTop+1);return t},getEndPoint:function(t){if(void 0===t&&(t=Bp),this.childrenMap.thumb){var e=0===this.orientation?jp:Ip;Yp.call(this,e,t)}else 0===this.orientation?(t.x=this.innerRight-1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerBottom-1);return t},updateThumb:function(t){var e,i,s=this.childrenMap.thumb;return void 0===s||(void 0===t&&(t=this.value),this.reverseAxis?(e=this.getEndPoint(),i=this.getStartPoint()):(e=this.getStartPoint(),i=this.getEndPoint()),function(t,e,i,s){void 0===s&&(s=Np),s.x=Hp(e.x,i.x,t),s.y=Hp(e.y,i.y,t)}(t,e,i,s),s.x+=this.thumbOffsetX,s.y+=this.thumbOffsetY,this.resetChildPositionState(s)),this},updateIndicator:function(t){var e=this.childrenMap.indicator;if(void 0===e)return this;void 0===t&&(t=this.value);var i,s,r,n=this.reverseAxis,h=this.childrenMap.thumb;if(h)if(0===this.orientation){var a,o=Q(h);if(n)a=h.x-o*h.originX,i=this.right-a;else i=(a=h.x-o*h.originX)+o-this.left}else{var l,d=tt(h);if(n)l=h.y-d*h.originY,s=this.bottom-l;else s=(l=h.y-d*h.originY)+d-this.top}else 0===this.orientation?i=this.width*t:s=this.height*t;Ne(e,i,s),r=n?0===this.orientation?Up:$p:0===this.orientation?Gp:Vp,he(e,this,r),this.resetChildPositionState(e)}};Object.assign(Qp.prototype,ev);const iv=Phaser.Utils.Objects.GetValue;class sv extends _h{constructor(t,e){super(t,e),this.type="rexScrollBar";var i,s,r=iv(e,"background",void 0),n=iv(e,"buttons",void 0),h=iv(n,"top",iv(n,"left",void 0)),a=iv(n,"bottom",iv(n,"right",void 0)),o=iv(e,"slider",void 0);(r&&this.addBackground(r),h&&(this.add(h),new Mr(h).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?this.scrollStep:-this.scrollStep;this.value+=t}}),this)),o)&&(o.orientation=this.orientation,o.eventEmitter=this,o.value=null,s=0===this.orientation?void 0===iv(o,"width",void 0)?1:0:void 0===iv(o,"height",void 0)?1:0,i=new Qp(t,o),t.add.existing(i),this.add(i,{proportion:s}));a&&(this.add(a),new Mr(a).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?-this.scrollStep:this.scrollStep;this.value+=t}}),this));var l=[h,a];this.addChildrenMap("background",r),this.addChildrenMap("slider",i),this.addChildrenMap("buttons",l);var d=iv(e,"valuechangeCallback",null);if(null!==d){var c=iv(e,"valuechangeCallbackScope",void 0);this.on("valuechange",d,c)}this.setEnable(iv(e,"enable",void 0)),this.setValue(iv(e,"value",0)),this.setScrollStep(iv(n,"step",.01))}setScrollStep(t){return this.scrollStep=t,this}get enable(){return!!this.childrenMap.slider&&this.childrenMap.slider.enable}set enable(t){this.childrenMap.slider&&this.childrenMap.slider.setEnable(t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get value(){return this.childrenMap.slider?this.childrenMap.slider.value:0}set value(t){this.childrenMap.slider&&(this.childrenMap.slider.value=t)}setValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setValue(t,e,i),this}addValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.addValue(t,e,i),this}getValue(t,e){return this.childrenMap.slider?this.childrenMap.slider.getValue(t,e):0}easeValueTo(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.easeValueTo(t,e,i),this}stopEaseValue(){return this.childrenMap.slider&&this.childrenMap.slider.stopEaseValue(),this}setEaseValueDuration(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueDuration(t),this}setEaseValueFunction(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueFunction(t),this}setGap(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setGap(t,e,i),this}get gap(){if(this.childrenMap.slider)return this.childrenMap.slider.gap}set gap(t){this.childrenMap.slider&&(this.childrenMap.slider.gap=t)}setTick(t,e,i){return this.setGap(t,e,i),this}get tick(){if(this.childrenMap.slider)return this.childrenMap.slider.tick}set tick(t){this.childrenMap.slider&&(this.childrenMap.slider.tick=t)}}class rv extends Rs{constructor(t,e){super(e),this.parent=t,this.init()}init(){this.start("IDLE")}next_IDLE(){var t,e=this.parent;return e.dragState.isDown&&(t=0===e.dragThreshold?"DRAG":"DRAGBEGIN"),t}update_IDLE(t,e){this.next()}next_DRAGBEGIN(){var t=this.parent,e=t.dragState;return e.isDown?e.pointer.getDistance()>=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const nv=Phaser.Utils.Objects.GetValue,hv=Phaser.Math.Distance.Between;class av extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=nv(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(nv(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(nv(t,"enable",!0)),this.holdThreshold=nv(t,"holdThreshold",50),this.pointerOutReleaseEnable=nv(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return dn(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:hv(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!or(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!or(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const ov=Phaser.Utils.Objects.GetValue;class lv{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(ov(t,"value",0)),this.setSpeed(ov(t,"speed",0)),this.setAcceleration(ov(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class dv{constructor(){this.value,this.dir,this.movement=new lv}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const vv={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},gv=Phaser.Utils.Objects.GetValue;class fv extends ii{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=gv(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(gv(e,"speed",.1)),this.setEnable(gv(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(gv(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||or(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const mv=Phaser.Utils.Objects.GetValue;var yv=function(t,e,i,s){var r,n,h="Y"===(i=i.toUpperCase()),a=2===t.scrollMode,o=t.childrenMap.child,l=`slider${i}`;if(r=a||s.hasOwnProperty(l)?mv(s,l,void 0):mv(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=h?1:0,n=function(t,e){void 0===e&&(e={});var i=mt(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new sv(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r),n.tickLength=mv(r,"tickLength",void 0);var p=mv(r,"position",0);"string"==typeof p&&(p=bv[p]);var v,g,f=mv(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=mv(s,"space.slider",void 0))&&(a?f=0:v=mv(s,"space.child",0)),g=void 0===v?"number"==typeof f:"number"==typeof v,h?0===p?(d=2,c=1,u=void 0===v?g?{left:f}:f:{left:mv(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:mv(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:mv(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:mv(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=mv(r,"hideUnscrollableSlider",!1),t[`disableUnscrollableDrag${i}`]=mv(r,"disableUnscrollableDrag",!1),t[`adaptThumb${i}SizeMode`]=mv(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=mv(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`disableUnscrollableDrag${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=mv(s,"scrollDetectionMode");"string"==typeof b&&(b=xv[b]);var x=`scroller${i}`;(m=a||s.hasOwnProperty(x)?mv(s,x,!0):mv(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new pv(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var w,S,C,O,P,_=mv(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);_&&o&&(void 0!==b&&(_.focus=1===b?2:0),w=new fv(o,_)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,w),a&&!h||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.disableUnscrollableDrag=t[`disableUnscrollableDrag${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",w)),n&&(a?(S=h?"t":"s",O=`scroll${i}`):(S="t",O="scroll"),n.on("valuechange",(function(e){t[S]=e,t.emit(O,t)}))),y&&(a?(C=`childO${i}`,O=`scroll${i}`):(C="childOY",O="scroll"),y.on("valuechange",(function(e){t[C]=e,t.emit(O,t)}))),w&&(P=a?`addChildO${i}`:"addChildOY",w.on("scroll",(function(e){t[P](-e,!0)})))};const bv={right:0,left:1,bottom:0,top:1},xv={gameObject:0,rectBounds:1},wv=Phaser.Utils.Objects.GetValue;var Sv=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=wv(e,"width"),h=wv(e,"height");n||wv(e,"child.expandWidth",!0)||(s[1]=0),h||wv(e,"child.expandHeight",!0)||(r[1]=0);var a=new Tp(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=kp(i,"child"),r=kp(s,"gameObject",void 0);if(r){var n=kp(i,"space.child",0);t.childMargin={};var h=t.childMargin,a={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:h.top=0,h.bottom=0,h.left=0,h.right=0;break;default:h.top=n,h.bottom=n,h.left=n,h.right=n}else switch(t.scrollMode){case 0:h.top=kp(n,"top",0),h.bottom=kp(n,"bottom",0),a.left=kp(n,"left",0),a.right=kp(n,"right",0);break;case 1:h.top=kp(n,"left",0),h.bottom=kp(n,"right",0),a.top=kp(n,"top",0),a.bottom=kp(n,"bottom",0);break;default:h.top=kp(n,"top",0),h.bottom=kp(n,"bottom",0),h.left=kp(n,"left",0),h.right=kp(n,"right",0)}e.add(r,{column:1,row:1,align:kp(s,"align","center"),padding:a,expand:{width:kp(s,"expandWidth",!0),height:kp(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:yv(t,a,"y",e);break;case 1:yv(t,a,"x",e);break;default:yv(t,a,"y",e),yv(t,a,"x",e)}return a},Cv=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}i*="Y"===t?this.scaleY:this.scaleX,s&&s.setBounds(e,i),r&&(r.setEnable(e!==i),r.tickLength&&r.setTick(r.tickLength,e,i))},Ov=function(t){switch(this.scrollMode){case 0:case 1:(i=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(i,this.isOverflow),(r=this.childrenMap.scroller)&&this.disableUnscrollableDrag&&r.setEnable(this.isOverflow);break;default:var e=this[`isOverflow${t=t.toUpperCase()}`],i=this.childrenMap[`slider${t}`],s=this[`hideUnscrollableSlider${t}`];i&&s&&this.setChildVisible(i,e);var r=this.childrenMap.scroller,n=this[`disableUnscrollableDrag${t}`];r&&n&&r.setEnable(e)}},Pv=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(a=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=a.childrenMap.track,s=a.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&n0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n")}return i}(this.textObject,this.text,this.lines),this.linesCount=this.lines.length,this._textHeight=void 0,this._textVisibleHeight=void 0,this.updateTextObject(),this},updateTextObject:function(){var t=Math.max(Math.floor(Rv.call(this,-this.textOY)),0),e=Lv.call(this,t)+this.textOY,i=Dv.call(this,t);return function(t,e){switch(Gh(t)){case 0:var i=(r=t.style).wordWrapWidth,s=r.wordWrapCallback;r.wordWrapWidth=0,r.wordWrapCallback=void 0,t.setText(e),r.wordWrapWidth=i,r.wordWrapCallback=s;break;case 1:var r,n=(r=t.style).wrapMode;r.wrapMode=0,t.setText(e),r.wrapMode=n;break;case 2:var h=t._maxWidth;t._maxWidth=0,t.setText(e),t._maxWidth=h}}(this.textObject,i),this.textObject.rexSizer.offsetY=e,Av.call(this),this},preLayout:function(){return this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,Ie.call(this),this},layoutChildren:function(){var t,e,i,s,r,n,h,a=this.left,o=this.top;(t=this.textObject).rexSizer.hidden||(s=a+(i=(e=t.rexSizer).padding).left*this.scaleX,r=o+i.top*this.scaleY,n=this.width*this.scaleX-(i.left+i.right)*this.scaleX,h=this.height*this.scaleY-(i.top+i.bottom)*this.scaleY,Xv.call(this,t,n,h),ae(t,s,r,n,h,e.align),e.preOffsetY=0,Av.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const zv=Phaser.Utils.Objects.IsPlainObject,Fv=Phaser.Utils.Objects.GetValue,jv=Phaser.Display.Align.TOP_LEFT;class Iv extends th{constructor(t,e,i,s,r,n){zv(e)?(e=Fv(n=e,"x",0),i=Fv(n,"y",0),s=Fv(n,"width",void 0),r=Fv(n,"height",void 0)):zv(s)&&(s=Fv(n=s,"width",void 0),r=Fv(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexTextBlock",this.textObject=void 0,this.linesCount=0,this.textMask=void 0,this.textObjectType=void 0,this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,this._textObjectRealHeight=0,this.lines=void 0,this.text=Fv(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode(Fv(n,"clampTextOY",!0)),this.alwaysScrollable=Fv(n,"alwaysScrollable",!1);var h=Fv(n,"background",void 0),a=Fv(n,"text",void 0);void 0===a&&(a=Bv(t)),this.textCropEnable=Fv(n,"textCrop",!!a.setCrop);var o=Fv(n,"textMask",!this.textCropEnable);h&&this.addBackground(h),this.add(a),this.sizerChildren=[a];var l=this.getSizerConfig(a);l.align=jv,l.padding=ge(0),l.expand=!0,this.textObject=a,this.textObjectType=Gh(a),l.preOffsetY=0,l.offsetY=0,o&&(this.textMask=jh.call(this,this.textObject,this)),this.addChildrenMap("background",h),this.addChildrenMap("text",a)}destroy(t){if(this.scene&&!this.ignoreDestroy){if(this.textObject=void 0,this.textMask=void 0,this.lines){switch(this.textObjectType){case 0:case 2:this.lines.length=0;break;case 1:this.lines.destroy()}this.lines=void 0}super.destroy(t)}}setClampMode(t){return void 0===t&&(t=!0),this.clampTextOY=t,this}get textLineHeight(){if(void 0===this._textLineHeight){var t;switch(this.textObjectType){case 0:case 1:var e=this.textObject.style;t=e.metrics.fontSize+e.strokeThickness;break;case 2:var i=this.textObject.fontSize/this.textObject.fontData.size;t=this.textObject.fontData.lineHeight*i}this._textLineHeight=t}return this._textLineHeight}get textLineSpacing(){if(void 0===this._textLineSpacing){var t;switch(this.textObjectType){case 0:case 1:t=this.textObject.lineSpacing;break;case 2:t=0}this._textLineSpacing=t}return this._textLineSpacing}get visibleLinesCount(){return void 0===this._visibleLinesCount&&(this._visibleLinesCount=Math.floor(Rv.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=Lv.call(this,this.linesCount)),this._textHeight}get textObjectHeight(){return this._textObjectRealHeight-(this.textLineHeight+this.textLineSpacing)}get textVisibleHeight(){if(void 0===this._textVisibleHeight){var t=this.textHeight-this.textObjectHeight;!this.alwaysScrollable&&t<0&&(t=0),this._textVisibleHeight=t}return this._textVisibleHeight}textOYExceedTop(t){return void 0===t&&(t=this.textOY),t>this.topTextOY}textOYExeceedBottom(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:s?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}setTextOY(t){return this.textOY=t,this}set t(t){this.textOY=-this.textVisibleHeight*t}get t(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t}setTextOYByPercentage(t){return this.t=t,this}}var Bv=function(t){return t.add.text(0,0,"")};Object.assign(Iv.prototype,Wv);var Hv={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},Nv={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const Gv=Phaser.Utils.Objects.GetValue;class Vv extends Ev{constructor(t,e){void 0===e&&(e={});var i=Gv(e,"text",void 0),s=Gv(e,"textWidth",void 0),r=Gv(e,"textHeight",void 0),n=Gv(e,"textCrop",!!i.setCrop),h=Gv(e,"textMask",!n),a=Gv(e,"content",""),o=new Iv(t,{width:s,height:r,text:i,textMask:h,textCrop:n&&!h,content:a,clampTextOY:Gv(e,"clampChildOY",!1),alwaysScrollable:Gv(e,"alwaysScrollable",!1)});t.add.existing(o),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textObjectHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.textHeight}})}(o),e.scrollMode=0,e.type="rexTextArea",e.child={gameObject:o,expandWidth:void 0===s,expandHeight:void 0===r};var l=Gv(e,"space",void 0);l&&(l.child=Gv(l,"text",0)),super(t,e),this.addChildrenMap("text",i)}get text(){return this.childrenMap.child.text}get lineHeight(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.textHeight}}Object.assign(Vv.prototype,Hv,Nv);const Uv=Phaser.Utils.Objects.GetValue;var $v=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("key")&&(i="bitmaptext",e.font=e.key)),i){case"bitmaptext":case"bitmap":s=new hp(t,e);break;case"bbcodetext":case"bbcode":s=new ip(t,0,0,"",e);break;case"label":s=new qv(t,e);break;case"textarea":s=function(t,e,i){e=e?So(e):{};var s=Uv(i,"background",xc),r=Uv(i,"text",$v),n=Uv(i,"track",xc),h=Uv(i,"thumb",xc);s?e.background=s(t,e.background):delete e.background,r?e.text=r(t,e.text):delete e.text;var a=e.slider;!1!==a&&null!==a&&(void 0===a&&(a={}),n?a.track=n(t,a.track):delete a.track,h?a.thumb=h(t,a.thumb):delete a.thumb,e.slider=a);var o=new Vv(t,e);return t.add.existing(o),o}(t,e);break;default:s=new Cc(t,e)}return bc(s,e),t.add.existing(s),s},Jv=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("leftWidth")?i="nineSlice":(e.hasOwnProperty("color")||e.hasOwnProperty("strokeColor"))&&(i="roundRectangle")),i){case"nineSlice":s=e.hasOwnProperty("stretchMode")?new mc(t,e):new Jd(t,e);break;case"roundRectangle":s=new Gl(t,e);break;default:s=new Qd(t,e)}return bc(s,e),t.add.existing(s),s};const Kv=Phaser.Utils.Objects.GetValue;class qv extends bl{constructor(t,e,i){e=function(t,e,i){e=e?So(e):{};var s=Kv(i,"background",xc),r=Kv(i,"text",$v),n=Kv(i,"icon",Jv),h=Kv(i,"action",Jv);return null!==e.background&&s?e.background=s(t,e.background):delete e.background,null!==e.text&&r?e.text=r(t,e.text):delete e.text,null!==e.icon&&n?e.icon=n(t,e.icon):delete e.icon,null!==e.action&&h?e.action=h(t,e.action):delete e.action,e}(t,e,i),super(t,e),this.type="rexSimpleLabel"}setActiveState(t){return Zv(this.getChildren(),"setActiveState",t),this}setHoverState(t){return Zv(this.getChildren(),"setHoverState",t),this}setDisableState(t){return Zv(this.getChildren(),"setDisableState",t),this}}var Zv=function(t,e,i){for(var s=0,r=t.length;so;d--){for(c=0;c0&&this.wrapMode!==Qh&&0===this.wrapWidth}setStyle(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wordWrap")){var s=t.wordWrap;s.hasOwnProperty("width")&&(t.wrap={mode:"word",width:s.width})}if(t&&t.hasOwnProperty("wrap")){var r=t.wrap;if(r.hasOwnProperty("mode")){var n=r.mode;"string"==typeof n&&(r.mode=sa[n])}else r.hasOwnProperty("width")&&(r.mode=1)}t&&t.rtl&&i&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var h=this.propertyMap;for(var a in h){var o=h[a],l=o[0],d=i?o[1]:this[a],c=o[2];if("wrapCallback"===a||"wrapCallbackScope"===a)this[a]=Yc(t,l,d);else{var u=Ac(t,l,d);c&&(u=c(u)),this[a]=u}}var p=Yc(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var v=Yc(t,"fill",null);null!==v&&(this.color=za(v));var g=Yc(t,"metrics",!1);return g?this.metrics={ascent:Yc(g,"ascent",0),descent:Yc(g,"descent",0),fontSize:Yc(g,"fontSize",0)}:!e&&this.metrics||(this.metrics=Dc(this)),e?this.parent.updateText():this.parent}syncFont(t,e){e.font=this._font}syncStyle(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"}syncShadow(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)}update(t){return t&&(this._font=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim(),this.metrics=Dc(this)),this.parent.updateText(t)}buildFont(){var t=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim();return t!==this._font&&(this._font=t),this}setFont(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=Yc(t,"fontFamily","Courier"),this.fontSize=Yc(t,"fontSize","16px"),this.fontStyle=Yc(t,"fontStyle","")),this.update(!0)}setFontFamily(t){return this.fontFamily=t,this.update(!0)}setFontStyle(t){return this.fontStyle=t,this.update(!0)}setFontSize(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}setTestString(t){return this.testString=t,this.update(!0)}setFixedSize(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}setResolution(t){return this.resolution=t,this.update(!1)}setXOffset(t){return this.xOffset=t,this.update(!1)}setBackgroundColor(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=za(t,this.parent.canvas,this.parent.context),this.backgroundColor2=za(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=za(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}setBackgroundCornerRadius(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}setFill(t){return this.color=za(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=za(t,this.parent.canvas,this.parent.context),this.update(!1)}setStroke(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=za(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}setShadow(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===n&&(n=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=za(i,this.parent.canvas,this.parent.context),this.shadowBlur=s,this.shadowStroke=r,this.shadowFill=n,this.update(!1)}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}setShadowColor(t){return void 0===t&&(t="#000"),this.shadowColor=za(t,this.parent.canvas,this.parent.context),this.update(!1)}setShadowBlur(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}setShadowStroke(t){return this.shadowStroke=t,this.update(!1)}setShadowFill(t){return this.shadowFill=t,this.update(!1)}setUnderline(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=za(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}setUnderlineColor(t){return void 0===t&&(t="#000"),this.underlineColor=za(t,this.parent.canvas,this.parent.context),this.update(!1)}setUnderlineThickness(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}setUnderlineOffset(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}setStrikethrough(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=za(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}setStrikethroughColor(t){return void 0===t&&(t="#000"),this.strikethroughColor=za(t,this.parent.canvas,this.parent.context),this.update(!1)}setStrikethroughThickness(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}setStrikethroughOffset(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}setWrapMode(t){return"string"==typeof t&&(t=sa[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}setWrapWidth(t){return this.wrapWidth=t,this.update(!1)}setAlign(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}setHAlign(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}setVAlign(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}setMaxLines(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}getTextMetrics(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}setTextMetrics(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=Yc(e,"fontFamily",this.fontFamily),this.fontSize=Yc(e,"fontSize",this.fontSize),this.fontStyle=Yc(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}get lineHeight(){return this.metrics.fontSize+this.parent.lineSpacing}toJSON(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}destroy(){this.parent=void 0}}var Wc={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var h=this.defaultStyle;this.clear(),Ka(this,h.backgroundColor,h.backgroundStrokeColor,h.backgroundStrokeLineWidth,h.backgroundCornerRadius,h.backgroundColor2,h.backgroundHorizontalGradient,h.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var a,o,l,d,c,u,p=h.halign,v=h.valign,g=h.lineHeight,f=r.lines,m=f.length,y=h.maxLines;y>0&&m>y?(o=y,l="center"===v?Math.floor((m-o)/2):"bottom"===v?m-o:0):(o=m,l=0),d=l+o;var b=this.rtl,x=b?this.parent.width:void 0;u="center"===v?Math.max((s-o*g)/2,0):"bottom"===v?Math.max(s-o*g-2,0):0,u+=e;for(var w=l;w0){var a=this.defaultStyle.metrics,o=i-a.ascent,l=a.fontSize;this.drawRectangle(e,o,t.width,l,h.bgcolor,h)}if(h.underlineThickness>0&&t.width>0){var d=i+h.underlineOffset-h.underlineThickness/2;this.drawLine(e,d,t.width,h.underlineThickness,h.underlineColor,h)}if(t.isTextPen&&(h.buildFont(),h.syncFont(r,n),h.syncStyle(r,n),this.drawText(e,i,t.text,h)),t.isImagePen&&this.drawImage(e,i,t.prop.img,t.prop.color,h),h.strikethroughThickness>0&&t.width>0&&(d=i+h.strikethroughOffset-h.strikethroughThickness/2,this.drawLine(e,d,t.width,h.strikethroughThickness,h.strikethroughColor,h)),n.restore(),t.hasAreaMarker&&t.width>0){var c,u=t.prop.area;if(u)c={key:u};else{var p=t.prop.url;c={key:`url:${p}`,url:p}}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,c)}},clear(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawRectangle(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var h=this.context;h.fillStyle=r,h.fillRect(t,e,i,s)},drawLine(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var h=this.context;n.syncShadow(h,n.shadowStroke);var a=h.lineCap;h.lineCap="butt",h.strokeStyle=r,h.lineWidth=s,h.beginPath(),h.moveTo(t,e),h.lineTo(t+i,e),h.stroke(),h.lineCap=a},drawText(t,e,i,s){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;s.stroke&&"none"!==s.stroke&&s.strokeThickness>0&&(s.syncShadow(r,s.shadowStroke),r.strokeText(i,t,e)),s.color&&"none"!==s.color&&(s.syncShadow(r,s.shadowFill),r.fillText(i,t,e))},drawImage(t,e,i,s,r){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,s,this.autoRound)}};const zc=Phaser.Utils.Objects.GetValue,Fc=Kh,jc=qh;class Ic{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=zc(t,"text",""),this.x=zc(t,"x",0),this.y=zc(t,"y",0),this.width=zc(t,"width",0);var e=zc(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=zc(t,"newLineMode",0),this.startIndex=zc(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===jc&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==Fc&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===jc&&(t+=1),t}get endIndex(){return this.startIndex+this.rawTextLength}get lastX(){return this.x+this.width}get isTextPen(){return""!==this.text}get isImagePen(){return!!this.prop.img}get hasAreaMarker(){return!!this.prop.area||!!this.prop.url}}const Bc=Phaser.Utils.Objects.GetFastValue,Hc=Kh,Nc=Zh;class Gc{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=Bc(t,"tagToText",Wt),this.tagToTextScope=Bc(t,"tagToTextScope",void 0)}destroy(){this.clear(),this.tagToText=void 0,this.tagToTextScope=void 0}clear(){for(var t=0,e=this.lines.length;t=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}getLineEndIndex(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,s=!1;for(e=t;e>=0&&!(s=null!=(i=this.lines[e])&&i.length>0);e--);return s?i[i.length-1].endIndex:0}getLineWidth(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}getMaxLineWidth(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,s=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}getLineWidths(){for(var t=[],e=0,i=this.lines.length;e=t&&o<=e||(h=h.substring(t-a,e-a)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,h,l,d):c+=this.tagToText(h,l,d),d=l,!(o>=e)));u++);return c}get length(){return this.lines.length}set length(t){this.clear()}}var Vc={};const Uc=Phaser.Geom.Rectangle;var $c=new rl;class Jc{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&lu(g)){""!==b?h.push(n.getLine(b,x,iu)):0===w&&r>0&&h.push(n.getLine("",0,iu)),h.push(...au(g,e,nu,s,0,n));var C=h.pop();b=C.text,x=C.width,n.freeLine(C)," "===b&&(b="",x=0)}else(m=x+f)>o?(h.push(n.getLine(b,x,iu)),b=g,x=f,o=s):(b+=g,x=m),w===S-1&&h.push(n.getLine(b,x,l))}return h},ou=function(t,e){var i;switch(e){case ru:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==cu&&i0&&t>e&&(t=e),t}get linesWidth(){return Math.ceil(this.penManager.getMaxLineWidth())}get linesHeight(){var t=this.displayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}get imageManager(){return this.parent.imageManager}get rtl(){return this.parent.style.rtl}newPenManager(){return new Gc({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}get tmpPenManager(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}getPlainText(t,e,i){var s;if(null==t)s=this.penManager.plainText;else{var r=this.parser.splitText(t,1);s="";for(var n=0,h=r.length;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return mp(this.sizerChildren,null),vh.call(this,t),this}},bp={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)mp(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},Cp={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=We.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,mp(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)mp(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},Pp=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const _p=Phaser.Utils.Objects.IsPlainObject,Tp=Phaser.Utils.Objects.GetValue;class kp extends th{constructor(t,e,i,s,r,n,h,a,o,l){_p(e)?(e=Tp(l=e,"x",0),i=Tp(l,"y",0),s=Tp(l,"width",void 0),r=Tp(l,"height",void 0),n=Tp(l,"column",l.col||0),h=Tp(l,"row",0),a=Tp(l,"columnProportions",0),o=Tp(l,"rowProportions",0)):_p(s)?(s=Tp(l=s,"width",void 0),r=Tp(l,"height",void 0),n=Tp(l,"column",l.col||0),h=Tp(l,"row",0),a=Tp(l,"columnProportions",0),o=Tp(l,"rowProportions",0)):_p(n)?(n=Tp(l=n,"column",l.col||0),h=Tp(l,"row",0),a=Tp(l,"columnProportions",0),o=Tp(l,"rowProportions",0)):_p(a)&&(a=Tp(l=a,"columnProportions",0),o=Tp(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(Tp(l,"createCellContainerCallback")),this.setIndentLeft(Tp(l,"space.indentLeftOdd",0),Tp(l,"space.indentLeftEven",0)),this.setIndentTop(Tp(l,"space.indentTopOdd",0),Tp(l,"space.indentTopEven",0)),this.resetGrid(n,h,a,o,Tp(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=Op.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=Pp.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(kp.prototype,Cp);const Ep=Phaser.Utils.Objects.GetValue,Mp=Phaser.Math.Percent;var Rp=function(t,e,i){var s;return t.y===e.y?s=Mp(i.x,t.x,e.x):t.x===e.x&&(s=Mp(i.y,t.y,e.y)),s},Lp=function(t,e,i){var s,r;this.enable&&(Dp.x=e,Dp.y=i,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint()),this.value=Rp(s,r,Dp))},Dp={},Ap=function(t,e,i){if(this.enable&&t.isDown){var s,r;Yp.x=t.worldX,Yp.y=t.worldY,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint());var n=Rp(s,r,Yp);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-n)<.1?this.value=n:this.easeValueTo(n)}},Yp={},Xp=function(t,e){void 0===e&&(e=Wp);var i=this.childrenMap.thumb,s=i.x,r=i.y;return ae(i,this.innerLeft,this.innerTop,this.innerWidth,this.innerHeight,t),e.x=i.x,e.y=i.y,i.x=s,i.y=r,e},Wp={};const zp=Phaser.Display.Align.LEFT_CENTER,Fp=Phaser.Display.Align.TOP_CENTER;var jp={};const Ip=Phaser.Display.Align.RIGHT_CENTER,Bp=Phaser.Display.Align.BOTTOM_CENTER;var Hp={};const Np=Phaser.Math.Linear;var Gp={};const Vp=Phaser.Display.Align.LEFT_CENTER,Up=Phaser.Display.Align.TOP_CENTER,$p=Phaser.Display.Align.RIGHT_CENTER,Jp=Phaser.Display.Align.BOTTOM_CENTER,Kp=Phaser.Utils.Objects.GetValue,qp=Phaser.Utils.Objects.IsPlainObject,Zp=Phaser.Math.Clamp,Qp=Phaser.Math.Snap.To;class tv extends(hd(_h)){constructor(t,e){super(t,e),this.type="rexSlider",this.bootProgressBase(e),this.reverseAxis=Kp(e,"reverseAxis",!1);var i=Kp(e,"background",void 0),s=Kp(e,"track",void 0),r=Kp(e,"indicator",void 0),n=Kp(e,"thumb",void 0);if(i&&(qp(i)&&(i=wc(t,i)),this.addBackground(i)),s&&(qp(s)&&(s=wc(t,s)),this.add(s,{proportion:1,expand:!0,minWidth:0===this.orientation?0:void 0,minHeight:1===this.orientation?0:void 0})),r&&(qp(r)&&(r=wc(t,r)),this.pin(r)),n){qp(n)&&(n=wc(t,n)),this.pin(n);var h=Kp(e,"thumbOffsetX",0),a=Kp(e,"thumbOffsetY",0);this.setThumbOffset(h,a)}var o=Kp(e,"input",0);switch("string"==typeof o&&(o=ev[o]),o){case 0:n&&(n.setInteractive(),this.scene.input.setDraggable(n),n.on("drag",Lp,this).on("dragstart",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("dragend",(function(t){this.eventEmitter.emit("inputend",t)}),this));break;case 1:this.on("pointerdown",Ap,this).on("pointermove",Ap,this).on("pointerdown",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("pointerup",(function(t){this.eventEmitter.emit("inputend",t)}),this).on("pointerover",(function(t){t.isDown&&this.eventEmitter.emit("inputstart",t)}),this).on("pointerout",(function(t){t.isDown&&this.eventEmitter.emit("inputend",t)}),this).setInteractive()}this.addChildrenMap("background",i),this.addChildrenMap("track",s),this.addChildrenMap("indicator",r),this.addChildrenMap("thumb",n),this.setEnable(Kp(e,"enable",void 0));var l=Kp(e,"tick",void 0);void 0===l&&(l=Kp(e,"gap",void 0)),this.setGap(l),this.setValue(Kp(e,"value",0),Kp(e,"min",void 0),Kp(e,"max",void 0))}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setGap(t,e,i){return t&&void 0!==e&&(t/=i-e),this.gap=t,this}setTick(t,e,i){return this.setGap(t,e,i),this}get tick(){return this.gap}set tick(t){this.gap=t}setThumbOffset(t,e){return this.thumbOffsetX=t,this.thumbOffsetY=e,this}get value(){return this._value}set value(t){void 0!==this.gap&&(t=Qp(t,this.gap));var e=this._value;this._value=Zp(t,0,1),e!==this._value&&(this.updateThumb(this._value),this.updateIndicator(this._value),this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter))}postLayout(t,e,i){return this.updateThumb(),this.updateIndicator(),super.postLayout(t,e,i),this}}const ev={pan:0,drag:0,click:1,none:-1};var iv={getStartPoint:function(t){if(void 0===t&&(t=jp),this.childrenMap.thumb){var e=0===this.orientation?zp:Fp;Xp.call(this,e,t)}else 0===this.orientation?(t.x=this.innerLeft+1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerTop+1);return t},getEndPoint:function(t){if(void 0===t&&(t=Hp),this.childrenMap.thumb){var e=0===this.orientation?Ip:Bp;Xp.call(this,e,t)}else 0===this.orientation?(t.x=this.innerRight-1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerBottom-1);return t},updateThumb:function(t){var e,i,s=this.childrenMap.thumb;return void 0===s||(void 0===t&&(t=this.value),this.reverseAxis?(e=this.getEndPoint(),i=this.getStartPoint()):(e=this.getStartPoint(),i=this.getEndPoint()),function(t,e,i,s){void 0===s&&(s=Gp),s.x=Np(e.x,i.x,t),s.y=Np(e.y,i.y,t)}(t,e,i,s),s.x+=this.thumbOffsetX,s.y+=this.thumbOffsetY,this.resetChildPositionState(s)),this},updateIndicator:function(t){var e=this.childrenMap.indicator;if(void 0===e)return this;void 0===t&&(t=this.value);var i,s,r,n=this.reverseAxis,h=this.childrenMap.thumb;if(h)if(0===this.orientation){var a,o=Q(h);if(n)a=h.x-o*h.originX,i=this.right-a;else i=(a=h.x-o*h.originX)+o-this.left}else{var l,d=tt(h);if(n)l=h.y-d*h.originY,s=this.bottom-l;else s=(l=h.y-d*h.originY)+d-this.top}else 0===this.orientation?i=this.width*t:s=this.height*t;Ne(e,i,s),r=n?0===this.orientation?$p:Jp:0===this.orientation?Vp:Up,he(e,this,r),this.resetChildPositionState(e)}};Object.assign(tv.prototype,iv);const sv=Phaser.Utils.Objects.GetValue;class rv extends _h{constructor(t,e){super(t,e),this.type="rexScrollBar";var i,s,r=sv(e,"background",void 0),n=sv(e,"buttons",void 0),h=sv(n,"top",sv(n,"left",void 0)),a=sv(n,"bottom",sv(n,"right",void 0)),o=sv(e,"slider",void 0);(r&&this.addBackground(r),h&&(this.add(h),new Mr(h).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?this.scrollStep:-this.scrollStep;this.value+=t}}),this)),o)&&(o.orientation=this.orientation,o.eventEmitter=this,o.value=null,s=0===this.orientation?void 0===sv(o,"width",void 0)?1:0:void 0===sv(o,"height",void 0)?1:0,i=new tv(t,o),t.add.existing(i),this.add(i,{proportion:s}));a&&(this.add(a),new Mr(a).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?-this.scrollStep:this.scrollStep;this.value+=t}}),this));var l=[h,a];this.addChildrenMap("background",r),this.addChildrenMap("slider",i),this.addChildrenMap("buttons",l);var d=sv(e,"valuechangeCallback",null);if(null!==d){var c=sv(e,"valuechangeCallbackScope",void 0);this.on("valuechange",d,c)}this.setEnable(sv(e,"enable",void 0)),this.setValue(sv(e,"value",0)),this.setScrollStep(sv(n,"step",.01))}setScrollStep(t){return this.scrollStep=t,this}get enable(){return!!this.childrenMap.slider&&this.childrenMap.slider.enable}set enable(t){this.childrenMap.slider&&this.childrenMap.slider.setEnable(t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get value(){return this.childrenMap.slider?this.childrenMap.slider.value:0}set value(t){this.childrenMap.slider&&(this.childrenMap.slider.value=t)}setValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setValue(t,e,i),this}addValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.addValue(t,e,i),this}getValue(t,e){return this.childrenMap.slider?this.childrenMap.slider.getValue(t,e):0}easeValueTo(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.easeValueTo(t,e,i),this}stopEaseValue(){return this.childrenMap.slider&&this.childrenMap.slider.stopEaseValue(),this}setEaseValueDuration(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueDuration(t),this}setEaseValueFunction(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueFunction(t),this}setGap(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setGap(t,e,i),this}get gap(){if(this.childrenMap.slider)return this.childrenMap.slider.gap}set gap(t){this.childrenMap.slider&&(this.childrenMap.slider.gap=t)}setTick(t,e,i){return this.setGap(t,e,i),this}get tick(){if(this.childrenMap.slider)return this.childrenMap.slider.tick}set tick(t){this.childrenMap.slider&&(this.childrenMap.slider.tick=t)}}class nv extends Rs{constructor(t,e){super(e),this.parent=t,this.init()}init(){this.start("IDLE")}next_IDLE(){var t,e=this.parent;return e.dragState.isDown&&(t=0===e.dragThreshold?"DRAG":"DRAGBEGIN"),t}update_IDLE(t,e){this.next()}next_DRAGBEGIN(){var t=this.parent,e=t.dragState;return e.isDown?e.pointer.getDistance()>=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const hv=Phaser.Utils.Objects.GetValue,av=Phaser.Math.Distance.Between;class ov extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=hv(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(hv(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(hv(t,"enable",!0)),this.holdThreshold=hv(t,"holdThreshold",50),this.pointerOutReleaseEnable=hv(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return dn(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:av(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!or(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!or(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const lv=Phaser.Utils.Objects.GetValue;class dv{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(lv(t,"value",0)),this.setSpeed(lv(t,"speed",0)),this.setAcceleration(lv(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class cv{constructor(){this.value,this.dir,this.movement=new dv}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const gv={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},fv=Phaser.Utils.Objects.GetValue;class mv extends ii{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=fv(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(fv(e,"speed",.1)),this.setEnable(fv(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(fv(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||or(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const yv=Phaser.Utils.Objects.GetValue;var bv=function(t,e,i,s){var r,n,h="Y"===(i=i.toUpperCase()),a=2===t.scrollMode,o=t.childrenMap.child,l=`slider${i}`;if(r=a||s.hasOwnProperty(l)?yv(s,l,void 0):yv(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=h?1:0,n=function(t,e){void 0===e&&(e={});var i=mt(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new rv(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r),n.tickLength=yv(r,"tickLength",void 0);var p=yv(r,"position",0);"string"==typeof p&&(p=xv[p]);var v,g,f=yv(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=yv(s,"space.slider",void 0))&&(a?f=0:v=yv(s,"space.child",0)),g=void 0===v?"number"==typeof f:"number"==typeof v,h?0===p?(d=2,c=1,u=void 0===v?g?{left:f}:f:{left:yv(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:yv(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:yv(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:yv(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=yv(r,"hideUnscrollableSlider",!1),t[`disableUnscrollableDrag${i}`]=yv(r,"disableUnscrollableDrag",!1),t[`adaptThumb${i}SizeMode`]=yv(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=yv(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`disableUnscrollableDrag${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=yv(s,"scrollDetectionMode");"string"==typeof b&&(b=wv[b]);var x=`scroller${i}`;(m=a||s.hasOwnProperty(x)?yv(s,x,!0):yv(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new vv(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var w,S,C,O,P,_=yv(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);_&&o&&(void 0!==b&&(_.focus=1===b?2:0),w=new mv(o,_)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,w),a&&!h||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.disableUnscrollableDrag=t[`disableUnscrollableDrag${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",w)),n&&(a?(S=h?"t":"s",O=`scroll${i}`):(S="t",O="scroll"),n.on("valuechange",(function(e){t[S]=e,t.emit(O,t)}))),y&&(a?(C=`childO${i}`,O=`scroll${i}`):(C="childOY",O="scroll"),y.on("valuechange",(function(e){t[C]=e,t.emit(O,t)}))),w&&(P=a?`addChildO${i}`:"addChildOY",w.on("scroll",(function(e){t[P](-e,!0)})))};const xv={right:0,left:1,bottom:0,top:1},wv={gameObject:0,rectBounds:1},Sv=Phaser.Utils.Objects.GetValue;var Cv=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=Sv(e,"width"),h=Sv(e,"height");n||Sv(e,"child.expandWidth",!0)||(s[1]=0),h||Sv(e,"child.expandHeight",!0)||(r[1]=0);var a=new kp(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=Ep(i,"child"),r=Ep(s,"gameObject",void 0);if(r){var n=Ep(i,"space.child",0);t.childMargin={};var h=t.childMargin,a={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:h.top=0,h.bottom=0,h.left=0,h.right=0;break;default:h.top=n,h.bottom=n,h.left=n,h.right=n}else switch(t.scrollMode){case 0:h.top=Ep(n,"top",0),h.bottom=Ep(n,"bottom",0),a.left=Ep(n,"left",0),a.right=Ep(n,"right",0);break;case 1:h.top=Ep(n,"left",0),h.bottom=Ep(n,"right",0),a.top=Ep(n,"top",0),a.bottom=Ep(n,"bottom",0);break;default:h.top=Ep(n,"top",0),h.bottom=Ep(n,"bottom",0),h.left=Ep(n,"left",0),h.right=Ep(n,"right",0)}e.add(r,{column:1,row:1,align:Ep(s,"align","center"),padding:a,expand:{width:Ep(s,"expandWidth",!0),height:Ep(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:bv(t,a,"y",e);break;case 1:bv(t,a,"x",e);break;default:bv(t,a,"y",e),bv(t,a,"x",e)}return a},Ov=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}i*="Y"===t?this.scaleY:this.scaleX,s&&s.setBounds(e,i),r&&(r.setEnable(e!==i),r.tickLength&&r.setTick(r.tickLength,e,i))},Pv=function(t){switch(this.scrollMode){case 0:case 1:(i=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(i,this.isOverflow),(r=this.childrenMap.scroller)&&this.disableUnscrollableDrag&&r.setEnable(this.isOverflow);break;default:var e=this[`isOverflow${t=t.toUpperCase()}`],i=this.childrenMap[`slider${t}`],s=this[`hideUnscrollableSlider${t}`];i&&s&&this.setChildVisible(i,e);var r=this.childrenMap.scroller,n=this[`disableUnscrollableDrag${t}`];r&&n&&r.setEnable(e)}},_v=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(a=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=a.childrenMap.track,s=a.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&n0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n")}return i}(this.textObject,this.text,this.lines),this.linesCount=this.lines.length,this._textHeight=void 0,this._textVisibleHeight=void 0,this.updateTextObject(),this},updateTextObject:function(){var t=Math.max(Math.floor(Lv.call(this,-this.textOY)),0),e=Dv.call(this,t)+this.textOY,i=Av.call(this,t);return function(t,e){switch(Gh(t)){case 0:var i=(r=t.style).wordWrapWidth,s=r.wordWrapCallback;r.wordWrapWidth=0,r.wordWrapCallback=void 0,t.setText(e),r.wordWrapWidth=i,r.wordWrapCallback=s;break;case 1:var r,n=(r=t.style).wrapMode;r.wrapMode=0,t.setText(e),r.wrapMode=n;break;case 2:var h=t._maxWidth;t._maxWidth=0,t.setText(e),t._maxWidth=h}}(this.textObject,i),this.textObject.rexSizer.offsetY=e,Yv.call(this),this},preLayout:function(){return this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,Ie.call(this),this},layoutChildren:function(){var t,e,i,s,r,n,h,a=this.left,o=this.top;(t=this.textObject).rexSizer.hidden||(s=a+(i=(e=t.rexSizer).padding).left*this.scaleX,r=o+i.top*this.scaleY,n=this.width*this.scaleX-(i.left+i.right)*this.scaleX,h=this.height*this.scaleY-(i.top+i.bottom)*this.scaleY,Wv.call(this,t,n,h),ae(t,s,r,n,h,e.align),e.preOffsetY=0,Yv.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const Fv=Phaser.Utils.Objects.IsPlainObject,jv=Phaser.Utils.Objects.GetValue,Iv=Phaser.Display.Align.TOP_LEFT;class Bv extends th{constructor(t,e,i,s,r,n){Fv(e)?(e=jv(n=e,"x",0),i=jv(n,"y",0),s=jv(n,"width",void 0),r=jv(n,"height",void 0)):Fv(s)&&(s=jv(n=s,"width",void 0),r=jv(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexTextBlock",this.textObject=void 0,this.linesCount=0,this.textMask=void 0,this.textObjectType=void 0,this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,this._textObjectRealHeight=0,this.lines=void 0,this.text=jv(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode(jv(n,"clampTextOY",!0)),this.alwaysScrollable=jv(n,"alwaysScrollable",!1);var h=jv(n,"background",void 0),a=jv(n,"text",void 0);void 0===a&&(a=Hv(t)),this.textCropEnable=jv(n,"textCrop",!!a.setCrop);var o=jv(n,"textMask",!this.textCropEnable);h&&this.addBackground(h),this.add(a),this.sizerChildren=[a];var l=this.getSizerConfig(a);l.align=Iv,l.padding=ge(0),l.expand=!0,this.textObject=a,this.textObjectType=Gh(a),l.preOffsetY=0,l.offsetY=0,o&&(this.textMask=jh.call(this,this.textObject,this)),this.addChildrenMap("background",h),this.addChildrenMap("text",a)}destroy(t){if(this.scene&&!this.ignoreDestroy){if(this.textObject=void 0,this.textMask=void 0,this.lines){switch(this.textObjectType){case 0:case 2:this.lines.length=0;break;case 1:this.lines.destroy()}this.lines=void 0}super.destroy(t)}}setClampMode(t){return void 0===t&&(t=!0),this.clampTextOY=t,this}get textLineHeight(){if(void 0===this._textLineHeight){var t;switch(this.textObjectType){case 0:case 1:var e=this.textObject.style;t=e.metrics.fontSize+e.strokeThickness;break;case 2:var i=this.textObject.fontSize/this.textObject.fontData.size;t=this.textObject.fontData.lineHeight*i}this._textLineHeight=t}return this._textLineHeight}get textLineSpacing(){if(void 0===this._textLineSpacing){var t;switch(this.textObjectType){case 0:case 1:t=this.textObject.lineSpacing;break;case 2:t=0}this._textLineSpacing=t}return this._textLineSpacing}get visibleLinesCount(){return void 0===this._visibleLinesCount&&(this._visibleLinesCount=Math.floor(Lv.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=Dv.call(this,this.linesCount)),this._textHeight}get textObjectHeight(){return this._textObjectRealHeight-(this.textLineHeight+this.textLineSpacing)}get textVisibleHeight(){if(void 0===this._textVisibleHeight){var t=this.textHeight-this.textObjectHeight;!this.alwaysScrollable&&t<0&&(t=0),this._textVisibleHeight=t}return this._textVisibleHeight}textOYExceedTop(t){return void 0===t&&(t=this.textOY),t>this.topTextOY}textOYExeceedBottom(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:s?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}setTextOY(t){return this.textOY=t,this}set t(t){this.textOY=-this.textVisibleHeight*t}get t(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t}setTextOYByPercentage(t){return this.t=t,this}}var Hv=function(t){return t.add.text(0,0,"")};Object.assign(Bv.prototype,zv);var Nv={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},Gv={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const Vv=Phaser.Utils.Objects.GetValue;class Uv extends Mv{constructor(t,e){void 0===e&&(e={});var i=Vv(e,"text",void 0),s=Vv(e,"textWidth",void 0),r=Vv(e,"textHeight",void 0),n=Vv(e,"textCrop",!!i.setCrop),h=Vv(e,"textMask",!n),a=Vv(e,"content",""),o=new Bv(t,{width:s,height:r,text:i,textMask:h,textCrop:n&&!h,content:a,clampTextOY:Vv(e,"clampChildOY",!1),alwaysScrollable:Vv(e,"alwaysScrollable",!1)});t.add.existing(o),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textObjectHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.textHeight}})}(o),e.scrollMode=0,e.type="rexTextArea",e.child={gameObject:o,expandWidth:void 0===s,expandHeight:void 0===r};var l=Vv(e,"space",void 0);l&&(l.child=Vv(l,"text",0)),super(t,e),this.addChildrenMap("text",i)}get text(){return this.childrenMap.child.text}get lineHeight(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.textHeight}}Object.assign(Uv.prototype,Nv,Gv);const $v=Phaser.Utils.Objects.GetValue;var Jv=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("key")&&(i="bitmaptext",e.font=e.key)),i){case"bitmaptext":case"bitmap":s=new ap(t,e);break;case"bbcodetext":case"bbcode":s=new sp(t,0,0,"",e);break;case"label":s=new Zv(t,e);break;case"textarea":s=function(t,e,i){e=e?So(e):{};var s=$v(i,"background",wc),r=$v(i,"text",Jv),n=$v(i,"track",wc),h=$v(i,"thumb",wc);s?e.background=s(t,e.background):delete e.background,r?e.text=r(t,e.text):delete e.text;var a=e.slider;!1!==a&&null!==a&&(void 0===a&&(a={}),n?a.track=n(t,a.track):delete a.track,h?a.thumb=h(t,a.thumb):delete a.thumb,e.slider=a);var o=new Uv(t,e);return t.add.existing(o),o}(t,e);break;default:s=new Oc(t,e)}return xc(s,e),t.add.existing(s),s},Kv=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("leftWidth")?i="nineSlice":(e.hasOwnProperty("color")||e.hasOwnProperty("strokeColor"))&&(i="roundRectangle")),i){case"nineSlice":s=e.hasOwnProperty("stretchMode")?new yc(t,e):new Kd(t,e);break;case"roundRectangle":s=new Gl(t,e);break;default:s=new tc(t,e)}return xc(s,e),t.add.existing(s),s};const qv=Phaser.Utils.Objects.GetValue;class Zv extends bl{constructor(t,e,i){e=function(t,e,i){e=e?So(e):{};var s=qv(i,"background",wc),r=qv(i,"text",Jv),n=qv(i,"icon",Kv),h=qv(i,"action",Kv);return null!==e.background&&s?e.background=s(t,e.background):delete e.background,null!==e.text&&r?e.text=r(t,e.text):delete e.text,null!==e.icon&&n?e.icon=n(t,e.icon):delete e.icon,null!==e.action&&h?e.action=h(t,e.action):delete e.action,e}(t,e,i),super(t,e),this.type="rexSimpleLabel"}setActiveState(t){return Qv(this.getChildren(),"setActiveState",t),this}setHoverState(t){return Qv(this.getChildren(),"setHoverState",t),this}setDisableState(t){return Qv(this.getChildren(),"setDisableState",t),this}}var Qv=function(t,e,i){for(var s=0,r=t.length;s=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const O=Phaser.Math.DegToRad;var E={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=O(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},T={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=w(t.scaleX,i.scaleX),e.scaleY=w(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},k={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},D={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=w(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},M={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},L={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},A={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(t){void 0===t&&(t=!1);var e=this;return this._mask=null,this.setChildMaskVisible(this),this.children.forEach((function(t){t.clearMask&&t.clearMask(!1),t.hasOwnProperty("isRexContainerLite")||e.setChildMaskVisible(t)})),t&&this.mask&&this.mask.destroy(),this}},j=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},F=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const Y=Phaser.Utils.Array;var N={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Ee=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const Te=/(\S+)\[(\d+)\]/i,ke=Phaser.Utils.Objects.GetValue;var De=function(t,e){return void 0===e?t:t[e]},Re=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=ke(e,"left",0),t.right=ke(e,"right",0),t.top=ke(e,"top",0),t.bottom=ke(e,"bottom",0)),t},Me={getInnerPadding(t){return De(this.space,t)},setInnerPadding(t,e){return Re(this.space,t,e),this},getOuterPadding(t){return De(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Re(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),De(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Re(this.getSizerConfig(t).padding,e,i),this}},Le=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Ae=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},je=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},ze=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Xe=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},Fe=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Ie={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Ye=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?gi:fi,this.repeatCounter=0,this}stop(){return this.state=vi,this}update(t,e){this.state!==vi&&this.state!==yi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=mi)):(this.nowTime=this.duration,this.state=yi):this.nowTime>=0&&(this.state=gi))}get t(){var t;switch(this.state){case vi:case fi:case mi:t=0;break;case gi:t=this.nowTime/this.duration;break;case yi:t=1}return ci(t,0,1)}set t(t){(t=ci(t,-1,1))<0?(this.state=fi,this.nowTime=-this.delay*t):(this.state=gi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===vi}get isDelay(){return this.state===fi}get isCountDown(){return this.state===gi}get isRunning(){return this.state===fi||this.state===gi}get isDone(){return this.state===yi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const vi=0,fi=1,gi=2,mi=3,yi=-1;class bi extends li{constructor(t,e){super(t,e),this.timer=new pi}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const Ci=Phaser.Utils.Objects.GetValue,_i=Phaser.Utils.Objects.GetAdvancedValue,Si=Phaser.Tweens.Builders.GetEaseFunction;class Pi extends bi{resetFromJSON(t){return this.timer.resetFromJSON(Ci(t,"timer")),this.setEnable(Ci(t,"enable",!0)),this.setTarget(Ci(t,"target",this.parent)),this.setDelay(_i(t,"delay",0)),this.setDuration(_i(t,"duration",1e3)),this.setEase(Ci(t,"ease","Linear")),this.setRepeat(Ci(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Si(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const wi=Phaser.Utils.Objects.GetValue,xi=Phaser.Utils.Objects.GetAdvancedValue,Oi=Phaser.Math.Linear;let Ei=class extends Pi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(wi(t,"mode",0)),this.setScaleRange(xi(t,"start",void 0),xi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ti[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=xi(t,"x",this.parent.scaleX),this.startY=xi(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=xi(e,"x",void 0),this.endY=xi(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Oi(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Oi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const Ti={stop:0,destroy:1,yoyo:2};var ki=function(t,e,i,s,r){var n,a;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},a={x:t.scaleX};break;case 1:case"y":n={y:0},a={y:t.scaleY};break;default:n=0,a=t.scale}var o={mode:0,start:n,end:a,duration:e,ease:s};return void 0===r?r=new Ei(t,o):r.resetFromJSON(o),r.restart(),r},Di=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Ei&&(n=r,r=void 0),void 0===r&&(r=!0);var a={};switch(a.mode=r?1:0,i){case 0:case"x":a.end={x:0};break;case 1:case"y":a.end={y:0};break;default:a.end=0}return a.duration=e,a.ease=s,void 0===n?n=new Ei(t,a):n.resetFromJSON(a),n.restart(),n},Ri=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Mi=function(t){return Ri(t,"complete")};const Li=Phaser.Utils.Objects.IsPlainObject;var Ai={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Li(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=ki(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Mi(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Li(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Di(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Mi(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Mi(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Li(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var a=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,a){var o,h;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":o={x:t.scaleX},h={x:i};break;case 1:case"y":o={y:t.scaleX},h={y:i};break;default:o=t.scaleX,h=i}var l={mode:2,start:o,end:h,duration:e/2,ease:n,repeat:s};return void 0===a?a=new Ei(t,l):a.resetFromJSON(l),a.restart(),a}(this,t,e,i,s,r,this._scaleBehavior),a&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Mi(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},ji={};Object.assign(ji,Ai),ji.onInitScale=function(){Ai.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=be.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const zi=Phaser.Utils.Objects.GetValue,Xi=Phaser.Utils.Objects.GetAdvancedValue,Fi=Phaser.Math.Linear;class Ii extends Pi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(zi(t,"mode",0)),this.setAlphaRange(Xi(t,"start",this.parent.alpha),Xi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Yi[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Fi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Yi={stop:0,destroy:1,yoyo:2},Ni=Phaser.Utils.Objects.IsPlainObject;var Wi=function(t,e,i,s){var r,n;Ni(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var a={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Ii(t,a):s.resetFromJSON(a),s.restart(),s},Bi=function(t,e,i,s){i instanceof Ii&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Ii(t,r):s.resetFromJSON(r),s.restart(),s};const Vi=Phaser.Utils.Objects.IsPlainObject;var Gi={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Vi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Wi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Mi(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Vi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Bi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Mi(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Mi(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Ui={};Object.assign(Ui,Gi),Ui.onInitFade=function(){Gi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=be.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Hi=Phaser.Utils.Objects.GetValue,Ji=Phaser.Utils.Objects.GetAdvancedValue,$i=Phaser.Math.Linear;class qi extends Pi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Hi(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ji(t,"x",void 0),i=Ji(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Ki[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Ji(i,"startX",void 0),this.startY=Ji(i,"startY",void 0),this.endX=Ji(i,"endX",void 0),this.endY=Ji(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=$i(this.startX,this.endX,i)),this.hasMoveY&&(t.y=$i(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ki={stop:0,destroy:1,yoyo:2};var Zi=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const Qi=Phaser.Utils.Objects.IsPlainObject,ts=Phaser.Math.Distance.Between;var es={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(Qi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*ts(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var a=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,a){n instanceof qi&&(a=n,n=void 0),void 0===n&&(n=!1);var o={};return o.mode=n?1:0,void 0!==i&&(o.startX=Zi(i,t.x),o.endX=t.x),void 0!==s&&(o.startY=Zi(s,t.y),o.endY=t.y),o.duration=e,o.ease=void 0===r?"Linear":r,void 0===a?a=new qi(t,o):a.resetFromJSON(o),a.restart(),a}(this,t,e,i,s,r,this._easeMove),a&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Mi(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Mi(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(Qi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*ts(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var a=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,a){n instanceof qi&&(a=n,n=void 0),void 0===n&&(n=!1);var o={};return o.mode=n?1:0,void 0!==i&&(o.startX=t.x,o.endX=Zi(i,t.x)),void 0!==s&&(o.startY=t.y,o.endY=Zi(s,t.y)),o.duration=e,o.ease=void 0===r?"Linear":r,void 0===a?a=new qi(t,o):a.resetFromJSON(o),a.restart(),a}(this,t,e,i,s,r,this._easeMove),a&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Mi(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Mi(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},is={};Object.assign(is,es),is.onInitEaseMove=function(){es.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=be.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const ss=Phaser.Utils.Objects.GetValue;class rs extends ai{constructor(t,e){super(t,e),this.timer=new pi,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(ss(t,"timer")),this.setEnable(ss(t,"enable",!0)),this.setMode(ss(t,"mode",1)),this.isRunning=ss(t,"isRunning",!1),this.setMagnitudeMode(ss(t,"magnitudeMode",1)),this.setAxisMode(ss(t,"axis",0)),this.setDuration(ss(t,"duration",500)),this.setMagnitude(ss(t,"magnitude",10)),this.ox=ss(t,"ox",void 0),this.oy=ss(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=ns[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=os[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=as[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=ss(i,"magnitude",void 0),t=ss(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,a=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=a;break;default:i.x=n,i.y=a}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const ns={effect:0,behavior:1},as={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},os={constant:0,decay:1},hs=Phaser.Utils.Objects.IsPlainObject;var ls={shake(t,e,i){if(hs(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new rs(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Mi(this._shake)}};const ds=Phaser.Utils.Objects.GetValue,us=Phaser.Math.Linear;class cs extends Pi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=ds(t,"key","value");var i=e[this.propertyKey];return this.fromValue=ds(t,"from",i),this.toValue=ds(t,"to",i),this.setEase(ds(t,"ease",this.ease)),this.setDuration(ds(t,"duration",this.duration)),this.setRepeat(ds(t,"repeat",0)),this.setDelay(ds(t,"delay",0)),this.setRepeatDelay(ds(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=us(this.fromValue,this.toValue,i)}}const ps=Phaser.Utils.Objects.IsPlainObject;class vs extends ei{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new cs(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(ps(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(ps(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var fs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new vs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Ri(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},gs=Phaser.Utils.Array.Remove,ms={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}}var Ms={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=qe(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Ls={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=zt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=zt),this.transitOutCallback=t,this}},As={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},js={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},zs={};Object.assign(zs,Ms,Ls,As,js);const Xs=Phaser.Utils.Objects.GetValue;class Fs extends ei{constructor(t,e){super(t,e),this.setTransitInTime(Xs(e,"duration.in",200)),this.setTransitOutTime(Xs(e,"duration.out",200)),this.setTransitInCallback(Xs(e,"transitIn")),this.setTransitOutCallback(Xs(e,"transitOut")),this.oneShotMode=Xs(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Rs(this,{eventEmitter:!1,initState:Xs(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Fs.prototype,zs);var Is=function(t){if(t.parentContainer)return Is(t.parentContainer);var e=function(t){var e=t.displayList;return H(e)?e:null}(t);return e?Is(e):t};class Ys extends ei{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Is(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,a=1/i.zoom,o=r/2,h=n/2,l=r*a,d=n*a;e.x===o&&e.y===h||e.setPosition(o,h),e.width===l&&e.height===d||e.setSize(l,d)}}}const Ns=Phaser.GameObjects.Rectangle;class Ws extends Ns{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Ys(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Bs=Phaser.Utils.Objects.GetValue;class Vs extends ei{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Bs(t,"hitAreaMode",0)),this.setEnable(Bs(t,"enable",!0)),this.setStopMode(Bs(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Gs[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Gs={default:0,fullWindow:1};const Us=Phaser.Utils.Objects.GetValue;class Hs extends Ws{constructor(t,e){super(t,Us(e,"color",0),Us(e,"alpha",.8)),this.touchEventStop=new Vs(this,{hitAreaMode:1})}}var Js={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,ki(t,e)},scaleDown(t,e){Di(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Wi(t,e)},fadeOut(t,e){Bi(t,e,!1)}},$s=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Wi(t,e,t.alpha)},qs=function(t,e){Bi(t,e,!1)},Ks=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!nt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Zs=Phaser.Utils.Objects.GetValue;let Qs=class extends Fs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=tr.popUp),null==e.transitOut&&(e.transitOut=tr.scaleDown),e.destroy=Zs(e,"destroy",!0),super(t,e);var i=Zs(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Hs(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Zs(i,"transitIn",$s)),this.setCoverTransitOutCallback(Zs(i,"transitOut",qs)));var s=Zs(e,"touchOutsideClose",!1),r=Zs(e,"duration.hold",-1),n=Zs(e,"timeOutClose",r>=0),a=Zs(e,"anyTouchClose",!1);Zs(e,"manualClose",!1)&&(s=!1,a=!1,n=!1),a&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),a?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Zs(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Ks(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=tr[t]),t){case tr.popUp:t=Js.popUp;break;case tr.fadeIn:t=Js.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=tr[t]),t){case tr.scaleDown:t=Js.scaleDown;break;case tr.fadeOut:t=Js.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const tr={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var er=function(t){return t&&"function"==typeof t},ir={modal(t,e){return er(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new Qs(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},sr=function(t,e,i,s,r){er(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},rr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return sr.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return sr.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return sr.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return sr.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return sr.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return sr.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return sr.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return sr.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return sr.call(this,"shutdown",t,e,i,s),this}},nr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=ar),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},ar={},or=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,a=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return a?Ks(t,e.x,e.y,i,s):!!(r=nr(e,n,!0))&&Ks(t,r.x,r.y,i,s);for(var o=t.scene.input.manager,h=o.pointersTotal,l=o.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const yr={press:0,pointerdown:0,release:1,pointerup:1};var br={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new mr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},Cr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!_r(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,a=n.pointersTotal,o=n.pointers,h=0;h0)return Sr.length=0,!0;return Sr.length=0,!1},Sr=[];const Pr=Phaser.Utils.Objects.GetValue;class wr extends ei{constructor(t,e){super(t,e),this._enable=void 0;var i=Pr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Pr(t,"enable",!0)),this.setMode(Pr(t,"mode",1)),this.setClickInterval(Pr(t,"clickInterval",100)),this.setDragThreshold(Pr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=xr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?Cr:or)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const xr={press:0,pointerdown:0,release:1,pointerup:1};var Or={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new wr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Er extends Ds{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Tr=Phaser.Utils.Objects.GetValue;class kr extends ei{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Er,this.parent.setInteractive(Tr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Tr(t,"enable",!0)),this.setCooldown(Tr(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Dr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&or(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new kr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new kr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Rr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Mr=function(t,e,i,s){if("parent"===t){for(var r,n=0,a=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Jr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===$r&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Jr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=qr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&or(t,s,e,i)}}const Jr=0,$r=1,qr="IDLE",Kr=Phaser.Utils.Objects.GetValue,Zr=Phaser.Math.Distance.Between;class Qr extends Hr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=tn},eventEmitter:!1};this.setRecongizedStateObject(new Ds(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Kr(t,"time",250)),this.setTapInterval(Kr(t,"tapInterval",200)),this.setDragThreshold(Kr(t,"threshold",9)),this.setTapOffset(Kr(t,"tapOffset",10));var e=Kr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Kr(t,"maxTaps",void 0)),this.setMinTaps(Kr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case tn:this.state=en;break;case en:var t=this.lastPointer;Zr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=sn,this.state=en);break;case sn:this.state=en}}onDragEnd(){this.state===en&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=sn))}onDrag(){this.state!==tn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=tn)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===en){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=tn):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=sn:this.state=tn)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===sn&&(this.state=tn)}get isTapped(){return this.state===sn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const tn="IDLE",en="BEGIN",sn="RECOGNIZED",rn=Phaser.Utils.Objects.GetValue;class nn extends Hr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=an},eventEmitter:!1};this.setRecongizedStateObject(new Ds(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(rn(t,"threshold",9)),this.setHoldTime(rn(t,"time",251)),this}onDragStart(){this.state=on,0===this.holdTime&&(this.state=hn)}onDragEnd(){this.state=an}onDrag(){this.state!==an&&this.pointer.getDistance()>this.dragThreshold&&(this.state=an)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===on&&t-this.pointer.downTime>=this.holdTime&&(this.state=hn)}get isPressed(){return this.state===hn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const an="IDLE",on="BEGIN",hn="RECOGNIZED";Phaser.Utils.Objects.GetValue;const ln=Phaser.Math.Distance.Between,dn=Phaser.Math.Angle.Between;var un={getDt:function(){var t;return t=this.scene,Qe(t).loop.delta},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return ln(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return dn(e.x,e.y,t.x,t.y)}},cn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},pn={};const vn=Phaser.Utils.Objects.GetValue,fn=Phaser.Math.RadToDeg;class gn extends Hr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=mn},eventEmitter:!1};this.setRecongizedStateObject(new Ds(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(vn(t,"threshold",10)),this.setVelocityThreshold(vn(t,"velocityThreshold",1e3)),this.setDirectionMode(vn(t,"dir","8dir")),this}onDragStart(){this.state=yn}onDragEnd(){this.state=mn}onDrag(){this.state===yn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=bn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===bn&&(this.state=mn)}get isSwiped(){return this.state===bn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=cn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=pn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(fn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(gn.prototype,un);const mn="IDLE",yn="BEGIN",bn="RECOGNIZED",Cn=Phaser.Utils.Objects.GetValue,_n=Phaser.Utils.Array.SpliceOne,Sn=Phaser.Math.Distance.Between,Pn=Phaser.Math.Angle.Between;class wn{constructor(t,e){var i=qe(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(Cn(e,"inputConfig",void 0)),this.setEventEmitter(Cn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(Cn(t,"enable",!0)),this.bounds=Cn(t,"bounds",void 0),this.tracerState=On,this.pointers.length=0,gt(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,gt(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case On:this.tracerState=En,this.onDrag1Start();break;case En:this.tracerState=Tn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],_n(this.pointers,e),this.tracerState){case En:this.tracerState=On,this.onDrag1End();break;case Tn:this.tracerState=En,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case En:this.onDrag1();break;case Tn:this.onDrag2()}}}dragCancel(){return this.tracerState===Tn&&this.onDrag2End(),this.pointers.length=0,gt(this.movedState),this.tracerState=On,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0],e=this.pointers[1];return Sn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0],e=this.pointers[1];return Pn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;xn.x=e.x-i.x,xn.y=e.y-i.y}else xn.x=0,xn.y=0;return xn}get centerX(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Tn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Tn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=kn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&or(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&or(t,s,e,i)}}Object.assign(wn.prototype,He);var xn={};const On=0,En=1,Tn=2,kn="IDLE";Phaser.Utils.Objects.GetValue;const Dn=Phaser.Math.RotateAround;var Rn=function(t,e,i,s){return Dn(t,e,i,s),t.rotation+=s,t},Mn={};const Ln=Phaser.Utils.Objects.GetValue,An=Phaser.Math.Angle.WrapDegrees,jn=Phaser.Math.Angle.ShortestBetween,zn=Phaser.Math.RadToDeg,Xn=Phaser.Math.DegToRad;var Fn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Mn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,a=r.y,o=this.rotation;if(Array.isArray(t))for(var h=t,l=0,d=h.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=An(zn(this.angleBetween));this.angle=jn(this.prevAngle,t),this.prevAngle=t,this.state=Nn}break;case Nn:t=An(zn(this.angleBetween)),this.angle=jn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Nn}get rotation(){return Xn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Fn);const In="IDLE",Yn="BEGIN",Nn="RECOGNIZED",Wn=Phaser.Utils.Objects.GetValue;var Bn=function(t){var e=Wn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new Qr(this,e),this._tap.on("tap",(function(t,e,s){Lr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Lr(i.eventEmitter,`${i.eventNamePrefix}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Vn=Phaser.Utils.Objects.GetValue;var Gn=function(t){var e=Vn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new nn(this,e),this._press.on("pressstart",(function(t,e,s){Lr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this).on("pressend",(function(t,e,s){Lr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Un=Phaser.Utils.Objects.GetValue;var Hn=function(t){var e=Un(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new gn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Lr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Lr(i.eventEmitter,`${i.eventNamePrefix}swipe`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Jn=Phaser.Utils.Objects.GetValue;var $n=function(t,e){return t.setInteractive(),Jn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Jn(e,"targets",[t]),targetMode:Jn(e,"targetMode","parent"),eventEmitter:Jn(e,"eventEmitter",t),eventNamePrefix:Jn(e,"inputEventPrefix","child.")},jr.call(t,e),Fr.call(t,e),Nr.call(t,e),Gr.call(t,e),Bn.call(t,e),Gn.call(t,e),Hn.call(t,e),t},qn={getSizerConfig:function(t){return void 0===t&&(t=this),kt(t)},getChildPrevState:function(t){var e=kt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Mt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,a,o=t.scene;if("number"==typeof e)i=e;else{i=oe(e,"color"),s=oe(e,"lineWidth");var h=oe(e,"name",!1);h&&(r=oe(h,"createTextCallback",de),n=oe(h,"createTextCallbackScope",void 0),"string"==typeof(a=oe(h,"align","left-top"))&&(a=jt[a]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new he(o),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}var d,u,c=this.getAllShownChildren([this]);ue(c,c);for(var p=0,v=c.length;p(i=0===this.orientation?Math.abs(h.left-t):Math.abs(h.top-e))&&(n=i,r=a)}return h=s[s.length-1],n>(i=0===this.orientation?Math.abs(h.right-t):Math.abs(h.bottom-e))&&(n=i,r=a+1),r};const na=Phaser.Utils.Objects.IsPlainObject,aa=Phaser.Utils.Objects.GetValue,oa=Phaser.Display.Align.CENTER,ha={min:0,full:-1};var la=function(t,e,i,s,r,n,a,o,h,l){var d,u,c,p;ge.call(this,t);var v=t.isRexSpace,f=typeof e;if(null===e)return this;if("number"===f);else if("string"===f)e=ha[e];else if(na(e)){var g;e=aa(g=e,"proportion",void 0),i=aa(g,"align",oa),s=aa(g,"padding",0),r=aa(g,"expand",!1),n=aa(g,"key",void 0),a=aa(g,"index",void 0),t.isRexSizer||(o=aa(g,"minWidth",void 0),h=aa(g,"minHeight",void 0)),l=aa(g,"fitRatio",0),d=aa(g,"offsetX",0),u=aa(g,"offsetY",0),c=aa(g,"offsetOriginX",0),p=aa(g,"offsetOriginY",0)}return"string"==typeof i&&(i=jt[i]),void 0===e&&(e=v?1:0),void 0===i&&(i=oa),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===o&&(v?o=0:t.isRexSizer||(o=t._minWidth)),void 0===h&&(v?h=0:t.isRexSizer||(h=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===u&&(u=0),void 0===c&&(c=0),void 0===p&&(p=0),(g=this.getSizerConfig(t)).proportion=e,g.align=i,g.padding=ve(s),g.expand=r,g.fitRatio=0===e?l:0,g.alignOffsetX=d,g.alignOffsetY=u,g.alignOffsetOriginX=c,g.alignOffsetOriginY=p,void 0===a||a>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(a,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===o?Q(t):o:t.minHeight=void 0===h?tt(t):h),r&&(0===this.orientation?t.minHeight=h:t.minWidth=o)),void 0!==n&&this.addChildrenMap(n,t),this},da={add:la,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),la.call(this,new sa(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,o){return na(i)&&(i.index=t),la.call(this,e,i,s,r,n,a,t,o),this},insertAtPosition(t,e,i,s,r,n,a,o,h){var l=ra.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,o,h),this}};const ua=Tt.prototype.clear;var ca=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),ua.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,ca.call(this,t),this}},fa={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=jt[e]),this.getSizerConfig(t).align=e,this}},ga={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},ma={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},ya={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},ba={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,o=this.sizerChildren,h=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,u=o.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?h=!0:n=0)):n=0,h||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,a+=n)));else for(d=0,u=o.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?h=!0:n=0)):n=0,h||(n+=((r=i.padding).top+r.bottom)*this.scaleY,u?u=!1:n+=this.space.item*this.scaleY,a+=n)))}return h?void 0:a+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,a=s.padding;i=n-(a.left+a.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,a=s.padding;i=n-(a.top+a.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Be(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Ye.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,o,h,l,d,u,c=this.sizerChildren,p=this.innerLeft,v=this.innerTop,f=this.innerWidth,g=this.innerHeight,m=p,y=v,b=this.startChildIndex,C=0,_=c.length;C<_;C++)u=0===b?C:ta(C+b,0,_),this.rtl&&(u=_-u-1),(t=c[u]).rexSizer.hidden||(i=(e=t.rexSizer).padding,cr.call(this,t),t.isRexSpace?(l=0,d=0):(l=this.getExpandedChildWidth(t),d=this.getExpandedChildHeight(t)),t.isRexSizer?(t.runLayout(this,l,d),Qn(t,this)):Be(t,l,d),void 0===l&&(l=Q(t)),void 0===d&&(d=tt(t)),0===this.orientation?(s=m+i.left*this.scaleX,n=0===e.proportion||0===this.proportionLength?l:e.proportion*this.proportionLength,r=y+i.top*this.scaleY,a=g-(i.top+i.bottom)*this.scaleY):(s=m+i.left*this.scaleX,n=f-(i.left+i.right)*this.scaleX,r=y+i.top*this.scaleY,a=0===e.proportion||0===this.proportionLength?d:e.proportion*this.proportionLength),void 0===l&&(l=Q(t)),void 0===d&&(d=tt(t)),o=(e.alignOffsetX+e.alignOffsetOriginX*l)*this.scaleX,h=(e.alignOffsetY+e.alignOffsetOriginY*d)*this.scaleY,pr.call(this,t,s,r,n,a,e.align,o,h),0===this.orientation?m+=n+(i.left+i.right)*this.scaleX+this.space.item*this.scaleX:y+=a+(i.top+i.bottom)*this.scaleY+this.space.item*this.scaleY)},resolveWidth:function(t){if(void 0!==(t=Le.call(this,t))&&0===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenWidth;e>0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=ze.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Ae.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&ea.call(this,t,void 0),je.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Xe.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&ea.call(this,void 0,t),Fe.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],a=n&&n.isRexSpace;return"center"===t?a||this.insertSpace(r+1):a&&this.remove(n,!0),this}};Object.assign(ba,da,va,fa,ga,ma,ya);var Ca=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},_a={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const Sa=Phaser.Utils.Objects.IsPlainObject,Pa=Phaser.Utils.Objects.GetValue;class wa extends Zn{constructor(t,e,i,s,r,n,a){Sa(e)?(e=Pa(a=e,"x",0),i=Pa(a,"y",0),s=Pa(a,"width",void 0),r=Pa(a,"height",void 0),n=Pa(a,"orientation",0)):Sa(s)?(s=Pa(a=s,"width",void 0),r=Pa(a,"height",void 0),n=Pa(a,"orientation",0)):Sa(n)&&(n=Pa(a=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,a),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Pa(a,"space.item",0)),this.setStartChildIndex(Pa(a,"startChildIndex",0)),this.setRTL(Pa(a,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=_a[t]),t}(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=Ca.call(this)),this._childrenProportion}}Object.assign(wa.prototype,ba);var xa=Phaser.Renderer.WebGL.Utils,Oa=function(t,e,i,s,r,n){for(var a=xa.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),o=i.pathData,h=i.pathIndexes,l=0;l>>16,o=(65280&r)>>>8,h=255&r;t.fillStyle="rgba("+a+","+o+","+h+","+n+")"},Ra=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,a=(16711680&r)>>>16,o=(65280&r)>>>8,h=255&r;t.strokeStyle="rgba("+a+","+o+","+h+","+n+")",t.lineWidth=e.lineWidth};const Ma=Phaser.Renderer.Canvas.SetTransform;var La={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=ka(e,i,s),a=r.calcMatrix.copyFrom(n.calc),o=e._displayOriginX,h=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&Oa(r,a,e,l,o,h),e.isStroked&&Ta(r,e,l,o,h),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(Ma(t,r,e,i,s)){var n=e._displayOriginX,a=e._displayOriginY,o=e.pathData,h=o.length-1,l=o[0]-n,d=o[1]-a;r.beginPath(),r.moveTo(l,d),e.closePath||(h-=2);for(var u=2;u0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(ja.prototype,La);const za=Phaser.Utils.Objects.GetValue;let Xa=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=za(t,"x",0),i=za(t,"y",0));var s=this.cornerRadius;s.tl=Fa(za(t,"tl",void 0),e,i),s.tr=Fa(za(t,"tr",void 0),e,i),s.bl=Fa(za(t,"bl",void 0),e,i),s.br=Fa(za(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Ia(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Ia(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Ia(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Ia(this.cornerRadius.br,t)}};var Fa=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Ya(t),t},Ia=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=za(e,"x",0),t.y=za(e,"y",0)),Ya(t)},Ya=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},Na=function(t){return t.x>0&&t.y>0},Wa=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const Ba=Phaser.Math.DegToRad;var Va=function(t,e,i,s,r,n,a,o,h){a&&n>r?n-=360:!a&&n0,a=0,o=e.length;a=0?t.startAt(a+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(a+n,i):t.startAt(a,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(a,i),t.close(),t};const Vo=Phaser.Utils.Objects.GetValue,Go=Phaser.Utils.Objects.IsPlainObject;class Uo extends(mo(ho)){constructor(t,e,i,s,r,n,a,o){Go(e)?(e=(o=e).x,i=o.y,s=o.width,r=o.height,n=o.barColor,a=o.value):Go(s)?(s=(o=s).width,r=o.height,n=o.barColor,a=o.value):Go(n)&&(n=(o=n).barColor,a=o.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===a&&(a=0),super(t,e,i,s,r,o),this.type="rexLineProgress",this.bootProgressBase(o),this.addShape((new Wo).setName("trackFill")).addShape((new Wo).setName("bar")).addShape((new Wo).setName("trackStroke")),this.setTrackColor(Vo(o,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(Vo(o,"trackStrokeThickness",2),Vo(o,"trackStrokeColor",void 0)),this.setSkewX(Vo(o,"skewX",0)),this.setRTL(Vo(o,"rtl",!1)),this.setValue(a)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var Ho={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&Bo(s,0,0,e,i,t);var r,n,a=this.getShape("bar");a.fillStyle(this.barColor),a.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),Bo(a,r,0,n,i,t));var o=this.getShape("trackStroke");o.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),o.isStroked&&Bo(o,0,0,e,i,t)}};Object.assign(Uo.prototype,Ho);var Jo=function(t){return null==t||""===t||0===t.length},$o=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(Jo(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(Jo(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,a=e.length;nph(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=ph(t[i]));return e}const vh=Phaser.Utils.Objects.IsPlainObject,fh=Phaser.Utils.Objects.GetValue;var gh=function(t){return"string"==typeof t&&(t=mh[t]),t};const mh={scale:0,repeat:1};var yh=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},bh={_beginDraw:zt,_drawImage:zt,_drawTileSprite:zt,_endDraw:zt,setGetFrameNameCallback:function(t){return void 0===t&&(t=ch),this.getFrameNameCallback=t,this},setBaseTexture:function(t,e,i,s){Array.isArray(e)&&(s=i,i=e,e=void 0),null==e&&(e="__BASE"),"number"==typeof i&&arguments.length>=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=ph(i),s=ph(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),a=n.width,o=0,h=0,l=i.length;h0?a/o:0,u=n.height,c=0;for(h=0,l=s.length;h0?0:f,b=0,h=0;for(var P=i.length;h0?0:g),g>=1&&f>=1){var w=typeof(m=this.getFrameNameCallback(h,_,e));"string"!==w&&"number"!==w||r.add(m,0,b+n.cutX,C+n.cutY,g,f)}b+=g}C+=f}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,a,o,h=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-h,u=this.height-l,c=d>=0?this.maxFixedPartScaleX:this.width/h,p=u>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(c,p);if(c>v){var f=(c-v)*h;d>=0?d+=f:d=f,c=v}if(p>v){var g=(p-v)*l;u>=0?u+=g:u=g,p=v}}this.columns.scale=c,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=u>0&&this.rows.stretch>0?u/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,C=this.rows.count;b0&&o>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(_,b)?0:1)?this._drawImage(this.textureKey,s,m,y,a,o):this._drawTileSprite(this.textureKey,s,m,y,a,o)),m+=a;y+=o}this._endDraw()},setStretchMode:function(t){return vh(t)?(this.stretchMode.edge=gh(fh(t,"edge",0)),this.stretchMode.internal=gh(fh(t,"internal",0))):(t=gh(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return yh.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const Ch=Phaser.Utils.Objects.IsPlainObject,_h=Phaser.Utils.Objects.GetValue,Sh=Phaser.GameObjects;var Ph=void 0,wh=function(t,e){if(Ph||(Ph={},Qe(t).events.once("destroy",(function(){for(var t in Ph)Ph[t].destroy();Ph=void 0}))),!Ph.hasOwnProperty(e)){var i=Qe(t).scene.systemScene;(t=new Sh[e](i)).setOrigin(0),Ph[e]=t}return Ph[e]};const xh=Phaser.GameObjects.RenderTexture;class Oh extends(function(t,e){class i extends t{constructor(t,i,s,r,n,a,o,h,l,d){if(Ch(i)?(i=_h(d=i,"x",0),s=_h(d,"y",0),r=_h(d,"width",1),n=_h(d,"height",1),a=_h(d,"key",void 0),o=_h(d,"baseFrame",void 0),h=_h(d,"columns",void 0),l=_h(d,"rows",void 0)):Ch(r)?(r=_h(d=r,"width",1),n=_h(d,"height",1),a=_h(d,"key",void 0),o=_h(d,"baseFrame",void 0),h=_h(d,"columns",void 0),l=_h(d,"rows",void 0)):Ch(a)?(a=_h(d=a,"key",void 0),o=_h(d,"baseFrame",void 0),h=_h(d,"columns",void 0),l=_h(d,"rows",void 0)):Ch(o)?(o=_h(d=o,"baseFrame",void 0),h=_h(d,"columns",void 0),l=_h(d,"rows",void 0)):Array.isArray(o)?(d=l,l=h,h=o,o=_h(d,"baseFrame",void 0)):Ch(h)&&(h=_h(d=h,"columns",void 0),l=_h(d,"rows",void 0)),void 0===o&&(o=_h(d,"frame",void 0)),void 0===h){var u=_h(d,"leftWidth",void 0),c=_h(d,"rightWidth",void 0);void 0!==u&&void 0!==c&&(h=[u,void 0,c])}if(void 0===l){var p=_h(d,"topHeight",void 0),v=_h(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(_h(d,"getFrameNameCallback",void 0)),this.setStretchMode(_h(d,"stretchMode",0)),this.setPreserveRatio(_h(d,"preserveRatio",!0));var f=_h(d,"maxFixedPartScale",1),g=_h(d,"maxFixedPartScaleX",f),m=_h(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(g,m),this.setBaseTexture(a,o,h,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,bh),i}(xh,"rexNinePatch")){}var Eh={_drawImage:function(t,e,i,s,r,n){var a=wh(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(a,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var a=wh(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(a,i,s)}};Object.assign(Oh.prototype,Eh);class Th extends ei{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Zo(t,e))return t[e];var i=t.parent;return Zo(i,e)?i[e]:void 0}set(t,e,i){return Zo(t,e)?t[e]=i:Zo(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}}const kh=Phaser.Utils.Objects.GetValue;class Dh extends Oh{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=kh(e,"effects",!0);i&&sh(this,i),this.style=new Th(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Dh.prototype,to);const Rh=["alpha","tint","flipX","flipY"];var Mh=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("barColor")?i="bar":e.hasOwnProperty("leftWidth")?i="nineSlice":e.hasOwnProperty("key")&&(i="image")),i){case"bar":s=new qo(t,e);break;case"image":s=new uh(t,e);break;case"nineSlice":s=e.hasOwnProperty("stretchMode")?new Dh(t,e):new oh(t,e);break;default:s=new eo(t,e)}return function(t,e){if(!e)return t;for(var i=0,s=Rh.length;i=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const O=Phaser.Math.DegToRad;var E={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=O(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},T={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=w(t.scaleX,i.scaleX),e.scaleY=w(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},k={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},D={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=w(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},M={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},L={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},A={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(t){void 0===t&&(t=!1);var e=this;return this._mask=null,this.setChildMaskVisible(this),this.children.forEach((function(t){t.clearMask&&t.clearMask(!1),t.hasOwnProperty("isRexContainerLite")||e.setChildMaskVisible(t)})),t&&this.mask&&this.mask.destroy(),this}},j=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},F=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const Y=Phaser.Utils.Array;var N={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Ee=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const Te=/(\S+)\[(\d+)\]/i,ke=Phaser.Utils.Objects.GetValue;var De=function(t,e){return void 0===e?t:t[e]},Re=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=ke(e,"left",0),t.right=ke(e,"right",0),t.top=ke(e,"top",0),t.bottom=ke(e,"bottom",0)),t},Me={getInnerPadding(t){return De(this.space,t)},setInnerPadding(t,e){return Re(this.space,t,e),this},getOuterPadding(t){return De(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Re(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),De(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Re(this.getSizerConfig(t).padding,e,i),this}},Le=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Ae=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},je=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},ze=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Xe=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},Fe=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Ie={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Ye=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?gi:fi,this.repeatCounter=0,this}stop(){return this.state=vi,this}update(t,e){this.state!==vi&&this.state!==yi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=mi)):(this.nowTime=this.duration,this.state=yi):this.nowTime>=0&&(this.state=gi))}get t(){var t;switch(this.state){case vi:case fi:case mi:t=0;break;case gi:t=this.nowTime/this.duration;break;case yi:t=1}return ci(t,0,1)}set t(t){(t=ci(t,-1,1))<0?(this.state=fi,this.nowTime=-this.delay*t):(this.state=gi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===vi}get isDelay(){return this.state===fi}get isCountDown(){return this.state===gi}get isRunning(){return this.state===fi||this.state===gi}get isDone(){return this.state===yi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const vi=0,fi=1,gi=2,mi=3,yi=-1;class bi extends li{constructor(t,e){super(t,e),this.timer=new pi}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const Ci=Phaser.Utils.Objects.GetValue,_i=Phaser.Utils.Objects.GetAdvancedValue,Si=Phaser.Tweens.Builders.GetEaseFunction;class Pi extends bi{resetFromJSON(t){return this.timer.resetFromJSON(Ci(t,"timer")),this.setEnable(Ci(t,"enable",!0)),this.setTarget(Ci(t,"target",this.parent)),this.setDelay(_i(t,"delay",0)),this.setDuration(_i(t,"duration",1e3)),this.setEase(Ci(t,"ease","Linear")),this.setRepeat(Ci(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Si(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const wi=Phaser.Utils.Objects.GetValue,xi=Phaser.Utils.Objects.GetAdvancedValue,Oi=Phaser.Math.Linear;let Ei=class extends Pi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(wi(t,"mode",0)),this.setScaleRange(xi(t,"start",void 0),xi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ti[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=xi(t,"x",this.parent.scaleX),this.startY=xi(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=xi(e,"x",void 0),this.endY=xi(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Oi(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Oi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const Ti={stop:0,destroy:1,yoyo:2};var ki=function(t,e,i,s,r){var n,a;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},a={x:t.scaleX};break;case 1:case"y":n={y:0},a={y:t.scaleY};break;default:n=0,a=t.scale}var o={mode:0,start:n,end:a,duration:e,ease:s};return void 0===r?r=new Ei(t,o):r.resetFromJSON(o),r.restart(),r},Di=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Ei&&(n=r,r=void 0),void 0===r&&(r=!0);var a={};switch(a.mode=r?1:0,i){case 0:case"x":a.end={x:0};break;case 1:case"y":a.end={y:0};break;default:a.end=0}return a.duration=e,a.ease=s,void 0===n?n=new Ei(t,a):n.resetFromJSON(a),n.restart(),n},Ri=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Mi=function(t){return Ri(t,"complete")};const Li=Phaser.Utils.Objects.IsPlainObject;var Ai={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Li(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=ki(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Mi(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Li(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Di(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Mi(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Mi(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Li(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var a=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,a){var o,h;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":o={x:t.scaleX},h={x:i};break;case 1:case"y":o={y:t.scaleX},h={y:i};break;default:o=t.scaleX,h=i}var l={mode:2,start:o,end:h,duration:e/2,ease:n,repeat:s};return void 0===a?a=new Ei(t,l):a.resetFromJSON(l),a.restart(),a}(this,t,e,i,s,r,this._scaleBehavior),a&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Mi(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},ji={};Object.assign(ji,Ai),ji.onInitScale=function(){Ai.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=be.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const zi=Phaser.Utils.Objects.GetValue,Xi=Phaser.Utils.Objects.GetAdvancedValue,Fi=Phaser.Math.Linear;class Ii extends Pi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(zi(t,"mode",0)),this.setAlphaRange(Xi(t,"start",this.parent.alpha),Xi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Yi[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Fi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Yi={stop:0,destroy:1,yoyo:2},Ni=Phaser.Utils.Objects.IsPlainObject;var Wi=function(t,e,i,s){var r,n;Ni(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var a={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Ii(t,a):s.resetFromJSON(a),s.restart(),s},Bi=function(t,e,i,s){i instanceof Ii&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Ii(t,r):s.resetFromJSON(r),s.restart(),s};const Vi=Phaser.Utils.Objects.IsPlainObject;var Gi={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Vi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Wi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Mi(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Vi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Bi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Mi(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Mi(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Ui={};Object.assign(Ui,Gi),Ui.onInitFade=function(){Gi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=be.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Hi=Phaser.Utils.Objects.GetValue,Ji=Phaser.Utils.Objects.GetAdvancedValue,$i=Phaser.Math.Linear;class qi extends Pi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Hi(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ji(t,"x",void 0),i=Ji(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Ki[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Ji(i,"startX",void 0),this.startY=Ji(i,"startY",void 0),this.endX=Ji(i,"endX",void 0),this.endY=Ji(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=$i(this.startX,this.endX,i)),this.hasMoveY&&(t.y=$i(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ki={stop:0,destroy:1,yoyo:2};var Zi=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const Qi=Phaser.Utils.Objects.IsPlainObject,ts=Phaser.Math.Distance.Between;var es={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(Qi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*ts(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var a=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,a){n instanceof qi&&(a=n,n=void 0),void 0===n&&(n=!1);var o={};return o.mode=n?1:0,void 0!==i&&(o.startX=Zi(i,t.x),o.endX=t.x),void 0!==s&&(o.startY=Zi(s,t.y),o.endY=t.y),o.duration=e,o.ease=void 0===r?"Linear":r,void 0===a?a=new qi(t,o):a.resetFromJSON(o),a.restart(),a}(this,t,e,i,s,r,this._easeMove),a&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Mi(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Mi(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(Qi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*ts(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var a=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,a){n instanceof qi&&(a=n,n=void 0),void 0===n&&(n=!1);var o={};return o.mode=n?1:0,void 0!==i&&(o.startX=t.x,o.endX=Zi(i,t.x)),void 0!==s&&(o.startY=t.y,o.endY=Zi(s,t.y)),o.duration=e,o.ease=void 0===r?"Linear":r,void 0===a?a=new qi(t,o):a.resetFromJSON(o),a.restart(),a}(this,t,e,i,s,r,this._easeMove),a&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Mi(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Mi(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},is={};Object.assign(is,es),is.onInitEaseMove=function(){es.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=be.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const ss=Phaser.Utils.Objects.GetValue;class rs extends ai{constructor(t,e){super(t,e),this.timer=new pi,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(ss(t,"timer")),this.setEnable(ss(t,"enable",!0)),this.setMode(ss(t,"mode",1)),this.isRunning=ss(t,"isRunning",!1),this.setMagnitudeMode(ss(t,"magnitudeMode",1)),this.setAxisMode(ss(t,"axis",0)),this.setDuration(ss(t,"duration",500)),this.setMagnitude(ss(t,"magnitude",10)),this.ox=ss(t,"ox",void 0),this.oy=ss(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=ns[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=os[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=as[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=ss(i,"magnitude",void 0),t=ss(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,a=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=a;break;default:i.x=n,i.y=a}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const ns={effect:0,behavior:1},as={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},os={constant:0,decay:1},hs=Phaser.Utils.Objects.IsPlainObject;var ls={shake(t,e,i){if(hs(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new rs(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Mi(this._shake)}};const ds=Phaser.Utils.Objects.GetValue,us=Phaser.Math.Linear;class cs extends Pi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=ds(t,"key","value");var i=e[this.propertyKey];return this.fromValue=ds(t,"from",i),this.toValue=ds(t,"to",i),this.setEase(ds(t,"ease",this.ease)),this.setDuration(ds(t,"duration",this.duration)),this.setRepeat(ds(t,"repeat",0)),this.setDelay(ds(t,"delay",0)),this.setRepeatDelay(ds(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=us(this.fromValue,this.toValue,i)}}const ps=Phaser.Utils.Objects.IsPlainObject;class vs extends ei{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new cs(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(ps(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(ps(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var fs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new vs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Ri(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},gs=Phaser.Utils.Array.Remove,ms={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}}var Ms={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=qe(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Ls={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=zt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=zt),this.transitOutCallback=t,this}},As={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},js={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},zs={};Object.assign(zs,Ms,Ls,As,js);const Xs=Phaser.Utils.Objects.GetValue;class Fs extends ei{constructor(t,e){super(t,e),this.setTransitInTime(Xs(e,"duration.in",200)),this.setTransitOutTime(Xs(e,"duration.out",200)),this.setTransitInCallback(Xs(e,"transitIn")),this.setTransitOutCallback(Xs(e,"transitOut")),this.oneShotMode=Xs(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Rs(this,{eventEmitter:!1,initState:Xs(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Fs.prototype,zs);var Is=function(t){if(t.parentContainer)return Is(t.parentContainer);var e=function(t){var e=t.displayList;return H(e)?e:null}(t);return e?Is(e):t};class Ys extends ei{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Is(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,a=1/i.zoom,o=r/2,h=n/2,l=r*a,d=n*a;e.x===o&&e.y===h||e.setPosition(o,h),e.width===l&&e.height===d||e.setSize(l,d)}}}const Ns=Phaser.GameObjects.Rectangle;class Ws extends Ns{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Ys(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Bs=Phaser.Utils.Objects.GetValue;class Vs extends ei{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Bs(t,"hitAreaMode",0)),this.setEnable(Bs(t,"enable",!0)),this.setStopMode(Bs(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Gs[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Gs={default:0,fullWindow:1};const Us=Phaser.Utils.Objects.GetValue;class Hs extends Ws{constructor(t,e){super(t,Us(e,"color",0),Us(e,"alpha",.8)),this.touchEventStop=new Vs(this,{hitAreaMode:1})}}var Js={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,ki(t,e)},scaleDown(t,e){Di(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Wi(t,e)},fadeOut(t,e){Bi(t,e,!1)}},$s=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Wi(t,e,t.alpha)},qs=function(t,e){Bi(t,e,!1)},Ks=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!nt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Zs=Phaser.Utils.Objects.GetValue;let Qs=class extends Fs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=tr.popUp),null==e.transitOut&&(e.transitOut=tr.scaleDown),e.destroy=Zs(e,"destroy",!0),super(t,e);var i=Zs(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Hs(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Zs(i,"transitIn",$s)),this.setCoverTransitOutCallback(Zs(i,"transitOut",qs)));var s=Zs(e,"touchOutsideClose",!1),r=Zs(e,"duration.hold",-1),n=Zs(e,"timeOutClose",r>=0),a=Zs(e,"anyTouchClose",!1);Zs(e,"manualClose",!1)&&(s=!1,a=!1,n=!1),a&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),a?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Zs(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Ks(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=tr[t]),t){case tr.popUp:t=Js.popUp;break;case tr.fadeIn:t=Js.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=tr[t]),t){case tr.scaleDown:t=Js.scaleDown;break;case tr.fadeOut:t=Js.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const tr={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var er=function(t){return t&&"function"==typeof t},ir={modal(t,e){return er(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new Qs(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},sr=function(t,e,i,s,r){er(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},rr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return sr.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return sr.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return sr.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return sr.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return sr.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return sr.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return sr.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return sr.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return sr.call(this,"shutdown",t,e,i,s),this}},nr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=ar),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},ar={},or=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,a=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return a?Ks(t,e.x,e.y,i,s):!!(r=nr(e,n,!0))&&Ks(t,r.x,r.y,i,s);for(var o=t.scene.input.manager,h=o.pointersTotal,l=o.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const yr={press:0,pointerdown:0,release:1,pointerup:1};var br={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new mr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},Cr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!_r(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,a=n.pointersTotal,o=n.pointers,h=0;h0)return Sr.length=0,!0;return Sr.length=0,!1},Sr=[];const Pr=Phaser.Utils.Objects.GetValue;class wr extends ei{constructor(t,e){super(t,e),this._enable=void 0;var i=Pr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Pr(t,"enable",!0)),this.setMode(Pr(t,"mode",1)),this.setClickInterval(Pr(t,"clickInterval",100)),this.setDragThreshold(Pr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=xr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?Cr:or)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const xr={press:0,pointerdown:0,release:1,pointerup:1};var Or={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new wr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Er extends Ds{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Tr=Phaser.Utils.Objects.GetValue;class kr extends ei{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Er,this.parent.setInteractive(Tr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Tr(t,"enable",!0)),this.setCooldown(Tr(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Dr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&or(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new kr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new kr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Rr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Mr=function(t,e,i,s){if("parent"===t){for(var r,n=0,a=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Jr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===$r&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Jr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=qr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&or(t,s,e,i)}}const Jr=0,$r=1,qr="IDLE",Kr=Phaser.Utils.Objects.GetValue,Zr=Phaser.Math.Distance.Between;class Qr extends Hr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=tn},eventEmitter:!1};this.setRecongizedStateObject(new Ds(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Kr(t,"time",250)),this.setTapInterval(Kr(t,"tapInterval",200)),this.setDragThreshold(Kr(t,"threshold",9)),this.setTapOffset(Kr(t,"tapOffset",10));var e=Kr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Kr(t,"maxTaps",void 0)),this.setMinTaps(Kr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case tn:this.state=en;break;case en:var t=this.lastPointer;Zr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=sn,this.state=en);break;case sn:this.state=en}}onDragEnd(){this.state===en&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=sn))}onDrag(){this.state!==tn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=tn)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===en){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=tn):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=sn:this.state=tn)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===sn&&(this.state=tn)}get isTapped(){return this.state===sn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const tn="IDLE",en="BEGIN",sn="RECOGNIZED",rn=Phaser.Utils.Objects.GetValue;class nn extends Hr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=an},eventEmitter:!1};this.setRecongizedStateObject(new Ds(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(rn(t,"threshold",9)),this.setHoldTime(rn(t,"time",251)),this}onDragStart(){this.state=on,0===this.holdTime&&(this.state=hn)}onDragEnd(){this.state=an}onDrag(){this.state!==an&&this.pointer.getDistance()>this.dragThreshold&&(this.state=an)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===on&&t-this.pointer.downTime>=this.holdTime&&(this.state=hn)}get isPressed(){return this.state===hn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const an="IDLE",on="BEGIN",hn="RECOGNIZED";Phaser.Utils.Objects.GetValue;const ln=Phaser.Math.Distance.Between,dn=Phaser.Math.Angle.Between;var un={getDt:function(){var t;return t=this.scene,Qe(t).loop.delta},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return ln(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return dn(e.x,e.y,t.x,t.y)}},cn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},pn={};const vn=Phaser.Utils.Objects.GetValue,fn=Phaser.Math.RadToDeg;class gn extends Hr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=mn},eventEmitter:!1};this.setRecongizedStateObject(new Ds(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(vn(t,"threshold",10)),this.setVelocityThreshold(vn(t,"velocityThreshold",1e3)),this.setDirectionMode(vn(t,"dir","8dir")),this}onDragStart(){this.state=yn}onDragEnd(){this.state=mn}onDrag(){this.state===yn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=bn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===bn&&(this.state=mn)}get isSwiped(){return this.state===bn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=cn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=pn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(fn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(gn.prototype,un);const mn="IDLE",yn="BEGIN",bn="RECOGNIZED",Cn=Phaser.Utils.Objects.GetValue,_n=Phaser.Utils.Array.SpliceOne,Sn=Phaser.Math.Distance.Between,Pn=Phaser.Math.Angle.Between;class wn{constructor(t,e){var i=qe(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(Cn(e,"inputConfig",void 0)),this.setEventEmitter(Cn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(Cn(t,"enable",!0)),this.bounds=Cn(t,"bounds",void 0),this.tracerState=On,this.pointers.length=0,gt(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,gt(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case On:this.tracerState=En,this.onDrag1Start();break;case En:this.tracerState=Tn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],_n(this.pointers,e),this.tracerState){case En:this.tracerState=On,this.onDrag1End();break;case Tn:this.tracerState=En,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case En:this.onDrag1();break;case Tn:this.onDrag2()}}}dragCancel(){return this.tracerState===Tn&&this.onDrag2End(),this.pointers.length=0,gt(this.movedState),this.tracerState=On,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0],e=this.pointers[1];return Sn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0],e=this.pointers[1];return Pn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;xn.x=e.x-i.x,xn.y=e.y-i.y}else xn.x=0,xn.y=0;return xn}get centerX(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Tn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Tn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Tn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=kn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&or(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&or(t,s,e,i)}}Object.assign(wn.prototype,He);var xn={};const On=0,En=1,Tn=2,kn="IDLE";Phaser.Utils.Objects.GetValue;const Dn=Phaser.Math.RotateAround;var Rn=function(t,e,i,s){return Dn(t,e,i,s),t.rotation+=s,t},Mn={};const Ln=Phaser.Utils.Objects.GetValue,An=Phaser.Math.Angle.WrapDegrees,jn=Phaser.Math.Angle.ShortestBetween,zn=Phaser.Math.RadToDeg,Xn=Phaser.Math.DegToRad;var Fn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Mn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,a=r.y,o=this.rotation;if(Array.isArray(t))for(var h=t,l=0,d=h.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=An(zn(this.angleBetween));this.angle=jn(this.prevAngle,t),this.prevAngle=t,this.state=Nn}break;case Nn:t=An(zn(this.angleBetween)),this.angle=jn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Nn}get rotation(){return Xn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Fn);const In="IDLE",Yn="BEGIN",Nn="RECOGNIZED",Wn=Phaser.Utils.Objects.GetValue;var Bn=function(t){var e=Wn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new Qr(this,e),this._tap.on("tap",(function(t,e,s){Lr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Lr(i.eventEmitter,`${i.eventNamePrefix}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Vn=Phaser.Utils.Objects.GetValue;var Gn=function(t){var e=Vn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new nn(this,e),this._press.on("pressstart",(function(t,e,s){Lr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this).on("pressend",(function(t,e,s){Lr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Un=Phaser.Utils.Objects.GetValue;var Hn=function(t){var e=Un(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new gn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Lr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Lr(i.eventEmitter,`${i.eventNamePrefix}swipe`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Jn=Phaser.Utils.Objects.GetValue;var $n=function(t,e){return t.setInteractive(),Jn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Jn(e,"targets",[t]),targetMode:Jn(e,"targetMode","parent"),eventEmitter:Jn(e,"eventEmitter",t),eventNamePrefix:Jn(e,"inputEventPrefix","child.")},jr.call(t,e),Fr.call(t,e),Nr.call(t,e),Gr.call(t,e),Bn.call(t,e),Gn.call(t,e),Hn.call(t,e),t},qn={getSizerConfig:function(t){return void 0===t&&(t=this),kt(t)},getChildPrevState:function(t){var e=kt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Mt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,a,o=t.scene;if("number"==typeof e)i=e;else{i=oe(e,"color"),s=oe(e,"lineWidth");var h=oe(e,"name",!1);h&&(r=oe(h,"createTextCallback",de),n=oe(h,"createTextCallbackScope",void 0),"string"==typeof(a=oe(h,"align","left-top"))&&(a=jt[a]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new he(o),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}var d,u,c=this.getAllShownChildren([this]);ue(c,c);for(var p=0,v=c.length;p(i=0===this.orientation?Math.abs(h.left-t):Math.abs(h.top-e))&&(n=i,r=a)}return h=s[s.length-1],n>(i=0===this.orientation?Math.abs(h.right-t):Math.abs(h.bottom-e))&&(n=i,r=a+1),r};const na=Phaser.Utils.Objects.IsPlainObject,aa=Phaser.Utils.Objects.GetValue,oa=Phaser.Display.Align.CENTER,ha={min:0,full:-1};var la=function(t,e,i,s,r,n,a,o,h,l){var d,u,c,p;ge.call(this,t);var v=t.isRexSpace,f=typeof e;if(null===e)return this;if("number"===f);else if("string"===f)e=ha[e];else if(na(e)){var g;e=aa(g=e,"proportion",void 0),i=aa(g,"align",oa),s=aa(g,"padding",0),r=aa(g,"expand",!1),n=aa(g,"key",void 0),a=aa(g,"index",void 0),t.isRexSizer||(o=aa(g,"minWidth",void 0),h=aa(g,"minHeight",void 0)),l=aa(g,"fitRatio",0),d=aa(g,"offsetX",0),u=aa(g,"offsetY",0),c=aa(g,"offsetOriginX",0),p=aa(g,"offsetOriginY",0)}return"string"==typeof i&&(i=jt[i]),void 0===e&&(e=v?1:0),void 0===i&&(i=oa),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===o&&(v?o=0:t.isRexSizer||(o=t._minWidth)),void 0===h&&(v?h=0:t.isRexSizer||(h=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===u&&(u=0),void 0===c&&(c=0),void 0===p&&(p=0),(g=this.getSizerConfig(t)).proportion=e,g.align=i,g.padding=ve(s),g.expand=r,g.fitRatio=0===e?l:0,g.alignOffsetX=d,g.alignOffsetY=u,g.alignOffsetOriginX=c,g.alignOffsetOriginY=p,void 0===a||a>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(a,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===o?Q(t):o:t.minHeight=void 0===h?tt(t):h),r&&(0===this.orientation?t.minHeight=h:t.minWidth=o)),void 0!==n&&this.addChildrenMap(n,t),this},da={add:la,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),la.call(this,new sa(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,o){return na(i)&&(i.index=t),la.call(this,e,i,s,r,n,a,t,o),this},insertAtPosition(t,e,i,s,r,n,a,o,h){var l=ra.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,o,h),this}};const ua=Tt.prototype.clear;var ca=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),ua.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,ca.call(this,t),this}},fa={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=jt[e]),this.getSizerConfig(t).align=e,this}},ga={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},ma={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},ya={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},ba={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,o=this.sizerChildren,h=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,u=o.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?h=!0:n=0)):n=0,h||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,a+=n)));else for(d=0,u=o.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?h=!0:n=0)):n=0,h||(n+=((r=i.padding).top+r.bottom)*this.scaleY,u?u=!1:n+=this.space.item*this.scaleY,a+=n)))}return h?void 0:a+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,a=s.padding;i=n-(a.left+a.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,a=s.padding;i=n-(a.top+a.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Be(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Ye.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,o,h,l,d,u,c=this.sizerChildren,p=this.innerLeft,v=this.innerTop,f=this.innerWidth,g=this.innerHeight,m=p,y=v,b=this.startChildIndex,C=0,_=c.length;C<_;C++)u=0===b?C:ta(C+b,0,_),this.rtl&&(u=_-u-1),(t=c[u]).rexSizer.hidden||(i=(e=t.rexSizer).padding,cr.call(this,t),t.isRexSpace?(l=0,d=0):(l=this.getExpandedChildWidth(t),d=this.getExpandedChildHeight(t)),t.isRexSizer?(t.runLayout(this,l,d),Qn(t,this)):Be(t,l,d),void 0===l&&(l=Q(t)),void 0===d&&(d=tt(t)),0===this.orientation?(s=m+i.left*this.scaleX,n=0===e.proportion||0===this.proportionLength?l:e.proportion*this.proportionLength,r=y+i.top*this.scaleY,a=g-(i.top+i.bottom)*this.scaleY):(s=m+i.left*this.scaleX,n=f-(i.left+i.right)*this.scaleX,r=y+i.top*this.scaleY,a=0===e.proportion||0===this.proportionLength?d:e.proportion*this.proportionLength),void 0===l&&(l=Q(t)),void 0===d&&(d=tt(t)),o=(e.alignOffsetX+e.alignOffsetOriginX*l)*this.scaleX,h=(e.alignOffsetY+e.alignOffsetOriginY*d)*this.scaleY,pr.call(this,t,s,r,n,a,e.align,o,h),0===this.orientation?m+=n+(i.left+i.right)*this.scaleX+this.space.item*this.scaleX:y+=a+(i.top+i.bottom)*this.scaleY+this.space.item*this.scaleY)},resolveWidth:function(t){if(void 0!==(t=Le.call(this,t))&&0===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenWidth;e>0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=ze.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Ae.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&ea.call(this,t,void 0),je.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Xe.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&ea.call(this,void 0,t),Fe.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],a=n&&n.isRexSpace;return"center"===t?a||this.insertSpace(r+1):a&&this.remove(n,!0),this}};Object.assign(ba,da,va,fa,ga,ma,ya);var Ca=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},_a={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const Sa=Phaser.Utils.Objects.IsPlainObject,Pa=Phaser.Utils.Objects.GetValue;class wa extends Zn{constructor(t,e,i,s,r,n,a){Sa(e)?(e=Pa(a=e,"x",0),i=Pa(a,"y",0),s=Pa(a,"width",void 0),r=Pa(a,"height",void 0),n=Pa(a,"orientation",0)):Sa(s)?(s=Pa(a=s,"width",void 0),r=Pa(a,"height",void 0),n=Pa(a,"orientation",0)):Sa(n)&&(n=Pa(a=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,a),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Pa(a,"space.item",0)),this.setStartChildIndex(Pa(a,"startChildIndex",0)),this.setRTL(Pa(a,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=_a[t]),t}(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=Ca.call(this)),this._childrenProportion}}Object.assign(wa.prototype,ba);var xa=Phaser.Renderer.WebGL.Utils,Oa=function(t,e,i,s,r,n){for(var a=xa.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),o=i.pathData,h=i.pathIndexes,l=0;l>>16,o=(65280&r)>>>8,h=255&r;t.fillStyle="rgba("+a+","+o+","+h+","+n+")"},Ra=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,a=(16711680&r)>>>16,o=(65280&r)>>>8,h=255&r;t.strokeStyle="rgba("+a+","+o+","+h+","+n+")",t.lineWidth=e.lineWidth};const Ma=Phaser.Renderer.Canvas.SetTransform;var La={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=ka(e,i,s),a=r.calcMatrix.copyFrom(n.calc),o=e._displayOriginX,h=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&Oa(r,a,e,l,o,h),e.isStroked&&Ta(r,e,l,o,h),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(Ma(t,r,e,i,s)){var n=e._displayOriginX,a=e._displayOriginY,o=e.pathData,h=o.length-1,l=o[0]-n,d=o[1]-a;r.beginPath(),r.moveTo(l,d),e.closePath||(h-=2);for(var u=2;u0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(ja.prototype,La);const za=Phaser.Utils.Objects.GetValue;let Xa=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=za(t,"x",0),i=za(t,"y",0));var s=this.cornerRadius;s.tl=Fa(za(t,"tl",void 0),e,i),s.tr=Fa(za(t,"tr",void 0),e,i),s.bl=Fa(za(t,"bl",void 0),e,i),s.br=Fa(za(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Ia(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Ia(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Ia(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Ia(this.cornerRadius.br,t)}};var Fa=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Ya(t),t},Ia=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=za(e,"x",0),t.y=za(e,"y",0)),Ya(t)},Ya=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},Na=function(t){return t.x>0&&t.y>0},Wa=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const Ba=Phaser.Math.DegToRad;var Va=function(t,e,i,s,r,n,a,o,h){a&&n>r?n-=360:!a&&n0,a=0,o=e.length;a=0?t.startAt(a+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(a+n,i):t.startAt(a,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(a,i),t.close(),t};const Go=Phaser.Utils.Objects.GetValue,Uo=Phaser.Utils.Objects.IsPlainObject;class Ho extends(mo(ho)){constructor(t,e,i,s,r,n,a,o){Uo(e)?(e=(o=e).x,i=o.y,s=o.width,r=o.height,n=o.barColor,a=o.value):Uo(s)?(s=(o=s).width,r=o.height,n=o.barColor,a=o.value):Uo(n)&&(n=(o=n).barColor,a=o.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===a&&(a=0),super(t,e,i,s,r,o),this.type="rexLineProgress",this.bootProgressBase(o),this.addShape((new Bo).setName("trackFill")).addShape((new Bo).setName("bar")).addShape((new Bo).setName("trackStroke")),this.setTrackColor(Go(o,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(Go(o,"trackStrokeThickness",2),Go(o,"trackStrokeColor",void 0)),this.setSkewX(Go(o,"skewX",0)),this.setRTL(Go(o,"rtl",!1)),this.setValue(a)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var Jo={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&Vo(s,0,0,e,i,t);var r,n,a=this.getShape("bar");a.fillStyle(this.barColor),a.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),Vo(a,r,0,n,i,t));var o=this.getShape("trackStroke");o.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),o.isStroked&&Vo(o,0,0,e,i,t)}};Object.assign(Ho.prototype,Jo);var $o=function(t){return null==t||""===t||0===t.length},qo=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if($o(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if($o(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,a=e.length;nvh(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=vh(t[i]));return e}const fh=Phaser.Utils.Objects.IsPlainObject,gh=Phaser.Utils.Objects.GetValue;var mh=function(t){return"string"==typeof t&&(t=yh[t]),t};const yh={scale:0,repeat:1};var bh=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},Ch={_beginDraw:zt,_drawImage:zt,_drawTileSprite:zt,_endDraw:zt,setGetFrameNameCallback:function(t){return void 0===t&&(t=ph),this.getFrameNameCallback=t,this},setBaseTexture:function(t,e,i,s){Array.isArray(e)&&(s=i,i=e,e=void 0),null==e&&(e="__BASE"),"number"==typeof i&&arguments.length>=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=vh(i),s=vh(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),a=n.width,o=0,h=0,l=i.length;h0?a/o:0,u=n.height,c=0;for(h=0,l=s.length;h0?0:f,b=0,h=0;for(var P=i.length;h0?0:g),g>=1&&f>=1){var w=typeof(m=this.getFrameNameCallback(h,_,e));"string"!==w&&"number"!==w||r.add(m,0,b+n.cutX,C+n.cutY,g,f)}b+=g}C+=f}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,a,o,h=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-h,u=this.height-l,c=d>=0?this.maxFixedPartScaleX:this.width/h,p=u>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(c,p);if(c>v){var f=(c-v)*h;d>=0?d+=f:d=f,c=v}if(p>v){var g=(p-v)*l;u>=0?u+=g:u=g,p=v}}this.columns.scale=c,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=u>0&&this.rows.stretch>0?u/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,C=this.rows.count;b0&&o>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(_,b)?0:1)?this._drawImage(this.textureKey,s,m,y,a,o):this._drawTileSprite(this.textureKey,s,m,y,a,o)),m+=a;y+=o}this._endDraw()},setStretchMode:function(t){return fh(t)?(this.stretchMode.edge=mh(gh(t,"edge",0)),this.stretchMode.internal=mh(gh(t,"internal",0))):(t=mh(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return bh.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const _h=Phaser.Utils.Objects.IsPlainObject,Sh=Phaser.Utils.Objects.GetValue,Ph=Phaser.GameObjects;var wh=void 0,xh=function(t,e){if(wh||(wh={},Qe(t).events.once("destroy",(function(){for(var t in wh)wh[t].destroy();wh=void 0}))),!wh.hasOwnProperty(e)){var i=Qe(t).scene.systemScene;(t=new Ph[e](i)).setOrigin(0),wh[e]=t}return wh[e]};const Oh=Phaser.GameObjects.RenderTexture;class Eh extends(function(t,e){class i extends t{constructor(t,i,s,r,n,a,o,h,l,d){if(_h(i)?(i=Sh(d=i,"x",0),s=Sh(d,"y",0),r=Sh(d,"width",1),n=Sh(d,"height",1),a=Sh(d,"key",void 0),o=Sh(d,"baseFrame",void 0),h=Sh(d,"columns",void 0),l=Sh(d,"rows",void 0)):_h(r)?(r=Sh(d=r,"width",1),n=Sh(d,"height",1),a=Sh(d,"key",void 0),o=Sh(d,"baseFrame",void 0),h=Sh(d,"columns",void 0),l=Sh(d,"rows",void 0)):_h(a)?(a=Sh(d=a,"key",void 0),o=Sh(d,"baseFrame",void 0),h=Sh(d,"columns",void 0),l=Sh(d,"rows",void 0)):_h(o)?(o=Sh(d=o,"baseFrame",void 0),h=Sh(d,"columns",void 0),l=Sh(d,"rows",void 0)):Array.isArray(o)?(d=l,l=h,h=o,o=Sh(d,"baseFrame",void 0)):_h(h)&&(h=Sh(d=h,"columns",void 0),l=Sh(d,"rows",void 0)),void 0===o&&(o=Sh(d,"frame",void 0)),void 0===h){var u=Sh(d,"leftWidth",void 0),c=Sh(d,"rightWidth",void 0);void 0!==u&&void 0!==c&&(h=[u,void 0,c])}if(void 0===l){var p=Sh(d,"topHeight",void 0),v=Sh(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(Sh(d,"getFrameNameCallback",void 0)),this.setStretchMode(Sh(d,"stretchMode",0)),this.setPreserveRatio(Sh(d,"preserveRatio",!0));var f=Sh(d,"maxFixedPartScale",1),g=Sh(d,"maxFixedPartScaleX",f),m=Sh(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(g,m),this.setBaseTexture(a,o,h,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,Ch),i}(Oh,"rexNinePatch")){}var Th={_drawImage:function(t,e,i,s,r,n){var a=xh(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(a,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var a=xh(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(a,i,s)}};Object.assign(Eh.prototype,Th);class kh extends ei{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Qo(t,e))return t[e];var i=t.parent;return Qo(i,e)?i[e]:void 0}set(t,e,i){return Qo(t,e)?t[e]=i:Qo(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}}const Dh=Phaser.Utils.Objects.GetValue;class Rh extends Eh{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=Dh(e,"effects",!0);i&&rh(this,i),this.style=new kh(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Rh.prototype,to);const Mh=["alpha","tint","flipX","flipY"];var Lh=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("barColor")?i="bar":e.hasOwnProperty("leftWidth")?i="nineSlice":e.hasOwnProperty("key")&&(i="image")),i){case"bar":s=new Ko(t,e);break;case"image":s=new ch(t,e);break;case"nineSlice":s=e.hasOwnProperty("stretchMode")?new Rh(t,e):new hh(t,e);break;default:s=new eo(t,e)}return function(t,e){if(!e)return t;for(var i=0,s=Mh.length;i0?-this.delay:0,this.state=this.nowTime>=0?T:_,this.repeatCounter=0,this}stop(){return this.state=b,this}update(t,e){this.state!==b&&this.state!==k&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=R)):(this.nowTime=this.duration,this.state=k):this.nowTime>=0&&(this.state=T))}get t(){var t;switch(this.state){case b:case _:case R:t=0;break;case T:t=this.nowTime/this.duration;break;case k:t=1}return D(t,0,1)}set t(t){(t=D(t,-1,1))<0?(this.state=_,this.nowTime=-this.delay*t):(this.state=T,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===b}get isDelay(){return this.state===_}get isCountDown(){return this.state===T}get isRunning(){return this.state===_||this.state===T}get isDone(){return this.state===k}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const b=0,_=1,T=2,R=3,k=-1;class A extends P{constructor(t,e){super(t,e),this.timer=new w}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const M=Phaser.Utils.Objects.GetValue,C=Phaser.Utils.Objects.GetAdvancedValue,E=Phaser.Tweens.Builders.GetEaseFunction;class L extends A{resetFromJSON(t){return this.timer.resetFromJSON(M(t,"timer")),this.setEnable(M(t,"enable",!0)),this.setTarget(M(t,"target",this.parent)),this.setDelay(C(t,"delay",0)),this.setDuration(C(t,"duration",1e3)),this.setEase(M(t,"ease","Linear")),this.setRepeat(M(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=E(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var s=this.target,i=this.timer;return i.update(t,e),i.isDelay||this.updateTarget(s,i),this.emit("update",s,this),i.isDone&&this.complete(),this}updateTarget(t,e){}}const O=Phaser.Utils.Objects.GetValue,X=Phaser.Math.Linear;class Y extends L{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=O(t,"key","value");var s=e[this.propertyKey];return this.fromValue=O(t,"from",s),this.toValue=O(t,"to",s),this.setEase(O(t,"ease",this.ease)),this.setDuration(O(t,"duration",this.duration)),this.setRepeat(O(t,"repeat",0)),this.setDelay(O(t,"delay",0)),this.setRepeatDelay(O(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var s=e.t;s=this.easeFn(s),t[this.propertyKey]=X(this.fromValue,this.toValue,s)}}var j={start:function(t){return this.easeValueTask||(this.easeValueTask=new Y(this,{eventEmitter:null})),void 0!==t&&(this.duration=t,this.easeValueTask.stop()),this.easeValueTask.isRunning||(this.easeValueTask.restart({key:"value",from:0,to:1,duration:this.duration,ease:this.ease,repeat:-1,delay:this.delay,repeatDelay:this.repeatDelay}),this.setDirty()),this},stop:function(){return this.easeValueTask?(this.easeValueTask.stop(),this.setDirty(),this):this},pause:function(){return this.easeValueTask?(this.easeValueTask.pause(),this.setDirty(),this):this},resume:function(){return this.easeValueTask?(this.easeValueTask.pause(),this.setDirty(),this):this}};const B=Phaser.Utils.Objects.GetValue;class I extends n{constructor(t,e){super(t,B(e,"x",0),B(e,"y",0),B(e,"width",64),B(e,"height",64)),this.resetFromConfig(e,!0),this.buildShapes(e),B(e,"start",!0)&&this.start()}resetFromConfig(t,e){var s;return void 0===e&&(e=!1),s=e?1e3:this.duration,this.setDuration(B(t,"duration",s)),s=e?"Linear":this.ease,this.setEase(B(t,"ease",s)),s=e?0:this.delay,this.setDelay(B(t,"delay",s)),s=e?0:this.repeatDelay,this.setRepeatDelay(B(t,"repeatDelay",s)),s=e?16777215:this.color,this.setColor(B(t,"color",s)),s=e?0:this.value,this.setValue(B(t,"value",s)),this}buildShapes(){}get centerX(){return this.width/2}get centerY(){return this.height/2}get radius(){return Math.min(this.centerX,this.centerY)}get color(){return this._color}set color(t){this.isColorChanged=this.isColorChanged||this._color!==t,this.dirty=this.dirty||this.isColorChanged,this._color=t,this.setShapesColor(t)}setColor(t){return this.color=t,this}setShapesColor(t){}get value(){return this._value}set value(t){t=Phaser.Math.Clamp(t,0,1),this.dirty=this.dirty||this._value!=t,this._value=t}setValue(t){return this.value=t,this}setDuration(t){return this.duration=t,this}setDelay(t){return this.delay=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return this.ease=t,this}get isRunning(){return!!this.tweenTask&&this.tweenTask.isRunning}}Object.assign(I.prototype,j);var V={fillStyle:function(t,e){return null==t?this.isFilled=!1:(void 0===e&&(e=1),this.isFilled=!0,this.fillColor=t,this.fillAlpha=e),this},lineStyle:function(t,e,s){return null==t||null==e?this.isStroked=!1:(void 0===s&&(s=1),this.isStroked=!0,this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=s),this}},z={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var s=t;for(t in s)this.data[t]=s[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:function(t,e,s){if(!t||"number"==typeof t)return s;if("string"==typeof e){if(t.hasOwnProperty(e))return t[e];if(-1===e.indexOf("."))return s;e=e.split(".")}for(var i=e,r=t,h=s,a=0;a>>16,n=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+a+","+n+","+o+","+h+")"},H=function(t,e,s,i){var r=s||e.strokeColor,h=i||e.strokeAlpha,a=(16711680&r)>>>16,n=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+a+","+n+","+o+","+h+")",t.lineWidth=e.lineWidth};const J=Phaser.Geom.Polygon.Earcut;class K extends F{constructor(){super(),this.pathData=[],this.pathIndexes=[],this.closePath=!1}updateData(){return this.pathIndexes=J(this.pathData),super.updateData(),this}webglRender(t,e,s,i,r){this.isFilled&&function(t,e,s,i,r,h){for(var a=N.getTintAppendFloatAlpha(s.fillColor,s.fillAlpha*i),n=s.pathData,o=s.pathIndexes,l=0;l=2){var r=s[i-2],h=s[i-1];if(t===r&&e===h)return s}return s.push(t,e),s};const Q=Phaser.Math.DegToRad;var $=function(t,e,s,i,r,h,a,n,o){a&&h>r?h-=360:!a&&h0,a=0,n=e.length;athis.value)for(var u=0;uthis.value&&(t+=1));for(var r=this.getShapes(),h=0,a=r.length;h0;this.dirty=this.dirty||this._radiusTL!==t||this._convexTL!==e,this._convexTL=e,this._radiusTL=Math.abs(t)}get radiusTR(){return this._radiusTR}set radiusTR(t){var e=t>0;this.dirty=this.dirty||this._radiusTR!==t||this._convexTR!==e,this._convexTR=e,this._radiusTR=Math.abs(t)}get radiusBL(){return this._radiusBL}set radiusBL(t){var e=t>0;this.dirty=this.dirty||this._radiusBL!==t||this._convexBL!==e,this._convexBL=e,this._radiusBL=Math.abs(t)}get radiusBR(){return this._radiusBR}set radiusBR(t){var e=t>0;this.dirty=this.dirty||this._radiusBR!==t||this._convexBR!==e,this._convexBR=e,this._radiusBR=Math.abs(t)}get radius(){return Math.max(this.radiusTL,this.radiusTR,this.radiusBL,this.radiusBR)}set radius(t){"number"==typeof t?(this.radiusTL=t,this.radiusTR=t,this.radiusBL=t,this.radiusBR=t):(this.radiusTL=Be(t,"tl",0),this.radiusTR=Be(t,"tr",0),this.radiusBL=Be(t,"bl",0),this.radiusBR=Be(t,"br",0))}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}get iterations(){return this._iterations}set iterations(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t}setIterations(t){return this.iterations=t,this}updateData(){var t=this.pathData;t.length=0;var e,s=this.width,i=this.height,r=this.iterations+1;return(e=this.radiusTL)>0?this._convexTL?$(e,e,e,e,180,270,!1,r,t):$(0,0,e,e,90,0,!0,r,t):q(0,0,t),(e=this.radiusTR)>0?this._convexTR?$(s-e,e,e,e,270,360,!1,r,t):$(s,0,e,e,180,90,!0,r,t):q(s,0,t),(e=this.radiusBR)>0?this._convexBR?$(s-e,i-e,e,e,0,90,!1,r,t):$(s,i,e,e,270,180,!0,r,t):q(s,i,t),(e=this.radiusBL)>0?this._convexBL?$(e,i-e,e,e,90,180,!1,r,t):$(0,i,e,e,360,270,!0,r,t):q(0,i,t),t.push(t[0],t[1]),rt(this.x,this.y,t),super.updateData(),this}},triangle:class extends F{constructor(t,e,s,i,r,h){void 0===t&&(t=0),void 0===e&&(e=0),void 0===s&&(s=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===h&&(h=0),super(),this.pathData=[],this.closePath=!0,this.setP0(t,e),this.setP1(s,i),this.setP2(r,h)}get x0(){return this._x0}set x0(t){this.dirty=this.dirty||this._x0!==t,this._x0=t}get y0(){return this._y0}set y0(t){this.dirty=this.dirty||this._y0!==t,this._y0=t}setP0(t,e){return this.x0=t,this.y0=e,this}get x1(){return this._x1}set x1(t){this.dirty=this.dirty||this._x1!==t,this._x1=t}get y1(){return this._y1}set y1(t){this.dirty=this.dirty||this._y1!==t,this._y1=t}setP1(t,e){return this.x1=t,this.y1=e,this}get x2(){return this._x2}set x2(t){this.dirty=this.dirty||this._x2!==t,this._x2=t}get y2(){return this._y2}set y2(t){this.dirty=this.dirty||this._y2!==t,this._y2=t}setP2(t,e){return this.dirty=this.dirty||this.x2!==t||this.y2!==e,this.x2=t,this.y2=e,this}updateData(){return this.pathData.length=0,this.pathData.push(this.x0,this.y0),this.pathData.push(this.x1,this.y1),this.pathData.push(this.x2,this.y2),this.pathData.push(this.x0,this.y0),super.updateData(),this}webglRender(t,e,s,i,r){if(this.isFilled){var h=Ie(this.fillColor,this.fillAlpha*s),a=this.x0-i,n=this.y0-r,o=this.x1-i,l=this.y1-r,u=this.x2-i,d=this.y2-r,p=e.getX(a,n),c=e.getY(a,n),g=e.getX(o,l),v=e.getY(o,l),y=e.getX(u,d),f=e.getY(u,d);t.batchTri(p,c,g,v,y,f,h,h,h)}this.isStroked&&U(t,this,s,i,r)}canvasRender(t,e,s){var i=this.x1-e,r=this.y1-s,h=this.x2-e,a=this.y2-s,n=this.x3-e,o=this.y3-s;t.beginPath(),t.moveTo(i,r),t.lineTo(h,a),t.lineTo(n,o),t.closePath(),this.isFilled&&(W(t,this),t.fill()),this.isStroked&&(H(t,this),t.stroke())}}},ze=Phaser.Utils.Objects.GetValue,Fe=Phaser.Utils.Objects.IsPlainObject,Ne=function(){for(var t=this.getShapes(),e=0,s=t.length;e0?-this.delay:0,this.state=this.nowTime>=0?T:_,this.repeatCounter=0,this}stop(){return this.state=b,this}update(t,e){this.state!==b&&this.state!==k&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=R)):(this.nowTime=this.duration,this.state=k):this.nowTime>=0&&(this.state=T))}get t(){var t;switch(this.state){case b:case _:case R:t=0;break;case T:t=this.nowTime/this.duration;break;case k:t=1}return D(t,0,1)}set t(t){(t=D(t,-1,1))<0?(this.state=_,this.nowTime=-this.delay*t):(this.state=T,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===b}get isDelay(){return this.state===_}get isCountDown(){return this.state===T}get isRunning(){return this.state===_||this.state===T}get isDone(){return this.state===k}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const b=0,_=1,T=2,R=3,k=-1;class A extends P{constructor(t,e){super(t,e),this.timer=new w}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const M=Phaser.Utils.Objects.GetValue,C=Phaser.Utils.Objects.GetAdvancedValue,E=Phaser.Tweens.Builders.GetEaseFunction;class L extends A{resetFromJSON(t){return this.timer.resetFromJSON(M(t,"timer")),this.setEnable(M(t,"enable",!0)),this.setTarget(M(t,"target",this.parent)),this.setDelay(C(t,"delay",0)),this.setDuration(C(t,"duration",1e3)),this.setEase(M(t,"ease","Linear")),this.setRepeat(M(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=E(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var s=this.target,i=this.timer;return i.update(t,e),i.isDelay||this.updateTarget(s,i),this.emit("update",s,this),i.isDone&&this.complete(),this}updateTarget(t,e){}}const O=Phaser.Utils.Objects.GetValue,X=Phaser.Math.Linear;class Y extends L{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=O(t,"key","value");var s=e[this.propertyKey];return this.fromValue=O(t,"from",s),this.toValue=O(t,"to",s),this.setEase(O(t,"ease",this.ease)),this.setDuration(O(t,"duration",this.duration)),this.setRepeat(O(t,"repeat",0)),this.setDelay(O(t,"delay",0)),this.setRepeatDelay(O(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var s=e.t;s=this.easeFn(s),t[this.propertyKey]=X(this.fromValue,this.toValue,s)}}var j={start:function(t){return this.easeValueTask||(this.easeValueTask=new Y(this,{eventEmitter:null})),void 0!==t&&(this.duration=t,this.easeValueTask.stop()),this.easeValueTask.isRunning||(this.easeValueTask.restart({key:"value",from:0,to:1,duration:this.duration,ease:this.ease,repeat:-1,delay:this.delay,repeatDelay:this.repeatDelay}),this.setDirty()),this},stop:function(){return this.easeValueTask?(this.easeValueTask.stop(),this.setDirty(),this):this},pause:function(){return this.easeValueTask?(this.easeValueTask.pause(),this.setDirty(),this):this},resume:function(){return this.easeValueTask?(this.easeValueTask.pause(),this.setDirty(),this):this}};const B=Phaser.Utils.Objects.GetValue;class I extends n{constructor(t,e){super(t,B(e,"x",0),B(e,"y",0),B(e,"width",64),B(e,"height",64)),this.resetFromConfig(e,!0),this.buildShapes(e),B(e,"start",!0)&&this.start()}resetFromConfig(t,e){var s;return void 0===e&&(e=!1),s=e?1e3:this.duration,this.setDuration(B(t,"duration",s)),s=e?"Linear":this.ease,this.setEase(B(t,"ease",s)),s=e?0:this.delay,this.setDelay(B(t,"delay",s)),s=e?0:this.repeatDelay,this.setRepeatDelay(B(t,"repeatDelay",s)),s=e?16777215:this.color,this.setColor(B(t,"color",s)),s=e?0:this.value,this.setValue(B(t,"value",s)),this}buildShapes(){}get centerX(){return this.width/2}get centerY(){return this.height/2}get radius(){return Math.min(this.centerX,this.centerY)}get color(){return this._color}set color(t){this.isColorChanged=this.isColorChanged||this._color!==t,this.dirty=this.dirty||this.isColorChanged,this._color=t,this.setShapesColor(t)}setColor(t){return this.color=t,this}setShapesColor(t){}get value(){return this._value}set value(t){t=Phaser.Math.Clamp(t,0,1),this.dirty=this.dirty||this._value!=t,this._value=t}setValue(t){return this.value=t,this}setDuration(t){return this.duration=t,this}setDelay(t){return this.delay=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return this.ease=t,this}get isRunning(){return!!this.tweenTask&&this.tweenTask.isRunning}}Object.assign(I.prototype,j);var V={fillStyle:function(t,e){return null==t?this.isFilled=!1:(void 0===e&&(e=1),this.isFilled=!0,this.fillColor=t,this.fillAlpha=e),this},lineStyle:function(t,e,s){return null==t||null==e?this.isStroked=!1:(void 0===s&&(s=1),this.isStroked=!0,this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=s),this}},z={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var s=t;for(t in s)this.data[t]=s[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:function(t,e,s){if(!t||"number"==typeof t)return s;if("string"==typeof e){if(t.hasOwnProperty(e))return t[e];if(-1===e.indexOf("."))return s;e=e.split(".")}for(var i=e,r=t,h=s,a=0;a>>16,n=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+a+","+n+","+o+","+h+")"},H=function(t,e,s,i){var r=s||e.strokeColor,h=i||e.strokeAlpha,a=(16711680&r)>>>16,n=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+a+","+n+","+o+","+h+")",t.lineWidth=e.lineWidth};const J=Phaser.Geom.Polygon.Earcut;class K extends F{constructor(){super(),this.pathData=[],this.pathIndexes=[],this.closePath=!1}updateData(){return this.pathIndexes=J(this.pathData),super.updateData(),this}webglRender(t,e,s,i,r){this.isFilled&&function(t,e,s,i,r,h){for(var a=N.getTintAppendFloatAlpha(s.fillColor,s.fillAlpha*i),n=s.pathData,o=s.pathIndexes,l=0;l=2){var r=s[i-2],h=s[i-1];if(t===r&&e===h)return s}return s.push(t,e),s};const Q=Phaser.Math.DegToRad;var $=function(t,e,s,i,r,h,a,n,o){a&&h>r?h-=360:!a&&h0,a=0,n=e.length;athis.value)for(var u=0;uthis.value&&(t+=1));for(var r=this.getShapes(),h=0,a=r.length;h0;this.dirty=this.dirty||this._radiusTL!==t||this._convexTL!==e,this._convexTL=e,this._radiusTL=Math.abs(t)}get radiusTR(){return this._radiusTR}set radiusTR(t){var e=t>0;this.dirty=this.dirty||this._radiusTR!==t||this._convexTR!==e,this._convexTR=e,this._radiusTR=Math.abs(t)}get radiusBL(){return this._radiusBL}set radiusBL(t){var e=t>0;this.dirty=this.dirty||this._radiusBL!==t||this._convexBL!==e,this._convexBL=e,this._radiusBL=Math.abs(t)}get radiusBR(){return this._radiusBR}set radiusBR(t){var e=t>0;this.dirty=this.dirty||this._radiusBR!==t||this._convexBR!==e,this._convexBR=e,this._radiusBR=Math.abs(t)}get radius(){return Math.max(this.radiusTL,this.radiusTR,this.radiusBL,this.radiusBR)}set radius(t){"number"==typeof t?(this.radiusTL=t,this.radiusTR=t,this.radiusBL=t,this.radiusBR=t):(this.radiusTL=Ie(t,"tl",0),this.radiusTR=Ie(t,"tr",0),this.radiusBL=Ie(t,"bl",0),this.radiusBR=Ie(t,"br",0))}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}get iterations(){return this._iterations}set iterations(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t}setIterations(t){return this.iterations=t,this}updateData(){var t=this.pathData;t.length=0;var e,s=this.width,i=this.height,r=this.iterations+1;return(e=this.radiusTL)>0?this._convexTL?$(e,e,e,e,180,270,!1,r,t):$(0,0,e,e,90,0,!0,r,t):q(0,0,t),(e=this.radiusTR)>0?this._convexTR?$(s-e,e,e,e,270,360,!1,r,t):$(s,0,e,e,180,90,!0,r,t):q(s,0,t),(e=this.radiusBR)>0?this._convexBR?$(s-e,i-e,e,e,0,90,!1,r,t):$(s,i,e,e,270,180,!0,r,t):q(s,i,t),(e=this.radiusBL)>0?this._convexBL?$(e,i-e,e,e,90,180,!1,r,t):$(0,i,e,e,360,270,!0,r,t):q(0,i,t),t.push(t[0],t[1]),ht(this.x,this.y,t),super.updateData(),this}},triangle:class extends F{constructor(t,e,s,i,r,h){void 0===t&&(t=0),void 0===e&&(e=0),void 0===s&&(s=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===h&&(h=0),super(),this.pathData=[],this.closePath=!0,this.setP0(t,e),this.setP1(s,i),this.setP2(r,h)}get x0(){return this._x0}set x0(t){this.dirty=this.dirty||this._x0!==t,this._x0=t}get y0(){return this._y0}set y0(t){this.dirty=this.dirty||this._y0!==t,this._y0=t}setP0(t,e){return this.x0=t,this.y0=e,this}get x1(){return this._x1}set x1(t){this.dirty=this.dirty||this._x1!==t,this._x1=t}get y1(){return this._y1}set y1(t){this.dirty=this.dirty||this._y1!==t,this._y1=t}setP1(t,e){return this.x1=t,this.y1=e,this}get x2(){return this._x2}set x2(t){this.dirty=this.dirty||this._x2!==t,this._x2=t}get y2(){return this._y2}set y2(t){this.dirty=this.dirty||this._y2!==t,this._y2=t}setP2(t,e){return this.dirty=this.dirty||this.x2!==t||this.y2!==e,this.x2=t,this.y2=e,this}updateData(){return this.pathData.length=0,this.pathData.push(this.x0,this.y0),this.pathData.push(this.x1,this.y1),this.pathData.push(this.x2,this.y2),this.pathData.push(this.x0,this.y0),super.updateData(),this}webglRender(t,e,s,i,r){if(this.isFilled){var h=Ve(this.fillColor,this.fillAlpha*s),a=this.x0-i,n=this.y0-r,o=this.x1-i,l=this.y1-r,u=this.x2-i,d=this.y2-r,p=e.getX(a,n),c=e.getY(a,n),g=e.getX(o,l),v=e.getY(o,l),y=e.getX(u,d),f=e.getY(u,d);t.batchTri(p,c,g,v,y,f,h,h,h)}this.isStroked&&U(t,this,s,i,r)}canvasRender(t,e,s){var i=this.x1-e,r=this.y1-s,h=this.x2-e,a=this.y2-s,n=this.x3-e,o=this.y3-s;t.beginPath(),t.moveTo(i,r),t.lineTo(h,a),t.lineTo(n,o),t.closePath(),this.isFilled&&(W(t,this),t.fill()),this.isStroked&&(H(t,this),t.stroke())}}},Fe=Phaser.Utils.Objects.GetValue,Ne=Phaser.Utils.Objects.IsPlainObject,Ge=function(){for(var t=this.getShapes(),e=0,s=t.length;e=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const O=Phaser.Math.DegToRad;var E={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=O(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},T={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=_(t.scaleX,i.scaleX),e.scaleY=_(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},k={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=_(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},D={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},R={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},L={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},Y={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(t){void 0===t&&(t=!1);var e=this;return this._mask=null,this.setChildMaskVisible(this),this.children.forEach((function(t){t.clearMask&&t.clearMask(!1),t.hasOwnProperty("isRexContainerLite")||e.setChildMaskVisible(t)})),t&&this.mask&&this.mask.destroy(),this}},j=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},A=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const W=Phaser.Utils.Array;var F={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Te=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const ke=/(\S+)\[(\d+)\]/i,Me=Phaser.Utils.Objects.GetValue;var De=function(t,e){return void 0===e?t:t[e]},Re=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Me(e,"left",0),t.right=Me(e,"right",0),t.top=Me(e,"top",0),t.bottom=Me(e,"bottom",0)),t},Le={getInnerPadding(t){return De(this.space,t)},setInnerPadding(t,e){return Re(this.space,t,e),this},getOuterPadding(t){return De(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Re(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),De(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Re(this.getSizerConfig(t).padding,e,i),this}},Ye=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},je=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Xe=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},ze=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Ae=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},Ie=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},We={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Fe=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?mi:fi,this.repeatCounter=0,this}stop(){return this.state=gi,this}update(t,e){this.state!==gi&&this.state!==bi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=yi)):(this.nowTime=this.duration,this.state=bi):this.nowTime>=0&&(this.state=mi))}get t(){var t;switch(this.state){case gi:case fi:case yi:t=0;break;case mi:t=this.nowTime/this.duration;break;case bi:t=1}return pi(t,0,1)}set t(t){(t=pi(t,-1,1))<0?(this.state=fi,this.nowTime=-this.delay*t):(this.state=mi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===gi}get isDelay(){return this.state===fi}get isCountDown(){return this.state===mi}get isRunning(){return this.state===fi||this.state===mi}get isDone(){return this.state===bi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const gi=0,fi=1,mi=2,yi=3,bi=-1;class Ci extends di{constructor(t,e){super(t,e),this.timer=new vi}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const xi=Phaser.Utils.Objects.GetValue,Si=Phaser.Utils.Objects.GetAdvancedValue,wi=Phaser.Tweens.Builders.GetEaseFunction;class _i extends Ci{resetFromJSON(t){return this.timer.resetFromJSON(xi(t,"timer")),this.setEnable(xi(t,"enable",!0)),this.setTarget(xi(t,"target",this.parent)),this.setDelay(Si(t,"delay",0)),this.setDuration(Si(t,"duration",1e3)),this.setEase(xi(t,"ease","Linear")),this.setRepeat(xi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=wi(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Pi=Phaser.Utils.Objects.GetValue,Oi=Phaser.Utils.Objects.GetAdvancedValue,Ei=Phaser.Math.Linear;let Ti=class extends _i{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Pi(t,"mode",0)),this.setScaleRange(Oi(t,"start",void 0),Oi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=ki[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Oi(t,"x",this.parent.scaleX),this.startY=Oi(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Oi(e,"x",void 0),this.endY=Oi(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Ei(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Ei(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const ki={stop:0,destroy:1,yoyo:2};var Mi=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new Ti(t,a):r.resetFromJSON(a),r.restart(),r},Di=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Ti&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new Ti(t,h):n.resetFromJSON(h),n.restart(),n},Ri=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Li=function(t){return Ri(t,"complete")};const Yi=Phaser.Utils.Objects.IsPlainObject;var ji={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Yi(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Mi(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Li(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Yi(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Di(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Li(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Li(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Yi(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new Ti(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Li(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Xi={};Object.assign(Xi,ji),Xi.onInitScale=function(){ji.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=Ce.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const zi=Phaser.Utils.Objects.GetValue,Ai=Phaser.Utils.Objects.GetAdvancedValue,Ii=Phaser.Math.Linear;class Wi extends _i{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(zi(t,"mode",0)),this.setAlphaRange(Ai(t,"start",this.parent.alpha),Ai(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Fi[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Ii(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Fi={stop:0,destroy:1,yoyo:2},Vi=Phaser.Utils.Objects.IsPlainObject;var Bi=function(t,e,i,s){var r,n;Vi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Wi(t,h):s.resetFromJSON(h),s.restart(),s},Ni=function(t,e,i,s){i instanceof Wi&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Wi(t,r):s.resetFromJSON(r),s.restart(),s};const Hi=Phaser.Utils.Objects.IsPlainObject;var Gi={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Hi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Bi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Li(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Hi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Ni(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Li(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Li(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Ui={};Object.assign(Ui,Gi),Ui.onInitFade=function(){Gi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=Ce.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const $i=Phaser.Utils.Objects.GetValue,Ji=Phaser.Utils.Objects.GetAdvancedValue,qi=Phaser.Math.Linear;class Ki extends _i{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode($i(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ji(t,"x",void 0),i=Ji(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Zi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Ji(i,"startX",void 0),this.startY=Ji(i,"startY",void 0),this.endX=Ji(i,"endX",void 0),this.endY=Ji(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=qi(this.startX,this.endX,i)),this.hasMoveY&&(t.y=qi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Zi={stop:0,destroy:1,yoyo:2};var Qi=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const ts=Phaser.Utils.Objects.IsPlainObject,es=Phaser.Math.Distance.Between;var is={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(ts(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*es(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Ki&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=Qi(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=Qi(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Ki(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Li(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Li(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(ts(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*es(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Ki&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=Qi(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=Qi(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Ki(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Li(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Li(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},ss={};Object.assign(ss,is),ss.onInitEaseMove=function(){is.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=Ce.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const rs=Phaser.Utils.Objects.GetValue;class ns extends ai{constructor(t,e){super(t,e),this.timer=new vi,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(rs(t,"timer")),this.setEnable(rs(t,"enable",!0)),this.setMode(rs(t,"mode",1)),this.isRunning=rs(t,"isRunning",!1),this.setMagnitudeMode(rs(t,"magnitudeMode",1)),this.setAxisMode(rs(t,"axis",0)),this.setDuration(rs(t,"duration",500)),this.setMagnitude(rs(t,"magnitude",10)),this.ox=rs(t,"ox",void 0),this.oy=rs(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=hs[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=os[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=as[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=rs(i,"magnitude",void 0),t=rs(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const hs={effect:0,behavior:1},as={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},os={constant:0,decay:1},ls=Phaser.Utils.Objects.IsPlainObject;var ds={shake(t,e,i){if(ls(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new ns(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Li(this._shake)}};const cs=Phaser.Utils.Objects.GetValue,us=Phaser.Math.Linear;class ps extends _i{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=cs(t,"key","value");var i=e[this.propertyKey];return this.fromValue=cs(t,"from",i),this.toValue=cs(t,"to",i),this.setEase(cs(t,"ease",this.ease)),this.setDuration(cs(t,"duration",this.duration)),this.setRepeat(cs(t,"repeat",0)),this.setDelay(cs(t,"delay",0)),this.setRepeatDelay(cs(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=us(this.fromValue,this.toValue,i)}}const vs=Phaser.Utils.Objects.IsPlainObject;class gs extends ii{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new ps(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(vs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(vs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var fs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new gs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Ri(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},ms=Phaser.Utils.Array.Remove,ys={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var Ls={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Ke(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Ys={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=zt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=zt),this.transitOutCallback=t,this}},js={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Xs={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},zs={};Object.assign(zs,Ls,Ys,js,Xs);const As=Phaser.Utils.Objects.GetValue;class Is extends ii{constructor(t,e){super(t,e),this.setTransitInTime(As(e,"duration.in",200)),this.setTransitOutTime(As(e,"duration.out",200)),this.setTransitInCallback(As(e,"transitIn")),this.setTransitOutCallback(As(e,"transitOut")),this.oneShotMode=As(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Rs(this,{eventEmitter:!1,initState:As(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Is.prototype,zs);var Ws=function(t){if(t.parentContainer)return Ws(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?Ws(e):t};class Fs extends ii{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Ws(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Vs=Phaser.GameObjects.Rectangle;class Bs extends Vs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Fs(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Ns=Phaser.Utils.Objects.GetValue;class Hs extends ii{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Ns(t,"hitAreaMode",0)),this.setEnable(Ns(t,"enable",!0)),this.setStopMode(Ns(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Gs[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Gs={default:0,fullWindow:1};const Us=Phaser.Utils.Objects.GetValue;class $s extends Bs{constructor(t,e){super(t,Us(e,"color",0),Us(e,"alpha",.8)),this.touchEventStop=new Hs(this,{hitAreaMode:1})}}var Js={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Mi(t,e)},scaleDown(t,e){Di(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Bi(t,e)},fadeOut(t,e){Ni(t,e,!1)}},qs=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Bi(t,e,t.alpha)},Ks=function(t,e){Ni(t,e,!1)},Zs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!nt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Qs=Phaser.Utils.Objects.GetValue;let tr=class extends Is{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=er.popUp),null==e.transitOut&&(e.transitOut=er.scaleDown),e.destroy=Qs(e,"destroy",!0),super(t,e);var i=Qs(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new $s(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Qs(i,"transitIn",qs)),this.setCoverTransitOutCallback(Qs(i,"transitOut",Ks)));var s=Qs(e,"touchOutsideClose",!1),r=Qs(e,"duration.hold",-1),n=Qs(e,"timeOutClose",r>=0),h=Qs(e,"anyTouchClose",!1);Qs(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Qs(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Zs(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=er[t]),t){case er.popUp:t=Js.popUp;break;case er.fadeIn:t=Js.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=er[t]),t){case er.scaleDown:t=Js.scaleDown;break;case er.fadeOut:t=Js.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const er={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var ir=function(t){return t&&"function"==typeof t},sr={modal(t,e){return ir(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new tr(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},rr=function(t,e,i,s,r){ir(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},nr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return rr.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return rr.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return rr.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return rr.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return rr.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return rr.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return rr.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return rr.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return rr.call(this,"shutdown",t,e,i,s),this}},hr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=ar),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},ar={},or=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?Zs(t,e.x,e.y,i,s):!!(r=hr(e,n,!0))&&Zs(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const br={press:0,pointerdown:0,release:1,pointerup:1};var Cr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new yr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},xr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!Sr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return wr.length=0,!0;return wr.length=0,!1},wr=[];const _r=Phaser.Utils.Objects.GetValue;class Pr extends ii{constructor(t,e){super(t,e),this._enable=void 0;var i=_r(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(_r(t,"enable",!0)),this.setMode(_r(t,"mode",1)),this.setClickInterval(_r(t,"clickInterval",100)),this.setDragThreshold(_r(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Or[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?xr:or)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Or={press:0,pointerdown:0,release:1,pointerup:1};var Er={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Pr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Tr extends Ds{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const kr=Phaser.Utils.Objects.GetValue;class Mr extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Tr,this.parent.setInteractive(kr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(kr(t,"enable",!0)),this.setCooldown(kr(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Dr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&or(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Mr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Mr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Rr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Lr=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Jr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===qr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Jr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Kr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&or(t,s,e,i)}}const Jr=0,qr=1,Kr="IDLE",Zr=Phaser.Utils.Objects.GetValue,Qr=Phaser.Math.Distance.Between;class tn extends $r{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=en},eventEmitter:!1};this.setRecongizedStateObject(new Ds(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Zr(t,"time",250)),this.setTapInterval(Zr(t,"tapInterval",200)),this.setDragThreshold(Zr(t,"threshold",9)),this.setTapOffset(Zr(t,"tapOffset",10));var e=Zr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Zr(t,"maxTaps",void 0)),this.setMinTaps(Zr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case en:this.state=sn;break;case sn:var t=this.lastPointer;Qr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=rn,this.state=sn);break;case rn:this.state=sn}}onDragEnd(){this.state===sn&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=rn))}onDrag(){this.state!==en&&this.pointer.getDistance()>this.dragThreshold&&(this.state=en)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===sn){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=en):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=rn:this.state=en)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===rn&&(this.state=en)}get isTapped(){return this.state===rn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const en="IDLE",sn="BEGIN",rn="RECOGNIZED",nn=Phaser.Utils.Objects.GetValue;class hn extends $r{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=an},eventEmitter:!1};this.setRecongizedStateObject(new Ds(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(nn(t,"threshold",9)),this.setHoldTime(nn(t,"time",251)),this}onDragStart(){this.state=on,0===this.holdTime&&(this.state=ln)}onDragEnd(){this.state=an}onDrag(){this.state!==an&&this.pointer.getDistance()>this.dragThreshold&&(this.state=an)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===on&&t-this.pointer.downTime>=this.holdTime&&(this.state=ln)}get isPressed(){return this.state===ln}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const an="IDLE",on="BEGIN",ln="RECOGNIZED";Phaser.Utils.Objects.GetValue;var dn=function(t){return ti(t).loop.delta};const cn=Phaser.Math.Distance.Between,un=Phaser.Math.Angle.Between;var pn={getDt:function(){return dn(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return cn(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return un(e.x,e.y,t.x,t.y)}},vn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},gn={};const fn=Phaser.Utils.Objects.GetValue,mn=Phaser.Math.RadToDeg;class yn extends $r{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=bn},eventEmitter:!1};this.setRecongizedStateObject(new Ds(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(fn(t,"threshold",10)),this.setVelocityThreshold(fn(t,"velocityThreshold",1e3)),this.setDirectionMode(fn(t,"dir","8dir")),this}onDragStart(){this.state=Cn}onDragEnd(){this.state=bn}onDrag(){this.state===Cn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=xn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===xn&&(this.state=bn)}get isSwiped(){return this.state===xn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=vn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=gn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(mn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(yn.prototype,pn);const bn="IDLE",Cn="BEGIN",xn="RECOGNIZED",Sn=Phaser.Utils.Objects.GetValue,wn=Phaser.Utils.Array.SpliceOne,_n=Phaser.Math.Distance.Between,Pn=Phaser.Math.Angle.Between;class On{constructor(t,e){var i=Ke(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(Sn(e,"inputConfig",void 0)),this.setEventEmitter(Sn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(Sn(t,"enable",!0)),this.bounds=Sn(t,"bounds",void 0),this.tracerState=Tn,this.pointers.length=0,ft(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,ft(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case Tn:this.tracerState=kn,this.onDrag1Start();break;case kn:this.tracerState=Mn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],wn(this.pointers,e),this.tracerState){case kn:this.tracerState=Tn,this.onDrag1End();break;case Mn:this.tracerState=kn,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case kn:this.onDrag1();break;case Mn:this.onDrag2()}}}dragCancel(){return this.tracerState===Mn&&this.onDrag2End(),this.pointers.length=0,ft(this.movedState),this.tracerState=Tn,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0],e=this.pointers[1];return _n(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0],e=this.pointers[1];return Pn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;En.x=e.x-i.x,En.y=e.y-i.y}else En.x=0,En.y=0;return En}get centerX(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Mn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Mn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Dn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&or(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&or(t,s,e,i)}}Object.assign(On.prototype,$e);var En={};const Tn=0,kn=1,Mn=2,Dn="IDLE";Phaser.Utils.Objects.GetValue;const Rn=Phaser.Math.RotateAround;var Ln=function(t,e,i,s){return Rn(t,e,i,s),t.rotation+=s,t},Yn={};const jn=Phaser.Utils.Objects.GetValue,Xn=Phaser.Math.Angle.WrapDegrees,zn=Phaser.Math.Angle.ShortestBetween,An=Phaser.Math.RadToDeg,In=Phaser.Math.DegToRad;var Wn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Yn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Xn(An(this.angleBetween));this.angle=zn(this.prevAngle,t),this.prevAngle=t,this.state=Bn}break;case Bn:t=Xn(An(this.angleBetween)),this.angle=zn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Bn}get rotation(){return In(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Wn);const Fn="IDLE",Vn="BEGIN",Bn="RECOGNIZED",Nn=Phaser.Utils.Objects.GetValue;var Hn=function(t){var e=Nn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new tn(this,e),this._tap.on("tap",(function(t,e,s){Yr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Yr(i.eventEmitter,`${i.eventNamePrefix}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Gn=Phaser.Utils.Objects.GetValue;var Un=function(t){var e=Gn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new hn(this,e),this._press.on("pressstart",(function(t,e,s){Yr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this).on("pressend",(function(t,e,s){Yr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const $n=Phaser.Utils.Objects.GetValue;var Jn=function(t){var e=$n(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new yn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Yr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Yr(i.eventEmitter,`${i.eventNamePrefix}swipe`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const qn=Phaser.Utils.Objects.GetValue;var Kn=function(t,e){return t.setInteractive(),qn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:qn(e,"targets",[t]),targetMode:qn(e,"targetMode","parent"),eventEmitter:qn(e,"eventEmitter",t),eventNamePrefix:qn(e,"inputEventPrefix","child.")},Xr.call(t,e),Ir.call(t,e),Vr.call(t,e),Gr.call(t,e),Hn.call(t,e),Un.call(t,e),Jn.call(t,e),t},Zn={getSizerConfig:function(t){return void 0===t&&(t=this),Mt(t)},getChildPrevState:function(t){var e=Mt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Lt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=oe(e,"color"),s=oe(e,"lineWidth");var o=oe(e,"name",!1);o&&(r=oe(o,"createTextCallback",ce),n=oe(o,"createTextCallbackScope",void 0),"string"==typeof(h=oe(o,"align","left-top"))&&(h=Xt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new le(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}var d,c,u=this.getAllShownChildren([this]);ue(u,u);for(var p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const ah=Phaser.Utils.Objects.IsPlainObject,oh=Phaser.Utils.Objects.GetValue,lh=Phaser.Display.Align.CENTER,dh={min:0,full:-1};var ch=function(t,e,i,s,r,n,h,a,o,l){var d,c,u,p;me.call(this,t);var v=t.isRexSpace,g=typeof e;if(null===e)return this;if("number"===g);else if("string"===g)e=dh[e];else if(ah(e)){var f;e=oh(f=e,"proportion",void 0),i=oh(f,"align",lh),s=oh(f,"padding",0),r=oh(f,"expand",!1),n=oh(f,"key",void 0),h=oh(f,"index",void 0),t.isRexSizer||(a=oh(f,"minWidth",void 0),o=oh(f,"minHeight",void 0)),l=oh(f,"fitRatio",0),d=oh(f,"offsetX",0),c=oh(f,"offsetY",0),u=oh(f,"offsetOriginX",0),p=oh(f,"offsetOriginY",0)}return"string"==typeof i&&(i=Xt[i]),void 0===e&&(e=v?1:0),void 0===i&&(i=lh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(v?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(v?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),(f=this.getSizerConfig(t)).proportion=e,f.align=i,f.padding=ge(s),f.expand=r,f.fitRatio=0===e?l:0,f.alignOffsetX=d,f.alignOffsetY=c,f.alignOffsetOriginX=u,f.alignOffsetOriginY=p,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},uh={add:ch,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),ch.call(this,new nh(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return ah(i)&&(i.index=t),ch.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=hh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const ph=kt.prototype.clear;var vh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),ph.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,vh.call(this,t),this}},mh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=Xt[e]),this.getSizerConfig(t).align=e,this}},yh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},bh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},Ch={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},xh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Ne(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Fe.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d,c,u=this.sizerChildren,p=this.innerLeft,v=this.innerTop,g=this.innerWidth,f=this.innerHeight,m=p,y=v,b=this.startChildIndex,C=0,x=u.length;C0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=ze.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||je.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&sh.call(this,t,void 0),Xe.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Ae.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&sh.call(this,void 0,t),Ie.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(xh,uh,fh,mh,yh,bh,Ch);var Sh=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},wh={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const _h=Phaser.Utils.Objects.IsPlainObject,Ph=Phaser.Utils.Objects.GetValue;class Oh extends th{constructor(t,e,i,s,r,n,h){_h(e)?(e=Ph(h=e,"x",0),i=Ph(h,"y",0),s=Ph(h,"width",void 0),r=Ph(h,"height",void 0),n=Ph(h,"orientation",0)):_h(s)?(s=Ph(h=s,"width",void 0),r=Ph(h,"height",void 0),n=Ph(h,"orientation",0)):_h(n)&&(n=Ph(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Ph(h,"space.item",0)),this.setStartChildIndex(Ph(h,"startChildIndex",0)),this.setRTL(Ph(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=wh[t]),t}(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=Sh.call(this)),this._childrenProportion}}Object.assign(Oh.prototype,xh);var Eh={v:0,vertical:0,y:0,h:1,horizontal:1,x:1,xy:2,vh:2},Th=function(t){var e=!!t.sliderY||!!t.scrollerY,i=!!t.sliderX||!!t.scrollerX;return e&&i?2:e?0:i?1:0},kh=function(){return Array.prototype.reduce.call(arguments,Mh,0)},Mh=function(t,e){return t+e};const Dh=Phaser.Utils.Objects.IsPlainObject,Rh=Phaser.Utils.Objects.GetValue,Lh=Phaser.Display.Align.CENTER;var Yh=function(t,e,i,s,r){if("number"==typeof t||"number"==typeof e){if(void 0===t){for(var n=0;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return Xh(this.sizerChildren,null),vh.call(this,t),this}},Ah={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)Xh(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},Vh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=ze.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,Xh(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Xh(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},Nh=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const Hh=Phaser.Utils.Objects.IsPlainObject,Gh=Phaser.Utils.Objects.GetValue;class Uh extends th{constructor(t,e,i,s,r,n,h,a,o,l){Hh(e)?(e=Gh(l=e,"x",0),i=Gh(l,"y",0),s=Gh(l,"width",void 0),r=Gh(l,"height",void 0),n=Gh(l,"column",l.col||0),h=Gh(l,"row",0),a=Gh(l,"columnProportions",0),o=Gh(l,"rowProportions",0)):Hh(s)?(s=Gh(l=s,"width",void 0),r=Gh(l,"height",void 0),n=Gh(l,"column",l.col||0),h=Gh(l,"row",0),a=Gh(l,"columnProportions",0),o=Gh(l,"rowProportions",0)):Hh(n)?(n=Gh(l=n,"column",l.col||0),h=Gh(l,"row",0),a=Gh(l,"columnProportions",0),o=Gh(l,"rowProportions",0)):Hh(a)&&(a=Gh(l=a,"columnProportions",0),o=Gh(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(Gh(l,"createCellContainerCallback")),this.setIndentLeft(Gh(l,"space.indentLeftOdd",0),Gh(l,"space.indentLeftEven",0)),this.setIndentTop(Gh(l,"space.indentTopOdd",0),Gh(l,"space.indentTopEven",0)),this.resetGrid(n,h,a,o,Gh(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=Bh.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=Nh.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(Uh.prototype,Vh);const $h=Phaser.Utils.Objects.GetValue;var Jh=Phaser.Renderer.WebGL.Utils,qh=function(t,e,i,s,r,n){for(var h=Jh.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),a=i.pathData,o=i.pathIndexes,l=0;l>>16,a=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+h+","+a+","+o+","+n+")"},ea=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,h=(16711680&r)>>>16,a=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+h+","+a+","+o+","+n+")",t.lineWidth=e.lineWidth};const ia=Phaser.Renderer.Canvas.SetTransform;var sa={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Qh(e,i,s),h=r.calcMatrix.copyFrom(n.calc),a=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&qh(r,h,e,l,a,o),e.isStroked&&Zh(r,e,l,a,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(ia(t,r,e,i,s)){var n=e._displayOriginX,h=e._displayOriginY,a=e.pathData,o=a.length-1,l=a[0]-n,d=a[1]-h;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(na.prototype,sa);const ha=Phaser.Utils.Objects.GetValue;let aa=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=ha(t,"x",0),i=ha(t,"y",0));var s=this.cornerRadius;s.tl=oa(ha(t,"tl",void 0),e,i),s.tr=oa(ha(t,"tr",void 0),e,i),s.bl=oa(ha(t,"bl",void 0),e,i),s.br=oa(ha(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){la(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){la(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){la(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){la(this.cornerRadius.br,t)}};var oa=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),da(t),t},la=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=ha(e,"x",0),t.y=ha(e,"y",0)),da(t)},da=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},ca=function(t){return t.x>0&&t.y>0},ua=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const pa=Phaser.Math.DegToRad;var va=function(t,e,i,s,r,n,h,a,o){h&&n>r?n-=360:!h&&n0,h=0,a=e.length;h=0?t.startAt(h+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(h+n,i):t.startAt(h,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(h,i),t.close(),t};const go=Phaser.Utils.Objects.GetValue,fo=Phaser.Utils.Objects.IsPlainObject;class mo extends(Fa(La)){constructor(t,e,i,s,r,n,h,a){fo(e)?(e=(a=e).x,i=a.y,s=a.width,r=a.height,n=a.barColor,h=a.value):fo(s)?(s=(a=s).width,r=a.height,n=a.barColor,h=a.value):fo(n)&&(n=(a=n).barColor,h=a.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===h&&(h=0),super(t,e,i,s,r,a),this.type="rexLineProgress",this.bootProgressBase(a),this.addShape((new po).setName("trackFill")).addShape((new po).setName("bar")).addShape((new po).setName("trackStroke")),this.setTrackColor(go(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(go(a,"trackStrokeThickness",2),go(a,"trackStrokeColor",void 0)),this.setSkewX(go(a,"skewX",0)),this.setRTL(go(a,"rtl",!1)),this.setValue(h)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var yo={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&vo(s,0,0,e,i,t);var r,n,h=this.getShape("bar");h.fillStyle(this.barColor),h.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),vo(h,r,0,n,i,t));var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&vo(a,0,0,e,i,t)}};Object.assign(mo.prototype,yo);var bo=function(t){return null==t||""===t||0===t.length},Co=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(bo(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(bo(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,h=e.length;nAo(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=Ao(t[i]));return e}const Io=Phaser.Utils.Objects.IsPlainObject,Wo=Phaser.Utils.Objects.GetValue;var Fo=function(t){return"string"==typeof t&&(t=Vo[t]),t};const Vo={scale:0,repeat:1};var Bo=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},No={_beginDraw:zt,_drawImage:zt,_drawTileSprite:zt,_endDraw:zt,setGetFrameNameCallback:function(t){return void 0===t&&(t=zo),this.getFrameNameCallback=t,this},setBaseTexture:function(t,e,i,s){Array.isArray(e)&&(s=i,i=e,e=void 0),null==e&&(e="__BASE"),"number"==typeof i&&arguments.length>=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=Ao(i),s=Ao(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),h=n.width,a=0,o=0,l=i.length;o0?h/a:0,c=n.height,u=0;for(o=0,l=s.length;o0?0:g,b=0,o=0;for(var w=i.length;o0?0:f),f>=1&&g>=1){var _=typeof(m=this.getFrameNameCallback(o,x,e));"string"!==_&&"number"!==_||r.add(m,0,b+n.cutX,C+n.cutY,f,g)}b+=f}C+=g}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,h,a,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/o,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(u,p);if(u>v){var g=(u-v)*o;d>=0?d+=g:d=g,u=v}if(p>v){var f=(p-v)*l;c>=0?c+=f:c=f,p=v}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,C=this.rows.count;b0&&a>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(x,b)?0:1)?this._drawImage(this.textureKey,s,m,y,h,a):this._drawTileSprite(this.textureKey,s,m,y,h,a)),m+=h;y+=a}this._endDraw()},setStretchMode:function(t){return Io(t)?(this.stretchMode.edge=Fo(Wo(t,"edge",0)),this.stretchMode.internal=Fo(Wo(t,"internal",0))):(t=Fo(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Bo.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const Ho=Phaser.Utils.Objects.IsPlainObject,Go=Phaser.Utils.Objects.GetValue,Uo=Phaser.GameObjects;var $o=void 0,Jo=function(t,e){if($o||($o={},ti(t).events.once("destroy",(function(){for(var t in $o)$o[t].destroy();$o=void 0}))),!$o.hasOwnProperty(e)){var i=ti(t).scene.systemScene;(t=new Uo[e](i)).setOrigin(0),$o[e]=t}return $o[e]};const qo=Phaser.GameObjects.RenderTexture;class Ko extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if(Ho(i)?(i=Go(d=i,"x",0),s=Go(d,"y",0),r=Go(d,"width",1),n=Go(d,"height",1),h=Go(d,"key",void 0),a=Go(d,"baseFrame",void 0),o=Go(d,"columns",void 0),l=Go(d,"rows",void 0)):Ho(r)?(r=Go(d=r,"width",1),n=Go(d,"height",1),h=Go(d,"key",void 0),a=Go(d,"baseFrame",void 0),o=Go(d,"columns",void 0),l=Go(d,"rows",void 0)):Ho(h)?(h=Go(d=h,"key",void 0),a=Go(d,"baseFrame",void 0),o=Go(d,"columns",void 0),l=Go(d,"rows",void 0)):Ho(a)?(a=Go(d=a,"baseFrame",void 0),o=Go(d,"columns",void 0),l=Go(d,"rows",void 0)):Array.isArray(a)?(d=l,l=o,o=a,a=Go(d,"baseFrame",void 0)):Ho(o)&&(o=Go(d=o,"columns",void 0),l=Go(d,"rows",void 0)),void 0===a&&(a=Go(d,"frame",void 0)),void 0===o){var c=Go(d,"leftWidth",void 0),u=Go(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=Go(d,"topHeight",void 0),v=Go(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(Go(d,"getFrameNameCallback",void 0)),this.setStretchMode(Go(d,"stretchMode",0)),this.setPreserveRatio(Go(d,"preserveRatio",!0));var g=Go(d,"maxFixedPartScale",1),f=Go(d,"maxFixedPartScaleX",g),m=Go(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(h,a,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,No),i}(qo,"rexNinePatch")){}var Zo={_drawImage:function(t,e,i,s,r,n){var h=Jo(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=Jo(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(Ko.prototype,Zo);class Qo extends ii{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(wo(t,e))return t[e];var i=t.parent;return wo(i,e)?i[e]:void 0}set(t,e,i){return wo(t,e)?t[e]=i:wo(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}}const tl=Phaser.Utils.Objects.GetValue;class el extends Ko{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=tl(e,"effects",!0);i&&To(this,i),this.style=new Qo(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(el.prototype,Pa);const il=["alpha","tint","flipX","flipY"];var sl=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("barColor")?i="bar":e.hasOwnProperty("leftWidth")?i="nineSlice":e.hasOwnProperty("key")&&(i="image")),i){case"bar":s=new xo(t,e);break;case"image":s=new Xo(t,e);break;case"nineSlice":s=e.hasOwnProperty("stretchMode")?new el(t,e):new Ro(t,e);break;default:s=new Oa(t,e)}return function(t,e){if(!e)return t;for(var i=0,s=il.length;i=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const Yl=Phaser.Utils.Objects.GetValue,jl=Phaser.Math.Distance.Between;class Xl extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=Yl(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(Yl(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(Yl(t,"enable",!0)),this.holdThreshold=Yl(t,"holdThreshold",50),this.pointerOutReleaseEnable=Yl(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return dn(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:jl(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!or(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!or(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const zl=Phaser.Utils.Objects.GetValue;class Al{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(zl(t,"value",0)),this.setSpeed(zl(t,"speed",0)),this.setAcceleration(zl(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class Il{constructor(){this.value,this.dir,this.movement=new Al}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const Bl={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},Nl=Phaser.Utils.Objects.GetValue;class Hl extends ii{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=Nl(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(Nl(e,"speed",.1)),this.setEnable(Nl(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(Nl(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||or(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const Gl=Phaser.Utils.Objects.GetValue;var Ul=function(t,e,i,s){var r,n,h="Y"===(i=i.toUpperCase()),a=2===t.scrollMode,o=t.childrenMap.child,l=`slider${i}`;if(r=a||s.hasOwnProperty(l)?Gl(s,l,void 0):Gl(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=h?1:0,n=function(t,e){void 0===e&&(e={});var i=mt(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new Rl(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r),n.tickLength=Gl(r,"tickLength",void 0);var p=Gl(r,"position",0);"string"==typeof p&&(p=$l[p]);var v,g,f=Gl(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=Gl(s,"space.slider",void 0))&&(a?f=0:v=Gl(s,"space.child",0)),g=void 0===v?"number"==typeof f:"number"==typeof v,h?0===p?(d=2,c=1,u=void 0===v?g?{left:f}:f:{left:Gl(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:Gl(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:Gl(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:Gl(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=Gl(r,"hideUnscrollableSlider",!1),t[`disableUnscrollableDrag${i}`]=Gl(r,"disableUnscrollableDrag",!1),t[`adaptThumb${i}SizeMode`]=Gl(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=Gl(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`disableUnscrollableDrag${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=Gl(s,"scrollDetectionMode");"string"==typeof b&&(b=Jl[b]);var C=`scroller${i}`;(m=a||s.hasOwnProperty(C)?Gl(s,C,!0):Gl(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new Vl(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var x,S,w,_,P,O=Gl(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);O&&o&&(void 0!==b&&(O.focus=1===b?2:0),x=new Hl(o,O)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,x),a&&!h||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.disableUnscrollableDrag=t[`disableUnscrollableDrag${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",x)),n&&(a?(S=h?"t":"s",_=`scroll${i}`):(S="t",_="scroll"),n.on("valuechange",(function(e){t[S]=e,t.emit(_,t)}))),y&&(a?(w=`childO${i}`,_=`scroll${i}`):(w="childOY",_="scroll"),y.on("valuechange",(function(e){t[w]=e,t.emit(_,t)}))),x&&(P=a?`addChildO${i}`:"addChildOY",x.on("scroll",(function(e){t[P](-e,!0)})))};const $l={right:0,left:1,bottom:0,top:1},Jl={gameObject:0,rectBounds:1},ql=Phaser.Utils.Objects.GetValue;var Kl=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=ql(e,"width"),h=ql(e,"height");n||ql(e,"child.expandWidth",!0)||(s[1]=0),h||ql(e,"child.expandHeight",!0)||(r[1]=0);var a=new Uh(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=$h(i,"child"),r=$h(s,"gameObject",void 0);if(r){var n=$h(i,"space.child",0);t.childMargin={};var h=t.childMargin,a={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:h.top=0,h.bottom=0,h.left=0,h.right=0;break;default:h.top=n,h.bottom=n,h.left=n,h.right=n}else switch(t.scrollMode){case 0:h.top=$h(n,"top",0),h.bottom=$h(n,"bottom",0),a.left=$h(n,"left",0),a.right=$h(n,"right",0);break;case 1:h.top=$h(n,"left",0),h.bottom=$h(n,"right",0),a.top=$h(n,"top",0),a.bottom=$h(n,"bottom",0);break;default:h.top=$h(n,"top",0),h.bottom=$h(n,"bottom",0),h.left=$h(n,"left",0),h.right=$h(n,"right",0)}e.add(r,{column:1,row:1,align:$h(s,"align","center"),padding:a,expand:{width:$h(s,"expandWidth",!0),height:$h(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:Ul(t,a,"y",e);break;case 1:Ul(t,a,"x",e);break;default:Ul(t,a,"y",e),Ul(t,a,"x",e)}return a},Zl=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}i*="Y"===t?this.scaleY:this.scaleX,s&&s.setBounds(e,i),r&&(r.setEnable(e!==i),r.tickLength&&r.setTick(r.tickLength,e,i))},Ql=function(t){switch(this.scrollMode){case 0:case 1:(i=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(i,this.isOverflow),(r=this.childrenMap.scroller)&&this.disableUnscrollableDrag&&r.setEnable(this.isOverflow);break;default:var e=this[`isOverflow${t=t.toUpperCase()}`],i=this.childrenMap[`slider${t}`],s=this[`hideUnscrollableSlider${t}`];i&&s&&this.setChildVisible(i,e);var r=this.childrenMap.scroller,n=this[`disableUnscrollableDrag${t}`];r&&n&&r.setEnable(e)}},td=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(a=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=a.childrenMap.track,s=a.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&n0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n")}return i}(this.textObject,this.text,this.lines),this.linesCount=this.lines.length,this._textHeight=void 0,this._textVisibleHeight=void 0,this.updateTextObject(),this},updateTextObject:function(){var t=Math.max(Math.floor(yd.call(this,-this.textOY)),0),e=bd.call(this,t)+this.textOY,i=Cd.call(this,t);return function(t,e){switch(od(t)){case 0:var i=(r=t.style).wordWrapWidth,s=r.wordWrapCallback;r.wordWrapWidth=0,r.wordWrapCallback=void 0,t.setText(e),r.wordWrapWidth=i,r.wordWrapCallback=s;break;case 1:var r,n=(r=t.style).wrapMode;r.wrapMode=0,t.setText(e),r.wrapMode=n;break;case 2:var h=t._maxWidth;t._maxWidth=0,t.setText(e),t._maxWidth=h}}(this.textObject,i),this.textObject.rexSizer.offsetY=e,xd.call(this),this},preLayout:function(){return this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,Fe.call(this),this},layoutChildren:function(){var t,e,i,s,r,n,h,a=this.left,o=this.top;(t=this.textObject).rexSizer.hidden||(s=a+(i=(e=t.rexSizer).padding).left*this.scaleX,r=o+i.top*this.scaleY,n=this.width*this.scaleX-(i.left+i.right)*this.scaleX,h=this.height*this.scaleY-(i.top+i.bottom)*this.scaleY,wd.call(this,t,n,h),ae(t,s,r,n,h,e.align),e.preOffsetY=0,xd.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const Pd=Phaser.Utils.Objects.IsPlainObject,Od=Phaser.Utils.Objects.GetValue,Ed=Phaser.Display.Align.TOP_LEFT;class Td extends th{constructor(t,e,i,s,r,n){Pd(e)?(e=Od(n=e,"x",0),i=Od(n,"y",0),s=Od(n,"width",void 0),r=Od(n,"height",void 0)):Pd(s)&&(s=Od(n=s,"width",void 0),r=Od(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexTextBlock",this.textObject=void 0,this.linesCount=0,this.textMask=void 0,this.textObjectType=void 0,this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,this._textObjectRealHeight=0,this.lines=void 0,this.text=Od(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode(Od(n,"clampTextOY",!0)),this.alwaysScrollable=Od(n,"alwaysScrollable",!1);var h=Od(n,"background",void 0),a=Od(n,"text",void 0);void 0===a&&(a=kd(t)),this.textCropEnable=Od(n,"textCrop",!!a.setCrop);var o=Od(n,"textMask",!this.textCropEnable);h&&this.addBackground(h),this.add(a),this.sizerChildren=[a];var l=this.getSizerConfig(a);l.align=Ed,l.padding=ge(0),l.expand=!0,this.textObject=a,this.textObjectType=od(a),l.preOffsetY=0,l.offsetY=0,o&&(this.textMask=md.call(this,this.textObject,this)),this.addChildrenMap("background",h),this.addChildrenMap("text",a)}destroy(t){if(this.scene&&!this.ignoreDestroy){if(this.textObject=void 0,this.textMask=void 0,this.lines){switch(this.textObjectType){case 0:case 2:this.lines.length=0;break;case 1:this.lines.destroy()}this.lines=void 0}super.destroy(t)}}setClampMode(t){return void 0===t&&(t=!0),this.clampTextOY=t,this}get textLineHeight(){if(void 0===this._textLineHeight){var t;switch(this.textObjectType){case 0:case 1:var e=this.textObject.style;t=e.metrics.fontSize+e.strokeThickness;break;case 2:var i=this.textObject.fontSize/this.textObject.fontData.size;t=this.textObject.fontData.lineHeight*i}this._textLineHeight=t}return this._textLineHeight}get textLineSpacing(){if(void 0===this._textLineSpacing){var t;switch(this.textObjectType){case 0:case 1:t=this.textObject.lineSpacing;break;case 2:t=0}this._textLineSpacing=t}return this._textLineSpacing}get visibleLinesCount(){return void 0===this._visibleLinesCount&&(this._visibleLinesCount=Math.floor(yd.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=bd.call(this,this.linesCount)),this._textHeight}get textObjectHeight(){return this._textObjectRealHeight-(this.textLineHeight+this.textLineSpacing)}get textVisibleHeight(){if(void 0===this._textVisibleHeight){var t=this.textHeight-this.textObjectHeight;!this.alwaysScrollable&&t<0&&(t=0),this._textVisibleHeight=t}return this._textVisibleHeight}textOYExceedTop(t){return void 0===t&&(t=this.textOY),t>this.topTextOY}textOYExeceedBottom(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:s?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}setTextOY(t){return this.textOY=t,this}set t(t){this.textOY=-this.textVisibleHeight*t}get t(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t}setTextOYByPercentage(t){return this.t=t,this}}var kd=function(t){return t.add.text(0,0,"")};Object.assign(Td.prototype,_d);var Md={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},Dd={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const Rd=Phaser.Utils.Objects.GetValue;class Ld extends rd{constructor(t,e){void 0===e&&(e={});var i=Rd(e,"text",void 0),s=Rd(e,"textWidth",void 0),r=Rd(e,"textHeight",void 0),n=Rd(e,"textCrop",!!i.setCrop),h=Rd(e,"textMask",!n),a=Rd(e,"content",""),o=new Td(t,{width:s,height:r,text:i,textMask:h,textCrop:n&&!h,content:a,clampTextOY:Rd(e,"clampChildOY",!1),alwaysScrollable:Rd(e,"alwaysScrollable",!1)});t.add.existing(o),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textObjectHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.textHeight}})}(o),e.scrollMode=0,e.type="rexTextArea",e.child={gameObject:o,expandWidth:void 0===s,expandHeight:void 0===r};var l=Rd(e,"space",void 0);l&&(l.child=Rd(l,"text",0)),super(t,e),this.addChildrenMap("text",i)}get text(){return this.childrenMap.child.text}get lineHeight(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.textHeight}}return Object.assign(Ld.prototype,Md,Dd),Ld},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rextextarea=e(); +var t,e;t=void 0,e=function(){var t,e=!1;e||(void 0===t&&(t=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const O=Phaser.Math.DegToRad;var E={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=O(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},T={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=_(t.scaleX,i.scaleX),e.scaleY=_(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},k={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=_(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},D={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},R={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},L={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},Y={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(t){void 0===t&&(t=!1);var e=this;return this._mask=null,this.setChildMaskVisible(this),this.children.forEach((function(t){t.clearMask&&t.clearMask(!1),t.hasOwnProperty("isRexContainerLite")||e.setChildMaskVisible(t)})),t&&this.mask&&this.mask.destroy(),this}},j=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},A=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const W=Phaser.Utils.Array;var F={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Te=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const ke=/(\S+)\[(\d+)\]/i,Me=Phaser.Utils.Objects.GetValue;var De=function(t,e){return void 0===e?t:t[e]},Re=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Me(e,"left",0),t.right=Me(e,"right",0),t.top=Me(e,"top",0),t.bottom=Me(e,"bottom",0)),t},Le={getInnerPadding(t){return De(this.space,t)},setInnerPadding(t,e){return Re(this.space,t,e),this},getOuterPadding(t){return De(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Re(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),De(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Re(this.getSizerConfig(t).padding,e,i),this}},Ye=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},je=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Xe=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},ze=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Ae=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},Ie=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},We={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Fe=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?mi:fi,this.repeatCounter=0,this}stop(){return this.state=gi,this}update(t,e){this.state!==gi&&this.state!==bi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=yi)):(this.nowTime=this.duration,this.state=bi):this.nowTime>=0&&(this.state=mi))}get t(){var t;switch(this.state){case gi:case fi:case yi:t=0;break;case mi:t=this.nowTime/this.duration;break;case bi:t=1}return pi(t,0,1)}set t(t){(t=pi(t,-1,1))<0?(this.state=fi,this.nowTime=-this.delay*t):(this.state=mi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===gi}get isDelay(){return this.state===fi}get isCountDown(){return this.state===mi}get isRunning(){return this.state===fi||this.state===mi}get isDone(){return this.state===bi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const gi=0,fi=1,mi=2,yi=3,bi=-1;class Ci extends di{constructor(t,e){super(t,e),this.timer=new vi}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const xi=Phaser.Utils.Objects.GetValue,Si=Phaser.Utils.Objects.GetAdvancedValue,wi=Phaser.Tweens.Builders.GetEaseFunction;class _i extends Ci{resetFromJSON(t){return this.timer.resetFromJSON(xi(t,"timer")),this.setEnable(xi(t,"enable",!0)),this.setTarget(xi(t,"target",this.parent)),this.setDelay(Si(t,"delay",0)),this.setDuration(Si(t,"duration",1e3)),this.setEase(xi(t,"ease","Linear")),this.setRepeat(xi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=wi(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Pi=Phaser.Utils.Objects.GetValue,Oi=Phaser.Utils.Objects.GetAdvancedValue,Ei=Phaser.Math.Linear;let Ti=class extends _i{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Pi(t,"mode",0)),this.setScaleRange(Oi(t,"start",void 0),Oi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=ki[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Oi(t,"x",this.parent.scaleX),this.startY=Oi(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Oi(e,"x",void 0),this.endY=Oi(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Ei(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Ei(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const ki={stop:0,destroy:1,yoyo:2};var Mi=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new Ti(t,a):r.resetFromJSON(a),r.restart(),r},Di=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Ti&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new Ti(t,h):n.resetFromJSON(h),n.restart(),n},Ri=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Li=function(t){return Ri(t,"complete")};const Yi=Phaser.Utils.Objects.IsPlainObject;var ji={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Yi(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Mi(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Li(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Yi(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Di(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Li(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Li(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Yi(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new Ti(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Li(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Xi={};Object.assign(Xi,ji),Xi.onInitScale=function(){ji.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=Ce.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const zi=Phaser.Utils.Objects.GetValue,Ai=Phaser.Utils.Objects.GetAdvancedValue,Ii=Phaser.Math.Linear;class Wi extends _i{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(zi(t,"mode",0)),this.setAlphaRange(Ai(t,"start",this.parent.alpha),Ai(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Fi[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Ii(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Fi={stop:0,destroy:1,yoyo:2},Vi=Phaser.Utils.Objects.IsPlainObject;var Bi=function(t,e,i,s){var r,n;Vi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Wi(t,h):s.resetFromJSON(h),s.restart(),s},Ni=function(t,e,i,s){i instanceof Wi&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Wi(t,r):s.resetFromJSON(r),s.restart(),s};const Hi=Phaser.Utils.Objects.IsPlainObject;var Gi={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Hi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Bi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Li(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Hi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Ni(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Li(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Li(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Ui={};Object.assign(Ui,Gi),Ui.onInitFade=function(){Gi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=Ce.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const $i=Phaser.Utils.Objects.GetValue,Ji=Phaser.Utils.Objects.GetAdvancedValue,qi=Phaser.Math.Linear;class Ki extends _i{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode($i(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ji(t,"x",void 0),i=Ji(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Zi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Ji(i,"startX",void 0),this.startY=Ji(i,"startY",void 0),this.endX=Ji(i,"endX",void 0),this.endY=Ji(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=qi(this.startX,this.endX,i)),this.hasMoveY&&(t.y=qi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Zi={stop:0,destroy:1,yoyo:2};var Qi=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const ts=Phaser.Utils.Objects.IsPlainObject,es=Phaser.Math.Distance.Between;var is={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(ts(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*es(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Ki&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=Qi(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=Qi(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Ki(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Li(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Li(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(ts(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*es(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Ki&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=Qi(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=Qi(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Ki(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Li(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Li(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},ss={};Object.assign(ss,is),ss.onInitEaseMove=function(){is.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=Ce.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const rs=Phaser.Utils.Objects.GetValue;class ns extends ai{constructor(t,e){super(t,e),this.timer=new vi,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(rs(t,"timer")),this.setEnable(rs(t,"enable",!0)),this.setMode(rs(t,"mode",1)),this.isRunning=rs(t,"isRunning",!1),this.setMagnitudeMode(rs(t,"magnitudeMode",1)),this.setAxisMode(rs(t,"axis",0)),this.setDuration(rs(t,"duration",500)),this.setMagnitude(rs(t,"magnitude",10)),this.ox=rs(t,"ox",void 0),this.oy=rs(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=hs[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=os[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=as[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=rs(i,"magnitude",void 0),t=rs(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const hs={effect:0,behavior:1},as={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},os={constant:0,decay:1},ls=Phaser.Utils.Objects.IsPlainObject;var ds={shake(t,e,i){if(ls(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new ns(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Li(this._shake)}};const cs=Phaser.Utils.Objects.GetValue,us=Phaser.Math.Linear;class ps extends _i{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=cs(t,"key","value");var i=e[this.propertyKey];return this.fromValue=cs(t,"from",i),this.toValue=cs(t,"to",i),this.setEase(cs(t,"ease",this.ease)),this.setDuration(cs(t,"duration",this.duration)),this.setRepeat(cs(t,"repeat",0)),this.setDelay(cs(t,"delay",0)),this.setRepeatDelay(cs(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=us(this.fromValue,this.toValue,i)}}const vs=Phaser.Utils.Objects.IsPlainObject;class gs extends ii{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new ps(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(vs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(vs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var fs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new gs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Ri(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},ms=Phaser.Utils.Array.Remove,ys={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var Ls={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Ke(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Ys={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=zt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=zt),this.transitOutCallback=t,this}},js={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Xs={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},zs={};Object.assign(zs,Ls,Ys,js,Xs);const As=Phaser.Utils.Objects.GetValue;class Is extends ii{constructor(t,e){super(t,e),this.setTransitInTime(As(e,"duration.in",200)),this.setTransitOutTime(As(e,"duration.out",200)),this.setTransitInCallback(As(e,"transitIn")),this.setTransitOutCallback(As(e,"transitOut")),this.oneShotMode=As(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Rs(this,{eventEmitter:!1,initState:As(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Is.prototype,zs);var Ws=function(t){if(t.parentContainer)return Ws(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?Ws(e):t};class Fs extends ii{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Ws(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Vs=Phaser.GameObjects.Rectangle;class Bs extends Vs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Fs(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Ns=Phaser.Utils.Objects.GetValue;class Hs extends ii{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Ns(t,"hitAreaMode",0)),this.setEnable(Ns(t,"enable",!0)),this.setStopMode(Ns(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Gs[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Gs={default:0,fullWindow:1};const Us=Phaser.Utils.Objects.GetValue;class $s extends Bs{constructor(t,e){super(t,Us(e,"color",0),Us(e,"alpha",.8)),this.touchEventStop=new Hs(this,{hitAreaMode:1})}}var Js={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Mi(t,e)},scaleDown(t,e){Di(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Bi(t,e)},fadeOut(t,e){Ni(t,e,!1)}},qs=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Bi(t,e,t.alpha)},Ks=function(t,e){Ni(t,e,!1)},Zs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!nt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Qs=Phaser.Utils.Objects.GetValue;let tr=class extends Is{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=er.popUp),null==e.transitOut&&(e.transitOut=er.scaleDown),e.destroy=Qs(e,"destroy",!0),super(t,e);var i=Qs(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new $s(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Qs(i,"transitIn",qs)),this.setCoverTransitOutCallback(Qs(i,"transitOut",Ks)));var s=Qs(e,"touchOutsideClose",!1),r=Qs(e,"duration.hold",-1),n=Qs(e,"timeOutClose",r>=0),h=Qs(e,"anyTouchClose",!1);Qs(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Qs(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Zs(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=er[t]),t){case er.popUp:t=Js.popUp;break;case er.fadeIn:t=Js.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=er[t]),t){case er.scaleDown:t=Js.scaleDown;break;case er.fadeOut:t=Js.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const er={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var ir=function(t){return t&&"function"==typeof t},sr={modal(t,e){return ir(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new tr(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},rr=function(t,e,i,s,r){ir(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},nr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return rr.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return rr.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return rr.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return rr.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return rr.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return rr.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return rr.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return rr.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return rr.call(this,"shutdown",t,e,i,s),this}},hr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=ar),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},ar={},or=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?Zs(t,e.x,e.y,i,s):!!(r=hr(e,n,!0))&&Zs(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const br={press:0,pointerdown:0,release:1,pointerup:1};var Cr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new yr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},xr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!Sr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return wr.length=0,!0;return wr.length=0,!1},wr=[];const _r=Phaser.Utils.Objects.GetValue;class Pr extends ii{constructor(t,e){super(t,e),this._enable=void 0;var i=_r(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(_r(t,"enable",!0)),this.setMode(_r(t,"mode",1)),this.setClickInterval(_r(t,"clickInterval",100)),this.setDragThreshold(_r(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Or[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?xr:or)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Or={press:0,pointerdown:0,release:1,pointerup:1};var Er={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Pr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Tr extends Ds{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const kr=Phaser.Utils.Objects.GetValue;class Mr extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Tr,this.parent.setInteractive(kr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(kr(t,"enable",!0)),this.setCooldown(kr(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Dr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&or(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Mr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Mr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Rr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Lr=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Jr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===qr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Jr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Kr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&or(t,s,e,i)}}const Jr=0,qr=1,Kr="IDLE",Zr=Phaser.Utils.Objects.GetValue,Qr=Phaser.Math.Distance.Between;class tn extends $r{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=en},eventEmitter:!1};this.setRecongizedStateObject(new Ds(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Zr(t,"time",250)),this.setTapInterval(Zr(t,"tapInterval",200)),this.setDragThreshold(Zr(t,"threshold",9)),this.setTapOffset(Zr(t,"tapOffset",10));var e=Zr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Zr(t,"maxTaps",void 0)),this.setMinTaps(Zr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case en:this.state=sn;break;case sn:var t=this.lastPointer;Qr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=rn,this.state=sn);break;case rn:this.state=sn}}onDragEnd(){this.state===sn&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=rn))}onDrag(){this.state!==en&&this.pointer.getDistance()>this.dragThreshold&&(this.state=en)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===sn){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=en):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=rn:this.state=en)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===rn&&(this.state=en)}get isTapped(){return this.state===rn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const en="IDLE",sn="BEGIN",rn="RECOGNIZED",nn=Phaser.Utils.Objects.GetValue;class hn extends $r{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=an},eventEmitter:!1};this.setRecongizedStateObject(new Ds(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(nn(t,"threshold",9)),this.setHoldTime(nn(t,"time",251)),this}onDragStart(){this.state=on,0===this.holdTime&&(this.state=ln)}onDragEnd(){this.state=an}onDrag(){this.state!==an&&this.pointer.getDistance()>this.dragThreshold&&(this.state=an)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===on&&t-this.pointer.downTime>=this.holdTime&&(this.state=ln)}get isPressed(){return this.state===ln}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const an="IDLE",on="BEGIN",ln="RECOGNIZED";Phaser.Utils.Objects.GetValue;var dn=function(t){return ti(t).loop.delta};const cn=Phaser.Math.Distance.Between,un=Phaser.Math.Angle.Between;var pn={getDt:function(){return dn(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return cn(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return un(e.x,e.y,t.x,t.y)}},vn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},gn={};const fn=Phaser.Utils.Objects.GetValue,mn=Phaser.Math.RadToDeg;class yn extends $r{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=bn},eventEmitter:!1};this.setRecongizedStateObject(new Ds(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(fn(t,"threshold",10)),this.setVelocityThreshold(fn(t,"velocityThreshold",1e3)),this.setDirectionMode(fn(t,"dir","8dir")),this}onDragStart(){this.state=Cn}onDragEnd(){this.state=bn}onDrag(){this.state===Cn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=xn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===xn&&(this.state=bn)}get isSwiped(){return this.state===xn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=vn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=gn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(mn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(yn.prototype,pn);const bn="IDLE",Cn="BEGIN",xn="RECOGNIZED",Sn=Phaser.Utils.Objects.GetValue,wn=Phaser.Utils.Array.SpliceOne,_n=Phaser.Math.Distance.Between,Pn=Phaser.Math.Angle.Between;class On{constructor(t,e){var i=Ke(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(Sn(e,"inputConfig",void 0)),this.setEventEmitter(Sn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(Sn(t,"enable",!0)),this.bounds=Sn(t,"bounds",void 0),this.tracerState=Tn,this.pointers.length=0,ft(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,ft(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case Tn:this.tracerState=kn,this.onDrag1Start();break;case kn:this.tracerState=Mn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],wn(this.pointers,e),this.tracerState){case kn:this.tracerState=Tn,this.onDrag1End();break;case Mn:this.tracerState=kn,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case kn:this.onDrag1();break;case Mn:this.onDrag2()}}}dragCancel(){return this.tracerState===Mn&&this.onDrag2End(),this.pointers.length=0,ft(this.movedState),this.tracerState=Tn,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0],e=this.pointers[1];return _n(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0],e=this.pointers[1];return Pn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;En.x=e.x-i.x,En.y=e.y-i.y}else En.x=0,En.y=0;return En}get centerX(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Mn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Mn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Dn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&or(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&or(t,s,e,i)}}Object.assign(On.prototype,$e);var En={};const Tn=0,kn=1,Mn=2,Dn="IDLE";Phaser.Utils.Objects.GetValue;const Rn=Phaser.Math.RotateAround;var Ln=function(t,e,i,s){return Rn(t,e,i,s),t.rotation+=s,t},Yn={};const jn=Phaser.Utils.Objects.GetValue,Xn=Phaser.Math.Angle.WrapDegrees,zn=Phaser.Math.Angle.ShortestBetween,An=Phaser.Math.RadToDeg,In=Phaser.Math.DegToRad;var Wn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Yn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Xn(An(this.angleBetween));this.angle=zn(this.prevAngle,t),this.prevAngle=t,this.state=Bn}break;case Bn:t=Xn(An(this.angleBetween)),this.angle=zn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Bn}get rotation(){return In(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Wn);const Fn="IDLE",Vn="BEGIN",Bn="RECOGNIZED",Nn=Phaser.Utils.Objects.GetValue;var Hn=function(t){var e=Nn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new tn(this,e),this._tap.on("tap",(function(t,e,s){Yr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Yr(i.eventEmitter,`${i.eventNamePrefix}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Gn=Phaser.Utils.Objects.GetValue;var Un=function(t){var e=Gn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new hn(this,e),this._press.on("pressstart",(function(t,e,s){Yr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this).on("pressend",(function(t,e,s){Yr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const $n=Phaser.Utils.Objects.GetValue;var Jn=function(t){var e=$n(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new yn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Yr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Yr(i.eventEmitter,`${i.eventNamePrefix}swipe`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const qn=Phaser.Utils.Objects.GetValue;var Kn=function(t,e){return t.setInteractive(),qn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:qn(e,"targets",[t]),targetMode:qn(e,"targetMode","parent"),eventEmitter:qn(e,"eventEmitter",t),eventNamePrefix:qn(e,"inputEventPrefix","child.")},Xr.call(t,e),Ir.call(t,e),Vr.call(t,e),Gr.call(t,e),Hn.call(t,e),Un.call(t,e),Jn.call(t,e),t},Zn={getSizerConfig:function(t){return void 0===t&&(t=this),Mt(t)},getChildPrevState:function(t){var e=Mt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Lt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=oe(e,"color"),s=oe(e,"lineWidth");var o=oe(e,"name",!1);o&&(r=oe(o,"createTextCallback",ce),n=oe(o,"createTextCallbackScope",void 0),"string"==typeof(h=oe(o,"align","left-top"))&&(h=Xt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new le(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}var d,c,u=this.getAllShownChildren([this]);ue(u,u);for(var p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const ah=Phaser.Utils.Objects.IsPlainObject,oh=Phaser.Utils.Objects.GetValue,lh=Phaser.Display.Align.CENTER,dh={min:0,full:-1};var ch=function(t,e,i,s,r,n,h,a,o,l){var d,c,u,p;me.call(this,t);var v=t.isRexSpace,g=typeof e;if(null===e)return this;if("number"===g);else if("string"===g)e=dh[e];else if(ah(e)){var f;e=oh(f=e,"proportion",void 0),i=oh(f,"align",lh),s=oh(f,"padding",0),r=oh(f,"expand",!1),n=oh(f,"key",void 0),h=oh(f,"index",void 0),t.isRexSizer||(a=oh(f,"minWidth",void 0),o=oh(f,"minHeight",void 0)),l=oh(f,"fitRatio",0),d=oh(f,"offsetX",0),c=oh(f,"offsetY",0),u=oh(f,"offsetOriginX",0),p=oh(f,"offsetOriginY",0)}return"string"==typeof i&&(i=Xt[i]),void 0===e&&(e=v?1:0),void 0===i&&(i=lh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(v?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(v?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),(f=this.getSizerConfig(t)).proportion=e,f.align=i,f.padding=ge(s),f.expand=r,f.fitRatio=0===e?l:0,f.alignOffsetX=d,f.alignOffsetY=c,f.alignOffsetOriginX=u,f.alignOffsetOriginY=p,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},uh={add:ch,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),ch.call(this,new nh(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return ah(i)&&(i.index=t),ch.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=hh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const ph=kt.prototype.clear;var vh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),ph.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,vh.call(this,t),this}},mh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=Xt[e]),this.getSizerConfig(t).align=e,this}},yh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},bh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},Ch={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},xh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Ne(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Fe.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d,c,u=this.sizerChildren,p=this.innerLeft,v=this.innerTop,g=this.innerWidth,f=this.innerHeight,m=p,y=v,b=this.startChildIndex,C=0,x=u.length;C0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=ze.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||je.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&sh.call(this,t,void 0),Xe.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Ae.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&sh.call(this,void 0,t),Ie.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(xh,uh,fh,mh,yh,bh,Ch);var Sh=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},wh={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const _h=Phaser.Utils.Objects.IsPlainObject,Ph=Phaser.Utils.Objects.GetValue;class Oh extends th{constructor(t,e,i,s,r,n,h){_h(e)?(e=Ph(h=e,"x",0),i=Ph(h,"y",0),s=Ph(h,"width",void 0),r=Ph(h,"height",void 0),n=Ph(h,"orientation",0)):_h(s)?(s=Ph(h=s,"width",void 0),r=Ph(h,"height",void 0),n=Ph(h,"orientation",0)):_h(n)&&(n=Ph(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Ph(h,"space.item",0)),this.setStartChildIndex(Ph(h,"startChildIndex",0)),this.setRTL(Ph(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=wh[t]),t}(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=Sh.call(this)),this._childrenProportion}}Object.assign(Oh.prototype,xh);var Eh={v:0,vertical:0,y:0,h:1,horizontal:1,x:1,xy:2,vh:2},Th=function(t){var e=!!t.sliderY||!!t.scrollerY,i=!!t.sliderX||!!t.scrollerX;return e&&i?2:e?0:i?1:0},kh=function(){return Array.prototype.reduce.call(arguments,Mh,0)},Mh=function(t,e){return t+e};const Dh=Phaser.Utils.Objects.IsPlainObject,Rh=Phaser.Utils.Objects.GetValue,Lh=Phaser.Display.Align.CENTER;var Yh=function(t,e,i,s,r){if("number"==typeof t||"number"==typeof e){if(void 0===t){for(var n=0;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return Xh(this.sizerChildren,null),vh.call(this,t),this}},Ah={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)Xh(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},Vh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=ze.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,Xh(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Xh(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},Nh=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const Hh=Phaser.Utils.Objects.IsPlainObject,Gh=Phaser.Utils.Objects.GetValue;class Uh extends th{constructor(t,e,i,s,r,n,h,a,o,l){Hh(e)?(e=Gh(l=e,"x",0),i=Gh(l,"y",0),s=Gh(l,"width",void 0),r=Gh(l,"height",void 0),n=Gh(l,"column",l.col||0),h=Gh(l,"row",0),a=Gh(l,"columnProportions",0),o=Gh(l,"rowProportions",0)):Hh(s)?(s=Gh(l=s,"width",void 0),r=Gh(l,"height",void 0),n=Gh(l,"column",l.col||0),h=Gh(l,"row",0),a=Gh(l,"columnProportions",0),o=Gh(l,"rowProportions",0)):Hh(n)?(n=Gh(l=n,"column",l.col||0),h=Gh(l,"row",0),a=Gh(l,"columnProportions",0),o=Gh(l,"rowProportions",0)):Hh(a)&&(a=Gh(l=a,"columnProportions",0),o=Gh(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(Gh(l,"createCellContainerCallback")),this.setIndentLeft(Gh(l,"space.indentLeftOdd",0),Gh(l,"space.indentLeftEven",0)),this.setIndentTop(Gh(l,"space.indentTopOdd",0),Gh(l,"space.indentTopEven",0)),this.resetGrid(n,h,a,o,Gh(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=Bh.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=Nh.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(Uh.prototype,Vh);const $h=Phaser.Utils.Objects.GetValue;var Jh=Phaser.Renderer.WebGL.Utils,qh=function(t,e,i,s,r,n){for(var h=Jh.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),a=i.pathData,o=i.pathIndexes,l=0;l>>16,a=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+h+","+a+","+o+","+n+")"},ea=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,h=(16711680&r)>>>16,a=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+h+","+a+","+o+","+n+")",t.lineWidth=e.lineWidth};const ia=Phaser.Renderer.Canvas.SetTransform;var sa={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Qh(e,i,s),h=r.calcMatrix.copyFrom(n.calc),a=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&qh(r,h,e,l,a,o),e.isStroked&&Zh(r,e,l,a,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(ia(t,r,e,i,s)){var n=e._displayOriginX,h=e._displayOriginY,a=e.pathData,o=a.length-1,l=a[0]-n,d=a[1]-h;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(na.prototype,sa);const ha=Phaser.Utils.Objects.GetValue;let aa=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=ha(t,"x",0),i=ha(t,"y",0));var s=this.cornerRadius;s.tl=oa(ha(t,"tl",void 0),e,i),s.tr=oa(ha(t,"tr",void 0),e,i),s.bl=oa(ha(t,"bl",void 0),e,i),s.br=oa(ha(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){la(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){la(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){la(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){la(this.cornerRadius.br,t)}};var oa=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),da(t),t},la=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=ha(e,"x",0),t.y=ha(e,"y",0)),da(t)},da=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},ca=function(t){return t.x>0&&t.y>0},ua=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const pa=Phaser.Math.DegToRad;var va=function(t,e,i,s,r,n,h,a,o){h&&n>r?n-=360:!h&&n0,h=0,a=e.length;h=0?t.startAt(h+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(h+n,i):t.startAt(h,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(h,i),t.close(),t};const fo=Phaser.Utils.Objects.GetValue,mo=Phaser.Utils.Objects.IsPlainObject;class yo extends(Fa(La)){constructor(t,e,i,s,r,n,h,a){mo(e)?(e=(a=e).x,i=a.y,s=a.width,r=a.height,n=a.barColor,h=a.value):mo(s)?(s=(a=s).width,r=a.height,n=a.barColor,h=a.value):mo(n)&&(n=(a=n).barColor,h=a.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===h&&(h=0),super(t,e,i,s,r,a),this.type="rexLineProgress",this.bootProgressBase(a),this.addShape((new vo).setName("trackFill")).addShape((new vo).setName("bar")).addShape((new vo).setName("trackStroke")),this.setTrackColor(fo(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(fo(a,"trackStrokeThickness",2),fo(a,"trackStrokeColor",void 0)),this.setSkewX(fo(a,"skewX",0)),this.setRTL(fo(a,"rtl",!1)),this.setValue(h)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var bo={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&go(s,0,0,e,i,t);var r,n,h=this.getShape("bar");h.fillStyle(this.barColor),h.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),go(h,r,0,n,i,t));var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&go(a,0,0,e,i,t)}};Object.assign(yo.prototype,bo);var Co=function(t){return null==t||""===t||0===t.length},xo=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(Co(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(Co(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,h=e.length;nIo(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=Io(t[i]));return e}const Wo=Phaser.Utils.Objects.IsPlainObject,Fo=Phaser.Utils.Objects.GetValue;var Vo=function(t){return"string"==typeof t&&(t=Bo[t]),t};const Bo={scale:0,repeat:1};var No=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},Ho={_beginDraw:zt,_drawImage:zt,_drawTileSprite:zt,_endDraw:zt,setGetFrameNameCallback:function(t){return void 0===t&&(t=Ao),this.getFrameNameCallback=t,this},setBaseTexture:function(t,e,i,s){Array.isArray(e)&&(s=i,i=e,e=void 0),null==e&&(e="__BASE"),"number"==typeof i&&arguments.length>=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=Io(i),s=Io(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),h=n.width,a=0,o=0,l=i.length;o0?h/a:0,c=n.height,u=0;for(o=0,l=s.length;o0?0:g,b=0,o=0;for(var w=i.length;o0?0:f),f>=1&&g>=1){var _=typeof(m=this.getFrameNameCallback(o,x,e));"string"!==_&&"number"!==_||r.add(m,0,b+n.cutX,C+n.cutY,f,g)}b+=f}C+=g}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,h,a,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/o,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(u,p);if(u>v){var g=(u-v)*o;d>=0?d+=g:d=g,u=v}if(p>v){var f=(p-v)*l;c>=0?c+=f:c=f,p=v}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,C=this.rows.count;b0&&a>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(x,b)?0:1)?this._drawImage(this.textureKey,s,m,y,h,a):this._drawTileSprite(this.textureKey,s,m,y,h,a)),m+=h;y+=a}this._endDraw()},setStretchMode:function(t){return Wo(t)?(this.stretchMode.edge=Vo(Fo(t,"edge",0)),this.stretchMode.internal=Vo(Fo(t,"internal",0))):(t=Vo(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return No.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const Go=Phaser.Utils.Objects.IsPlainObject,Uo=Phaser.Utils.Objects.GetValue,$o=Phaser.GameObjects;var Jo=void 0,qo=function(t,e){if(Jo||(Jo={},ti(t).events.once("destroy",(function(){for(var t in Jo)Jo[t].destroy();Jo=void 0}))),!Jo.hasOwnProperty(e)){var i=ti(t).scene.systemScene;(t=new $o[e](i)).setOrigin(0),Jo[e]=t}return Jo[e]};const Ko=Phaser.GameObjects.RenderTexture;class Zo extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if(Go(i)?(i=Uo(d=i,"x",0),s=Uo(d,"y",0),r=Uo(d,"width",1),n=Uo(d,"height",1),h=Uo(d,"key",void 0),a=Uo(d,"baseFrame",void 0),o=Uo(d,"columns",void 0),l=Uo(d,"rows",void 0)):Go(r)?(r=Uo(d=r,"width",1),n=Uo(d,"height",1),h=Uo(d,"key",void 0),a=Uo(d,"baseFrame",void 0),o=Uo(d,"columns",void 0),l=Uo(d,"rows",void 0)):Go(h)?(h=Uo(d=h,"key",void 0),a=Uo(d,"baseFrame",void 0),o=Uo(d,"columns",void 0),l=Uo(d,"rows",void 0)):Go(a)?(a=Uo(d=a,"baseFrame",void 0),o=Uo(d,"columns",void 0),l=Uo(d,"rows",void 0)):Array.isArray(a)?(d=l,l=o,o=a,a=Uo(d,"baseFrame",void 0)):Go(o)&&(o=Uo(d=o,"columns",void 0),l=Uo(d,"rows",void 0)),void 0===a&&(a=Uo(d,"frame",void 0)),void 0===o){var c=Uo(d,"leftWidth",void 0),u=Uo(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=Uo(d,"topHeight",void 0),v=Uo(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(Uo(d,"getFrameNameCallback",void 0)),this.setStretchMode(Uo(d,"stretchMode",0)),this.setPreserveRatio(Uo(d,"preserveRatio",!0));var g=Uo(d,"maxFixedPartScale",1),f=Uo(d,"maxFixedPartScaleX",g),m=Uo(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(h,a,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,Ho),i}(Ko,"rexNinePatch")){}var Qo={_drawImage:function(t,e,i,s,r,n){var h=qo(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=qo(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(Zo.prototype,Qo);class tl extends ii{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(_o(t,e))return t[e];var i=t.parent;return _o(i,e)?i[e]:void 0}set(t,e,i){return _o(t,e)?t[e]=i:_o(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}}const el=Phaser.Utils.Objects.GetValue;class il extends Zo{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=el(e,"effects",!0);i&&ko(this,i),this.style=new tl(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(il.prototype,Pa);const sl=["alpha","tint","flipX","flipY"];var rl=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("barColor")?i="bar":e.hasOwnProperty("leftWidth")?i="nineSlice":e.hasOwnProperty("key")&&(i="image")),i){case"bar":s=new So(t,e);break;case"image":s=new zo(t,e);break;case"nineSlice":s=e.hasOwnProperty("stretchMode")?new il(t,e):new Lo(t,e);break;default:s=new Oa(t,e)}return function(t,e){if(!e)return t;for(var i=0,s=sl.length;i=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const jl=Phaser.Utils.Objects.GetValue,Xl=Phaser.Math.Distance.Between;class zl extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=jl(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(jl(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(jl(t,"enable",!0)),this.holdThreshold=jl(t,"holdThreshold",50),this.pointerOutReleaseEnable=jl(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return dn(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:Xl(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!or(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!or(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const Al=Phaser.Utils.Objects.GetValue;class Il{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(Al(t,"value",0)),this.setSpeed(Al(t,"speed",0)),this.setAcceleration(Al(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class Wl{constructor(){this.value,this.dir,this.movement=new Il}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const Nl={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},Hl=Phaser.Utils.Objects.GetValue;class Gl extends ii{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=Hl(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(Hl(e,"speed",.1)),this.setEnable(Hl(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(Hl(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||or(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const Ul=Phaser.Utils.Objects.GetValue;var $l=function(t,e,i,s){var r,n,h="Y"===(i=i.toUpperCase()),a=2===t.scrollMode,o=t.childrenMap.child,l=`slider${i}`;if(r=a||s.hasOwnProperty(l)?Ul(s,l,void 0):Ul(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=h?1:0,n=function(t,e){void 0===e&&(e={});var i=mt(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new Ll(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r),n.tickLength=Ul(r,"tickLength",void 0);var p=Ul(r,"position",0);"string"==typeof p&&(p=Jl[p]);var v,g,f=Ul(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=Ul(s,"space.slider",void 0))&&(a?f=0:v=Ul(s,"space.child",0)),g=void 0===v?"number"==typeof f:"number"==typeof v,h?0===p?(d=2,c=1,u=void 0===v?g?{left:f}:f:{left:Ul(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:Ul(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:Ul(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:Ul(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=Ul(r,"hideUnscrollableSlider",!1),t[`disableUnscrollableDrag${i}`]=Ul(r,"disableUnscrollableDrag",!1),t[`adaptThumb${i}SizeMode`]=Ul(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=Ul(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`disableUnscrollableDrag${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=Ul(s,"scrollDetectionMode");"string"==typeof b&&(b=ql[b]);var C=`scroller${i}`;(m=a||s.hasOwnProperty(C)?Ul(s,C,!0):Ul(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new Bl(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var x,S,w,_,P,O=Ul(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);O&&o&&(void 0!==b&&(O.focus=1===b?2:0),x=new Gl(o,O)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,x),a&&!h||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.disableUnscrollableDrag=t[`disableUnscrollableDrag${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",x)),n&&(a?(S=h?"t":"s",_=`scroll${i}`):(S="t",_="scroll"),n.on("valuechange",(function(e){t[S]=e,t.emit(_,t)}))),y&&(a?(w=`childO${i}`,_=`scroll${i}`):(w="childOY",_="scroll"),y.on("valuechange",(function(e){t[w]=e,t.emit(_,t)}))),x&&(P=a?`addChildO${i}`:"addChildOY",x.on("scroll",(function(e){t[P](-e,!0)})))};const Jl={right:0,left:1,bottom:0,top:1},ql={gameObject:0,rectBounds:1},Kl=Phaser.Utils.Objects.GetValue;var Zl=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=Kl(e,"width"),h=Kl(e,"height");n||Kl(e,"child.expandWidth",!0)||(s[1]=0),h||Kl(e,"child.expandHeight",!0)||(r[1]=0);var a=new Uh(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=$h(i,"child"),r=$h(s,"gameObject",void 0);if(r){var n=$h(i,"space.child",0);t.childMargin={};var h=t.childMargin,a={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:h.top=0,h.bottom=0,h.left=0,h.right=0;break;default:h.top=n,h.bottom=n,h.left=n,h.right=n}else switch(t.scrollMode){case 0:h.top=$h(n,"top",0),h.bottom=$h(n,"bottom",0),a.left=$h(n,"left",0),a.right=$h(n,"right",0);break;case 1:h.top=$h(n,"left",0),h.bottom=$h(n,"right",0),a.top=$h(n,"top",0),a.bottom=$h(n,"bottom",0);break;default:h.top=$h(n,"top",0),h.bottom=$h(n,"bottom",0),h.left=$h(n,"left",0),h.right=$h(n,"right",0)}e.add(r,{column:1,row:1,align:$h(s,"align","center"),padding:a,expand:{width:$h(s,"expandWidth",!0),height:$h(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:$l(t,a,"y",e);break;case 1:$l(t,a,"x",e);break;default:$l(t,a,"y",e),$l(t,a,"x",e)}return a},Ql=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}i*="Y"===t?this.scaleY:this.scaleX,s&&s.setBounds(e,i),r&&(r.setEnable(e!==i),r.tickLength&&r.setTick(r.tickLength,e,i))},td=function(t){switch(this.scrollMode){case 0:case 1:(i=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(i,this.isOverflow),(r=this.childrenMap.scroller)&&this.disableUnscrollableDrag&&r.setEnable(this.isOverflow);break;default:var e=this[`isOverflow${t=t.toUpperCase()}`],i=this.childrenMap[`slider${t}`],s=this[`hideUnscrollableSlider${t}`];i&&s&&this.setChildVisible(i,e);var r=this.childrenMap.scroller,n=this[`disableUnscrollableDrag${t}`];r&&n&&r.setEnable(e)}},ed=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(a=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=a.childrenMap.track,s=a.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&n0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n")}return i}(this.textObject,this.text,this.lines),this.linesCount=this.lines.length,this._textHeight=void 0,this._textVisibleHeight=void 0,this.updateTextObject(),this},updateTextObject:function(){var t=Math.max(Math.floor(bd.call(this,-this.textOY)),0),e=Cd.call(this,t)+this.textOY,i=xd.call(this,t);return function(t,e){switch(ld(t)){case 0:var i=(r=t.style).wordWrapWidth,s=r.wordWrapCallback;r.wordWrapWidth=0,r.wordWrapCallback=void 0,t.setText(e),r.wordWrapWidth=i,r.wordWrapCallback=s;break;case 1:var r,n=(r=t.style).wrapMode;r.wrapMode=0,t.setText(e),r.wrapMode=n;break;case 2:var h=t._maxWidth;t._maxWidth=0,t.setText(e),t._maxWidth=h}}(this.textObject,i),this.textObject.rexSizer.offsetY=e,Sd.call(this),this},preLayout:function(){return this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,Fe.call(this),this},layoutChildren:function(){var t,e,i,s,r,n,h,a=this.left,o=this.top;(t=this.textObject).rexSizer.hidden||(s=a+(i=(e=t.rexSizer).padding).left*this.scaleX,r=o+i.top*this.scaleY,n=this.width*this.scaleX-(i.left+i.right)*this.scaleX,h=this.height*this.scaleY-(i.top+i.bottom)*this.scaleY,_d.call(this,t,n,h),ae(t,s,r,n,h,e.align),e.preOffsetY=0,Sd.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const Od=Phaser.Utils.Objects.IsPlainObject,Ed=Phaser.Utils.Objects.GetValue,Td=Phaser.Display.Align.TOP_LEFT;class kd extends th{constructor(t,e,i,s,r,n){Od(e)?(e=Ed(n=e,"x",0),i=Ed(n,"y",0),s=Ed(n,"width",void 0),r=Ed(n,"height",void 0)):Od(s)&&(s=Ed(n=s,"width",void 0),r=Ed(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexTextBlock",this.textObject=void 0,this.linesCount=0,this.textMask=void 0,this.textObjectType=void 0,this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,this._textObjectRealHeight=0,this.lines=void 0,this.text=Ed(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode(Ed(n,"clampTextOY",!0)),this.alwaysScrollable=Ed(n,"alwaysScrollable",!1);var h=Ed(n,"background",void 0),a=Ed(n,"text",void 0);void 0===a&&(a=Md(t)),this.textCropEnable=Ed(n,"textCrop",!!a.setCrop);var o=Ed(n,"textMask",!this.textCropEnable);h&&this.addBackground(h),this.add(a),this.sizerChildren=[a];var l=this.getSizerConfig(a);l.align=Td,l.padding=ge(0),l.expand=!0,this.textObject=a,this.textObjectType=ld(a),l.preOffsetY=0,l.offsetY=0,o&&(this.textMask=yd.call(this,this.textObject,this)),this.addChildrenMap("background",h),this.addChildrenMap("text",a)}destroy(t){if(this.scene&&!this.ignoreDestroy){if(this.textObject=void 0,this.textMask=void 0,this.lines){switch(this.textObjectType){case 0:case 2:this.lines.length=0;break;case 1:this.lines.destroy()}this.lines=void 0}super.destroy(t)}}setClampMode(t){return void 0===t&&(t=!0),this.clampTextOY=t,this}get textLineHeight(){if(void 0===this._textLineHeight){var t;switch(this.textObjectType){case 0:case 1:var e=this.textObject.style;t=e.metrics.fontSize+e.strokeThickness;break;case 2:var i=this.textObject.fontSize/this.textObject.fontData.size;t=this.textObject.fontData.lineHeight*i}this._textLineHeight=t}return this._textLineHeight}get textLineSpacing(){if(void 0===this._textLineSpacing){var t;switch(this.textObjectType){case 0:case 1:t=this.textObject.lineSpacing;break;case 2:t=0}this._textLineSpacing=t}return this._textLineSpacing}get visibleLinesCount(){return void 0===this._visibleLinesCount&&(this._visibleLinesCount=Math.floor(bd.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=Cd.call(this,this.linesCount)),this._textHeight}get textObjectHeight(){return this._textObjectRealHeight-(this.textLineHeight+this.textLineSpacing)}get textVisibleHeight(){if(void 0===this._textVisibleHeight){var t=this.textHeight-this.textObjectHeight;!this.alwaysScrollable&&t<0&&(t=0),this._textVisibleHeight=t}return this._textVisibleHeight}textOYExceedTop(t){return void 0===t&&(t=this.textOY),t>this.topTextOY}textOYExeceedBottom(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:s?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}setTextOY(t){return this.textOY=t,this}set t(t){this.textOY=-this.textVisibleHeight*t}get t(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t}setTextOYByPercentage(t){return this.t=t,this}}var Md=function(t){return t.add.text(0,0,"")};Object.assign(kd.prototype,Pd);var Dd={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},Rd={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const Ld=Phaser.Utils.Objects.GetValue;class Yd extends nd{constructor(t,e){void 0===e&&(e={});var i=Ld(e,"text",void 0),s=Ld(e,"textWidth",void 0),r=Ld(e,"textHeight",void 0),n=Ld(e,"textCrop",!!i.setCrop),h=Ld(e,"textMask",!n),a=Ld(e,"content",""),o=new kd(t,{width:s,height:r,text:i,textMask:h,textCrop:n&&!h,content:a,clampTextOY:Ld(e,"clampChildOY",!1),alwaysScrollable:Ld(e,"alwaysScrollable",!1)});t.add.existing(o),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textObjectHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.textHeight}})}(o),e.scrollMode=0,e.type="rexTextArea",e.child={gameObject:o,expandWidth:void 0===s,expandHeight:void 0===r};var l=Ld(e,"space",void 0);l&&(l.child=Ld(l,"text",0)),super(t,e),this.addChildrenMap("text",i)}get text(){return this.childrenMap.child.text}get lineHeight(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.textHeight}}return Object.assign(Yd.prototype,Dd,Rd),Yd},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rextextarea=e(); diff --git a/dist/rextextareainput.js b/dist/rextextareainput.js index e5c8e41fca..24b8873a02 100644 --- a/dist/rextextareainput.js +++ b/dist/rextextareainput.js @@ -15864,6 +15864,32 @@ return pathData; }; + //import CatmullRomInterpolation from '../../utils/math/interpolation/CatmullRomInterpolation.js'; + + const CatmullRomInterpolation = Phaser.Math.Interpolation.CatmullRom; + + var CatmullRomTo = function (points, iterations, pathData) { + var pathDataCnt = pathData.length; + var p0x = pathData[pathDataCnt - 2]; + var p0y = pathData[pathDataCnt - 1]; + + var xList = [p0x]; + var yList = [p0y]; + for (var i = 0, cnt = points.length; i < cnt; i += 2) { + xList.push(points[i]); + yList.push(points[i + 1]); + } + + for (var i = 1, last = iterations - 1; i <= last; i++) { + var t = i / last; + pathData.push( + CatmullRomInterpolation(xList, t), + CatmullRomInterpolation(yList, t) + ); + } + return pathData; + }; + var DuplicateLast = function (pathData) { var len = pathData.length; if (len < 2) { @@ -15975,6 +16001,18 @@ return this; }, + catmullRomTo(...points) { + CatmullRomTo( + points, + this.iterations, + this.pathData + ); + + this.lastPointX = points[points.length-2]; + this.lastPointY = points[points.length-1]; + return this; + }, + close() { // Line to first point var startX = this.pathData[0], @@ -16412,6 +16450,13 @@ return this; } + catmullRomTo(...points) { + this.builder.catmullRomTo(...points); + + this.dirty = true; + return this; + } + close() { this.builder.close(); diff --git a/dist/rextextareainput.min.js b/dist/rextextareainput.min.js index 3d2d3815ec..17006c0699 100644 --- a/dist/rextextareainput.min.js +++ b/dist/rextextareainput.min.js @@ -1 +1 @@ -var t,e;t=void 0,e=function(){var t=!1,e=function(e){t||(void 0===e&&(e=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const _=Phaser.Math.DegToRad;var T={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=_(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},k={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=P(t.scaleX,i.scaleX),e.scaleY=P(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},E={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=P(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},D={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},R={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},L={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},X={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(t){void 0===t&&(t=!1);var e=this;return this._mask=null,this.setChildMaskVisible(this),this.children.forEach((function(t){t.clearMask&&t.clearMask(!1),t.hasOwnProperty("isRexContainerLite")||e.setChildMaskVisible(t)})),t&&this.mask&&this.mask.destroy(),this}},Y=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},W=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const I=Phaser.Utils.Array;var F={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},ke=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const Ee=/(\S+)\[(\d+)\]/i,Me=Phaser.Utils.Objects.GetValue;var De=function(t,e){return void 0===e?t:t[e]},Re=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Me(e,"left",0),t.right=Me(e,"right",0),t.top=Me(e,"top",0),t.bottom=Me(e,"bottom",0)),t},Le={getInnerPadding(t){return De(this.space,t)},setInnerPadding(t,e){return Re(this.space,t,e),this},getOuterPadding(t){return De(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Re(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),De(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Re(this.getSizerConfig(t).padding,e,i),this}},Xe=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Ye=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Ae=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},ze=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},We=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},je=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Ie={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Fe=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?mi:fi,this.repeatCounter=0,this}stop(){return this.state=gi,this}update(t,e){this.state!==gi&&this.state!==bi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=yi)):(this.nowTime=this.duration,this.state=bi):this.nowTime>=0&&(this.state=mi))}get t(){var t;switch(this.state){case gi:case fi:case yi:t=0;break;case mi:t=this.nowTime/this.duration;break;case bi:t=1}return pi(t,0,1)}set t(t){(t=pi(t,-1,1))<0?(this.state=fi,this.nowTime=-this.delay*t):(this.state=mi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===gi}get isDelay(){return this.state===fi}get isCountDown(){return this.state===mi}get isRunning(){return this.state===fi||this.state===mi}get isDone(){return this.state===bi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const gi=0,fi=1,mi=2,yi=3,bi=-1;class Ci extends di{constructor(t,e){super(t,e),this.timer=new vi}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const xi=Phaser.Utils.Objects.GetValue,wi=Phaser.Utils.Objects.GetAdvancedValue,Si=Phaser.Tweens.Builders.GetEaseFunction;class Pi extends Ci{resetFromJSON(t){return this.timer.resetFromJSON(xi(t,"timer")),this.setEnable(xi(t,"enable",!0)),this.setTarget(xi(t,"target",this.parent)),this.setDelay(wi(t,"delay",0)),this.setDuration(wi(t,"duration",1e3)),this.setEase(xi(t,"ease","Linear")),this.setRepeat(xi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Si(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Oi=Phaser.Utils.Objects.GetValue,_i=Phaser.Utils.Objects.GetAdvancedValue,Ti=Phaser.Math.Linear;let ki=class extends Pi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Oi(t,"mode",0)),this.setScaleRange(_i(t,"start",void 0),_i(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ei[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=_i(t,"x",this.parent.scaleX),this.startY=_i(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=_i(e,"x",void 0),this.endY=_i(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Ti(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Ti(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const Ei={stop:0,destroy:1,yoyo:2};var Mi=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new ki(t,a):r.resetFromJSON(a),r.restart(),r},Di=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof ki&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new ki(t,h):n.resetFromJSON(h),n.restart(),n},Ri=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Li=function(t){return Ri(t,"complete")};const Xi=Phaser.Utils.Objects.IsPlainObject;var Yi={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Xi(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Mi(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Li(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Xi(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Di(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Li(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Li(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Xi(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new ki(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Li(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Ai={};Object.assign(Ai,Yi),Ai.onInitScale=function(){Yi.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=Ce.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const zi=Phaser.Utils.Objects.GetValue,Wi=Phaser.Utils.Objects.GetAdvancedValue,ji=Phaser.Math.Linear;class Ii extends Pi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(zi(t,"mode",0)),this.setAlphaRange(Wi(t,"start",this.parent.alpha),Wi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Fi[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=ji(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Fi={stop:0,destroy:1,yoyo:2},Bi=Phaser.Utils.Objects.IsPlainObject;var Vi=function(t,e,i,s){var r,n;Bi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Ii(t,h):s.resetFromJSON(h),s.restart(),s},Hi=function(t,e,i,s){i instanceof Ii&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Ii(t,r):s.resetFromJSON(r),s.restart(),s};const Ni=Phaser.Utils.Objects.IsPlainObject;var Ui={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Ni(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Vi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Li(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Ni(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Hi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Li(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Li(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Gi={};Object.assign(Gi,Ui),Gi.onInitFade=function(){Ui.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=Ce.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const $i=Phaser.Utils.Objects.GetValue,Ji=Phaser.Utils.Objects.GetAdvancedValue,qi=Phaser.Math.Linear;class Ki extends Pi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode($i(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ji(t,"x",void 0),i=Ji(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Zi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Ji(i,"startX",void 0),this.startY=Ji(i,"startY",void 0),this.endX=Ji(i,"endX",void 0),this.endY=Ji(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=qi(this.startX,this.endX,i)),this.hasMoveY&&(t.y=qi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Zi={stop:0,destroy:1,yoyo:2};var Qi=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const ts=Phaser.Utils.Objects.IsPlainObject,es=Phaser.Math.Distance.Between;var is={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(ts(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*es(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Ki&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=Qi(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=Qi(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Ki(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Li(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Li(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(ts(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*es(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Ki&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=Qi(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=Qi(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Ki(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Li(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Li(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},ss={};Object.assign(ss,is),ss.onInitEaseMove=function(){is.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=Ce.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const rs=Phaser.Utils.Objects.GetValue;class ns extends ai{constructor(t,e){super(t,e),this.timer=new vi,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(rs(t,"timer")),this.setEnable(rs(t,"enable",!0)),this.setMode(rs(t,"mode",1)),this.isRunning=rs(t,"isRunning",!1),this.setMagnitudeMode(rs(t,"magnitudeMode",1)),this.setAxisMode(rs(t,"axis",0)),this.setDuration(rs(t,"duration",500)),this.setMagnitude(rs(t,"magnitude",10)),this.ox=rs(t,"ox",void 0),this.oy=rs(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=hs[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=os[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=as[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=rs(i,"magnitude",void 0),t=rs(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const hs={effect:0,behavior:1},as={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},os={constant:0,decay:1},ls=Phaser.Utils.Objects.IsPlainObject;var ds={shake(t,e,i){if(ls(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new ns(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Li(this._shake)}};const cs=Phaser.Utils.Objects.GetValue,us=Phaser.Math.Linear;class ps extends Pi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=cs(t,"key","value");var i=e[this.propertyKey];return this.fromValue=cs(t,"from",i),this.toValue=cs(t,"to",i),this.setEase(cs(t,"ease",this.ease)),this.setDuration(cs(t,"duration",this.duration)),this.setRepeat(cs(t,"repeat",0)),this.setDelay(cs(t,"delay",0)),this.setRepeatDelay(cs(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=us(this.fromValue,this.toValue,i)}}const vs=Phaser.Utils.Objects.IsPlainObject;class gs extends ii{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new ps(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(vs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(vs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var fs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new gs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Ri(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},ms=Phaser.Utils.Array.Remove,ys={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var Ls={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Ke(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Xs={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=zt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=zt),this.transitOutCallback=t,this}},Ys={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},As={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},zs={};Object.assign(zs,Ls,Xs,Ys,As);const Ws=Phaser.Utils.Objects.GetValue;class js extends ii{constructor(t,e){super(t,e),this.setTransitInTime(Ws(e,"duration.in",200)),this.setTransitOutTime(Ws(e,"duration.out",200)),this.setTransitInCallback(Ws(e,"transitIn")),this.setTransitOutCallback(Ws(e,"transitOut")),this.oneShotMode=Ws(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Rs(this,{eventEmitter:!1,initState:Ws(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(js.prototype,zs);var Is=function(t){if(t.parentContainer)return Is(t.parentContainer);var e=function(t){var e=t.displayList;return G(e)?e:null}(t);return e?Is(e):t};class Fs extends ii{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Is(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Bs=Phaser.GameObjects.Rectangle;let Vs=class extends Bs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Fs(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}};const Hs=Phaser.Utils.Objects.GetValue;class Ns extends ii{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Hs(t,"hitAreaMode",0)),this.setEnable(Hs(t,"enable",!0)),this.setStopMode(Hs(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Us[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Us={default:0,fullWindow:1};const Gs=Phaser.Utils.Objects.GetValue;class $s extends Vs{constructor(t,e){super(t,Gs(e,"color",0),Gs(e,"alpha",.8)),this.touchEventStop=new Ns(this,{hitAreaMode:1})}}var Js={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Mi(t,e)},scaleDown(t,e){Di(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Vi(t,e)},fadeOut(t,e){Hi(t,e,!1)}},qs=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Vi(t,e,t.alpha)},Ks=function(t,e){Hi(t,e,!1)},Zs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!nt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Qs=Phaser.Utils.Objects.GetValue;let tr=class extends js{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=er.popUp),null==e.transitOut&&(e.transitOut=er.scaleDown),e.destroy=Qs(e,"destroy",!0),super(t,e);var i=Qs(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new $s(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Qs(i,"transitIn",qs)),this.setCoverTransitOutCallback(Qs(i,"transitOut",Ks)));var s=Qs(e,"touchOutsideClose",!1),r=Qs(e,"duration.hold",-1),n=Qs(e,"timeOutClose",r>=0),h=Qs(e,"anyTouchClose",!1);Qs(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Qs(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Zs(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=er[t]),t){case er.popUp:t=Js.popUp;break;case er.fadeIn:t=Js.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=er[t]),t){case er.scaleDown:t=Js.scaleDown;break;case er.fadeOut:t=Js.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const er={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var ir=function(t){return t&&"function"==typeof t},sr={modal(t,e){return ir(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new tr(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},rr=function(t,e,i,s,r){ir(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},nr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return rr.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return rr.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return rr.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return rr.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return rr.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return rr.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return rr.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return rr.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return rr.call(this,"shutdown",t,e,i,s),this}},hr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=ar),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},ar={},or=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?Zs(t,e.x,e.y,i,s):!!(r=hr(e,n,!0))&&Zs(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const br={press:0,pointerdown:0,release:1,pointerup:1};var Cr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new yr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},xr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!wr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return Sr.length=0,!0;return Sr.length=0,!1},Sr=[];const Pr=Phaser.Utils.Objects.GetValue;class Or extends ii{constructor(t,e){super(t,e),this._enable=void 0;var i=Pr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Pr(t,"enable",!0)),this.setMode(Pr(t,"mode",1)),this.setClickInterval(Pr(t,"clickInterval",100)),this.setDragThreshold(Pr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=_r[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?xr:or)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const _r={press:0,pointerdown:0,release:1,pointerup:1};var Tr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Or(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class kr extends Ds{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Er=Phaser.Utils.Objects.GetValue;class Mr extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new kr,this.parent.setInteractive(Er(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Er(t,"enable",!0)),this.setCooldown(Er(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Dr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&or(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Mr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Mr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Rr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Lr=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Jr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===qr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Jr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Kr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&or(t,s,e,i)}}const Jr=0,qr=1,Kr="IDLE",Zr=Phaser.Utils.Objects.GetValue,Qr=Phaser.Math.Distance.Between;class tn extends $r{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=en},eventEmitter:!1};this.setRecongizedStateObject(new Ds(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Zr(t,"time",250)),this.setTapInterval(Zr(t,"tapInterval",200)),this.setDragThreshold(Zr(t,"threshold",9)),this.setTapOffset(Zr(t,"tapOffset",10));var e=Zr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Zr(t,"maxTaps",void 0)),this.setMinTaps(Zr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case en:this.state=sn;break;case sn:var t=this.lastPointer;Qr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=rn,this.state=sn);break;case rn:this.state=sn}}onDragEnd(){this.state===sn&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=rn))}onDrag(){this.state!==en&&this.pointer.getDistance()>this.dragThreshold&&(this.state=en)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===sn){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=en):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=rn:this.state=en)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===rn&&(this.state=en)}get isTapped(){return this.state===rn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const en="IDLE",sn="BEGIN",rn="RECOGNIZED",nn=Phaser.Utils.Objects.GetValue;class hn extends $r{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=an},eventEmitter:!1};this.setRecongizedStateObject(new Ds(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(nn(t,"threshold",9)),this.setHoldTime(nn(t,"time",251)),this}onDragStart(){this.state=on,0===this.holdTime&&(this.state=ln)}onDragEnd(){this.state=an}onDrag(){this.state!==an&&this.pointer.getDistance()>this.dragThreshold&&(this.state=an)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===on&&t-this.pointer.downTime>=this.holdTime&&(this.state=ln)}get isPressed(){return this.state===ln}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const an="IDLE",on="BEGIN",ln="RECOGNIZED";Phaser.Utils.Objects.GetValue;var dn=function(t){return ti(t).loop.delta};const cn=Phaser.Math.Distance.Between,un=Phaser.Math.Angle.Between;var pn={getDt:function(){return dn(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return cn(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return un(e.x,e.y,t.x,t.y)}},vn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},gn={};const fn=Phaser.Utils.Objects.GetValue,mn=Phaser.Math.RadToDeg;class yn extends $r{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=bn},eventEmitter:!1};this.setRecongizedStateObject(new Ds(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(fn(t,"threshold",10)),this.setVelocityThreshold(fn(t,"velocityThreshold",1e3)),this.setDirectionMode(fn(t,"dir","8dir")),this}onDragStart(){this.state=Cn}onDragEnd(){this.state=bn}onDrag(){this.state===Cn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=xn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===xn&&(this.state=bn)}get isSwiped(){return this.state===xn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=vn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=gn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(mn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(yn.prototype,pn);const bn="IDLE",Cn="BEGIN",xn="RECOGNIZED",wn=Phaser.Utils.Objects.GetValue,Sn=Phaser.Utils.Array.SpliceOne,Pn=Phaser.Math.Distance.Between,On=Phaser.Math.Angle.Between;class _n{constructor(t,e){var i=Ke(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(wn(e,"inputConfig",void 0)),this.setEventEmitter(wn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(wn(t,"enable",!0)),this.bounds=wn(t,"bounds",void 0),this.tracerState=kn,this.pointers.length=0,ft(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,ft(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case kn:this.tracerState=En,this.onDrag1Start();break;case En:this.tracerState=Mn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],Sn(this.pointers,e),this.tracerState){case En:this.tracerState=kn,this.onDrag1End();break;case Mn:this.tracerState=En,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case En:this.onDrag1();break;case Mn:this.onDrag2()}}}dragCancel(){return this.tracerState===Mn&&this.onDrag2End(),this.pointers.length=0,ft(this.movedState),this.tracerState=kn,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0],e=this.pointers[1];return Pn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0],e=this.pointers[1];return On(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Tn.x=e.x-i.x,Tn.y=e.y-i.y}else Tn.x=0,Tn.y=0;return Tn}get centerX(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Mn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Mn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Dn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&or(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&or(t,s,e,i)}}Object.assign(_n.prototype,$e);var Tn={};const kn=0,En=1,Mn=2,Dn="IDLE";Phaser.Utils.Objects.GetValue;const Rn=Phaser.Math.RotateAround;var Ln=function(t,e,i,s){return Rn(t,e,i,s),t.rotation+=s,t},Xn={};const Yn=Phaser.Utils.Objects.GetValue,An=Phaser.Math.Angle.WrapDegrees,zn=Phaser.Math.Angle.ShortestBetween,Wn=Phaser.Math.RadToDeg,jn=Phaser.Math.DegToRad;var In={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Xn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=An(Wn(this.angleBetween));this.angle=zn(this.prevAngle,t),this.prevAngle=t,this.state=Vn}break;case Vn:t=An(Wn(this.angleBetween)),this.angle=zn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Vn}get rotation(){return jn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,In);const Fn="IDLE",Bn="BEGIN",Vn="RECOGNIZED",Hn=Phaser.Utils.Objects.GetValue;var Nn=function(t){var e=Hn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new tn(this,e),this._tap.on("tap",(function(t,e,s){Xr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Xr(i.eventEmitter,`${i.eventNamePrefix}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Un=Phaser.Utils.Objects.GetValue;var Gn=function(t){var e=Un(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new hn(this,e),this._press.on("pressstart",(function(t,e,s){Xr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this).on("pressend",(function(t,e,s){Xr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const $n=Phaser.Utils.Objects.GetValue;var Jn=function(t){var e=$n(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new yn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Xr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Xr(i.eventEmitter,`${i.eventNamePrefix}swipe`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const qn=Phaser.Utils.Objects.GetValue;var Kn=function(t,e){return t.setInteractive(),qn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:qn(e,"targets",[t]),targetMode:qn(e,"targetMode","parent"),eventEmitter:qn(e,"eventEmitter",t),eventNamePrefix:qn(e,"inputEventPrefix","child.")},Ar.call(t,e),jr.call(t,e),Br.call(t,e),Ur.call(t,e),Nn.call(t,e),Gn.call(t,e),Jn.call(t,e),t},Zn={getSizerConfig:function(t){return void 0===t&&(t=this),Mt(t)},getChildPrevState:function(t){var e=Mt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Lt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=oe(e,"color"),s=oe(e,"lineWidth");var o=oe(e,"name",!1);o&&(r=oe(o,"createTextCallback",ce),n=oe(o,"createTextCallbackScope",void 0),"string"==typeof(h=oe(o,"align","left-top"))&&(h=At[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new le(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}var d,c,u=this.getAllShownChildren([this]);ue(u,u);for(var p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const ah=Phaser.Utils.Objects.IsPlainObject,oh=Phaser.Utils.Objects.GetValue,lh=Phaser.Display.Align.CENTER,dh={min:0,full:-1};var ch=function(t,e,i,s,r,n,h,a,o,l){var d,c,u,p;me.call(this,t);var v=t.isRexSpace,g=typeof e;if(null===e)return this;if("number"===g);else if("string"===g)e=dh[e];else if(ah(e)){var f;e=oh(f=e,"proportion",void 0),i=oh(f,"align",lh),s=oh(f,"padding",0),r=oh(f,"expand",!1),n=oh(f,"key",void 0),h=oh(f,"index",void 0),t.isRexSizer||(a=oh(f,"minWidth",void 0),o=oh(f,"minHeight",void 0)),l=oh(f,"fitRatio",0),d=oh(f,"offsetX",0),c=oh(f,"offsetY",0),u=oh(f,"offsetOriginX",0),p=oh(f,"offsetOriginY",0)}return"string"==typeof i&&(i=At[i]),void 0===e&&(e=v?1:0),void 0===i&&(i=lh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(v?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(v?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),(f=this.getSizerConfig(t)).proportion=e,f.align=i,f.padding=ge(s),f.expand=r,f.fitRatio=0===e?l:0,f.alignOffsetX=d,f.alignOffsetY=c,f.alignOffsetOriginX=u,f.alignOffsetOriginY=p,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},uh={add:ch,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),ch.call(this,new nh(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return ah(i)&&(i.index=t),ch.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=hh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const ph=Et.prototype.clear;var vh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),ph.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,vh.call(this,t),this}},mh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=At[e]),this.getSizerConfig(t).align=e,this}},yh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},bh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},Ch={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},xh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(He(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Fe.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d,c,u=this.sizerChildren,p=this.innerLeft,v=this.innerTop,g=this.innerWidth,f=this.innerHeight,m=p,y=v,b=this.startChildIndex,C=0,x=u.length;C0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=ze.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Ye.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&sh.call(this,t,void 0),Ae.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||We.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&sh.call(this,void 0,t),je.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(xh,uh,fh,mh,yh,bh,Ch);var wh=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},Sh={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const Ph=Phaser.Utils.Objects.IsPlainObject,Oh=Phaser.Utils.Objects.GetValue;class _h extends th{constructor(t,e,i,s,r,n,h){Ph(e)?(e=Oh(h=e,"x",0),i=Oh(h,"y",0),s=Oh(h,"width",void 0),r=Oh(h,"height",void 0),n=Oh(h,"orientation",0)):Ph(s)?(s=Oh(h=s,"width",void 0),r=Oh(h,"height",void 0),n=Oh(h,"orientation",0)):Ph(n)&&(n=Oh(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Oh(h,"space.item",0)),this.setStartChildIndex(Oh(h,"startChildIndex",0)),this.setRTL(Oh(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=Sh[t]),t}(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=wh.call(this)),this._childrenProportion}}Object.assign(_h.prototype,xh);var Th={v:0,vertical:0,y:0,h:1,horizontal:1,x:1,xy:2,vh:2},kh=function(t){var e=!!t.sliderY||!!t.scrollerY,i=!!t.sliderX||!!t.scrollerX;return e&&i?2:e?0:i?1:0},Eh=function(){return Array.prototype.reduce.call(arguments,Mh,0)},Mh=function(t,e){return t+e};const Dh=Phaser.Utils.Objects.IsPlainObject,Rh=Phaser.Utils.Objects.GetValue,Lh=Phaser.Display.Align.CENTER;var Xh=function(t,e,i,s,r){if("number"==typeof t||"number"==typeof e){if(void 0===t){for(var n=0;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return Ah(this.sizerChildren,null),vh.call(this,t),this}},Wh={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)Ah(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},Bh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=ze.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,Ah(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Ah(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},Hh=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const Nh=Phaser.Utils.Objects.IsPlainObject,Uh=Phaser.Utils.Objects.GetValue;class Gh extends th{constructor(t,e,i,s,r,n,h,a,o,l){Nh(e)?(e=Uh(l=e,"x",0),i=Uh(l,"y",0),s=Uh(l,"width",void 0),r=Uh(l,"height",void 0),n=Uh(l,"column",l.col||0),h=Uh(l,"row",0),a=Uh(l,"columnProportions",0),o=Uh(l,"rowProportions",0)):Nh(s)?(s=Uh(l=s,"width",void 0),r=Uh(l,"height",void 0),n=Uh(l,"column",l.col||0),h=Uh(l,"row",0),a=Uh(l,"columnProportions",0),o=Uh(l,"rowProportions",0)):Nh(n)?(n=Uh(l=n,"column",l.col||0),h=Uh(l,"row",0),a=Uh(l,"columnProportions",0),o=Uh(l,"rowProportions",0)):Nh(a)&&(a=Uh(l=a,"columnProportions",0),o=Uh(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(Uh(l,"createCellContainerCallback")),this.setIndentLeft(Uh(l,"space.indentLeftOdd",0),Uh(l,"space.indentLeftEven",0)),this.setIndentTop(Uh(l,"space.indentTopOdd",0),Uh(l,"space.indentTopEven",0)),this.resetGrid(n,h,a,o,Uh(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=Vh.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=Hh.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(Gh.prototype,Bh);const $h=Phaser.Utils.Objects.GetValue;var Jh=Phaser.Renderer.WebGL.Utils,qh=function(t,e,i,s,r,n){for(var h=Jh.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),a=i.pathData,o=i.pathIndexes,l=0;l>>16,a=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+h+","+a+","+o+","+n+")"},ea=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,h=(16711680&r)>>>16,a=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+h+","+a+","+o+","+n+")",t.lineWidth=e.lineWidth};const ia=Phaser.Renderer.Canvas.SetTransform;var sa={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Qh(e,i,s),h=r.calcMatrix.copyFrom(n.calc),a=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&qh(r,h,e,l,a,o),e.isStroked&&Zh(r,e,l,a,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(ia(t,r,e,i,s)){var n=e._displayOriginX,h=e._displayOriginY,a=e.pathData,o=a.length-1,l=a[0]-n,d=a[1]-h;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(na.prototype,sa);const ha=Phaser.Utils.Objects.GetValue;let aa=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=ha(t,"x",0),i=ha(t,"y",0));var s=this.cornerRadius;s.tl=oa(ha(t,"tl",void 0),e,i),s.tr=oa(ha(t,"tr",void 0),e,i),s.bl=oa(ha(t,"bl",void 0),e,i),s.br=oa(ha(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){la(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){la(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){la(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){la(this.cornerRadius.br,t)}};var oa=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),da(t),t},la=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=ha(e,"x",0),t.y=ha(e,"y",0)),da(t)},da=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},ca=function(t){return t.x>0&&t.y>0},ua=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const pa=Phaser.Math.DegToRad;var va=function(t,e,i,s,r,n,h,a,o){h&&n>r?n-=360:!h&&n0,h=0,a=e.length;h=0?t.startAt(h+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(h+n,i):t.startAt(h,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(h,i),t.close(),t};const mo=Phaser.Utils.Objects.GetValue,yo=Phaser.Utils.Objects.IsPlainObject;class bo extends(Va(Ya)){constructor(t,e,i,s,r,n,h,a){yo(e)?(e=(a=e).x,i=a.y,s=a.width,r=a.height,n=a.barColor,h=a.value):yo(s)?(s=(a=s).width,r=a.height,n=a.barColor,h=a.value):yo(n)&&(n=(a=n).barColor,h=a.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===h&&(h=0),super(t,e,i,s,r,a),this.type="rexLineProgress",this.bootProgressBase(a),this.addShape((new go).setName("trackFill")).addShape((new go).setName("bar")).addShape((new go).setName("trackStroke")),this.setTrackColor(mo(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(mo(a,"trackStrokeThickness",2),mo(a,"trackStrokeColor",void 0)),this.setSkewX(mo(a,"skewX",0)),this.setRTL(mo(a,"rtl",!1)),this.setValue(h)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var Co={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&fo(s,0,0,e,i,t);var r,n,h=this.getShape("bar");h.fillStyle(this.barColor),h.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),fo(h,r,0,n,i,t));var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&fo(a,0,0,e,i,t)}};Object.assign(bo.prototype,Co);var xo=function(t){return null==t||""===t||0===t.length},wo=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(xo(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(xo(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,h=e.length;nIo(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=Io(t[i]));return e}const Fo=Phaser.Utils.Objects.IsPlainObject,Bo=Phaser.Utils.Objects.GetValue;var Vo=function(t){return"string"==typeof t&&(t=Ho[t]),t};const Ho={scale:0,repeat:1};var No=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},Uo={_beginDraw:zt,_drawImage:zt,_drawTileSprite:zt,_endDraw:zt,setGetFrameNameCallback:function(t){return void 0===t&&(t=jo),this.getFrameNameCallback=t,this},setBaseTexture:function(t,e,i,s){Array.isArray(e)&&(s=i,i=e,e=void 0),null==e&&(e="__BASE"),"number"==typeof i&&arguments.length>=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=Io(i),s=Io(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),h=n.width,a=0,o=0,l=i.length;o0?h/a:0,c=n.height,u=0;for(o=0,l=s.length;o0?0:g,b=0,o=0;for(var S=i.length;o0?0:f),f>=1&&g>=1){var P=typeof(m=this.getFrameNameCallback(o,x,e));"string"!==P&&"number"!==P||r.add(m,0,b+n.cutX,C+n.cutY,f,g)}b+=f}C+=g}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,h,a,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/o,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(u,p);if(u>v){var g=(u-v)*o;d>=0?d+=g:d=g,u=v}if(p>v){var f=(p-v)*l;c>=0?c+=f:c=f,p=v}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,C=this.rows.count;b0&&a>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(x,b)?0:1)?this._drawImage(this.textureKey,s,m,y,h,a):this._drawTileSprite(this.textureKey,s,m,y,h,a)),m+=h;y+=a}this._endDraw()},setStretchMode:function(t){return Fo(t)?(this.stretchMode.edge=Vo(Bo(t,"edge",0)),this.stretchMode.internal=Vo(Bo(t,"internal",0))):(t=Vo(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return No.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const Go=Phaser.Utils.Objects.IsPlainObject,$o=Phaser.Utils.Objects.GetValue,Jo=Phaser.GameObjects;var qo=void 0,Ko=function(t,e){if(qo||(qo={},ti(t).events.once("destroy",(function(){for(var t in qo)qo[t].destroy();qo=void 0}))),!qo.hasOwnProperty(e)){var i=ti(t).scene.systemScene;(t=new Jo[e](i)).setOrigin(0),qo[e]=t}return qo[e]};const Zo=Phaser.GameObjects.RenderTexture;class Qo extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if(Go(i)?(i=$o(d=i,"x",0),s=$o(d,"y",0),r=$o(d,"width",1),n=$o(d,"height",1),h=$o(d,"key",void 0),a=$o(d,"baseFrame",void 0),o=$o(d,"columns",void 0),l=$o(d,"rows",void 0)):Go(r)?(r=$o(d=r,"width",1),n=$o(d,"height",1),h=$o(d,"key",void 0),a=$o(d,"baseFrame",void 0),o=$o(d,"columns",void 0),l=$o(d,"rows",void 0)):Go(h)?(h=$o(d=h,"key",void 0),a=$o(d,"baseFrame",void 0),o=$o(d,"columns",void 0),l=$o(d,"rows",void 0)):Go(a)?(a=$o(d=a,"baseFrame",void 0),o=$o(d,"columns",void 0),l=$o(d,"rows",void 0)):Array.isArray(a)?(d=l,l=o,o=a,a=$o(d,"baseFrame",void 0)):Go(o)&&(o=$o(d=o,"columns",void 0),l=$o(d,"rows",void 0)),void 0===a&&(a=$o(d,"frame",void 0)),void 0===o){var c=$o(d,"leftWidth",void 0),u=$o(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=$o(d,"topHeight",void 0),v=$o(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback($o(d,"getFrameNameCallback",void 0)),this.setStretchMode($o(d,"stretchMode",0)),this.setPreserveRatio($o(d,"preserveRatio",!0));var g=$o(d,"maxFixedPartScale",1),f=$o(d,"maxFixedPartScaleX",g),m=$o(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(h,a,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,Uo),i}(Zo,"rexNinePatch")){}var tl={_drawImage:function(t,e,i,s,r,n){var h=Ko(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=Ko(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(Qo.prototype,tl);class el extends ii{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Oo(t,e))return t[e];var i=t.parent;return Oo(i,e)?i[e]:void 0}set(t,e,i){return Oo(t,e)?t[e]=i:Oo(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}}const il=Phaser.Utils.Objects.GetValue;class sl extends Qo{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=il(e,"effects",!0);i&&Mo(this,i),this.style=new el(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(sl.prototype,Ta);const rl=["alpha","tint","flipX","flipY"];var nl=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("barColor")?i="bar":e.hasOwnProperty("leftWidth")?i="nineSlice":e.hasOwnProperty("key")&&(i="image")),i){case"bar":s=new So(t,e);break;case"image":s=new Wo(t,e);break;case"nineSlice":s=e.hasOwnProperty("stretchMode")?new sl(t,e):new Xo(t,e);break;default:s=new ka(t,e)}return function(t,e){if(!e)return t;for(var i=0,s=rl.length;i=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const Al=Phaser.Utils.Objects.GetValue,zl=Phaser.Math.Distance.Between;class Wl extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=Al(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(Al(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(Al(t,"enable",!0)),this.holdThreshold=Al(t,"holdThreshold",50),this.pointerOutReleaseEnable=Al(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return dn(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:zl(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!or(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!or(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const jl=Phaser.Utils.Objects.GetValue;class Il{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(jl(t,"value",0)),this.setSpeed(jl(t,"speed",0)),this.setAcceleration(jl(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class Fl{constructor(){this.value,this.dir,this.movement=new Il}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const Nl={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},Ul=Phaser.Utils.Objects.GetValue;class Gl extends ii{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=Ul(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(Ul(e,"speed",.1)),this.setEnable(Ul(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(Ul(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||or(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const $l=Phaser.Utils.Objects.GetValue;var Jl=function(t,e,i,s){var r,n,h="Y"===(i=i.toUpperCase()),a=2===t.scrollMode,o=t.childrenMap.child,l=`slider${i}`;if(r=a||s.hasOwnProperty(l)?$l(s,l,void 0):$l(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=h?1:0,n=function(t,e){void 0===e&&(e={});var i=mt(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new Xl(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r),n.tickLength=$l(r,"tickLength",void 0);var p=$l(r,"position",0);"string"==typeof p&&(p=ql[p]);var v,g,f=$l(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=$l(s,"space.slider",void 0))&&(a?f=0:v=$l(s,"space.child",0)),g=void 0===v?"number"==typeof f:"number"==typeof v,h?0===p?(d=2,c=1,u=void 0===v?g?{left:f}:f:{left:$l(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:$l(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:$l(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:$l(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=$l(r,"hideUnscrollableSlider",!1),t[`disableUnscrollableDrag${i}`]=$l(r,"disableUnscrollableDrag",!1),t[`adaptThumb${i}SizeMode`]=$l(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=$l(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`disableUnscrollableDrag${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=$l(s,"scrollDetectionMode");"string"==typeof b&&(b=Kl[b]);var C=`scroller${i}`;(m=a||s.hasOwnProperty(C)?$l(s,C,!0):$l(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new Hl(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var x,w,S,P,O,_=$l(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);_&&o&&(void 0!==b&&(_.focus=1===b?2:0),x=new Gl(o,_)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,x),a&&!h||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.disableUnscrollableDrag=t[`disableUnscrollableDrag${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",x)),n&&(a?(w=h?"t":"s",P=`scroll${i}`):(w="t",P="scroll"),n.on("valuechange",(function(e){t[w]=e,t.emit(P,t)}))),y&&(a?(S=`childO${i}`,P=`scroll${i}`):(S="childOY",P="scroll"),y.on("valuechange",(function(e){t[S]=e,t.emit(P,t)}))),x&&(O=a?`addChildO${i}`:"addChildOY",x.on("scroll",(function(e){t[O](-e,!0)})))};const ql={right:0,left:1,bottom:0,top:1},Kl={gameObject:0,rectBounds:1},Zl=Phaser.Utils.Objects.GetValue;var Ql=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=Zl(e,"width"),h=Zl(e,"height");n||Zl(e,"child.expandWidth",!0)||(s[1]=0),h||Zl(e,"child.expandHeight",!0)||(r[1]=0);var a=new Gh(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=$h(i,"child"),r=$h(s,"gameObject",void 0);if(r){var n=$h(i,"space.child",0);t.childMargin={};var h=t.childMargin,a={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:h.top=0,h.bottom=0,h.left=0,h.right=0;break;default:h.top=n,h.bottom=n,h.left=n,h.right=n}else switch(t.scrollMode){case 0:h.top=$h(n,"top",0),h.bottom=$h(n,"bottom",0),a.left=$h(n,"left",0),a.right=$h(n,"right",0);break;case 1:h.top=$h(n,"left",0),h.bottom=$h(n,"right",0),a.top=$h(n,"top",0),a.bottom=$h(n,"bottom",0);break;default:h.top=$h(n,"top",0),h.bottom=$h(n,"bottom",0),h.left=$h(n,"left",0),h.right=$h(n,"right",0)}e.add(r,{column:1,row:1,align:$h(s,"align","center"),padding:a,expand:{width:$h(s,"expandWidth",!0),height:$h(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:Jl(t,a,"y",e);break;case 1:Jl(t,a,"x",e);break;default:Jl(t,a,"y",e),Jl(t,a,"x",e)}return a},td=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}i*="Y"===t?this.scaleY:this.scaleX,s&&s.setBounds(e,i),r&&(r.setEnable(e!==i),r.tickLength&&r.setTick(r.tickLength,e,i))},ed=function(t){switch(this.scrollMode){case 0:case 1:(i=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(i,this.isOverflow),(r=this.childrenMap.scroller)&&this.disableUnscrollableDrag&&r.setEnable(this.isOverflow);break;default:var e=this[`isOverflow${t=t.toUpperCase()}`],i=this.childrenMap[`slider${t}`],s=this[`hideUnscrollableSlider${t}`];i&&s&&this.setChildVisible(i,e);var r=this.childrenMap.scroller,n=this[`disableUnscrollableDrag${t}`];r&&n&&r.setEnable(e)}},id=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(a=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=a.childrenMap.track,s=a.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&n0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(Wd.prototype,Xd);const jd=Phaser.Utils.String.Pad;var Id=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${jd(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},Fd=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Bd=Phaser.Math.DegToRad;var Vd=function(t){return!t.hasOwnProperty("convex")||t.convex},Hd=function(t){return t.x>0&&t.y>0},Nd=function(t,e,i,s,r,n,h,a,o){if(a&&h>n?h-=360:!a&&h=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=m.tl,Hd(a)?(o=a.x*g,l=a.y*f,Vd(a)?Nd(t,o,l,o,l,180,270,!1,h):Nd(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,Hd(a)?(o=a.x*g,l=a.y*f,Vd(a)?Nd(t,s-o,l,o,l,270,360,!1,h):Nd(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,Hd(a)?(o=a.x*g,l=a.y*f,Vd(a)?Nd(t,s-o,r-l,o,l,0,90,!1,h):Nd(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,Hd(a)?(o=a.x*g,l=a.y*f,Vd(a)?Nd(t,o,r-l,o,l,90,180,!1,h):Nd(t,0,r,o,l,360,270,!0,h)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,h,u),null!=a)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,a),p.addColorStop(1,d),a=p),e.fillStyle=a,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())};const Gd=Phaser.Utils.Objects.GetValue;class $d extends Wd{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(Gd(e,"color",null),Gd(e,"color2",null),Gd(e,"horizontalGradient",!0)),this.setStroke(Gd(e,"stroke",null),Gd(e,"strokeThickness",2)),this.setCornerRadius(Gd(e,"cornerRadius",0),Gd(e,"cornerIteration",null))}set color(t){t=Id(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Id(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Id(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,Fd("color2",t,this),Fd("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Fd("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Fd("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){!function(t,e,i,s,r,n,h,a){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),Ud(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}}(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Jd=Phaser.Utils.Objects.GetValue;class qd extends Wd{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(Jd(e,"color",null),Jd(e,"color2",null),Jd(e,"horizontalGradient",!0)),this.setStroke(Jd(e,"stroke",null),Jd(e,"strokeThickness",2))}set color(t){t=Id(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Id(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Id(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,Jd(t,"color2",null),Jd(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Jd(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,h=this.parent.height-i.top-i.bottom,a=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?a.createLinearGradient(0,0,n,0):a.createLinearGradient(0,0,0,h)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,a.fillStyle=t,a.fillRect(s,r,n,h));null!=this.stroke&&this.strokeThickness>0&&(a.strokeStyle=this.stroke,a.lineWidth=this.strokeThickness,a.strokeRect(s,r,n,h))}}const Kd=Phaser.Utils.Objects.GetValue;class Zd{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(Kd(t,"bold",!1)),this.setItalic(Kd(t,"italic",!1)),this.setFontSize(Kd(t,"fontSize","16px")),this.setFontFamily(Kd(t,"fontFamily","Courier")),this.setColor(Kd(t,"color","#fff")),this.setStrokeStyle(Kd(t,"stroke",null),Kd(t,"strokeThickness",0)),this.setShadow(Kd(t,"shadowColor",null),Kd(t,"shadowOffsetX",0),Kd(t,"shadowOffsetY",0),Kd(t,"shadowBlur",0)),this.setOffset(Kd(t,"offsetX",0),Kd(t,"offsetY",0)),this.setSpace(Kd(t,"leftSpace",0),Kd(t,"rightSpace",0)),this.setAlign(Kd(t,"align",void 0)),this.setBackgroundColor(Kd(t,"backgroundColor",null)),this.setBackgroundHeight(Kd(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Kd(t,"backgroundBottomY",void 0)),this.setBackgroundLeftX(Kd(t,"backgroundLeftX",0)),this.setBackgroundRightX(Kd(t,"backgroundRightX",0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(Fd("stroke",t,this),Fd("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Fd("shadowOffsetX",t,this),Fd("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),t.hasOwnProperty("backgroundLeftX")&&this.setBackgroundLeftX(t.backgroundLeftX),t.hasOwnProperty("backgroundRightX")&&this.setBackgroundRightX(t.backgroundRightX),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new Zd(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=Id(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=Id(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=Id(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=Id(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setBackgroundLeftX(t){return this.backgroundLeftX=t,this}setBackgroundRightX(t){return this.backgroundRightX=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}}const Qd=Phaser.Utils.Array.Remove,tc=Phaser.Utils.Array.Remove,ec="text",ic="image",sc="drawer",rc="space",nc="command";var hc=function(t){return t.type===ec&&"\n"===t.text},ac=function(t){return t.type===ec&&"\f"===t.text},oc=function(t){return t.type===ec};class lc extends Wd{constructor(t,e,i){super(t,ec),this.updateTextFlag=!1,this.style=new Zd(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX+e.backgroundLeftX,s=i,r=this.drawTRX+e.backgroundRightX-i+1;if(r>0){var n=e.backgroundBottomY;null==n&&(n=this.drawBLY);var h=e.backgroundHeight;null==h&&(h=n-this.drawTLY);var a=n-h;t.fillRect(s,a,r,h)}}var o=e.hasFill,l=e.hasStroke;(o||l)&&(e.syncFont(t).syncStyle(t),l&&(e.syncShadow(t),t.strokeText(this.text,0,0)),o&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var dc=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const cc=Phaser.Display.Canvas.CanvasPool;Phaser.Display.Canvas.CanvasPool;class uc extends Wd{constructor(t,e,i){super(t,ic),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){!function(t,e,i,s,r,n,h,a){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===a&&(a=!1),a&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(h){var l=cc.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=h,d.fillRect(0,0,r,n),o.drawImage(l,0,0,r,n,i,s,r,n),cc.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)}(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class pc extends Wd{constructor(t,e,i,s){super(t,sc),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class vc extends Wd{constructor(t,e){super(t,rc),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class gc extends yd{constructor(t,e,i,s,r){super(t,nc),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}var fc=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const mc={none:0,word:1,char:2,character:2,mix:3};var yc=/^[\x00-\x7F]+$/,bc=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r,n=2===i,h=3===i,a=!n&&!h,o=t.length,l=e,d=s.word,c=0,u=!1;l0&&!a){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=Sc.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=Sc.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=Oc(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=Oc(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=Oc(t,"wrapMode");void 0===c&&(c=Oc(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=mc[c]);var u=Oc(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=Oc(t,"letterSpacing",0),v=Oc(t,"hAlign",0),g=Oc(t,"vAlign",0),f=Oc(t,"justifyPercentage",.25),m=fc({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:h,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,b=0,C=y.length;b0&&(E.push({children:M,width:D}),R=Math.max(R,D)),m.start+=k.length,m.isLastPage=!L&&m.start===T,m.maxLineWidth=R,m.linesHeight=E.length*n;var I=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,F=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,h=t.vAlign,a=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(h=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=kc(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=kc(t,"maxLines",0);var a=0===i,o=kc(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=kc(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=kc(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=kc(t,"letterSpacing",0),p=kc(t,"rtl",!0),v=kc(t,"hAlign",p?2:0),g=kc(t,"vAlign",0),f=fc({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:o,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(k.push({children:E,height:M}),D=Math.max(D,M)),f.start+=T.length,f.isLastPage=f.start===_,f.maxLineHeight=D,f.linesWidth=k.length*n;var z=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,W=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,h=t.vAlign,a=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}a&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,h=i.bottom;return Re(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return De(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),Qd(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return tc(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(ec);return null===i?i=new lc(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),Ld(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const Qc=Phaser.Utils.Objects.GetFastValue;var tu={};class eu{constructor(t){this.pools=Qc(t,"pools",tu)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new Zc),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;e=r&&o=i&&oi.length&&(t.prevCursorPosition=null),null!==t.prevCursorPosition&&(s=e.getCharChild(t.prevCursorPosition))&&("\n"===s.text&&s.clearTextSize(),e.emit("cursorout",s,t.prevCursorPosition,e)),null!=r&&(s=e.getCharChild(r))&&("\n"===s.text&&s.copyTextSize(e.lastInsertCursor),function(t){var e,i,s=t.parent,r=s.width,n=s.height,h=t.drawX,a=t.drawY,o=h+t.drawTLX,l=h+t.drawTRX,d=a+t.drawTLY,c=a+t.drawBLY;e=o<0?0-o:l>r?r-l:0,i=d<0?0-d:c>n?n-c:0,s._textOX+=e,s._textOY+=i}(s),e.emit("cursorin",s,r,e)),e.emit("movecursor",r,t.prevCursorPosition,e),t.prevCursorPosition=r)}(this)):(Pu(this),Ou(this)),this}setNumberInput(){return this.onUpdateCallback=Su,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}}const ku=Phaser.Utils.Objects.GetValue,Eu=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var Mu=function(t,e){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return!0;if(-1!==e.indexOf(".")){for(var i=e.split("."),s=t,r=0;rt.length?i:t})),h.value=t.join(e)}else h.value=t.join(i.slice(a,a+h.count));a+=h.count,h.added||(o+=h.count)}}let l=e[h-1];return h>1&&"string"==typeof l.value&&(l.added||l.removed)&&t.equals("",l.value)&&(e[h-2].value+=l.value,e.pop()),e}Wu.prototype={diff(t,e,i={}){let s=i.callback;"function"==typeof i&&(s=i,i={}),this.options=i;let r=this;function n(t){return s?(setTimeout((function(){s(void 0,t)}),0),!0):t}t=this.castInput(t),e=this.castInput(e),t=this.removeEmpty(this.tokenize(t));let h=(e=this.removeEmpty(this.tokenize(e))).length,a=t.length,o=1,l=h+a;i.maxEditLength&&(l=Math.min(l,i.maxEditLength));let d=[{newPos:-1,components:[]}],c=this.extractCommon(d[0],e,t,0);if(d[0].newPos+1>=h&&c+1>=a)return n([{value:this.join(e),count:e.length}]);function u(){for(let s=-1*o;s<=o;s+=2){let o,l=d[s-1],c=d[s+1],u=(c?c.newPos:0)-s;l&&(d[s-1]=void 0);let p=l&&l.newPos+1=h&&u+1>=a)return n(ju(r,o.components,e,t,r.useLongestToken));d[s]=o}else d[s]=void 0}var i;o++}if(s)!function t(){setTimeout((function(){if(o>l)return s();u()||t()}),0)}();else for(;o<=l;){let t=u();if(t)return t}},pushComponent(t,e,i){let s=t[t.length-1];s&&s.added===e&&s.removed===i?t[t.length-1]={count:s.count+1,added:e,removed:i}:t.push({count:1,added:e,removed:i})},extractCommon(t,e,i,s){let r=e.length,n=i.length,h=t.newPos,a=h-s,o=0;for(;h+1t,tokenize:t=>t.split(""),join:t=>t.join("")};const Iu=new Wu,Fu=/^[a-zA-Z\u{C0}-\u{FF}\u{D8}-\u{F6}\u{F8}-\u{2C6}\u{2C8}-\u{2D7}\u{2DE}-\u{2FF}\u{1E00}-\u{1EFF}]+$/u,Bu=/\S/,Vu=new Wu;Vu.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!Bu.test(t)&&!Bu.test(e)},Vu.tokenize=function(t){let e=t.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/);for(let t=0;tvoid 0===i?e:i}=this.options;return"string"==typeof t?t:JSON.stringify(Gu(t,null,null,i),i," ")},Uu.equals=function(t,e){return Wu.prototype.equals.call(Uu,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const $u=new Wu;$u.tokenize=function(t){return t.slice()},$u.join=$u.removeEmpty=function(t){return t};const Ju=Phaser.Utils.Array.Remove;var qu=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),Ju(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(o=i,l=e,Iu.diff(o,l,d)),r=0,n=0,h=s.length;nr)i+=h;else{if(s!==r)break;i+=Math.min(e.position,h)}}return i},ep={cursorMoveLeft(){if(!this.isOpened)return this;var t=Zu(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=Zu(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=Qu(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=Zu(tp(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=Qu(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=Zu(tp(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const ip=Phaser.Utils.Objects.IsPlainObject;class sp extends ru{constructor(t,e,i,s,r,n){ip(e)?n=e:ip(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(Mu(e,"wrap.vAlign")||wo(e,"wrap.vAlign",s=i?"center":"top"),Mu(e,"wrap.wrapMode")||wo(e,"wrap.wrapMode","char"),Mu(e,"wrap.maxLines")||wo(e,"wrap.maxLines",s=i?1:void 0),i&&wo(e,"wrap.wrapWidth",1/0),Mu(e,"wrap.useDefaultTextHeight")||wo(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!Mu(e.edit,"inputType")){var s=i?"text":"textarea";wo(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new Ru(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var h=n.text;h&&delete n.text;var a=Ca(n.background,"focus"),o=Ca(n.style,"cursor"),l=Ca(n.style,"range");super(t,e,i,s,r,n),this.type="rexCanvasInput",this.contentWidth=void 0,this.contentHeight=void 0,this.lineHeight=void 0,this.linesCount=void 0,this.characterCountOfLines=[],this._text,this.textEdit=function(t,e){var i=ku(e,"edit");return void 0===i&&(i={}),au(e,i,Eu),new Tu(t,i)}(this,n),Lu.call(this),n.focusStyle&&Object.assign(a,n.focusStyle),zu.call(this,a),n.cursorStyle&&Object.assign(o,n.cursorStyle),Yu.call(this,o),n.rangeStyle&&Object.assign(l,n.rangeStyle),Xu(l)&&Object.assign(l,o),Au.call(this,l);var d=n.onAddChar;d&&this.on("addchar",d);var c=n.onCursorIn;c&&this.on("cursorin",c);var u=n.onCursorOut;u&&this.on("cursorout",u);var p=!n.onRangeIn&&!n.onRangeOut,v=p?n.onCursorIn:n.onRangeIn;v&&this.on("rangein",v);var g=p?n.onCursorOut:n.onRangeOut;g&&this.on("rangeout",g);var f,m=n.onMoveCursor;m&&this.on("movecursor",m),this.setParseTextCallback(n.parseTextCallback),this.lastInsertCursor=((f=this.createCharChild("|")).text="",f),h||(h=""),this.setText(h)}addChild(t,e){if(super.addChild(t,e),Array.isArray(t))for(var i=t,s=0,r=i.length;s=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const _=Phaser.Math.DegToRad;var T={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=_(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},k={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=P(t.scaleX,i.scaleX),e.scaleY=P(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},E={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=P(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},D={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},R={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},L={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},X={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(t){void 0===t&&(t=!1);var e=this;return this._mask=null,this.setChildMaskVisible(this),this.children.forEach((function(t){t.clearMask&&t.clearMask(!1),t.hasOwnProperty("isRexContainerLite")||e.setChildMaskVisible(t)})),t&&this.mask&&this.mask.destroy(),this}},Y=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},W=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const I=Phaser.Utils.Array;var F={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},ke=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const Ee=/(\S+)\[(\d+)\]/i,Me=Phaser.Utils.Objects.GetValue;var De=function(t,e){return void 0===e?t:t[e]},Re=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Me(e,"left",0),t.right=Me(e,"right",0),t.top=Me(e,"top",0),t.bottom=Me(e,"bottom",0)),t},Le={getInnerPadding(t){return De(this.space,t)},setInnerPadding(t,e){return Re(this.space,t,e),this},getOuterPadding(t){return De(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Re(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),De(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Re(this.getSizerConfig(t).padding,e,i),this}},Xe=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Ye=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Ae=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},ze=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},We=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},je=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Ie={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Fe=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?mi:fi,this.repeatCounter=0,this}stop(){return this.state=gi,this}update(t,e){this.state!==gi&&this.state!==bi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=yi)):(this.nowTime=this.duration,this.state=bi):this.nowTime>=0&&(this.state=mi))}get t(){var t;switch(this.state){case gi:case fi:case yi:t=0;break;case mi:t=this.nowTime/this.duration;break;case bi:t=1}return pi(t,0,1)}set t(t){(t=pi(t,-1,1))<0?(this.state=fi,this.nowTime=-this.delay*t):(this.state=mi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===gi}get isDelay(){return this.state===fi}get isCountDown(){return this.state===mi}get isRunning(){return this.state===fi||this.state===mi}get isDone(){return this.state===bi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const gi=0,fi=1,mi=2,yi=3,bi=-1;class Ci extends di{constructor(t,e){super(t,e),this.timer=new vi}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const xi=Phaser.Utils.Objects.GetValue,wi=Phaser.Utils.Objects.GetAdvancedValue,Si=Phaser.Tweens.Builders.GetEaseFunction;class Pi extends Ci{resetFromJSON(t){return this.timer.resetFromJSON(xi(t,"timer")),this.setEnable(xi(t,"enable",!0)),this.setTarget(xi(t,"target",this.parent)),this.setDelay(wi(t,"delay",0)),this.setDuration(wi(t,"duration",1e3)),this.setEase(xi(t,"ease","Linear")),this.setRepeat(xi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Si(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Oi=Phaser.Utils.Objects.GetValue,_i=Phaser.Utils.Objects.GetAdvancedValue,Ti=Phaser.Math.Linear;let ki=class extends Pi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Oi(t,"mode",0)),this.setScaleRange(_i(t,"start",void 0),_i(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ei[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=_i(t,"x",this.parent.scaleX),this.startY=_i(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=_i(e,"x",void 0),this.endY=_i(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Ti(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Ti(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const Ei={stop:0,destroy:1,yoyo:2};var Mi=function(t,e,i,s,r){var n,h;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},h={x:t.scaleX};break;case 1:case"y":n={y:0},h={y:t.scaleY};break;default:n=0,h=t.scale}var a={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new ki(t,a):r.resetFromJSON(a),r.restart(),r},Di=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof ki&&(n=r,r=void 0),void 0===r&&(r=!0);var h={};switch(h.mode=r?1:0,i){case 0:case"x":h.end={x:0};break;case 1:case"y":h.end={y:0};break;default:h.end=0}return h.duration=e,h.ease=s,void 0===n?n=new ki(t,h):n.resetFromJSON(h),n.restart(),n},Ri=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Li=function(t){return Ri(t,"complete")};const Xi=Phaser.Utils.Objects.IsPlainObject;var Yi={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Xi(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Mi(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Li(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Xi(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Di(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Li(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Li(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Xi(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var h=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,h){var a,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":a={x:t.scaleX},o={x:i};break;case 1:case"y":a={y:t.scaleX},o={y:i};break;default:a=t.scaleX,o=i}var l={mode:2,start:a,end:o,duration:e/2,ease:n,repeat:s};return void 0===h?h=new ki(t,l):h.resetFromJSON(l),h.restart(),h}(this,t,e,i,s,r,this._scaleBehavior),h&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Li(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Ai={};Object.assign(Ai,Yi),Ai.onInitScale=function(){Yi.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=Ce.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const zi=Phaser.Utils.Objects.GetValue,Wi=Phaser.Utils.Objects.GetAdvancedValue,ji=Phaser.Math.Linear;class Ii extends Pi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(zi(t,"mode",0)),this.setAlphaRange(Wi(t,"start",this.parent.alpha),Wi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Fi[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=ji(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Fi={stop:0,destroy:1,yoyo:2},Bi=Phaser.Utils.Objects.IsPlainObject;var Vi=function(t,e,i,s){var r,n;Bi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Ii(t,h):s.resetFromJSON(h),s.restart(),s},Hi=function(t,e,i,s){i instanceof Ii&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Ii(t,r):s.resetFromJSON(r),s.restart(),s};const Ni=Phaser.Utils.Objects.IsPlainObject;var Ui={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Ni(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Vi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Li(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Ni(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Hi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Li(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Li(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Gi={};Object.assign(Gi,Ui),Gi.onInitFade=function(){Ui.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=Ce.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const $i=Phaser.Utils.Objects.GetValue,Ji=Phaser.Utils.Objects.GetAdvancedValue,qi=Phaser.Math.Linear;class Ki extends Pi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode($i(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ji(t,"x",void 0),i=Ji(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Zi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Ji(i,"startX",void 0),this.startY=Ji(i,"startY",void 0),this.endX=Ji(i,"endX",void 0),this.endY=Ji(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=qi(this.startX,this.endX,i)),this.hasMoveY&&(t.y=qi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Zi={stop:0,destroy:1,yoyo:2};var Qi=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const ts=Phaser.Utils.Objects.IsPlainObject,es=Phaser.Math.Distance.Between;var is={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(ts(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*es(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Ki&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=Qi(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=Qi(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Ki(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Li(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Li(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(ts(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*es(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var h=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,h){n instanceof Ki&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=t.x,a.endX=Qi(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=Qi(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Ki(t,a):h.resetFromJSON(a),h.restart(),h}(this,t,e,i,s,r,this._easeMove),h&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Li(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Li(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},ss={};Object.assign(ss,is),ss.onInitEaseMove=function(){is.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=Ce.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const rs=Phaser.Utils.Objects.GetValue;class ns extends ai{constructor(t,e){super(t,e),this.timer=new vi,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(rs(t,"timer")),this.setEnable(rs(t,"enable",!0)),this.setMode(rs(t,"mode",1)),this.isRunning=rs(t,"isRunning",!1),this.setMagnitudeMode(rs(t,"magnitudeMode",1)),this.setAxisMode(rs(t,"axis",0)),this.setDuration(rs(t,"duration",500)),this.setMagnitude(rs(t,"magnitude",10)),this.ox=rs(t,"ox",void 0),this.oy=rs(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=hs[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=os[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=as[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=rs(i,"magnitude",void 0),t=rs(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,h=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=h;break;default:i.x=n,i.y=h}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const hs={effect:0,behavior:1},as={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},os={constant:0,decay:1},ls=Phaser.Utils.Objects.IsPlainObject;var ds={shake(t,e,i){if(ls(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new ns(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Li(this._shake)}};const cs=Phaser.Utils.Objects.GetValue,us=Phaser.Math.Linear;class ps extends Pi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=cs(t,"key","value");var i=e[this.propertyKey];return this.fromValue=cs(t,"from",i),this.toValue=cs(t,"to",i),this.setEase(cs(t,"ease",this.ease)),this.setDuration(cs(t,"duration",this.duration)),this.setRepeat(cs(t,"repeat",0)),this.setDelay(cs(t,"delay",0)),this.setRepeatDelay(cs(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=us(this.fromValue,this.toValue,i)}}const vs=Phaser.Utils.Objects.IsPlainObject;class gs extends ii{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new ps(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(vs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(vs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var fs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new gs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Ri(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},ms=Phaser.Utils.Array.Remove,ys={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var Ls={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Ke(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Xs={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=zt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=zt),this.transitOutCallback=t,this}},Ys={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},As={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},zs={};Object.assign(zs,Ls,Xs,Ys,As);const Ws=Phaser.Utils.Objects.GetValue;class js extends ii{constructor(t,e){super(t,e),this.setTransitInTime(Ws(e,"duration.in",200)),this.setTransitOutTime(Ws(e,"duration.out",200)),this.setTransitInCallback(Ws(e,"transitIn")),this.setTransitOutCallback(Ws(e,"transitOut")),this.oneShotMode=Ws(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Rs(this,{eventEmitter:!1,initState:Ws(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(js.prototype,zs);var Is=function(t){if(t.parentContainer)return Is(t.parentContainer);var e=function(t){var e=t.displayList;return G(e)?e:null}(t);return e?Is(e):t};class Fs extends ii{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Is(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,h=1/i.zoom,a=r/2,o=n/2,l=r*h,d=n*h;e.x===a&&e.y===o||e.setPosition(a,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Bs=Phaser.GameObjects.Rectangle;let Vs=class extends Bs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Fs(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}};const Hs=Phaser.Utils.Objects.GetValue;class Ns extends ii{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Hs(t,"hitAreaMode",0)),this.setEnable(Hs(t,"enable",!0)),this.setStopMode(Hs(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Us[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Us={default:0,fullWindow:1};const Gs=Phaser.Utils.Objects.GetValue;class $s extends Vs{constructor(t,e){super(t,Gs(e,"color",0),Gs(e,"alpha",.8)),this.touchEventStop=new Ns(this,{hitAreaMode:1})}}var Js={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Mi(t,e)},scaleDown(t,e){Di(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Vi(t,e)},fadeOut(t,e){Hi(t,e,!1)}},qs=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Vi(t,e,t.alpha)},Ks=function(t,e){Hi(t,e,!1)},Zs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!nt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Qs=Phaser.Utils.Objects.GetValue;let tr=class extends js{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=er.popUp),null==e.transitOut&&(e.transitOut=er.scaleDown),e.destroy=Qs(e,"destroy",!0),super(t,e);var i=Qs(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new $s(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Qs(i,"transitIn",qs)),this.setCoverTransitOutCallback(Qs(i,"transitOut",Ks)));var s=Qs(e,"touchOutsideClose",!1),r=Qs(e,"duration.hold",-1),n=Qs(e,"timeOutClose",r>=0),h=Qs(e,"anyTouchClose",!1);Qs(e,"manualClose",!1)&&(s=!1,h=!1,n=!1),h&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),h?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Qs(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Zs(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=er[t]),t){case er.popUp:t=Js.popUp;break;case er.fadeIn:t=Js.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=er[t]),t){case er.scaleDown:t=Js.scaleDown;break;case er.fadeOut:t=Js.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const er={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var ir=function(t){return t&&"function"==typeof t},sr={modal(t,e){return ir(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new tr(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},rr=function(t,e,i,s,r){ir(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},nr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return rr.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return rr.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return rr.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return rr.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return rr.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return rr.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return rr.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return rr.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return rr.call(this,"shutdown",t,e,i,s),this}},hr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=ar),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},ar={},or=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?Zs(t,e.x,e.y,i,s):!!(r=hr(e,n,!0))&&Zs(t,r.x,r.y,i,s);for(var a=t.scene.input.manager,o=a.pointersTotal,l=a.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const br={press:0,pointerdown:0,release:1,pointerup:1};var Cr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new yr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},xr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!wr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,a=n.pointers,o=0;o0)return Sr.length=0,!0;return Sr.length=0,!1},Sr=[];const Pr=Phaser.Utils.Objects.GetValue;class Or extends ii{constructor(t,e){super(t,e),this._enable=void 0;var i=Pr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Pr(t,"enable",!0)),this.setMode(Pr(t,"mode",1)),this.setClickInterval(Pr(t,"clickInterval",100)),this.setDragThreshold(Pr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=_r[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?xr:or)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const _r={press:0,pointerdown:0,release:1,pointerup:1};var Tr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Or(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class kr extends Ds{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Er=Phaser.Utils.Objects.GetValue;class Mr extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new kr,this.parent.setInteractive(Er(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Er(t,"enable",!0)),this.setCooldown(Er(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Dr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&or(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Mr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Mr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Rr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Lr=function(t,e,i,s){if("parent"===t){for(var r,n=0,h=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Jr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===qr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Jr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Kr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&or(t,s,e,i)}}const Jr=0,qr=1,Kr="IDLE",Zr=Phaser.Utils.Objects.GetValue,Qr=Phaser.Math.Distance.Between;class tn extends $r{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=en},eventEmitter:!1};this.setRecongizedStateObject(new Ds(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Zr(t,"time",250)),this.setTapInterval(Zr(t,"tapInterval",200)),this.setDragThreshold(Zr(t,"threshold",9)),this.setTapOffset(Zr(t,"tapOffset",10));var e=Zr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Zr(t,"maxTaps",void 0)),this.setMinTaps(Zr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case en:this.state=sn;break;case sn:var t=this.lastPointer;Qr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=rn,this.state=sn);break;case rn:this.state=sn}}onDragEnd(){this.state===sn&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=rn))}onDrag(){this.state!==en&&this.pointer.getDistance()>this.dragThreshold&&(this.state=en)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===sn){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=en):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=rn:this.state=en)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===rn&&(this.state=en)}get isTapped(){return this.state===rn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const en="IDLE",sn="BEGIN",rn="RECOGNIZED",nn=Phaser.Utils.Objects.GetValue;class hn extends $r{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=an},eventEmitter:!1};this.setRecongizedStateObject(new Ds(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(nn(t,"threshold",9)),this.setHoldTime(nn(t,"time",251)),this}onDragStart(){this.state=on,0===this.holdTime&&(this.state=ln)}onDragEnd(){this.state=an}onDrag(){this.state!==an&&this.pointer.getDistance()>this.dragThreshold&&(this.state=an)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===on&&t-this.pointer.downTime>=this.holdTime&&(this.state=ln)}get isPressed(){return this.state===ln}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const an="IDLE",on="BEGIN",ln="RECOGNIZED";Phaser.Utils.Objects.GetValue;var dn=function(t){return ti(t).loop.delta};const cn=Phaser.Math.Distance.Between,un=Phaser.Math.Angle.Between;var pn={getDt:function(){return dn(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return cn(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return un(e.x,e.y,t.x,t.y)}},vn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},gn={};const fn=Phaser.Utils.Objects.GetValue,mn=Phaser.Math.RadToDeg;class yn extends $r{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=bn},eventEmitter:!1};this.setRecongizedStateObject(new Ds(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(fn(t,"threshold",10)),this.setVelocityThreshold(fn(t,"velocityThreshold",1e3)),this.setDirectionMode(fn(t,"dir","8dir")),this}onDragStart(){this.state=Cn}onDragEnd(){this.state=bn}onDrag(){this.state===Cn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=xn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===xn&&(this.state=bn)}get isSwiped(){return this.state===xn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=vn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=gn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(mn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(yn.prototype,pn);const bn="IDLE",Cn="BEGIN",xn="RECOGNIZED",wn=Phaser.Utils.Objects.GetValue,Sn=Phaser.Utils.Array.SpliceOne,Pn=Phaser.Math.Distance.Between,On=Phaser.Math.Angle.Between;class _n{constructor(t,e){var i=Ke(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(wn(e,"inputConfig",void 0)),this.setEventEmitter(wn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(wn(t,"enable",!0)),this.bounds=wn(t,"bounds",void 0),this.tracerState=kn,this.pointers.length=0,ft(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,ft(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case kn:this.tracerState=En,this.onDrag1Start();break;case En:this.tracerState=Mn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],Sn(this.pointers,e),this.tracerState){case En:this.tracerState=kn,this.onDrag1End();break;case Mn:this.tracerState=En,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case En:this.onDrag1();break;case Mn:this.onDrag2()}}}dragCancel(){return this.tracerState===Mn&&this.onDrag2End(),this.pointers.length=0,ft(this.movedState),this.tracerState=kn,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0],e=this.pointers[1];return Pn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0],e=this.pointers[1];return On(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Tn.x=e.x-i.x,Tn.y=e.y-i.y}else Tn.x=0,Tn.y=0;return Tn}get centerX(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Mn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Mn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Dn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&or(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&or(t,s,e,i)}}Object.assign(_n.prototype,$e);var Tn={};const kn=0,En=1,Mn=2,Dn="IDLE";Phaser.Utils.Objects.GetValue;const Rn=Phaser.Math.RotateAround;var Ln=function(t,e,i,s){return Rn(t,e,i,s),t.rotation+=s,t},Xn={};const Yn=Phaser.Utils.Objects.GetValue,An=Phaser.Math.Angle.WrapDegrees,zn=Phaser.Math.Angle.ShortestBetween,Wn=Phaser.Math.RadToDeg,jn=Phaser.Math.DegToRad;var In={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Xn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,a=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=An(Wn(this.angleBetween));this.angle=zn(this.prevAngle,t),this.prevAngle=t,this.state=Vn}break;case Vn:t=An(Wn(this.angleBetween)),this.angle=zn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Vn}get rotation(){return jn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,In);const Fn="IDLE",Bn="BEGIN",Vn="RECOGNIZED",Hn=Phaser.Utils.Objects.GetValue;var Nn=function(t){var e=Hn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new tn(this,e),this._tap.on("tap",(function(t,e,s){Xr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Xr(i.eventEmitter,`${i.eventNamePrefix}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Un=Phaser.Utils.Objects.GetValue;var Gn=function(t){var e=Un(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new hn(this,e),this._press.on("pressstart",(function(t,e,s){Xr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this).on("pressend",(function(t,e,s){Xr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const $n=Phaser.Utils.Objects.GetValue;var Jn=function(t){var e=$n(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new yn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Xr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Xr(i.eventEmitter,`${i.eventNamePrefix}swipe`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const qn=Phaser.Utils.Objects.GetValue;var Kn=function(t,e){return t.setInteractive(),qn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:qn(e,"targets",[t]),targetMode:qn(e,"targetMode","parent"),eventEmitter:qn(e,"eventEmitter",t),eventNamePrefix:qn(e,"inputEventPrefix","child.")},Ar.call(t,e),jr.call(t,e),Br.call(t,e),Ur.call(t,e),Nn.call(t,e),Gn.call(t,e),Jn.call(t,e),t},Zn={getSizerConfig:function(t){return void 0===t&&(t=this),Mt(t)},getChildPrevState:function(t){var e=Mt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Lt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,h,a=t.scene;if("number"==typeof e)i=e;else{i=oe(e,"color"),s=oe(e,"lineWidth");var o=oe(e,"name",!1);o&&(r=oe(o,"createTextCallback",ce),n=oe(o,"createTextCallbackScope",void 0),"string"==typeof(h=oe(o,"align","left-top"))&&(h=At[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new le(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}var d,c,u=this.getAllShownChildren([this]);ue(u,u);for(var p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=h)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=h+1),r};const ah=Phaser.Utils.Objects.IsPlainObject,oh=Phaser.Utils.Objects.GetValue,lh=Phaser.Display.Align.CENTER,dh={min:0,full:-1};var ch=function(t,e,i,s,r,n,h,a,o,l){var d,c,u,p;me.call(this,t);var v=t.isRexSpace,g=typeof e;if(null===e)return this;if("number"===g);else if("string"===g)e=dh[e];else if(ah(e)){var f;e=oh(f=e,"proportion",void 0),i=oh(f,"align",lh),s=oh(f,"padding",0),r=oh(f,"expand",!1),n=oh(f,"key",void 0),h=oh(f,"index",void 0),t.isRexSizer||(a=oh(f,"minWidth",void 0),o=oh(f,"minHeight",void 0)),l=oh(f,"fitRatio",0),d=oh(f,"offsetX",0),c=oh(f,"offsetY",0),u=oh(f,"offsetOriginX",0),p=oh(f,"offsetOriginY",0)}return"string"==typeof i&&(i=At[i]),void 0===e&&(e=v?1:0),void 0===i&&(i=lh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(v?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(v?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),(f=this.getSizerConfig(t)).proportion=e,f.align=i,f.padding=ge(s),f.expand=r,f.fitRatio=0===e?l:0,f.alignOffsetX=d,f.alignOffsetY=c,f.alignOffsetOriginX=u,f.alignOffsetOriginY=p,void 0===h||h>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(h,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===a?Q(t):a:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=a)),void 0!==n&&this.addChildrenMap(n,t),this},uh={add:ch,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),ch.call(this,new nh(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return ah(i)&&(i.index=t),ch.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=hh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const ph=Et.prototype.clear;var vh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),ph.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,vh.call(this,t),this}},mh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=At[e]),this.getSizerConfig(t).align=e,this}},yh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},bh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},Ch={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},xh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,h+=n)));else for(d=0,c=a.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return o?void 0:h+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,h=s.padding;i=n-(h.left+h.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,h=s.padding;i=n-(h.top+h.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(He(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Fe.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d,c,u=this.sizerChildren,p=this.innerLeft,v=this.innerTop,g=this.innerWidth,f=this.innerHeight,m=p,y=v,b=this.startChildIndex,C=0,x=u.length;C0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=ze.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Ye.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&sh.call(this,t,void 0),Ae.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||We.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&sh.call(this,void 0,t),je.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(xh,uh,fh,mh,yh,bh,Ch);var wh=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},Sh={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const Ph=Phaser.Utils.Objects.IsPlainObject,Oh=Phaser.Utils.Objects.GetValue;class _h extends th{constructor(t,e,i,s,r,n,h){Ph(e)?(e=Oh(h=e,"x",0),i=Oh(h,"y",0),s=Oh(h,"width",void 0),r=Oh(h,"height",void 0),n=Oh(h,"orientation",0)):Ph(s)?(s=Oh(h=s,"width",void 0),r=Oh(h,"height",void 0),n=Oh(h,"orientation",0)):Ph(n)&&(n=Oh(h=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,h),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Oh(h,"space.item",0)),this.setStartChildIndex(Oh(h,"startChildIndex",0)),this.setRTL(Oh(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=Sh[t]),t}(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=wh.call(this)),this._childrenProportion}}Object.assign(_h.prototype,xh);var Th={v:0,vertical:0,y:0,h:1,horizontal:1,x:1,xy:2,vh:2},kh=function(t){var e=!!t.sliderY||!!t.scrollerY,i=!!t.sliderX||!!t.scrollerX;return e&&i?2:e?0:i?1:0},Eh=function(){return Array.prototype.reduce.call(arguments,Mh,0)},Mh=function(t,e){return t+e};const Dh=Phaser.Utils.Objects.IsPlainObject,Rh=Phaser.Utils.Objects.GetValue,Lh=Phaser.Display.Align.CENTER;var Xh=function(t,e,i,s,r){if("number"==typeof t||"number"==typeof e){if(void 0===t){for(var n=0;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return Ah(this.sizerChildren,null),vh.call(this,t),this}},Wh={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)Ah(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},Bh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=ze.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,Ah(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Ah(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},Hh=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const Nh=Phaser.Utils.Objects.IsPlainObject,Uh=Phaser.Utils.Objects.GetValue;class Gh extends th{constructor(t,e,i,s,r,n,h,a,o,l){Nh(e)?(e=Uh(l=e,"x",0),i=Uh(l,"y",0),s=Uh(l,"width",void 0),r=Uh(l,"height",void 0),n=Uh(l,"column",l.col||0),h=Uh(l,"row",0),a=Uh(l,"columnProportions",0),o=Uh(l,"rowProportions",0)):Nh(s)?(s=Uh(l=s,"width",void 0),r=Uh(l,"height",void 0),n=Uh(l,"column",l.col||0),h=Uh(l,"row",0),a=Uh(l,"columnProportions",0),o=Uh(l,"rowProportions",0)):Nh(n)?(n=Uh(l=n,"column",l.col||0),h=Uh(l,"row",0),a=Uh(l,"columnProportions",0),o=Uh(l,"rowProportions",0)):Nh(a)&&(a=Uh(l=a,"columnProportions",0),o=Uh(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(Uh(l,"createCellContainerCallback")),this.setIndentLeft(Uh(l,"space.indentLeftOdd",0),Uh(l,"space.indentLeftEven",0)),this.setIndentTop(Uh(l,"space.indentTopOdd",0),Uh(l,"space.indentTopEven",0)),this.resetGrid(n,h,a,o,Uh(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=Vh.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=Hh.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(Gh.prototype,Bh);const $h=Phaser.Utils.Objects.GetValue;var Jh=Phaser.Renderer.WebGL.Utils,qh=function(t,e,i,s,r,n){for(var h=Jh.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),a=i.pathData,o=i.pathIndexes,l=0;l>>16,a=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+h+","+a+","+o+","+n+")"},ea=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,h=(16711680&r)>>>16,a=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+h+","+a+","+o+","+n+")",t.lineWidth=e.lineWidth};const ia=Phaser.Renderer.Canvas.SetTransform;var sa={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Qh(e,i,s),h=r.calcMatrix.copyFrom(n.calc),a=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&qh(r,h,e,l,a,o),e.isStroked&&Zh(r,e,l,a,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(ia(t,r,e,i,s)){var n=e._displayOriginX,h=e._displayOriginY,a=e.pathData,o=a.length-1,l=a[0]-n,d=a[1]-h;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(na.prototype,sa);const ha=Phaser.Utils.Objects.GetValue;let aa=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=ha(t,"x",0),i=ha(t,"y",0));var s=this.cornerRadius;s.tl=oa(ha(t,"tl",void 0),e,i),s.tr=oa(ha(t,"tr",void 0),e,i),s.bl=oa(ha(t,"bl",void 0),e,i),s.br=oa(ha(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){la(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){la(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){la(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){la(this.cornerRadius.br,t)}};var oa=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),da(t),t},la=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=ha(e,"x",0),t.y=ha(e,"y",0)),da(t)},da=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},ca=function(t){return t.x>0&&t.y>0},ua=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const pa=Phaser.Math.DegToRad;var va=function(t,e,i,s,r,n,h,a,o){h&&n>r?n-=360:!h&&n0,h=0,a=e.length;h=0?t.startAt(h+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(h+n,i):t.startAt(h,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(h,i),t.close(),t};const yo=Phaser.Utils.Objects.GetValue,bo=Phaser.Utils.Objects.IsPlainObject;class Co extends(Va(Ya)){constructor(t,e,i,s,r,n,h,a){bo(e)?(e=(a=e).x,i=a.y,s=a.width,r=a.height,n=a.barColor,h=a.value):bo(s)?(s=(a=s).width,r=a.height,n=a.barColor,h=a.value):bo(n)&&(n=(a=n).barColor,h=a.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===h&&(h=0),super(t,e,i,s,r,a),this.type="rexLineProgress",this.bootProgressBase(a),this.addShape((new fo).setName("trackFill")).addShape((new fo).setName("bar")).addShape((new fo).setName("trackStroke")),this.setTrackColor(yo(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(yo(a,"trackStrokeThickness",2),yo(a,"trackStrokeColor",void 0)),this.setSkewX(yo(a,"skewX",0)),this.setRTL(yo(a,"rtl",!1)),this.setValue(h)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var xo={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&mo(s,0,0,e,i,t);var r,n,h=this.getShape("bar");h.fillStyle(this.barColor),h.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),mo(h,r,0,n,i,t));var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&mo(a,0,0,e,i,t)}};Object.assign(Co.prototype,xo);var wo=function(t){return null==t||""===t||0===t.length},So=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(wo(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(wo(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,h=e.length;nFo(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=Fo(t[i]));return e}const Bo=Phaser.Utils.Objects.IsPlainObject,Vo=Phaser.Utils.Objects.GetValue;var Ho=function(t){return"string"==typeof t&&(t=No[t]),t};const No={scale:0,repeat:1};var Uo=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},Go={_beginDraw:zt,_drawImage:zt,_drawTileSprite:zt,_endDraw:zt,setGetFrameNameCallback:function(t){return void 0===t&&(t=Io),this.getFrameNameCallback=t,this},setBaseTexture:function(t,e,i,s){Array.isArray(e)&&(s=i,i=e,e=void 0),null==e&&(e="__BASE"),"number"==typeof i&&arguments.length>=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=Fo(i),s=Fo(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),h=n.width,a=0,o=0,l=i.length;o0?h/a:0,c=n.height,u=0;for(o=0,l=s.length;o0?0:g,b=0,o=0;for(var S=i.length;o0?0:f),f>=1&&g>=1){var P=typeof(m=this.getFrameNameCallback(o,x,e));"string"!==P&&"number"!==P||r.add(m,0,b+n.cutX,C+n.cutY,f,g)}b+=f}C+=g}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,h,a,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/o,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(u,p);if(u>v){var g=(u-v)*o;d>=0?d+=g:d=g,u=v}if(p>v){var f=(p-v)*l;c>=0?c+=f:c=f,p=v}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,C=this.rows.count;b0&&a>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(x,b)?0:1)?this._drawImage(this.textureKey,s,m,y,h,a):this._drawTileSprite(this.textureKey,s,m,y,h,a)),m+=h;y+=a}this._endDraw()},setStretchMode:function(t){return Bo(t)?(this.stretchMode.edge=Ho(Vo(t,"edge",0)),this.stretchMode.internal=Ho(Vo(t,"internal",0))):(t=Ho(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Uo.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const $o=Phaser.Utils.Objects.IsPlainObject,Jo=Phaser.Utils.Objects.GetValue,qo=Phaser.GameObjects;var Ko=void 0,Zo=function(t,e){if(Ko||(Ko={},ti(t).events.once("destroy",(function(){for(var t in Ko)Ko[t].destroy();Ko=void 0}))),!Ko.hasOwnProperty(e)){var i=ti(t).scene.systemScene;(t=new qo[e](i)).setOrigin(0),Ko[e]=t}return Ko[e]};const Qo=Phaser.GameObjects.RenderTexture;class tl extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if($o(i)?(i=Jo(d=i,"x",0),s=Jo(d,"y",0),r=Jo(d,"width",1),n=Jo(d,"height",1),h=Jo(d,"key",void 0),a=Jo(d,"baseFrame",void 0),o=Jo(d,"columns",void 0),l=Jo(d,"rows",void 0)):$o(r)?(r=Jo(d=r,"width",1),n=Jo(d,"height",1),h=Jo(d,"key",void 0),a=Jo(d,"baseFrame",void 0),o=Jo(d,"columns",void 0),l=Jo(d,"rows",void 0)):$o(h)?(h=Jo(d=h,"key",void 0),a=Jo(d,"baseFrame",void 0),o=Jo(d,"columns",void 0),l=Jo(d,"rows",void 0)):$o(a)?(a=Jo(d=a,"baseFrame",void 0),o=Jo(d,"columns",void 0),l=Jo(d,"rows",void 0)):Array.isArray(a)?(d=l,l=o,o=a,a=Jo(d,"baseFrame",void 0)):$o(o)&&(o=Jo(d=o,"columns",void 0),l=Jo(d,"rows",void 0)),void 0===a&&(a=Jo(d,"frame",void 0)),void 0===o){var c=Jo(d,"leftWidth",void 0),u=Jo(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=Jo(d,"topHeight",void 0),v=Jo(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(Jo(d,"getFrameNameCallback",void 0)),this.setStretchMode(Jo(d,"stretchMode",0)),this.setPreserveRatio(Jo(d,"preserveRatio",!0));var g=Jo(d,"maxFixedPartScale",1),f=Jo(d,"maxFixedPartScaleX",g),m=Jo(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(h,a,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,Go),i}(Qo,"rexNinePatch")){}var el={_drawImage:function(t,e,i,s,r,n){var h=Zo(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=Zo(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(tl.prototype,el);class il extends ii{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(_o(t,e))return t[e];var i=t.parent;return _o(i,e)?i[e]:void 0}set(t,e,i){return _o(t,e)?t[e]=i:_o(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}}const sl=Phaser.Utils.Objects.GetValue;class rl extends tl{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=sl(e,"effects",!0);i&&Do(this,i),this.style=new il(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(rl.prototype,Ta);const nl=["alpha","tint","flipX","flipY"];var hl=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("barColor")?i="bar":e.hasOwnProperty("leftWidth")?i="nineSlice":e.hasOwnProperty("key")&&(i="image")),i){case"bar":s=new Po(t,e);break;case"image":s=new jo(t,e);break;case"nineSlice":s=e.hasOwnProperty("stretchMode")?new rl(t,e):new Yo(t,e);break;default:s=new ka(t,e)}return function(t,e){if(!e)return t;for(var i=0,s=nl.length;i=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const zl=Phaser.Utils.Objects.GetValue,Wl=Phaser.Math.Distance.Between;class jl extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=zl(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(zl(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(zl(t,"enable",!0)),this.holdThreshold=zl(t,"holdThreshold",50),this.pointerOutReleaseEnable=zl(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return dn(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:Wl(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!or(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!or(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const Il=Phaser.Utils.Objects.GetValue;class Fl{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(Il(t,"value",0)),this.setSpeed(Il(t,"speed",0)),this.setAcceleration(Il(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class Bl{constructor(){this.value,this.dir,this.movement=new Fl}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const Ul={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},Gl=Phaser.Utils.Objects.GetValue;class $l extends ii{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=Gl(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(Gl(e,"speed",.1)),this.setEnable(Gl(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(Gl(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||or(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const Jl=Phaser.Utils.Objects.GetValue;var ql=function(t,e,i,s){var r,n,h="Y"===(i=i.toUpperCase()),a=2===t.scrollMode,o=t.childrenMap.child,l=`slider${i}`;if(r=a||s.hasOwnProperty(l)?Jl(s,l,void 0):Jl(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=h?1:0,n=function(t,e){void 0===e&&(e={});var i=mt(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new Yl(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r),n.tickLength=Jl(r,"tickLength",void 0);var p=Jl(r,"position",0);"string"==typeof p&&(p=Kl[p]);var v,g,f=Jl(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=Jl(s,"space.slider",void 0))&&(a?f=0:v=Jl(s,"space.child",0)),g=void 0===v?"number"==typeof f:"number"==typeof v,h?0===p?(d=2,c=1,u=void 0===v?g?{left:f}:f:{left:Jl(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:Jl(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:Jl(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:Jl(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=Jl(r,"hideUnscrollableSlider",!1),t[`disableUnscrollableDrag${i}`]=Jl(r,"disableUnscrollableDrag",!1),t[`adaptThumb${i}SizeMode`]=Jl(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=Jl(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`disableUnscrollableDrag${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=Jl(s,"scrollDetectionMode");"string"==typeof b&&(b=Zl[b]);var C=`scroller${i}`;(m=a||s.hasOwnProperty(C)?Jl(s,C,!0):Jl(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new Nl(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var x,w,S,P,O,_=Jl(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);_&&o&&(void 0!==b&&(_.focus=1===b?2:0),x=new $l(o,_)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,x),a&&!h||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.disableUnscrollableDrag=t[`disableUnscrollableDrag${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",x)),n&&(a?(w=h?"t":"s",P=`scroll${i}`):(w="t",P="scroll"),n.on("valuechange",(function(e){t[w]=e,t.emit(P,t)}))),y&&(a?(S=`childO${i}`,P=`scroll${i}`):(S="childOY",P="scroll"),y.on("valuechange",(function(e){t[S]=e,t.emit(P,t)}))),x&&(O=a?`addChildO${i}`:"addChildOY",x.on("scroll",(function(e){t[O](-e,!0)})))};const Kl={right:0,left:1,bottom:0,top:1},Zl={gameObject:0,rectBounds:1},Ql=Phaser.Utils.Objects.GetValue;var td=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=Ql(e,"width"),h=Ql(e,"height");n||Ql(e,"child.expandWidth",!0)||(s[1]=0),h||Ql(e,"child.expandHeight",!0)||(r[1]=0);var a=new Gh(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=$h(i,"child"),r=$h(s,"gameObject",void 0);if(r){var n=$h(i,"space.child",0);t.childMargin={};var h=t.childMargin,a={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:h.top=0,h.bottom=0,h.left=0,h.right=0;break;default:h.top=n,h.bottom=n,h.left=n,h.right=n}else switch(t.scrollMode){case 0:h.top=$h(n,"top",0),h.bottom=$h(n,"bottom",0),a.left=$h(n,"left",0),a.right=$h(n,"right",0);break;case 1:h.top=$h(n,"left",0),h.bottom=$h(n,"right",0),a.top=$h(n,"top",0),a.bottom=$h(n,"bottom",0);break;default:h.top=$h(n,"top",0),h.bottom=$h(n,"bottom",0),h.left=$h(n,"left",0),h.right=$h(n,"right",0)}e.add(r,{column:1,row:1,align:$h(s,"align","center"),padding:a,expand:{width:$h(s,"expandWidth",!0),height:$h(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:ql(t,a,"y",e);break;case 1:ql(t,a,"x",e);break;default:ql(t,a,"y",e),ql(t,a,"x",e)}return a},ed=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}i*="Y"===t?this.scaleY:this.scaleX,s&&s.setBounds(e,i),r&&(r.setEnable(e!==i),r.tickLength&&r.setTick(r.tickLength,e,i))},id=function(t){switch(this.scrollMode){case 0:case 1:(i=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(i,this.isOverflow),(r=this.childrenMap.scroller)&&this.disableUnscrollableDrag&&r.setEnable(this.isOverflow);break;default:var e=this[`isOverflow${t=t.toUpperCase()}`],i=this.childrenMap[`slider${t}`],s=this[`hideUnscrollableSlider${t}`];i&&s&&this.setChildVisible(i,e);var r=this.childrenMap.scroller,n=this[`disableUnscrollableDrag${t}`];r&&n&&r.setEnable(e)}},sd=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(a=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=a.childrenMap.track,s=a.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&n0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(jd.prototype,Yd);const Id=Phaser.Utils.String.Pad;var Fd=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${Id(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},Bd=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Vd=Phaser.Math.DegToRad;var Hd=function(t){return!t.hasOwnProperty("convex")||t.convex},Nd=function(t){return t.x>0&&t.y>0},Ud=function(t,e,i,s,r,n,h,a,o){if(a&&h>n?h-=360:!a&&h=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=m.tl,Nd(a)?(o=a.x*g,l=a.y*f,Hd(a)?Ud(t,o,l,o,l,180,270,!1,h):Ud(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,Nd(a)?(o=a.x*g,l=a.y*f,Hd(a)?Ud(t,s-o,l,o,l,270,360,!1,h):Ud(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,Nd(a)?(o=a.x*g,l=a.y*f,Hd(a)?Ud(t,s-o,r-l,o,l,0,90,!1,h):Ud(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,Nd(a)?(o=a.x*g,l=a.y*f,Hd(a)?Ud(t,o,r-l,o,l,90,180,!1,h):Ud(t,0,r,o,l,360,270,!0,h)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,h,u),null!=a)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,a),p.addColorStop(1,d),a=p),e.fillStyle=a,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())};const $d=Phaser.Utils.Objects.GetValue;class Jd extends jd{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor($d(e,"color",null),$d(e,"color2",null),$d(e,"horizontalGradient",!0)),this.setStroke($d(e,"stroke",null),$d(e,"strokeThickness",2)),this.setCornerRadius($d(e,"cornerRadius",0),$d(e,"cornerIteration",null))}set color(t){t=Fd(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Fd(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Fd(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,Bd("color2",t,this),Bd("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Bd("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Bd("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){!function(t,e,i,s,r,n,h,a){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),Gd(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}}(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const qd=Phaser.Utils.Objects.GetValue;class Kd extends jd{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(qd(e,"color",null),qd(e,"color2",null),qd(e,"horizontalGradient",!0)),this.setStroke(qd(e,"stroke",null),qd(e,"strokeThickness",2))}set color(t){t=Fd(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Fd(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=Fd(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,qd(t,"color2",null),qd(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,qd(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,h=this.parent.height-i.top-i.bottom,a=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?a.createLinearGradient(0,0,n,0):a.createLinearGradient(0,0,0,h)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,a.fillStyle=t,a.fillRect(s,r,n,h));null!=this.stroke&&this.strokeThickness>0&&(a.strokeStyle=this.stroke,a.lineWidth=this.strokeThickness,a.strokeRect(s,r,n,h))}}const Zd=Phaser.Utils.Objects.GetValue;class Qd{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(Zd(t,"bold",!1)),this.setItalic(Zd(t,"italic",!1)),this.setFontSize(Zd(t,"fontSize","16px")),this.setFontFamily(Zd(t,"fontFamily","Courier")),this.setColor(Zd(t,"color","#fff")),this.setStrokeStyle(Zd(t,"stroke",null),Zd(t,"strokeThickness",0)),this.setShadow(Zd(t,"shadowColor",null),Zd(t,"shadowOffsetX",0),Zd(t,"shadowOffsetY",0),Zd(t,"shadowBlur",0)),this.setOffset(Zd(t,"offsetX",0),Zd(t,"offsetY",0)),this.setSpace(Zd(t,"leftSpace",0),Zd(t,"rightSpace",0)),this.setAlign(Zd(t,"align",void 0)),this.setBackgroundColor(Zd(t,"backgroundColor",null)),this.setBackgroundHeight(Zd(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Zd(t,"backgroundBottomY",void 0)),this.setBackgroundLeftX(Zd(t,"backgroundLeftX",0)),this.setBackgroundRightX(Zd(t,"backgroundRightX",0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(Bd("stroke",t,this),Bd("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Bd("shadowOffsetX",t,this),Bd("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),t.hasOwnProperty("backgroundLeftX")&&this.setBackgroundLeftX(t.backgroundLeftX),t.hasOwnProperty("backgroundRightX")&&this.setBackgroundRightX(t.backgroundRightX),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new Qd(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=Fd(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=Fd(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=Fd(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=Fd(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setBackgroundLeftX(t){return this.backgroundLeftX=t,this}setBackgroundRightX(t){return this.backgroundRightX=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}}const tc=Phaser.Utils.Array.Remove,ec=Phaser.Utils.Array.Remove,ic="text",sc="image",rc="drawer",nc="space",hc="command";var ac=function(t){return t.type===ic&&"\n"===t.text},oc=function(t){return t.type===ic&&"\f"===t.text},lc=function(t){return t.type===ic};class dc extends jd{constructor(t,e,i){super(t,ic),this.updateTextFlag=!1,this.style=new Qd(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX+e.backgroundLeftX,s=i,r=this.drawTRX+e.backgroundRightX-i+1;if(r>0){var n=e.backgroundBottomY;null==n&&(n=this.drawBLY);var h=e.backgroundHeight;null==h&&(h=n-this.drawTLY);var a=n-h;t.fillRect(s,a,r,h)}}var o=e.hasFill,l=e.hasStroke;(o||l)&&(e.syncFont(t).syncStyle(t),l&&(e.syncShadow(t),t.strokeText(this.text,0,0)),o&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var cc=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const uc=Phaser.Display.Canvas.CanvasPool;Phaser.Display.Canvas.CanvasPool;class pc extends jd{constructor(t,e,i){super(t,sc),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){!function(t,e,i,s,r,n,h,a){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===a&&(a=!1),a&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(h){var l=uc.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=h,d.fillRect(0,0,r,n),o.drawImage(l,0,0,r,n,i,s,r,n),uc.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)}(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class vc extends jd{constructor(t,e,i,s){super(t,rc),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class gc extends jd{constructor(t,e){super(t,nc),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class fc extends bd{constructor(t,e,i,s,r){super(t,hc),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}var mc=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const yc={none:0,word:1,char:2,character:2,mix:3};var bc=/^[\x00-\x7F]+$/,Cc=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r,n=2===i,h=3===i,a=!n&&!h,o=t.length,l=e,d=s.word,c=0,u=!1;l0&&!a){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=Pc.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=Pc.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=_c(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=_c(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=_c(t,"wrapMode");void 0===c&&(c=_c(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=yc[c]);var u=_c(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=_c(t,"letterSpacing",0),v=_c(t,"hAlign",0),g=_c(t,"vAlign",0),f=_c(t,"justifyPercentage",.25),m=mc({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:h,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,b=0,C=y.length;b0&&(E.push({children:M,width:D}),R=Math.max(R,D)),m.start+=k.length,m.isLastPage=!L&&m.start===T,m.maxLineWidth=R,m.linesHeight=E.length*n;var I=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,F=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,h=t.vAlign,a=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(h=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=Ec(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=Ec(t,"maxLines",0);var a=0===i,o=Ec(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=Ec(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=Ec(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=Ec(t,"letterSpacing",0),p=Ec(t,"rtl",!0),v=Ec(t,"hAlign",p?2:0),g=Ec(t,"vAlign",0),f=mc({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:o,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(k.push({children:E,height:M}),D=Math.max(D,M)),f.start+=T.length,f.isLastPage=f.start===_,f.maxLineHeight=D,f.linesWidth=k.length*n;var z=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,W=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,h=t.vAlign,a=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}a&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,h=i.bottom;return Re(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return De(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),tc(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return ec(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(ic);return null===i?i=new dc(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),Xd(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const tu=Phaser.Utils.Objects.GetFastValue;var eu={};class iu{constructor(t){this.pools=tu(t,"pools",eu)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new Qc),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;e=r&&o=i&&oi.length&&(t.prevCursorPosition=null),null!==t.prevCursorPosition&&(s=e.getCharChild(t.prevCursorPosition))&&("\n"===s.text&&s.clearTextSize(),e.emit("cursorout",s,t.prevCursorPosition,e)),null!=r&&(s=e.getCharChild(r))&&("\n"===s.text&&s.copyTextSize(e.lastInsertCursor),function(t){var e,i,s=t.parent,r=s.width,n=s.height,h=t.drawX,a=t.drawY,o=h+t.drawTLX,l=h+t.drawTRX,d=a+t.drawTLY,c=a+t.drawBLY;e=o<0?0-o:l>r?r-l:0,i=d<0?0-d:c>n?n-c:0,s._textOX+=e,s._textOY+=i}(s),e.emit("cursorin",s,r,e)),e.emit("movecursor",r,t.prevCursorPosition,e),t.prevCursorPosition=r)}(this)):(Ou(this),_u(this)),this}setNumberInput(){return this.onUpdateCallback=Pu,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}}const Eu=Phaser.Utils.Objects.GetValue,Mu=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var Du=function(t,e){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return!0;if(-1!==e.indexOf(".")){for(var i=e.split("."),s=t,r=0;rt.length?i:t})),h.value=t.join(e)}else h.value=t.join(i.slice(a,a+h.count));a+=h.count,h.added||(o+=h.count)}}let l=e[h-1];return h>1&&"string"==typeof l.value&&(l.added||l.removed)&&t.equals("",l.value)&&(e[h-2].value+=l.value,e.pop()),e}ju.prototype={diff(t,e,i={}){let s=i.callback;"function"==typeof i&&(s=i,i={}),this.options=i;let r=this;function n(t){return s?(setTimeout((function(){s(void 0,t)}),0),!0):t}t=this.castInput(t),e=this.castInput(e),t=this.removeEmpty(this.tokenize(t));let h=(e=this.removeEmpty(this.tokenize(e))).length,a=t.length,o=1,l=h+a;i.maxEditLength&&(l=Math.min(l,i.maxEditLength));let d=[{newPos:-1,components:[]}],c=this.extractCommon(d[0],e,t,0);if(d[0].newPos+1>=h&&c+1>=a)return n([{value:this.join(e),count:e.length}]);function u(){for(let s=-1*o;s<=o;s+=2){let o,l=d[s-1],c=d[s+1],u=(c?c.newPos:0)-s;l&&(d[s-1]=void 0);let p=l&&l.newPos+1=h&&u+1>=a)return n(Iu(r,o.components,e,t,r.useLongestToken));d[s]=o}else d[s]=void 0}var i;o++}if(s)!function t(){setTimeout((function(){if(o>l)return s();u()||t()}),0)}();else for(;o<=l;){let t=u();if(t)return t}},pushComponent(t,e,i){let s=t[t.length-1];s&&s.added===e&&s.removed===i?t[t.length-1]={count:s.count+1,added:e,removed:i}:t.push({count:1,added:e,removed:i})},extractCommon(t,e,i,s){let r=e.length,n=i.length,h=t.newPos,a=h-s,o=0;for(;h+1t,tokenize:t=>t.split(""),join:t=>t.join("")};const Fu=new ju,Bu=/^[a-zA-Z\u{C0}-\u{FF}\u{D8}-\u{F6}\u{F8}-\u{2C6}\u{2C8}-\u{2D7}\u{2DE}-\u{2FF}\u{1E00}-\u{1EFF}]+$/u,Vu=/\S/,Hu=new ju;Hu.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!Vu.test(t)&&!Vu.test(e)},Hu.tokenize=function(t){let e=t.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/);for(let t=0;tvoid 0===i?e:i}=this.options;return"string"==typeof t?t:JSON.stringify($u(t,null,null,i),i," ")},Gu.equals=function(t,e){return ju.prototype.equals.call(Gu,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const Ju=new ju;Ju.tokenize=function(t){return t.slice()},Ju.join=Ju.removeEmpty=function(t){return t};const qu=Phaser.Utils.Array.Remove;var Ku=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),qu(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(o=i,l=e,Fu.diff(o,l,d)),r=0,n=0,h=s.length;nr)i+=h;else{if(s!==r)break;i+=Math.min(e.position,h)}}return i},ip={cursorMoveLeft(){if(!this.isOpened)return this;var t=Qu(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=Qu(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=tp(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=Qu(ep(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=tp(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=Qu(ep(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const sp=Phaser.Utils.Objects.IsPlainObject;class rp extends nu{constructor(t,e,i,s,r,n){sp(e)?n=e:sp(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(Du(e,"wrap.vAlign")||So(e,"wrap.vAlign",s=i?"center":"top"),Du(e,"wrap.wrapMode")||So(e,"wrap.wrapMode","char"),Du(e,"wrap.maxLines")||So(e,"wrap.maxLines",s=i?1:void 0),i&&So(e,"wrap.wrapWidth",1/0),Du(e,"wrap.useDefaultTextHeight")||So(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!Du(e.edit,"inputType")){var s=i?"text":"textarea";So(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new Lu(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var h=n.text;h&&delete n.text;var a=Ca(n.background,"focus"),o=Ca(n.style,"cursor"),l=Ca(n.style,"range");super(t,e,i,s,r,n),this.type="rexCanvasInput",this.contentWidth=void 0,this.contentHeight=void 0,this.lineHeight=void 0,this.linesCount=void 0,this.characterCountOfLines=[],this._text,this.textEdit=function(t,e){var i=Eu(e,"edit");return void 0===i&&(i={}),ou(e,i,Mu),new ku(t,i)}(this,n),Xu.call(this),n.focusStyle&&Object.assign(a,n.focusStyle),Wu.call(this,a),n.cursorStyle&&Object.assign(o,n.cursorStyle),Au.call(this,o),n.rangeStyle&&Object.assign(l,n.rangeStyle),Yu(l)&&Object.assign(l,o),zu.call(this,l);var d=n.onAddChar;d&&this.on("addchar",d);var c=n.onCursorIn;c&&this.on("cursorin",c);var u=n.onCursorOut;u&&this.on("cursorout",u);var p=!n.onRangeIn&&!n.onRangeOut,v=p?n.onCursorIn:n.onRangeIn;v&&this.on("rangein",v);var g=p?n.onCursorOut:n.onRangeOut;g&&this.on("rangeout",g);var f,m=n.onMoveCursor;m&&this.on("movecursor",m),this.setParseTextCallback(n.parseTextCallback),this.lastInsertCursor=((f=this.createCharChild("|")).text="",f),h||(h=""),this.setText(h)}addChild(t,e){if(super.addChild(t,e),Array.isArray(t))for(var i=t,s=0,r=i.length;s>>16,n=(65280&h)>>>8,o=255&h;t.fillStyle="rgba("+a+","+n+","+o+","+r+")"}(t,this),t.fill()),this.isStroked&&(function(t,i,e,s){var h=e||i.strokeColor,r=s||i.strokeAlpha,a=(16711680&h)>>>16,n=(65280&h)>>>8,o=255&h;t.strokeStyle="rgba("+a+","+n+","+o+","+r+")",t.lineWidth=i.lineWidth}(t,this),t.stroke())}}var y=function(t,i,e){var s=e.length;if(s>=2){var h=e[s-2],r=e[s-1];if(t===h&&i===r)return e}return e.push(t,i),e};const f=Phaser.Math.DegToRad;var D=function(t,i,e,s,h,r,a,n,o){a&&r>h?r-=360:!a&&r0,a=0,n=i.length;a0;this.dirty=this.dirty||this._radiusTL!==t||this._convexTL!==i,this._convexTL=i,this._radiusTL=Math.abs(t)}get radiusTR(){return this._radiusTR}set radiusTR(t){var i=t>0;this.dirty=this.dirty||this._radiusTR!==t||this._convexTR!==i,this._convexTR=i,this._radiusTR=Math.abs(t)}get radiusBL(){return this._radiusBL}set radiusBL(t){var i=t>0;this.dirty=this.dirty||this._radiusBL!==t||this._convexBL!==i,this._convexBL=i,this._radiusBL=Math.abs(t)}get radiusBR(){return this._radiusBR}set radiusBR(t){var i=t>0;this.dirty=this.dirty||this._radiusBR!==t||this._convexBR!==i,this._convexBR=i,this._radiusBR=Math.abs(t)}get radius(){return Math.max(this.radiusTL,this.radiusTR,this.radiusBL,this.radiusBR)}set radius(t){"number"==typeof t?(this.radiusTL=t,this.radiusTR=t,this.radiusBL=t,this.radiusBR=t):(this.radiusTL=z(t,"tl",0),this.radiusTR=z(t,"tr",0),this.radiusBL=z(t,"bl",0),this.radiusBR=z(t,"br",0))}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}get iterations(){return this._iterations}set iterations(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t}setIterations(t){return this.iterations=t,this}updateData(){var t=this.pathData;t.length=0;var i,e=this.width,s=this.height,h=this.iterations+1;return(i=this.radiusTL)>0?this._convexTL?D(i,i,i,i,180,270,!1,h,t):D(0,0,i,i,90,0,!0,h,t):y(0,0,t),(i=this.radiusTR)>0?this._convexTR?D(e-i,i,i,i,270,360,!1,h,t):D(e,0,i,i,180,90,!0,h,t):y(e,0,t),(i=this.radiusBR)>0?this._convexBR?D(e-i,s-i,i,i,0,90,!1,h,t):D(e,s,i,i,270,180,!0,h,t):y(e,s,t),(i=this.radiusBL)>0?this._convexBL?D(i,s-i,i,i,90,180,!1,h,t):D(0,s,i,i,360,270,!0,h,t):y(0,s,t),t.push(t[0],t[1]),S(this.x,this.y,t),super.updateData(),this}}Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlpha; +var t,i;t=void 0,i=function(){const t=Phaser.GameObjects.GetCalcMatrix,i=Phaser.Renderer.Canvas.SetTransform;var e={renderWebGL:function(i,e,s,h){e.updateData(),s.addToRenderList(e);var r=i.pipelines.set(e.pipeline),a=t(e,s,h),n=r.calcMatrix.copyFrom(a.calc),o=e._displayOriginX,l=e._displayOriginY,u=s.alpha*e.alpha;i.pipelines.preBatch(e);for(var d,p=e.geom,c=0,g=p.length;c>>16,n=(65280&h)>>>8,o=255&h;t.fillStyle="rgba("+a+","+n+","+o+","+r+")"}(t,this),t.fill()),this.isStroked&&(function(t,i,e,s){var h=e||i.strokeColor,r=s||i.strokeAlpha,a=(16711680&h)>>>16,n=(65280&h)>>>8,o=255&h;t.strokeStyle="rgba("+a+","+n+","+o+","+r+")",t.lineWidth=i.lineWidth}(t,this),t.stroke())}}var y=function(t,i,e){var s=e.length;if(s>=2){var h=e[s-2],r=e[s-1];if(t===h&&i===r)return e}return e.push(t,i),e};const f=Phaser.Math.DegToRad;var D=function(t,i,e,s,h,r,a,n,o){a&&r>h?r-=360:!a&&r0,a=0,n=i.length;a0;this.dirty=this.dirty||this._radiusTL!==t||this._convexTL!==i,this._convexTL=i,this._radiusTL=Math.abs(t)}get radiusTR(){return this._radiusTR}set radiusTR(t){var i=t>0;this.dirty=this.dirty||this._radiusTR!==t||this._convexTR!==i,this._convexTR=i,this._radiusTR=Math.abs(t)}get radiusBL(){return this._radiusBL}set radiusBL(t){var i=t>0;this.dirty=this.dirty||this._radiusBL!==t||this._convexBL!==i,this._convexBL=i,this._radiusBL=Math.abs(t)}get radiusBR(){return this._radiusBR}set radiusBR(t){var i=t>0;this.dirty=this.dirty||this._radiusBR!==t||this._convexBR!==i,this._convexBR=i,this._radiusBR=Math.abs(t)}get radius(){return Math.max(this.radiusTL,this.radiusTR,this.radiusBL,this.radiusBR)}set radius(t){"number"==typeof t?(this.radiusTL=t,this.radiusTR=t,this.radiusBL=t,this.radiusBR=t):(this.radiusTL=z(t,"tl",0),this.radiusTR=z(t,"tr",0),this.radiusBL=z(t,"bl",0),this.radiusBR=z(t,"br",0))}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}get iterations(){return this._iterations}set iterations(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t}setIterations(t){return this.iterations=t,this}updateData(){var t=this.pathData;t.length=0;var i,e=this.width,s=this.height,h=this.iterations+1;return(i=this.radiusTL)>0?this._convexTL?D(i,i,i,i,180,270,!1,h,t):D(0,0,i,i,90,0,!0,h,t):y(0,0,t),(i=this.radiusTR)>0?this._convexTR?D(e-i,i,i,i,270,360,!1,h,t):D(e,0,i,i,180,90,!0,h,t):y(e,0,t),(i=this.radiusBR)>0?this._convexBR?D(e-i,s-i,i,i,0,90,!1,h,t):D(e,s,i,i,270,180,!0,h,t):y(e,s,t),(i=this.radiusBL)>0?this._convexBL?D(i,s-i,i,i,90,180,!1,h,t):D(0,s,i,i,360,270,!0,h,t):y(0,s,t),t.push(t[0],t[1]),R(this.x,this.y,t),super.updateData(),this}}Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlpha; /** * @author Richard Davey * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var W=function(t,i,e){return(i-t)*e+t},G=function(t){return t>>16&255},Y=function(t){return t>>8&255},I=function(t){return 255&t};const N=Phaser.Math.Linear;var U={buildShapes(){this.addShape((new X).setName("track")).addShape((new X).setName("thumb"))},updateShapes(){var t=this.width,i=this.height,e=this.value?this.toggleAnimProgress:1-this.toggleAnimProgress,s=this.getShape("track");if(this.isSizeChanged){var h=t*this.trackWidth,r=i*this.trackHeight,a=(t-h)/2,n=(i-r)/2,o=i*this.trackRadius;s.setTopLeftPosition(a,n).setSize(h,r).setRadius(o)}var l,u,d,p=(l=this.falseValueTrackColor,u=this.trackFillColor,d=e,(255&W(G(l),G(u),d))<<16|(255&W(Y(l),Y(u),d))<<8|255&W(I(l),I(u),d)),c=N(this.falseValueTrackFillAlpha,this.trackFillAlpha,e);s.fillStyle(p,c);var g=this.getShape("thumb");if(this.isSizeChanged){var v=t*this.thumbWidth,m=i*this.thumbHeight,y=i*this.thumbRadius;g.setSize(v,m).setRadius(y)}var f=N(this.thumbLeftX,this.thumbRightX,e)*t;this.rtl&&(f=t-f);var D=i/2;g.setCenterPosition(f,D),g.fillStyle(this.thumbColor,this.thumbAlpha)}},H={setEventEmitter(t,i){return void 0===i&&(i=Phaser.Events.EventEmitter),this._privateEE=!0===t||void 0===t,this._eventEmitter=this._privateEE?new i:t,this},destroyEventEmitter(){return this._eventEmitter&&this._privateEE&&this._eventEmitter.shutdown(),this},getEventEmitter(){return this._eventEmitter},on(){return this._eventEmitter&&this._eventEmitter.on.apply(this._eventEmitter,arguments),this},once(){return this._eventEmitter&&this._eventEmitter.once.apply(this._eventEmitter,arguments),this},off(){return this._eventEmitter&&this._eventEmitter.off.apply(this._eventEmitter,arguments),this},emit(t){return this._eventEmitter&&t&&this._eventEmitter.emit.apply(this._eventEmitter,arguments),this},addListener(){return this._eventEmitter&&this._eventEmitter.addListener.apply(this._eventEmitter,arguments),this},removeListener(){return this._eventEmitter&&this._eventEmitter.removeListener.apply(this._eventEmitter,arguments),this},removeAllListeners(){return this._eventEmitter&&this._eventEmitter.removeAllListeners.apply(this._eventEmitter,arguments),this},listenerCount(){return this._eventEmitter?this._eventEmitter.listenerCount.apply(this._eventEmitter,arguments):0},listeners(){return this._eventEmitter?this._eventEmitter.listeners.apply(this._eventEmitter,arguments):[]},eventNames(){return this._eventEmitter?this._eventEmitter.eventNames.apply(this._eventEmitter,arguments):[]}};const J=Phaser.Scene;var K=function(t){return t instanceof J};const q=Phaser.Game;var Q=function(t){return t instanceof q};const Z=Phaser.Utils.Objects.GetValue;class ${constructor(t,i){this.setParent(t),this.isShutdown=!1,this.setEventEmitter(Z(i,"eventEmitter",!0)),this.parent&&(this.parent===this.scene?this.scene.sys.events.once("shutdown",this.onEnvDestroy,this):this.parent===this.game?this.game.events.once("shutdown",this.onEnvDestroy,this):this.parent.once&&this.parent.once("destroy",this.onParentDestroy,this))}shutdown(t){this.isShutdown||(this.parent&&(this.parent===this.scene?this.scene.sys.events.off("shutdown",this.onEnvDestroy,this):this.parent===this.game?this.game.events.off("shutdown",this.onEnvDestroy,this):this.parent.once&&this.parent.off("destroy",this.onParentDestroy,this)),this.destroyEventEmitter(),this.parent=void 0,this.scene=void 0,this.game=void 0,this.isShutdown=!0)}destroy(t){this.shutdown(t)}onEnvDestroy(){this.destroy(!0)}onParentDestroy(t,i){this.destroy(i)}setParent(t){var i;return this.parent=t,this.scene=null==(i=t)||"object"!=typeof i?null:K(i)?i:i.scene&&K(i.scene)?i.scene:i.parent&&i.parent.scene&&K(i.parent.scene)?i.parent.scene:null,this.game=function(t){return null==t||"object"!=typeof t?null:Q(t)?t:Q(t.game)?t.game:K(t)?t.sys.game:K(t.scene)?t.scene.sys.game:void 0}(t),this}}Object.assign($.prototype,H);const tt=Phaser.Utils.Objects.GetValue;class it extends ${constructor(t,i){super(t,i),this._isRunning=!1,this.isPaused=!1,this.tickingState=!1,this.setTickingMode(tt(i,"tickingMode",1))}boot(){2!==this.tickingMode||this.tickingState||this.startTicking()}shutdown(t){this.isShutdown||(this.stop(),this.tickingState&&this.stopTicking(),super.shutdown(t))}setTickingMode(t){"string"==typeof t&&(t=et[t]),this.tickingMode=t}startTicking(){this.tickingState=!0}stopTicking(){this.tickingState=!1}get isRunning(){return this._isRunning}set isRunning(t){this._isRunning!==t&&(this._isRunning=t,1===this.tickingMode&&t!=this.tickingState&&(t?this.startTicking():this.stopTicking()))}start(){return this.isPaused=!1,this.isRunning=!0,this}pause(){return this.isRunning&&(this.isPaused=!0,this.isRunning=!1),this}resume(){return this.isPaused&&(this.isPaused=!1,this.isRunning=!0),this}stop(){return this.isPaused=!1,this.isRunning=!1,this}complete(){this.isPaused=!1,this.isRunning=!1,this.emit("complete",this.parent,this)}}const et={no:0,lazy:1,always:2},st=Phaser.Utils.Objects.GetValue;class ht extends it{constructor(t,i){super(t,i);var e=this.scene?"update":"step";this.tickEventName=st(i,"tickEventName",e),this.isSceneTicker=!rt(this.tickEventName)}startTicking(){super.startTicking(),this.isSceneTicker?this.scene.sys.events.on(this.tickEventName,this.update,this):this.game.events.on(this.tickEventName,this.update,this)}stopTicking(){super.stopTicking(),this.isSceneTicker&&this.scene?this.scene.sys.events.off(this.tickEventName,this.update,this):this.game&&this.game.events.off(this.tickEventName,this.update,this)}}var rt=function(t){return"step"===t||"poststep"===t};const at=Phaser.Utils.Objects.GetValue,nt=Phaser.Math.Clamp;class ot{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){this.state=at(t,"state",lt),this.timeScale=at(t,"timeScale",1),this.delay=at(t,"delay",0),this.repeat=at(t,"repeat",0),this.repeatCounter=at(t,"repeatCounter",0),this.repeatDelay=at(t,"repeatDelay",0),this.duration=at(t,"duration",0),this.nowTime=at(t,"nowTime",0),this.justRestart=at(t,"justRestart",!1)}toJSON(){return{state:this.state,timeScale:this.timeScale,delay:this.delay,repeat:this.repeat,repeatCounter:this.repeatCounter,repeatDelay:this.repeatDelay,duration:this.duration,nowTime:this.nowTime,justRestart:this.justRestart}}destroy(){}setTimeScale(t){return this.timeScale=t,this}setDelay(t){return void 0===t&&(t=0),this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatInfinity(){return this.repeat=-1,this}setRepeatDelay(t){return this.repeatDelay=t,this}start(){return this.nowTime=this.delay>0?-this.delay:0,this.state=this.nowTime>=0?dt:ut,this.repeatCounter=0,this}stop(){return this.state=lt,this}update(t,i){this.state!==lt&&this.state!==ct&&0!==i&&0!==this.timeScale&&(this.nowTime+=i*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=pt)):(this.nowTime=this.duration,this.state=ct):this.nowTime>=0&&(this.state=dt))}get t(){var t;switch(this.state){case lt:case ut:case pt:t=0;break;case dt:t=this.nowTime/this.duration;break;case ct:t=1}return nt(t,0,1)}set t(t){(t=nt(t,-1,1))<0?(this.state=ut,this.nowTime=-this.delay*t):(this.state=dt,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===lt}get isDelay(){return this.state===ut}get isCountDown(){return this.state===dt}get isRunning(){return this.state===ut||this.state===dt}get isDone(){return this.state===ct}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const lt=0,ut=1,dt=2,pt=3,ct=-1;class gt extends ht{constructor(t,i){super(t,i),this.timer=new ot}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const vt=Phaser.Utils.Objects.GetValue,mt=Phaser.Utils.Objects.GetAdvancedValue,yt=Phaser.Tweens.Builders.GetEaseFunction;class ft extends gt{resetFromJSON(t){return this.timer.resetFromJSON(vt(t,"timer")),this.setEnable(vt(t,"enable",!0)),this.setTarget(vt(t,"target",this.parent)),this.setDelay(mt(t,"delay",0)),this.setDuration(mt(t,"duration",1e3)),this.setEase(vt(t,"ease","Linear")),this.setRepeat(vt(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=yt(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,i){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var e=this.target,s=this.timer;return s.update(t,i),s.isDelay||this.updateTarget(e,s),this.emit("update",e,this),s.isDone&&this.complete(),this}updateTarget(t,i){}}const Dt=Phaser.Utils.Objects.GetValue,Tt=Phaser.Math.Linear;class kt extends ft{constructor(t,i){super(t,i),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var i=this.target;this.propertyKey=Dt(t,"key","value");var e=i[this.propertyKey];return this.fromValue=Dt(t,"from",e),this.toValue=Dt(t,"to",e),this.setEase(Dt(t,"ease",this.ease)),this.setDuration(Dt(t,"duration",this.duration)),this.setRepeat(Dt(t,"repeat",0)),this.setDelay(Dt(t,"delay",0)),this.setRepeatDelay(Dt(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),i[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,i){var e=i.t;e=this.easeFn(e),t[this.propertyKey]=Tt(this.fromValue,this.toValue,e)}}var Pt={setToggleAnimationDuration(t){return void 0===t&&(t=0),this.toggleAnimDuration=t,this},playToggleAnimation(){return void 0===this.toggleAnimProgressTask&&(this.toggleAnimProgressTask=new kt(this,{eventEmitter:null})),this.toggleAnimProgressTask.restart({key:"toggleAnimProgress",from:0,to:1,duration:this.toggleAnimDuration}),this},stopToggleAnimation(){return void 0===this.toggleAnimProgressTask||this.toggleAnimProgressTask.stop(),this}},bt={};Object.assign(bt,n,o,l,U,Pt);const _t=Phaser.Utils.Objects.GetValue,St=Phaser.Utils.Objects.IsPlainObject,Rt=23730;class At extends a{constructor(t,i,e,s,h,r,a){St(i)?(i=_t(a=i,"x",0),e=_t(a,"y",0),s=_t(a,"width",2),h=_t(a,"height",2),r=_t(a,"color",Rt)):St(r)&&(r=_t(a=r,"color",Rt)),super(t,i,e,s,h),this.type="rexToggleSwitch",void 0===r&&(r=Rt),this.setTrackFillStyle(r,_t(a,"trackFillAlpha",1)),this.setFalseValueTrackFillStyle(_t(a,"falseValueTrackColor",function(t){var i=.3*G(t)+.59*Y(t)+.11*I(t);return(255&i)<<16|(255&i)<<8|255&i}(r)),_t(a,"falseValueTrackFillAlpha",1)),this.setThumbStyle(_t(a,"thumbColor",16777215),_t(a,"thumbAlpha",1)),this.setTrackSize(_t(a,"trackWidth",.9),_t(a,"trackHeight",.5)),this.setTrackRadius(_t(a,"trackRadius",.5*this.trackHeight));var n=_t(a,"thumbHeight",void 0),o=_t(a,"thumbWidth",n);void 0===o&&(o=.9*this.trackHeight),this.setThumbSize(o,n),this.setThumbRadius(_t(a,"thumbRadius",.5*this.thumbHeight)),this.setThumbPosition(_t(a,"thumbLeft",.3),_t(a,"thumbRight",void 0)),this.setRTL(_t(a,"rtl",!1)),this.setToggleAnimationDuration(_t(a,"animationDuration",150)),this.buildShapes(),this.setValue(_t(a,"value",!1),0)}get value(){return this._value}set value(t){t=!!t,this._value!==t&&(this.dirty=!0,this._value=t,this.playToggleAnimation(),this.emit("valuechange",t))}setValue(t,i){void 0===i&&(i=this.toggleAnimDuration);var e=this.toggleAnimDuration;return this.toggleAnimDuration=i,this.value=t,this.toggleAnimDuration=e,this}toggleValue(t){return this.setValue(!this.value,t),this}get toggleAnimProgress(){return this._toggleAnimProgress}set toggleAnimProgress(t){this._toggleAnimProgress!==t&&(this._toggleAnimProgress=t,this.dirty=!0)}}Object.assign(At.prototype,bt);const wt=Phaser.Utils.Objects.GetValue;class Et extends ${constructor(t,i){super(t,i),this._enable=void 0,t.setInteractive(wt(i,"inputConfig",void 0)),this.resetFromJSON(i),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.isDown=!1,this.isOver=!1,this.setEnable(wt(t,"enable",!0)),this.setMode(wt(t,"mode",1)),this.setClickInterval(wt(t,"clickInterval",100)),this.setDragThreshold(wt(t,"threshold",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPress,this),t.on("pointerup",this.onRelease,this),t.on("pointerout",this.onPointOut,this),t.on("pointermove",this.onMove,this),t.on("pointerover",this.onOver,this),t.on("pointerout",this.onOut,this)}shutdown(t){this.isShutdown||(this.pointer=null,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var i=t?"enable":"disable";this.emit(i,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Ct[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}onPress(t,i,e,s){void 0===this.pointer&&(this.pointer=t,this.isDown=!0,this.emit("down",this,this.parent,t,s),0===this.mode&&this.click(t.downTime,t,s))}onRelease(t,i,e,s){this.pointer===t&&(this.isDown=!1,this.emit("up",this,this.parent,t,s),1===this.mode&&this.click(t.upTime,t,s),this.pointer=void 0)}onPointOut(t,i){this.pointer===t&&this.cancel()}onMove(t,i,e,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&t.getDistance()>=this.dragThreshold&&this.cancel()}onOver(t,i,e,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,i){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,i),this):this}click(t,i,e){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,i,e),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,i,e)),this}cancel(){return this.pointer=void 0,this}}const Ct={press:0,pointerdown:0,release:1,pointerup:1},Lt=Phaser.Utils.Objects.GetValue;return class extends At{constructor(t,i,e,s,h,r,a){super(t,i,e,s,h,r,a),this._click=new Et(this,Lt(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(Lt(a,"readOnly",!1))}get readOnly(){return!this._click.enable}set readOnly(t){this._click.enable=!t}setReadOnly(t){return void 0===t&&(t=!0),this.readOnly=t,this}}},"object"==typeof exports&&"undefined"!=typeof module?module.exports=i():"function"==typeof define&&define.amd?define(i):(t="undefined"!=typeof globalThis?globalThis:t||self).rextoggleswitch=i(); +var Y=function(t,i,e){return(i-t)*e+t},G=function(t){return t>>16&255},I=function(t){return t>>8&255},N=function(t){return 255&t};const U=Phaser.Math.Linear;var H={buildShapes(){this.addShape((new W).setName("track")).addShape((new W).setName("thumb"))},updateShapes(){var t=this.width,i=this.height,e=this.value?this.toggleAnimProgress:1-this.toggleAnimProgress,s=this.getShape("track");if(this.isSizeChanged){var h=t*this.trackWidth,r=i*this.trackHeight,a=(t-h)/2,n=(i-r)/2,o=i*this.trackRadius;s.setTopLeftPosition(a,n).setSize(h,r).setRadius(o)}var l,u,d,p=(l=this.falseValueTrackColor,u=this.trackFillColor,d=e,(255&Y(G(l),G(u),d))<<16|(255&Y(I(l),I(u),d))<<8|255&Y(N(l),N(u),d)),c=U(this.falseValueTrackFillAlpha,this.trackFillAlpha,e);s.fillStyle(p,c);var g=this.getShape("thumb");if(this.isSizeChanged){var v=t*this.thumbWidth,m=i*this.thumbHeight,y=i*this.thumbRadius;g.setSize(v,m).setRadius(y)}var f=U(this.thumbLeftX,this.thumbRightX,e)*t;this.rtl&&(f=t-f);var D=i/2;g.setCenterPosition(f,D),g.fillStyle(this.thumbColor,this.thumbAlpha)}},J={setEventEmitter(t,i){return void 0===i&&(i=Phaser.Events.EventEmitter),this._privateEE=!0===t||void 0===t,this._eventEmitter=this._privateEE?new i:t,this},destroyEventEmitter(){return this._eventEmitter&&this._privateEE&&this._eventEmitter.shutdown(),this},getEventEmitter(){return this._eventEmitter},on(){return this._eventEmitter&&this._eventEmitter.on.apply(this._eventEmitter,arguments),this},once(){return this._eventEmitter&&this._eventEmitter.once.apply(this._eventEmitter,arguments),this},off(){return this._eventEmitter&&this._eventEmitter.off.apply(this._eventEmitter,arguments),this},emit(t){return this._eventEmitter&&t&&this._eventEmitter.emit.apply(this._eventEmitter,arguments),this},addListener(){return this._eventEmitter&&this._eventEmitter.addListener.apply(this._eventEmitter,arguments),this},removeListener(){return this._eventEmitter&&this._eventEmitter.removeListener.apply(this._eventEmitter,arguments),this},removeAllListeners(){return this._eventEmitter&&this._eventEmitter.removeAllListeners.apply(this._eventEmitter,arguments),this},listenerCount(){return this._eventEmitter?this._eventEmitter.listenerCount.apply(this._eventEmitter,arguments):0},listeners(){return this._eventEmitter?this._eventEmitter.listeners.apply(this._eventEmitter,arguments):[]},eventNames(){return this._eventEmitter?this._eventEmitter.eventNames.apply(this._eventEmitter,arguments):[]}};const K=Phaser.Scene;var q=function(t){return t instanceof K};const Q=Phaser.Game;var Z=function(t){return t instanceof Q};const $=Phaser.Utils.Objects.GetValue;class tt{constructor(t,i){this.setParent(t),this.isShutdown=!1,this.setEventEmitter($(i,"eventEmitter",!0)),this.parent&&(this.parent===this.scene?this.scene.sys.events.once("shutdown",this.onEnvDestroy,this):this.parent===this.game?this.game.events.once("shutdown",this.onEnvDestroy,this):this.parent.once&&this.parent.once("destroy",this.onParentDestroy,this))}shutdown(t){this.isShutdown||(this.parent&&(this.parent===this.scene?this.scene.sys.events.off("shutdown",this.onEnvDestroy,this):this.parent===this.game?this.game.events.off("shutdown",this.onEnvDestroy,this):this.parent.once&&this.parent.off("destroy",this.onParentDestroy,this)),this.destroyEventEmitter(),this.parent=void 0,this.scene=void 0,this.game=void 0,this.isShutdown=!0)}destroy(t){this.shutdown(t)}onEnvDestroy(){this.destroy(!0)}onParentDestroy(t,i){this.destroy(i)}setParent(t){var i;return this.parent=t,this.scene=null==(i=t)||"object"!=typeof i?null:q(i)?i:i.scene&&q(i.scene)?i.scene:i.parent&&i.parent.scene&&q(i.parent.scene)?i.parent.scene:null,this.game=function(t){return null==t||"object"!=typeof t?null:Z(t)?t:Z(t.game)?t.game:q(t)?t.sys.game:q(t.scene)?t.scene.sys.game:void 0}(t),this}}Object.assign(tt.prototype,J);const it=Phaser.Utils.Objects.GetValue;class et extends tt{constructor(t,i){super(t,i),this._isRunning=!1,this.isPaused=!1,this.tickingState=!1,this.setTickingMode(it(i,"tickingMode",1))}boot(){2!==this.tickingMode||this.tickingState||this.startTicking()}shutdown(t){this.isShutdown||(this.stop(),this.tickingState&&this.stopTicking(),super.shutdown(t))}setTickingMode(t){"string"==typeof t&&(t=st[t]),this.tickingMode=t}startTicking(){this.tickingState=!0}stopTicking(){this.tickingState=!1}get isRunning(){return this._isRunning}set isRunning(t){this._isRunning!==t&&(this._isRunning=t,1===this.tickingMode&&t!=this.tickingState&&(t?this.startTicking():this.stopTicking()))}start(){return this.isPaused=!1,this.isRunning=!0,this}pause(){return this.isRunning&&(this.isPaused=!0,this.isRunning=!1),this}resume(){return this.isPaused&&(this.isPaused=!1,this.isRunning=!0),this}stop(){return this.isPaused=!1,this.isRunning=!1,this}complete(){this.isPaused=!1,this.isRunning=!1,this.emit("complete",this.parent,this)}}const st={no:0,lazy:1,always:2},ht=Phaser.Utils.Objects.GetValue;class rt extends et{constructor(t,i){super(t,i);var e=this.scene?"update":"step";this.tickEventName=ht(i,"tickEventName",e),this.isSceneTicker=!at(this.tickEventName)}startTicking(){super.startTicking(),this.isSceneTicker?this.scene.sys.events.on(this.tickEventName,this.update,this):this.game.events.on(this.tickEventName,this.update,this)}stopTicking(){super.stopTicking(),this.isSceneTicker&&this.scene?this.scene.sys.events.off(this.tickEventName,this.update,this):this.game&&this.game.events.off(this.tickEventName,this.update,this)}}var at=function(t){return"step"===t||"poststep"===t};const nt=Phaser.Utils.Objects.GetValue,ot=Phaser.Math.Clamp;class lt{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){this.state=nt(t,"state",ut),this.timeScale=nt(t,"timeScale",1),this.delay=nt(t,"delay",0),this.repeat=nt(t,"repeat",0),this.repeatCounter=nt(t,"repeatCounter",0),this.repeatDelay=nt(t,"repeatDelay",0),this.duration=nt(t,"duration",0),this.nowTime=nt(t,"nowTime",0),this.justRestart=nt(t,"justRestart",!1)}toJSON(){return{state:this.state,timeScale:this.timeScale,delay:this.delay,repeat:this.repeat,repeatCounter:this.repeatCounter,repeatDelay:this.repeatDelay,duration:this.duration,nowTime:this.nowTime,justRestart:this.justRestart}}destroy(){}setTimeScale(t){return this.timeScale=t,this}setDelay(t){return void 0===t&&(t=0),this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatInfinity(){return this.repeat=-1,this}setRepeatDelay(t){return this.repeatDelay=t,this}start(){return this.nowTime=this.delay>0?-this.delay:0,this.state=this.nowTime>=0?pt:dt,this.repeatCounter=0,this}stop(){return this.state=ut,this}update(t,i){this.state!==ut&&this.state!==gt&&0!==i&&0!==this.timeScale&&(this.nowTime+=i*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=ct)):(this.nowTime=this.duration,this.state=gt):this.nowTime>=0&&(this.state=pt))}get t(){var t;switch(this.state){case ut:case dt:case ct:t=0;break;case pt:t=this.nowTime/this.duration;break;case gt:t=1}return ot(t,0,1)}set t(t){(t=ot(t,-1,1))<0?(this.state=dt,this.nowTime=-this.delay*t):(this.state=pt,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===ut}get isDelay(){return this.state===dt}get isCountDown(){return this.state===pt}get isRunning(){return this.state===dt||this.state===pt}get isDone(){return this.state===gt}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const ut=0,dt=1,pt=2,ct=3,gt=-1;class vt extends rt{constructor(t,i){super(t,i),this.timer=new lt}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const mt=Phaser.Utils.Objects.GetValue,yt=Phaser.Utils.Objects.GetAdvancedValue,ft=Phaser.Tweens.Builders.GetEaseFunction;class Dt extends vt{resetFromJSON(t){return this.timer.resetFromJSON(mt(t,"timer")),this.setEnable(mt(t,"enable",!0)),this.setTarget(mt(t,"target",this.parent)),this.setDelay(yt(t,"delay",0)),this.setDuration(yt(t,"duration",1e3)),this.setEase(mt(t,"ease","Linear")),this.setRepeat(mt(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=ft(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,i){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var e=this.target,s=this.timer;return s.update(t,i),s.isDelay||this.updateTarget(e,s),this.emit("update",e,this),s.isDone&&this.complete(),this}updateTarget(t,i){}}const Tt=Phaser.Utils.Objects.GetValue,Pt=Phaser.Math.Linear;class kt extends Dt{constructor(t,i){super(t,i),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var i=this.target;this.propertyKey=Tt(t,"key","value");var e=i[this.propertyKey];return this.fromValue=Tt(t,"from",e),this.toValue=Tt(t,"to",e),this.setEase(Tt(t,"ease",this.ease)),this.setDuration(Tt(t,"duration",this.duration)),this.setRepeat(Tt(t,"repeat",0)),this.setDelay(Tt(t,"delay",0)),this.setRepeatDelay(Tt(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),i[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,i){var e=i.t;e=this.easeFn(e),t[this.propertyKey]=Pt(this.fromValue,this.toValue,e)}}var bt={setToggleAnimationDuration(t){return void 0===t&&(t=0),this.toggleAnimDuration=t,this},playToggleAnimation(){return void 0===this.toggleAnimProgressTask&&(this.toggleAnimProgressTask=new kt(this,{eventEmitter:null})),this.toggleAnimProgressTask.restart({key:"toggleAnimProgress",from:0,to:1,duration:this.toggleAnimDuration}),this},stopToggleAnimation(){return void 0===this.toggleAnimProgressTask||this.toggleAnimProgressTask.stop(),this}},_t={};Object.assign(_t,n,o,l,H,bt);const St=Phaser.Utils.Objects.GetValue,Rt=Phaser.Utils.Objects.IsPlainObject,At=23730;class wt extends a{constructor(t,i,e,s,h,r,a){Rt(i)?(i=St(a=i,"x",0),e=St(a,"y",0),s=St(a,"width",2),h=St(a,"height",2),r=St(a,"color",At)):Rt(r)&&(r=St(a=r,"color",At)),super(t,i,e,s,h),this.type="rexToggleSwitch",void 0===r&&(r=At),this.setTrackFillStyle(r,St(a,"trackFillAlpha",1)),this.setFalseValueTrackFillStyle(St(a,"falseValueTrackColor",function(t){var i=.3*G(t)+.59*I(t)+.11*N(t);return(255&i)<<16|(255&i)<<8|255&i}(r)),St(a,"falseValueTrackFillAlpha",1)),this.setThumbStyle(St(a,"thumbColor",16777215),St(a,"thumbAlpha",1)),this.setTrackSize(St(a,"trackWidth",.9),St(a,"trackHeight",.5)),this.setTrackRadius(St(a,"trackRadius",.5*this.trackHeight));var n=St(a,"thumbHeight",void 0),o=St(a,"thumbWidth",n);void 0===o&&(o=.9*this.trackHeight),this.setThumbSize(o,n),this.setThumbRadius(St(a,"thumbRadius",.5*this.thumbHeight)),this.setThumbPosition(St(a,"thumbLeft",.3),St(a,"thumbRight",void 0)),this.setRTL(St(a,"rtl",!1)),this.setToggleAnimationDuration(St(a,"animationDuration",150)),this.buildShapes(),this.setValue(St(a,"value",!1),0)}get value(){return this._value}set value(t){t=!!t,this._value!==t&&(this.dirty=!0,this._value=t,this.playToggleAnimation(),this.emit("valuechange",t))}setValue(t,i){void 0===i&&(i=this.toggleAnimDuration);var e=this.toggleAnimDuration;return this.toggleAnimDuration=i,this.value=t,this.toggleAnimDuration=e,this}toggleValue(t){return this.setValue(!this.value,t),this}get toggleAnimProgress(){return this._toggleAnimProgress}set toggleAnimProgress(t){this._toggleAnimProgress!==t&&(this._toggleAnimProgress=t,this.dirty=!0)}}Object.assign(wt.prototype,_t);const Et=Phaser.Utils.Objects.GetValue;class Ct extends tt{constructor(t,i){super(t,i),this._enable=void 0,t.setInteractive(Et(i,"inputConfig",void 0)),this.resetFromJSON(i),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.isDown=!1,this.isOver=!1,this.setEnable(Et(t,"enable",!0)),this.setMode(Et(t,"mode",1)),this.setClickInterval(Et(t,"clickInterval",100)),this.setDragThreshold(Et(t,"threshold",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPress,this),t.on("pointerup",this.onRelease,this),t.on("pointerout",this.onPointOut,this),t.on("pointermove",this.onMove,this),t.on("pointerover",this.onOver,this),t.on("pointerout",this.onOut,this)}shutdown(t){this.isShutdown||(this.pointer=null,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var i=t?"enable":"disable";this.emit(i,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Lt[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}onPress(t,i,e,s){void 0===this.pointer&&(this.pointer=t,this.isDown=!0,this.emit("down",this,this.parent,t,s),0===this.mode&&this.click(t.downTime,t,s))}onRelease(t,i,e,s){this.pointer===t&&(this.isDown=!1,this.emit("up",this,this.parent,t,s),1===this.mode&&this.click(t.upTime,t,s),this.pointer=void 0)}onPointOut(t,i){this.pointer===t&&this.cancel()}onMove(t,i,e,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&t.getDistance()>=this.dragThreshold&&this.cancel()}onOver(t,i,e,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,i){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,i),this):this}click(t,i,e){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,i,e),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,i,e)),this}cancel(){return this.pointer=void 0,this}}const Lt={press:0,pointerdown:0,release:1,pointerup:1},Ot=Phaser.Utils.Objects.GetValue;return class extends wt{constructor(t,i,e,s,h,r,a){super(t,i,e,s,h,r,a),this._click=new Ct(this,Ot(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(Ot(a,"readOnly",!1))}get readOnly(){return!this._click.enable}set readOnly(t){this._click.enable=!t}setReadOnly(t){return void 0===t&&(t=!0),this.readOnly=t,this}}},"object"==typeof exports&&"undefined"!=typeof module?module.exports=i():"function"==typeof define&&define.amd?define(i):(t="undefined"!=typeof globalThis?globalThis:t||self).rextoggleswitch=i(); diff --git a/dist/rextoggleswitchplugin.js b/dist/rextoggleswitchplugin.js index 154367decf..cc15758062 100644 --- a/dist/rextoggleswitchplugin.js +++ b/dist/rextoggleswitchplugin.js @@ -855,6 +855,32 @@ return pathData; }; + //import CatmullRomInterpolation from '../../utils/math/interpolation/CatmullRomInterpolation.js'; + + const CatmullRomInterpolation = Phaser.Math.Interpolation.CatmullRom; + + var CatmullRomTo = function (points, iterations, pathData) { + var pathDataCnt = pathData.length; + var p0x = pathData[pathDataCnt - 2]; + var p0y = pathData[pathDataCnt - 1]; + + var xList = [p0x]; + var yList = [p0y]; + for (var i = 0, cnt = points.length; i < cnt; i += 2) { + xList.push(points[i]); + yList.push(points[i + 1]); + } + + for (var i = 1, last = iterations - 1; i <= last; i++) { + var t = i / last; + pathData.push( + CatmullRomInterpolation(xList, t), + CatmullRomInterpolation(yList, t) + ); + } + return pathData; + }; + var DuplicateLast = function (pathData) { var len = pathData.length; if (len < 2) { @@ -966,6 +992,18 @@ return this; }, + catmullRomTo(...points) { + CatmullRomTo( + points, + this.iterations, + this.pathData + ); + + this.lastPointX = points[points.length-2]; + this.lastPointY = points[points.length-1]; + return this; + }, + close() { // Line to first point var startX = this.pathData[0], diff --git a/dist/rextoggleswitchplugin.min.js b/dist/rextoggleswitchplugin.min.js index d371660a8f..09c50d752e 100644 --- a/dist/rextoggleswitchplugin.min.js +++ b/dist/rextoggleswitchplugin.min.js @@ -1,7 +1,7 @@ -var t,i;t=void 0,i=function(){const t=Phaser.GameObjects.GetCalcMatrix,i=Phaser.Renderer.Canvas.SetTransform;var e={renderWebGL:function(i,e,s,h){e.updateData(),s.addToRenderList(e);var r=i.pipelines.set(e.pipeline),a=t(e,s,h),n=r.calcMatrix.copyFrom(a.calc),o=e._displayOriginX,l=e._displayOriginY,u=s.alpha*e.alpha;i.pipelines.preBatch(e);for(var d,c=e.geom,p=0,g=c.length;p>>16,n=(65280&h)>>>8,o=255&h;t.fillStyle="rgba("+a+","+n+","+o+","+r+")"}(t,this),t.fill()),this.isStroked&&(function(t,i,e,s){var h=e||i.strokeColor,r=s||i.strokeAlpha,a=(16711680&h)>>>16,n=(65280&h)>>>8,o=255&h;t.strokeStyle="rgba("+a+","+n+","+o+","+r+")",t.lineWidth=i.lineWidth}(t,this),t.stroke())}}var y=function(t,i,e){var s=e.length;if(s>=2){var h=e[s-2],r=e[s-1];if(t===h&&i===r)return e}return e.push(t,i),e};const f=Phaser.Math.DegToRad;var P=function(t,i,e,s,h,r,a,n,o){a&&r>h?r-=360:!a&&r0,a=0,n=i.length;a0;this.dirty=this.dirty||this._radiusTL!==t||this._convexTL!==i,this._convexTL=i,this._radiusTL=Math.abs(t)}get radiusTR(){return this._radiusTR}set radiusTR(t){var i=t>0;this.dirty=this.dirty||this._radiusTR!==t||this._convexTR!==i,this._convexTR=i,this._radiusTR=Math.abs(t)}get radiusBL(){return this._radiusBL}set radiusBL(t){var i=t>0;this.dirty=this.dirty||this._radiusBL!==t||this._convexBL!==i,this._convexBL=i,this._radiusBL=Math.abs(t)}get radiusBR(){return this._radiusBR}set radiusBR(t){var i=t>0;this.dirty=this.dirty||this._radiusBR!==t||this._convexBR!==i,this._convexBR=i,this._radiusBR=Math.abs(t)}get radius(){return Math.max(this.radiusTL,this.radiusTR,this.radiusBL,this.radiusBR)}set radius(t){"number"==typeof t?(this.radiusTL=t,this.radiusTR=t,this.radiusBL=t,this.radiusBR=t):(this.radiusTL=M(t,"tl",0),this.radiusTR=M(t,"tr",0),this.radiusBL=M(t,"bl",0),this.radiusBR=M(t,"br",0))}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}get iterations(){return this._iterations}set iterations(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t}setIterations(t){return this.iterations=t,this}updateData(){var t=this.pathData;t.length=0;var i,e=this.width,s=this.height,h=this.iterations+1;return(i=this.radiusTL)>0?this._convexTL?P(i,i,i,i,180,270,!1,h,t):P(0,0,i,i,90,0,!0,h,t):y(0,0,t),(i=this.radiusTR)>0?this._convexTR?P(e-i,i,i,i,270,360,!1,h,t):P(e,0,i,i,180,90,!0,h,t):y(e,0,t),(i=this.radiusBR)>0?this._convexBR?P(e-i,s-i,i,i,0,90,!1,h,t):P(e,s,i,i,270,180,!0,h,t):y(e,s,t),(i=this.radiusBL)>0?this._convexBL?P(i,s-i,i,i,90,180,!1,h,t):P(0,s,i,i,360,270,!0,h,t):y(0,s,t),t.push(t[0],t[1]),S(this.x,this.y,t),super.updateData(),this}}Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlpha; +var t,i;t=void 0,i=function(){const t=Phaser.GameObjects.GetCalcMatrix,i=Phaser.Renderer.Canvas.SetTransform;var e={renderWebGL:function(i,e,s,h){e.updateData(),s.addToRenderList(e);var r=i.pipelines.set(e.pipeline),a=t(e,s,h),n=r.calcMatrix.copyFrom(a.calc),o=e._displayOriginX,l=e._displayOriginY,u=s.alpha*e.alpha;i.pipelines.preBatch(e);for(var d,c=e.geom,p=0,g=c.length;p>>16,n=(65280&h)>>>8,o=255&h;t.fillStyle="rgba("+a+","+n+","+o+","+r+")"}(t,this),t.fill()),this.isStroked&&(function(t,i,e,s){var h=e||i.strokeColor,r=s||i.strokeAlpha,a=(16711680&h)>>>16,n=(65280&h)>>>8,o=255&h;t.strokeStyle="rgba("+a+","+n+","+o+","+r+")",t.lineWidth=i.lineWidth}(t,this),t.stroke())}}var y=function(t,i,e){var s=e.length;if(s>=2){var h=e[s-2],r=e[s-1];if(t===h&&i===r)return e}return e.push(t,i),e};const f=Phaser.Math.DegToRad;var P=function(t,i,e,s,h,r,a,n,o){a&&r>h?r-=360:!a&&r0,a=0,n=i.length;a0;this.dirty=this.dirty||this._radiusTL!==t||this._convexTL!==i,this._convexTL=i,this._radiusTL=Math.abs(t)}get radiusTR(){return this._radiusTR}set radiusTR(t){var i=t>0;this.dirty=this.dirty||this._radiusTR!==t||this._convexTR!==i,this._convexTR=i,this._radiusTR=Math.abs(t)}get radiusBL(){return this._radiusBL}set radiusBL(t){var i=t>0;this.dirty=this.dirty||this._radiusBL!==t||this._convexBL!==i,this._convexBL=i,this._radiusBL=Math.abs(t)}get radiusBR(){return this._radiusBR}set radiusBR(t){var i=t>0;this.dirty=this.dirty||this._radiusBR!==t||this._convexBR!==i,this._convexBR=i,this._radiusBR=Math.abs(t)}get radius(){return Math.max(this.radiusTL,this.radiusTR,this.radiusBL,this.radiusBR)}set radius(t){"number"==typeof t?(this.radiusTL=t,this.radiusTR=t,this.radiusBL=t,this.radiusBR=t):(this.radiusTL=X(t,"tl",0),this.radiusTR=X(t,"tr",0),this.radiusBL=X(t,"bl",0),this.radiusBR=X(t,"br",0))}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}get iterations(){return this._iterations}set iterations(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t}setIterations(t){return this.iterations=t,this}updateData(){var t=this.pathData;t.length=0;var i,e=this.width,s=this.height,h=this.iterations+1;return(i=this.radiusTL)>0?this._convexTL?P(i,i,i,i,180,270,!1,h,t):P(0,0,i,i,90,0,!0,h,t):y(0,0,t),(i=this.radiusTR)>0?this._convexTR?P(e-i,i,i,i,270,360,!1,h,t):P(e,0,i,i,180,90,!0,h,t):y(e,0,t),(i=this.radiusBR)>0?this._convexBR?P(e-i,s-i,i,i,0,90,!1,h,t):P(e,s,i,i,270,180,!0,h,t):y(e,s,t),(i=this.radiusBL)>0?this._convexBL?P(i,s-i,i,i,90,180,!1,h,t):P(0,s,i,i,360,270,!0,h,t):y(0,s,t),t.push(t[0],t[1]),R(this.x,this.y,t),super.updateData(),this}}Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlpha; /** * @author Richard Davey * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var X=function(t,i,e){return(i-t)*e+t},W=function(t){return t>>16&255},Y=function(t){return t>>8&255},I=function(t){return 255&t};const N=Phaser.Math.Linear;var U={buildShapes(){this.addShape((new z).setName("track")).addShape((new z).setName("thumb"))},updateShapes(){var t=this.width,i=this.height,e=this.value?this.toggleAnimProgress:1-this.toggleAnimProgress,s=this.getShape("track");if(this.isSizeChanged){var h=t*this.trackWidth,r=i*this.trackHeight,a=(t-h)/2,n=(i-r)/2,o=i*this.trackRadius;s.setTopLeftPosition(a,n).setSize(h,r).setRadius(o)}var l,u,d,c=(l=this.falseValueTrackColor,u=this.trackFillColor,d=e,(255&X(W(l),W(u),d))<<16|(255&X(Y(l),Y(u),d))<<8|255&X(I(l),I(u),d)),p=N(this.falseValueTrackFillAlpha,this.trackFillAlpha,e);s.fillStyle(c,p);var g=this.getShape("thumb");if(this.isSizeChanged){var v=t*this.thumbWidth,m=i*this.thumbHeight,y=i*this.thumbRadius;g.setSize(v,m).setRadius(y)}var f=N(this.thumbLeftX,this.thumbRightX,e)*t;this.rtl&&(f=t-f);var P=i/2;g.setCenterPosition(f,P),g.fillStyle(this.thumbColor,this.thumbAlpha)}},H={setEventEmitter(t,i){return void 0===i&&(i=Phaser.Events.EventEmitter),this._privateEE=!0===t||void 0===t,this._eventEmitter=this._privateEE?new i:t,this},destroyEventEmitter(){return this._eventEmitter&&this._privateEE&&this._eventEmitter.shutdown(),this},getEventEmitter(){return this._eventEmitter},on(){return this._eventEmitter&&this._eventEmitter.on.apply(this._eventEmitter,arguments),this},once(){return this._eventEmitter&&this._eventEmitter.once.apply(this._eventEmitter,arguments),this},off(){return this._eventEmitter&&this._eventEmitter.off.apply(this._eventEmitter,arguments),this},emit(t){return this._eventEmitter&&t&&this._eventEmitter.emit.apply(this._eventEmitter,arguments),this},addListener(){return this._eventEmitter&&this._eventEmitter.addListener.apply(this._eventEmitter,arguments),this},removeListener(){return this._eventEmitter&&this._eventEmitter.removeListener.apply(this._eventEmitter,arguments),this},removeAllListeners(){return this._eventEmitter&&this._eventEmitter.removeAllListeners.apply(this._eventEmitter,arguments),this},listenerCount(){return this._eventEmitter?this._eventEmitter.listenerCount.apply(this._eventEmitter,arguments):0},listeners(){return this._eventEmitter?this._eventEmitter.listeners.apply(this._eventEmitter,arguments):[]},eventNames(){return this._eventEmitter?this._eventEmitter.eventNames.apply(this._eventEmitter,arguments):[]}};const J=Phaser.Scene;var K=function(t){return t instanceof J};const q=Phaser.Game;var Q=function(t){return t instanceof q};const Z=Phaser.Utils.Objects.GetValue;class ${constructor(t,i){this.setParent(t),this.isShutdown=!1,this.setEventEmitter(Z(i,"eventEmitter",!0)),this.parent&&(this.parent===this.scene?this.scene.sys.events.once("shutdown",this.onEnvDestroy,this):this.parent===this.game?this.game.events.once("shutdown",this.onEnvDestroy,this):this.parent.once&&this.parent.once("destroy",this.onParentDestroy,this))}shutdown(t){this.isShutdown||(this.parent&&(this.parent===this.scene?this.scene.sys.events.off("shutdown",this.onEnvDestroy,this):this.parent===this.game?this.game.events.off("shutdown",this.onEnvDestroy,this):this.parent.once&&this.parent.off("destroy",this.onParentDestroy,this)),this.destroyEventEmitter(),this.parent=void 0,this.scene=void 0,this.game=void 0,this.isShutdown=!0)}destroy(t){this.shutdown(t)}onEnvDestroy(){this.destroy(!0)}onParentDestroy(t,i){this.destroy(i)}setParent(t){var i;return this.parent=t,this.scene=null==(i=t)||"object"!=typeof i?null:K(i)?i:i.scene&&K(i.scene)?i.scene:i.parent&&i.parent.scene&&K(i.parent.scene)?i.parent.scene:null,this.game=function(t){return null==t||"object"!=typeof t?null:Q(t)?t:Q(t.game)?t.game:K(t)?t.sys.game:K(t.scene)?t.scene.sys.game:void 0}(t),this}}Object.assign($.prototype,H);const tt=Phaser.Utils.Objects.GetValue;class it extends ${constructor(t,i){super(t,i),this._isRunning=!1,this.isPaused=!1,this.tickingState=!1,this.setTickingMode(tt(i,"tickingMode",1))}boot(){2!==this.tickingMode||this.tickingState||this.startTicking()}shutdown(t){this.isShutdown||(this.stop(),this.tickingState&&this.stopTicking(),super.shutdown(t))}setTickingMode(t){"string"==typeof t&&(t=et[t]),this.tickingMode=t}startTicking(){this.tickingState=!0}stopTicking(){this.tickingState=!1}get isRunning(){return this._isRunning}set isRunning(t){this._isRunning!==t&&(this._isRunning=t,1===this.tickingMode&&t!=this.tickingState&&(t?this.startTicking():this.stopTicking()))}start(){return this.isPaused=!1,this.isRunning=!0,this}pause(){return this.isRunning&&(this.isPaused=!0,this.isRunning=!1),this}resume(){return this.isPaused&&(this.isPaused=!1,this.isRunning=!0),this}stop(){return this.isPaused=!1,this.isRunning=!1,this}complete(){this.isPaused=!1,this.isRunning=!1,this.emit("complete",this.parent,this)}}const et={no:0,lazy:1,always:2},st=Phaser.Utils.Objects.GetValue;class ht extends it{constructor(t,i){super(t,i);var e=this.scene?"update":"step";this.tickEventName=st(i,"tickEventName",e),this.isSceneTicker=!rt(this.tickEventName)}startTicking(){super.startTicking(),this.isSceneTicker?this.scene.sys.events.on(this.tickEventName,this.update,this):this.game.events.on(this.tickEventName,this.update,this)}stopTicking(){super.stopTicking(),this.isSceneTicker&&this.scene?this.scene.sys.events.off(this.tickEventName,this.update,this):this.game&&this.game.events.off(this.tickEventName,this.update,this)}}var rt=function(t){return"step"===t||"poststep"===t};const at=Phaser.Utils.Objects.GetValue,nt=Phaser.Math.Clamp;class ot{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){this.state=at(t,"state",lt),this.timeScale=at(t,"timeScale",1),this.delay=at(t,"delay",0),this.repeat=at(t,"repeat",0),this.repeatCounter=at(t,"repeatCounter",0),this.repeatDelay=at(t,"repeatDelay",0),this.duration=at(t,"duration",0),this.nowTime=at(t,"nowTime",0),this.justRestart=at(t,"justRestart",!1)}toJSON(){return{state:this.state,timeScale:this.timeScale,delay:this.delay,repeat:this.repeat,repeatCounter:this.repeatCounter,repeatDelay:this.repeatDelay,duration:this.duration,nowTime:this.nowTime,justRestart:this.justRestart}}destroy(){}setTimeScale(t){return this.timeScale=t,this}setDelay(t){return void 0===t&&(t=0),this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatInfinity(){return this.repeat=-1,this}setRepeatDelay(t){return this.repeatDelay=t,this}start(){return this.nowTime=this.delay>0?-this.delay:0,this.state=this.nowTime>=0?dt:ut,this.repeatCounter=0,this}stop(){return this.state=lt,this}update(t,i){this.state!==lt&&this.state!==pt&&0!==i&&0!==this.timeScale&&(this.nowTime+=i*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=ct)):(this.nowTime=this.duration,this.state=pt):this.nowTime>=0&&(this.state=dt))}get t(){var t;switch(this.state){case lt:case ut:case ct:t=0;break;case dt:t=this.nowTime/this.duration;break;case pt:t=1}return nt(t,0,1)}set t(t){(t=nt(t,-1,1))<0?(this.state=ut,this.nowTime=-this.delay*t):(this.state=dt,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===lt}get isDelay(){return this.state===ut}get isCountDown(){return this.state===dt}get isRunning(){return this.state===ut||this.state===dt}get isDone(){return this.state===pt}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const lt=0,ut=1,dt=2,ct=3,pt=-1;class gt extends ht{constructor(t,i){super(t,i),this.timer=new ot}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const vt=Phaser.Utils.Objects.GetValue,mt=Phaser.Utils.Objects.GetAdvancedValue,yt=Phaser.Tweens.Builders.GetEaseFunction;class ft extends gt{resetFromJSON(t){return this.timer.resetFromJSON(vt(t,"timer")),this.setEnable(vt(t,"enable",!0)),this.setTarget(vt(t,"target",this.parent)),this.setDelay(mt(t,"delay",0)),this.setDuration(mt(t,"duration",1e3)),this.setEase(vt(t,"ease","Linear")),this.setRepeat(vt(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=yt(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,i){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var e=this.target,s=this.timer;return s.update(t,i),s.isDelay||this.updateTarget(e,s),this.emit("update",e,this),s.isDone&&this.complete(),this}updateTarget(t,i){}}const Pt=Phaser.Utils.Objects.GetValue,bt=Phaser.Math.Linear;class Dt extends ft{constructor(t,i){super(t,i),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var i=this.target;this.propertyKey=Pt(t,"key","value");var e=i[this.propertyKey];return this.fromValue=Pt(t,"from",e),this.toValue=Pt(t,"to",e),this.setEase(Pt(t,"ease",this.ease)),this.setDuration(Pt(t,"duration",this.duration)),this.setRepeat(Pt(t,"repeat",0)),this.setDelay(Pt(t,"delay",0)),this.setRepeatDelay(Pt(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),i[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,i){var e=i.t;e=this.easeFn(e),t[this.propertyKey]=bt(this.fromValue,this.toValue,e)}}var Tt={setToggleAnimationDuration(t){return void 0===t&&(t=0),this.toggleAnimDuration=t,this},playToggleAnimation(){return void 0===this.toggleAnimProgressTask&&(this.toggleAnimProgressTask=new Dt(this,{eventEmitter:null})),this.toggleAnimProgressTask.restart({key:"toggleAnimProgress",from:0,to:1,duration:this.toggleAnimDuration}),this},stopToggleAnimation(){return void 0===this.toggleAnimProgressTask||this.toggleAnimProgressTask.stop(),this}},kt={};Object.assign(kt,n,o,l,U,Tt);const _t=Phaser.Utils.Objects.GetValue,St=Phaser.Utils.Objects.IsPlainObject,Rt=23730;class wt extends a{constructor(t,i,e,s,h,r,a){St(i)?(i=_t(a=i,"x",0),e=_t(a,"y",0),s=_t(a,"width",2),h=_t(a,"height",2),r=_t(a,"color",Rt)):St(r)&&(r=_t(a=r,"color",Rt)),super(t,i,e,s,h),this.type="rexToggleSwitch",void 0===r&&(r=Rt),this.setTrackFillStyle(r,_t(a,"trackFillAlpha",1)),this.setFalseValueTrackFillStyle(_t(a,"falseValueTrackColor",function(t){var i=.3*W(t)+.59*Y(t)+.11*I(t);return(255&i)<<16|(255&i)<<8|255&i}(r)),_t(a,"falseValueTrackFillAlpha",1)),this.setThumbStyle(_t(a,"thumbColor",16777215),_t(a,"thumbAlpha",1)),this.setTrackSize(_t(a,"trackWidth",.9),_t(a,"trackHeight",.5)),this.setTrackRadius(_t(a,"trackRadius",.5*this.trackHeight));var n=_t(a,"thumbHeight",void 0),o=_t(a,"thumbWidth",n);void 0===o&&(o=.9*this.trackHeight),this.setThumbSize(o,n),this.setThumbRadius(_t(a,"thumbRadius",.5*this.thumbHeight)),this.setThumbPosition(_t(a,"thumbLeft",.3),_t(a,"thumbRight",void 0)),this.setRTL(_t(a,"rtl",!1)),this.setToggleAnimationDuration(_t(a,"animationDuration",150)),this.buildShapes(),this.setValue(_t(a,"value",!1),0)}get value(){return this._value}set value(t){t=!!t,this._value!==t&&(this.dirty=!0,this._value=t,this.playToggleAnimation(),this.emit("valuechange",t))}setValue(t,i){void 0===i&&(i=this.toggleAnimDuration);var e=this.toggleAnimDuration;return this.toggleAnimDuration=i,this.value=t,this.toggleAnimDuration=e,this}toggleValue(t){return this.setValue(!this.value,t),this}get toggleAnimProgress(){return this._toggleAnimProgress}set toggleAnimProgress(t){this._toggleAnimProgress!==t&&(this._toggleAnimProgress=t,this.dirty=!0)}}Object.assign(wt.prototype,kt);const At=Phaser.Utils.Objects.GetValue;class Et extends ${constructor(t,i){super(t,i),this._enable=void 0,t.setInteractive(At(i,"inputConfig",void 0)),this.resetFromJSON(i),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.isDown=!1,this.isOver=!1,this.setEnable(At(t,"enable",!0)),this.setMode(At(t,"mode",1)),this.setClickInterval(At(t,"clickInterval",100)),this.setDragThreshold(At(t,"threshold",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPress,this),t.on("pointerup",this.onRelease,this),t.on("pointerout",this.onPointOut,this),t.on("pointermove",this.onMove,this),t.on("pointerover",this.onOver,this),t.on("pointerout",this.onOut,this)}shutdown(t){this.isShutdown||(this.pointer=null,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var i=t?"enable":"disable";this.emit(i,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Ct[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}onPress(t,i,e,s){void 0===this.pointer&&(this.pointer=t,this.isDown=!0,this.emit("down",this,this.parent,t,s),0===this.mode&&this.click(t.downTime,t,s))}onRelease(t,i,e,s){this.pointer===t&&(this.isDown=!1,this.emit("up",this,this.parent,t,s),1===this.mode&&this.click(t.upTime,t,s),this.pointer=void 0)}onPointOut(t,i){this.pointer===t&&this.cancel()}onMove(t,i,e,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&t.getDistance()>=this.dragThreshold&&this.cancel()}onOver(t,i,e,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,i){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,i),this):this}click(t,i,e){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,i,e),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,i,e)),this}cancel(){return this.pointer=void 0,this}}const Ct={press:0,pointerdown:0,release:1,pointerup:1},Lt=Phaser.Utils.Objects.GetValue;class Ot extends wt{constructor(t,i,e,s,h,r,a){super(t,i,e,s,h,r,a),this._click=new Et(this,Lt(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(Lt(a,"readOnly",!1))}get readOnly(){return!this._click.enable}set readOnly(t){this._click.enable=!t}setReadOnly(t){return void 0===t&&(t=!0),this.readOnly=t,this}}function xt(t,i,e,s,h,r){var a=new Ot(this.scene,t,i,e,s,h,r);return this.scene.add.existing(a),a}const jt=Phaser.Utils.Objects.GetAdvancedValue,Ft=Phaser.GameObjects.BuildGameObject;function Bt(t,i){void 0===t&&(t={}),void 0!==i&&(t.add=i);var e=jt(t,"width",void 0),s=jt(t,"height",e),h=jt(t,"color",23730),r=new Ot(this.scene,0,0,e,s,h,t);return Ft(this.scene,r,t),r}function Vt(t,i,e,s,h,r){var a=new wt(this.scene,t,i,e,s,h,r);return this.scene.add.existing(a),a}const Gt=Phaser.Utils.Objects.GetAdvancedValue,Mt=Phaser.GameObjects.BuildGameObject;function zt(t,i){void 0===t&&(t={}),void 0!==i&&(t.add=i);var e=Gt(t,"width",void 0),s=Gt(t,"height",e),h=Gt(t,"color",23730),r=new wt(this.scene,0,0,e,s,h,t);return Mt(this.scene,r,t),r}var Xt=function(t){return null==t||""===t||0===t.length},Wt=function(t,i,e,s){if(void 0===s&&(s="."),"object"==typeof t){if(Xt(i)){if(null==e)return;"object"==typeof e&&(t=e)}else{"string"==typeof i&&(i=i.split(s));var h=i.pop(),r=function(t,i,e){var s=t;if(Xt(i));else{var h;"string"==typeof i&&(i=i.split("."));for(var r=0,a=i.length;r>16&255},I=function(t){return t>>8&255},N=function(t){return 255&t};const U=Phaser.Math.Linear;var H={buildShapes(){this.addShape((new z).setName("track")).addShape((new z).setName("thumb"))},updateShapes(){var t=this.width,i=this.height,e=this.value?this.toggleAnimProgress:1-this.toggleAnimProgress,s=this.getShape("track");if(this.isSizeChanged){var h=t*this.trackWidth,r=i*this.trackHeight,a=(t-h)/2,n=(i-r)/2,o=i*this.trackRadius;s.setTopLeftPosition(a,n).setSize(h,r).setRadius(o)}var l,u,d,c=(l=this.falseValueTrackColor,u=this.trackFillColor,d=e,(255&W(Y(l),Y(u),d))<<16|(255&W(I(l),I(u),d))<<8|255&W(N(l),N(u),d)),p=U(this.falseValueTrackFillAlpha,this.trackFillAlpha,e);s.fillStyle(c,p);var g=this.getShape("thumb");if(this.isSizeChanged){var v=t*this.thumbWidth,m=i*this.thumbHeight,y=i*this.thumbRadius;g.setSize(v,m).setRadius(y)}var f=U(this.thumbLeftX,this.thumbRightX,e)*t;this.rtl&&(f=t-f);var P=i/2;g.setCenterPosition(f,P),g.fillStyle(this.thumbColor,this.thumbAlpha)}},J={setEventEmitter(t,i){return void 0===i&&(i=Phaser.Events.EventEmitter),this._privateEE=!0===t||void 0===t,this._eventEmitter=this._privateEE?new i:t,this},destroyEventEmitter(){return this._eventEmitter&&this._privateEE&&this._eventEmitter.shutdown(),this},getEventEmitter(){return this._eventEmitter},on(){return this._eventEmitter&&this._eventEmitter.on.apply(this._eventEmitter,arguments),this},once(){return this._eventEmitter&&this._eventEmitter.once.apply(this._eventEmitter,arguments),this},off(){return this._eventEmitter&&this._eventEmitter.off.apply(this._eventEmitter,arguments),this},emit(t){return this._eventEmitter&&t&&this._eventEmitter.emit.apply(this._eventEmitter,arguments),this},addListener(){return this._eventEmitter&&this._eventEmitter.addListener.apply(this._eventEmitter,arguments),this},removeListener(){return this._eventEmitter&&this._eventEmitter.removeListener.apply(this._eventEmitter,arguments),this},removeAllListeners(){return this._eventEmitter&&this._eventEmitter.removeAllListeners.apply(this._eventEmitter,arguments),this},listenerCount(){return this._eventEmitter?this._eventEmitter.listenerCount.apply(this._eventEmitter,arguments):0},listeners(){return this._eventEmitter?this._eventEmitter.listeners.apply(this._eventEmitter,arguments):[]},eventNames(){return this._eventEmitter?this._eventEmitter.eventNames.apply(this._eventEmitter,arguments):[]}};const K=Phaser.Scene;var q=function(t){return t instanceof K};const Q=Phaser.Game;var Z=function(t){return t instanceof Q};const $=Phaser.Utils.Objects.GetValue;class tt{constructor(t,i){this.setParent(t),this.isShutdown=!1,this.setEventEmitter($(i,"eventEmitter",!0)),this.parent&&(this.parent===this.scene?this.scene.sys.events.once("shutdown",this.onEnvDestroy,this):this.parent===this.game?this.game.events.once("shutdown",this.onEnvDestroy,this):this.parent.once&&this.parent.once("destroy",this.onParentDestroy,this))}shutdown(t){this.isShutdown||(this.parent&&(this.parent===this.scene?this.scene.sys.events.off("shutdown",this.onEnvDestroy,this):this.parent===this.game?this.game.events.off("shutdown",this.onEnvDestroy,this):this.parent.once&&this.parent.off("destroy",this.onParentDestroy,this)),this.destroyEventEmitter(),this.parent=void 0,this.scene=void 0,this.game=void 0,this.isShutdown=!0)}destroy(t){this.shutdown(t)}onEnvDestroy(){this.destroy(!0)}onParentDestroy(t,i){this.destroy(i)}setParent(t){var i;return this.parent=t,this.scene=null==(i=t)||"object"!=typeof i?null:q(i)?i:i.scene&&q(i.scene)?i.scene:i.parent&&i.parent.scene&&q(i.parent.scene)?i.parent.scene:null,this.game=function(t){return null==t||"object"!=typeof t?null:Z(t)?t:Z(t.game)?t.game:q(t)?t.sys.game:q(t.scene)?t.scene.sys.game:void 0}(t),this}}Object.assign(tt.prototype,J);const it=Phaser.Utils.Objects.GetValue;class et extends tt{constructor(t,i){super(t,i),this._isRunning=!1,this.isPaused=!1,this.tickingState=!1,this.setTickingMode(it(i,"tickingMode",1))}boot(){2!==this.tickingMode||this.tickingState||this.startTicking()}shutdown(t){this.isShutdown||(this.stop(),this.tickingState&&this.stopTicking(),super.shutdown(t))}setTickingMode(t){"string"==typeof t&&(t=st[t]),this.tickingMode=t}startTicking(){this.tickingState=!0}stopTicking(){this.tickingState=!1}get isRunning(){return this._isRunning}set isRunning(t){this._isRunning!==t&&(this._isRunning=t,1===this.tickingMode&&t!=this.tickingState&&(t?this.startTicking():this.stopTicking()))}start(){return this.isPaused=!1,this.isRunning=!0,this}pause(){return this.isRunning&&(this.isPaused=!0,this.isRunning=!1),this}resume(){return this.isPaused&&(this.isPaused=!1,this.isRunning=!0),this}stop(){return this.isPaused=!1,this.isRunning=!1,this}complete(){this.isPaused=!1,this.isRunning=!1,this.emit("complete",this.parent,this)}}const st={no:0,lazy:1,always:2},ht=Phaser.Utils.Objects.GetValue;class rt extends et{constructor(t,i){super(t,i);var e=this.scene?"update":"step";this.tickEventName=ht(i,"tickEventName",e),this.isSceneTicker=!at(this.tickEventName)}startTicking(){super.startTicking(),this.isSceneTicker?this.scene.sys.events.on(this.tickEventName,this.update,this):this.game.events.on(this.tickEventName,this.update,this)}stopTicking(){super.stopTicking(),this.isSceneTicker&&this.scene?this.scene.sys.events.off(this.tickEventName,this.update,this):this.game&&this.game.events.off(this.tickEventName,this.update,this)}}var at=function(t){return"step"===t||"poststep"===t};const nt=Phaser.Utils.Objects.GetValue,ot=Phaser.Math.Clamp;class lt{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){this.state=nt(t,"state",ut),this.timeScale=nt(t,"timeScale",1),this.delay=nt(t,"delay",0),this.repeat=nt(t,"repeat",0),this.repeatCounter=nt(t,"repeatCounter",0),this.repeatDelay=nt(t,"repeatDelay",0),this.duration=nt(t,"duration",0),this.nowTime=nt(t,"nowTime",0),this.justRestart=nt(t,"justRestart",!1)}toJSON(){return{state:this.state,timeScale:this.timeScale,delay:this.delay,repeat:this.repeat,repeatCounter:this.repeatCounter,repeatDelay:this.repeatDelay,duration:this.duration,nowTime:this.nowTime,justRestart:this.justRestart}}destroy(){}setTimeScale(t){return this.timeScale=t,this}setDelay(t){return void 0===t&&(t=0),this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatInfinity(){return this.repeat=-1,this}setRepeatDelay(t){return this.repeatDelay=t,this}start(){return this.nowTime=this.delay>0?-this.delay:0,this.state=this.nowTime>=0?ct:dt,this.repeatCounter=0,this}stop(){return this.state=ut,this}update(t,i){this.state!==ut&&this.state!==gt&&0!==i&&0!==this.timeScale&&(this.nowTime+=i*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=pt)):(this.nowTime=this.duration,this.state=gt):this.nowTime>=0&&(this.state=ct))}get t(){var t;switch(this.state){case ut:case dt:case pt:t=0;break;case ct:t=this.nowTime/this.duration;break;case gt:t=1}return ot(t,0,1)}set t(t){(t=ot(t,-1,1))<0?(this.state=dt,this.nowTime=-this.delay*t):(this.state=ct,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===ut}get isDelay(){return this.state===dt}get isCountDown(){return this.state===ct}get isRunning(){return this.state===dt||this.state===ct}get isDone(){return this.state===gt}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const ut=0,dt=1,ct=2,pt=3,gt=-1;class vt extends rt{constructor(t,i){super(t,i),this.timer=new lt}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const mt=Phaser.Utils.Objects.GetValue,yt=Phaser.Utils.Objects.GetAdvancedValue,ft=Phaser.Tweens.Builders.GetEaseFunction;class Pt extends vt{resetFromJSON(t){return this.timer.resetFromJSON(mt(t,"timer")),this.setEnable(mt(t,"enable",!0)),this.setTarget(mt(t,"target",this.parent)),this.setDelay(yt(t,"delay",0)),this.setDuration(yt(t,"duration",1e3)),this.setEase(mt(t,"ease","Linear")),this.setRepeat(mt(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=ft(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,i){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var e=this.target,s=this.timer;return s.update(t,i),s.isDelay||this.updateTarget(e,s),this.emit("update",e,this),s.isDone&&this.complete(),this}updateTarget(t,i){}}const Dt=Phaser.Utils.Objects.GetValue,bt=Phaser.Math.Linear;class Tt extends Pt{constructor(t,i){super(t,i),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var i=this.target;this.propertyKey=Dt(t,"key","value");var e=i[this.propertyKey];return this.fromValue=Dt(t,"from",e),this.toValue=Dt(t,"to",e),this.setEase(Dt(t,"ease",this.ease)),this.setDuration(Dt(t,"duration",this.duration)),this.setRepeat(Dt(t,"repeat",0)),this.setDelay(Dt(t,"delay",0)),this.setRepeatDelay(Dt(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),i[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,i){var e=i.t;e=this.easeFn(e),t[this.propertyKey]=bt(this.fromValue,this.toValue,e)}}var kt={setToggleAnimationDuration(t){return void 0===t&&(t=0),this.toggleAnimDuration=t,this},playToggleAnimation(){return void 0===this.toggleAnimProgressTask&&(this.toggleAnimProgressTask=new Tt(this,{eventEmitter:null})),this.toggleAnimProgressTask.restart({key:"toggleAnimProgress",from:0,to:1,duration:this.toggleAnimDuration}),this},stopToggleAnimation(){return void 0===this.toggleAnimProgressTask||this.toggleAnimProgressTask.stop(),this}},_t={};Object.assign(_t,n,o,l,H,kt);const St=Phaser.Utils.Objects.GetValue,Rt=Phaser.Utils.Objects.IsPlainObject,wt=23730;class At extends a{constructor(t,i,e,s,h,r,a){Rt(i)?(i=St(a=i,"x",0),e=St(a,"y",0),s=St(a,"width",2),h=St(a,"height",2),r=St(a,"color",wt)):Rt(r)&&(r=St(a=r,"color",wt)),super(t,i,e,s,h),this.type="rexToggleSwitch",void 0===r&&(r=wt),this.setTrackFillStyle(r,St(a,"trackFillAlpha",1)),this.setFalseValueTrackFillStyle(St(a,"falseValueTrackColor",function(t){var i=.3*Y(t)+.59*I(t)+.11*N(t);return(255&i)<<16|(255&i)<<8|255&i}(r)),St(a,"falseValueTrackFillAlpha",1)),this.setThumbStyle(St(a,"thumbColor",16777215),St(a,"thumbAlpha",1)),this.setTrackSize(St(a,"trackWidth",.9),St(a,"trackHeight",.5)),this.setTrackRadius(St(a,"trackRadius",.5*this.trackHeight));var n=St(a,"thumbHeight",void 0),o=St(a,"thumbWidth",n);void 0===o&&(o=.9*this.trackHeight),this.setThumbSize(o,n),this.setThumbRadius(St(a,"thumbRadius",.5*this.thumbHeight)),this.setThumbPosition(St(a,"thumbLeft",.3),St(a,"thumbRight",void 0)),this.setRTL(St(a,"rtl",!1)),this.setToggleAnimationDuration(St(a,"animationDuration",150)),this.buildShapes(),this.setValue(St(a,"value",!1),0)}get value(){return this._value}set value(t){t=!!t,this._value!==t&&(this.dirty=!0,this._value=t,this.playToggleAnimation(),this.emit("valuechange",t))}setValue(t,i){void 0===i&&(i=this.toggleAnimDuration);var e=this.toggleAnimDuration;return this.toggleAnimDuration=i,this.value=t,this.toggleAnimDuration=e,this}toggleValue(t){return this.setValue(!this.value,t),this}get toggleAnimProgress(){return this._toggleAnimProgress}set toggleAnimProgress(t){this._toggleAnimProgress!==t&&(this._toggleAnimProgress=t,this.dirty=!0)}}Object.assign(At.prototype,_t);const Et=Phaser.Utils.Objects.GetValue;class Ct extends tt{constructor(t,i){super(t,i),this._enable=void 0,t.setInteractive(Et(i,"inputConfig",void 0)),this.resetFromJSON(i),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.isDown=!1,this.isOver=!1,this.setEnable(Et(t,"enable",!0)),this.setMode(Et(t,"mode",1)),this.setClickInterval(Et(t,"clickInterval",100)),this.setDragThreshold(Et(t,"threshold",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPress,this),t.on("pointerup",this.onRelease,this),t.on("pointerout",this.onPointOut,this),t.on("pointermove",this.onMove,this),t.on("pointerover",this.onOver,this),t.on("pointerout",this.onOut,this)}shutdown(t){this.isShutdown||(this.pointer=null,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var i=t?"enable":"disable";this.emit(i,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Lt[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}onPress(t,i,e,s){void 0===this.pointer&&(this.pointer=t,this.isDown=!0,this.emit("down",this,this.parent,t,s),0===this.mode&&this.click(t.downTime,t,s))}onRelease(t,i,e,s){this.pointer===t&&(this.isDown=!1,this.emit("up",this,this.parent,t,s),1===this.mode&&this.click(t.upTime,t,s),this.pointer=void 0)}onPointOut(t,i){this.pointer===t&&this.cancel()}onMove(t,i,e,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&t.getDistance()>=this.dragThreshold&&this.cancel()}onOver(t,i,e,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,i){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,i),this):this}click(t,i,e){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,i,e),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,i,e)),this}cancel(){return this.pointer=void 0,this}}const Lt={press:0,pointerdown:0,release:1,pointerup:1},Ot=Phaser.Utils.Objects.GetValue;class xt extends At{constructor(t,i,e,s,h,r,a){super(t,i,e,s,h,r,a),this._click=new Ct(this,Ot(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(Ot(a,"readOnly",!1))}get readOnly(){return!this._click.enable}set readOnly(t){this._click.enable=!t}setReadOnly(t){return void 0===t&&(t=!0),this.readOnly=t,this}}function jt(t,i,e,s,h,r){var a=new xt(this.scene,t,i,e,s,h,r);return this.scene.add.existing(a),a}const Ft=Phaser.Utils.Objects.GetAdvancedValue,Bt=Phaser.GameObjects.BuildGameObject;function Vt(t,i){void 0===t&&(t={}),void 0!==i&&(t.add=i);var e=Ft(t,"width",void 0),s=Ft(t,"height",e),h=Ft(t,"color",23730),r=new xt(this.scene,0,0,e,s,h,t);return Bt(this.scene,r,t),r}function Gt(t,i,e,s,h,r){var a=new At(this.scene,t,i,e,s,h,r);return this.scene.add.existing(a),a}const Mt=Phaser.Utils.Objects.GetAdvancedValue,Xt=Phaser.GameObjects.BuildGameObject;function zt(t,i){void 0===t&&(t={}),void 0!==i&&(t.add=i);var e=Mt(t,"width",void 0),s=Mt(t,"height",e),h=Mt(t,"color",23730),r=new At(this.scene,0,0,e,s,h,t);return Xt(this.scene,r,t),r}var Wt=function(t){return null==t||""===t||0===t.length},Yt=function(t,i,e,s){if(void 0===s&&(s="."),"object"==typeof t){if(Wt(i)){if(null==e)return;"object"==typeof e&&(t=e)}else{"string"==typeof i&&(i=i.split(s));var h=i.pop(),r=function(t,i,e){var s=t;if(Wt(i));else{var h;"string"==typeof i&&(i=i.split("."));for(var r=0,a=i.length;r=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const L=Phaser.Math.DegToRad;var _={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=L(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},M={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=S(t.scaleX,i.scaleX),e.scaleY=S(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},w={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},D={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=S(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},E={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},R={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},A={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},O={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(t){void 0===t&&(t=!1);var e=this;return this._mask=null,this.setChildMaskVisible(this),this.children.forEach((function(t){t.clearMask&&t.clearMask(!1),t.hasOwnProperty("isRexContainerLite")||e.setChildMaskVisible(t)})),t&&this.mask&&this.mask.destroy(),this}},F=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var a=e[r];s!==a&&(a!==this&&s.displayList!==a.displayList||(s.displayList.moveBelow(a,s),s=a))}return this}},j=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const Y=Phaser.Utils.Array;var G={getChildren(t){if(t)for(var e=0,i=this.children.length;e0?-this.delay:0,this.state=this.nowTime>=0?Zt:Jt,this.repeatCounter=0,this}stop(){return this.state=Ht,this}update(t,e){this.state!==Ht&&this.state!==qt&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=$t)):(this.nowTime=this.duration,this.state=qt):this.nowTime>=0&&(this.state=Zt))}get t(){var t;switch(this.state){case Ht:case Jt:case $t:t=0;break;case Zt:t=this.nowTime/this.duration;break;case qt:t=1}return Wt(t,0,1)}set t(t){(t=Wt(t,-1,1))<0?(this.state=Jt,this.nowTime=-this.delay*t):(this.state=Zt,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===Ht}get isDelay(){return this.state===Jt}get isCountDown(){return this.state===Zt}get isRunning(){return this.state===Jt||this.state===Zt}get isDone(){return this.state===qt}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const Ht=0,Jt=1,Zt=2,$t=3,qt=-1;class Kt extends zt{constructor(t,e){super(t,e),this.timer=new Nt}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const Qt=Phaser.Utils.Objects.GetValue,te=Phaser.Utils.Objects.GetAdvancedValue,ee=Phaser.Tweens.Builders.GetEaseFunction;class ie extends Kt{resetFromJSON(t){return this.timer.resetFromJSON(Qt(t,"timer")),this.setEnable(Qt(t,"enable",!0)),this.setTarget(Qt(t,"target",this.parent)),this.setDelay(te(t,"delay",0)),this.setDuration(te(t,"duration",1e3)),this.setEase(Qt(t,"ease","Linear")),this.setRepeat(Qt(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=ee(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const se=Phaser.Utils.Objects.GetValue,re=Phaser.Math.Linear;class ae extends ie{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=se(t,"key","value");var i=e[this.propertyKey];return this.fromValue=se(t,"from",i),this.toValue=se(t,"to",i),this.setEase(se(t,"ease",this.ease)),this.setDuration(se(t,"duration",this.duration)),this.setRepeat(se(t,"repeat",0)),this.setDelay(se(t,"delay",0)),this.setRepeatDelay(se(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=re(this.fromValue,this.toValue,i)}}var ne=function(t,e,i,s){if(void 0===i)i=0;else{var r=typeof i;"boolean"===r?(s=i,i=0):"string"===r&&(i=he[i])}void 0===s?s={}:!0===s&&(s=oe);var a=e.width/t.width,n=e.height/t.height,h=i?Math.max(a,n):Math.min(a,n);return s.width=t.width*h,s.height=t.height*h,s};const he={fit:0,FIT:0,envelop:1,ENVELOP:1};var oe={},le=function(){for(var t=this.scaleMode-1,e=0,i=this.images.length;e0?d.pop().setTexture(u,_):r(c,u,_),o&&c.add.existing(L),l){var M=C+x*T+n*x,w=b+k*S+h*k;L.setOrigin(n,h).setPosition(M,w).setScale(v,f).setRotation(m),De(L,C,b,m)}P.push(L)}return P}(t,e,i,s),n=0,h=a.length;n0&&(n=this.getChildLocalScaleX(s),n/=s.biasScale,this.setChildLocalScale(s,n)),r.biasScale&&(n=this.getChildLocalScaleX(r),n/=r.biasScale,this.setChildLocalScale(r,n))),e?t.call(e,i,s,r,a):t(i,s,r,a),this.scaleMode&&(s.biasScale>0&&(n=this.getChildLocalScaleX(s),n*=s.biasScale,this.setChildLocalScale(s,n)),r.biasScale&&(n=this.getChildLocalScaleX(r),n*=r.biasScale,this.setChildLocalScale(r,n))))};Object.assign(Ye.prototype,Ae);const ze={fit:1,FIT:1,envelop:2,ENVELOP:2};var Be=function(t,e){return void 0===e&&(e=.5),t<=e?t/=e:t=1-(t-e)/(1-e),t};const Ue=Phaser.GameObjects.GetCalcMatrix,We=Phaser.Renderer.Canvas.SetTransform;var Ne={renderWebGL:function(t,e,i,s){e.updateData(),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),a=Ue(e,i,s),n=r.calcMatrix.copyFrom(a.calc),h=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e);for(var d,c=e.geom,u=0,p=c.length;u>>16,h=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+n+","+h+","+o+","+a+")"},si=function(t,e,i,s){var r=i||e.strokeColor,a=s||e.strokeAlpha,n=(16711680&r)>>>16,h=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+n+","+h+","+o+","+a+")",t.lineWidth=e.lineWidth};const ri=Phaser.Geom.Polygon.Earcut;class ai extends Ke{constructor(){super(),this.pathData=[],this.pathIndexes=[],this.closePath=!1}updateData(){return this.pathIndexes=ri(this.pathData),super.updateData(),this}webglRender(t,e,i,s,r){this.isFilled&&function(t,e,i,s,r,a){for(var n=Qe.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),h=i.pathData,o=i.pathIndexes,l=0;l=2){var r=i[s-2],a=i[s-1];if(t===r&&e===a)return i}return i.push(t,e),i};const hi=Phaser.Math.DegToRad;var oi=function(t,e,i,s,r,a,n,h,o){n&&a>r?a-=360:!n&&a0,n=0,h=e.length;n0;this.dirty=this.dirty||this._radiusTL!==t||this._convexTL!==e,this._convexTL=e,this._radiusTL=Math.abs(t)}get radiusTR(){return this._radiusTR}set radiusTR(t){var e=t>0;this.dirty=this.dirty||this._radiusTR!==t||this._convexTR!==e,this._convexTR=e,this._radiusTR=Math.abs(t)}get radiusBL(){return this._radiusBL}set radiusBL(t){var e=t>0;this.dirty=this.dirty||this._radiusBL!==t||this._convexBL!==e,this._convexBL=e,this._radiusBL=Math.abs(t)}get radiusBR(){return this._radiusBR}set radiusBR(t){var e=t>0;this.dirty=this.dirty||this._radiusBR!==t||this._convexBR!==e,this._convexBR=e,this._radiusBR=Math.abs(t)}get radius(){return Math.max(this.radiusTL,this.radiusTR,this.radiusBL,this.radiusBR)}set radius(t){"number"==typeof t?(this.radiusTL=t,this.radiusTR=t,this.radiusBL=t,this.radiusBR=t):(this.radiusTL=Ri(t,"tl",0),this.radiusTR=Ri(t,"tr",0),this.radiusBL=Ri(t,"bl",0),this.radiusBR=Ri(t,"br",0))}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}get iterations(){return this._iterations}set iterations(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t}setIterations(t){return this.iterations=t,this}updateData(){var t=this.pathData;t.length=0;var e,i=this.width,s=this.height,r=this.iterations+1;return(e=this.radiusTL)>0?this._convexTL?oi(e,e,e,e,180,270,!1,r,t):oi(0,0,e,e,90,0,!0,r,t):ni(0,0,t),(e=this.radiusTR)>0?this._convexTR?oi(i-e,e,e,e,270,360,!1,r,t):oi(i,0,e,e,180,90,!0,r,t):ni(i,0,t),(e=this.radiusBR)>0?this._convexBR?oi(i-e,s-e,e,e,0,90,!1,r,t):oi(i,s,e,e,270,180,!0,r,t):ni(i,s,t),(e=this.radiusBL)>0?this._convexBL?oi(e,s-e,e,e,90,180,!1,r,t):oi(0,s,e,e,360,270,!0,r,t):ni(0,s,t),t.push(t[0],t[1]),fi(this.x,this.y,t),super.updateData(),this}},triangle:class extends Ke{constructor(t,e,i,s,r,a){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),void 0===a&&(a=0),super(),this.pathData=[],this.closePath=!0,this.setP0(t,e),this.setP1(i,s),this.setP2(r,a)}get x0(){return this._x0}set x0(t){this.dirty=this.dirty||this._x0!==t,this._x0=t}get y0(){return this._y0}set y0(t){this.dirty=this.dirty||this._y0!==t,this._y0=t}setP0(t,e){return this.x0=t,this.y0=e,this}get x1(){return this._x1}set x1(t){this.dirty=this.dirty||this._x1!==t,this._x1=t}get y1(){return this._y1}set y1(t){this.dirty=this.dirty||this._y1!==t,this._y1=t}setP1(t,e){return this.x1=t,this.y1=e,this}get x2(){return this._x2}set x2(t){this.dirty=this.dirty||this._x2!==t,this._x2=t}get y2(){return this._y2}set y2(t){this.dirty=this.dirty||this._y2!==t,this._y2=t}setP2(t,e){return this.dirty=this.dirty||this.x2!==t||this.y2!==e,this.x2=t,this.y2=e,this}updateData(){return this.pathData.length=0,this.pathData.push(this.x0,this.y0),this.pathData.push(this.x1,this.y1),this.pathData.push(this.x2,this.y2),this.pathData.push(this.x0,this.y0),super.updateData(),this}webglRender(t,e,i,s,r){if(this.isFilled){var a=Ai(this.fillColor,this.fillAlpha*i),n=this.x0-s,h=this.y0-r,o=this.x1-s,l=this.y1-r,d=this.x2-s,c=this.y2-r,u=e.getX(n,h),p=e.getY(n,h),g=e.getX(o,l),v=e.getY(o,l),f=e.getX(d,c),m=e.getY(d,c);t.batchTri(u,p,g,v,f,m,a,a,a)}this.isStroked&&ei(t,this,i,s,r)}canvasRender(t,e,i){var s=this.x1-e,r=this.y1-i,a=this.x2-e,n=this.y2-i,h=this.x3-e,o=this.y3-i;t.beginPath(),t.moveTo(s,r),t.lineTo(a,n),t.lineTo(h,o),t.closePath(),this.isFilled&&(ii(t,this),t.fill()),this.isStroked&&(si(t,this),t.stroke())}}},Fi=Phaser.Utils.Objects.GetValue,Xi=Phaser.Utils.Objects.IsPlainObject,Vi=function(){for(var t=this.getShapes(),e=0,i=t.length;e=0;s--)(n=r[s])instanceof e&&(n.destroy(),os(r,s));else{s=0;for(var r,a=(r=t.postPipelines).length;s0}(e,ns),delete e.effect}})},function(t){t.addTransitionMode("revealRight",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(ls,0,0)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}}).addTransitionMode("revealLeft",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(ls,1,0)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}}).addTransitionMode("revealDown",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(ls,0,1)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}}).addTransitionMode("revealUp",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(ls,1,1)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}})}];class cs extends Ye{constructor(t,e,i,s,r,a){super(t,e,i,s,r,a);for(var n=0,h=ds.length;n=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const L=Phaser.Math.DegToRad;var _={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=L(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},M={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=S(t.scaleX,i.scaleX),e.scaleY=S(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},w={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},D={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=S(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},E={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},R={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},A={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},O={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(t){void 0===t&&(t=!1);var e=this;return this._mask=null,this.setChildMaskVisible(this),this.children.forEach((function(t){t.clearMask&&t.clearMask(!1),t.hasOwnProperty("isRexContainerLite")||e.setChildMaskVisible(t)})),t&&this.mask&&this.mask.destroy(),this}},F=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var a=e[r];s!==a&&(a!==this&&s.displayList!==a.displayList||(s.displayList.moveBelow(a,s),s=a))}return this}},j=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const Y=Phaser.Utils.Array;var G={getChildren(t){if(t)for(var e=0,i=this.children.length;e0?-this.delay:0,this.state=this.nowTime>=0?Zt:Jt,this.repeatCounter=0,this}stop(){return this.state=Ht,this}update(t,e){this.state!==Ht&&this.state!==qt&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=$t)):(this.nowTime=this.duration,this.state=qt):this.nowTime>=0&&(this.state=Zt))}get t(){var t;switch(this.state){case Ht:case Jt:case $t:t=0;break;case Zt:t=this.nowTime/this.duration;break;case qt:t=1}return Wt(t,0,1)}set t(t){(t=Wt(t,-1,1))<0?(this.state=Jt,this.nowTime=-this.delay*t):(this.state=Zt,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===Ht}get isDelay(){return this.state===Jt}get isCountDown(){return this.state===Zt}get isRunning(){return this.state===Jt||this.state===Zt}get isDone(){return this.state===qt}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const Ht=0,Jt=1,Zt=2,$t=3,qt=-1;class Kt extends zt{constructor(t,e){super(t,e),this.timer=new Nt}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const Qt=Phaser.Utils.Objects.GetValue,te=Phaser.Utils.Objects.GetAdvancedValue,ee=Phaser.Tweens.Builders.GetEaseFunction;class ie extends Kt{resetFromJSON(t){return this.timer.resetFromJSON(Qt(t,"timer")),this.setEnable(Qt(t,"enable",!0)),this.setTarget(Qt(t,"target",this.parent)),this.setDelay(te(t,"delay",0)),this.setDuration(te(t,"duration",1e3)),this.setEase(Qt(t,"ease","Linear")),this.setRepeat(Qt(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=ee(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const se=Phaser.Utils.Objects.GetValue,re=Phaser.Math.Linear;class ae extends ie{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=se(t,"key","value");var i=e[this.propertyKey];return this.fromValue=se(t,"from",i),this.toValue=se(t,"to",i),this.setEase(se(t,"ease",this.ease)),this.setDuration(se(t,"duration",this.duration)),this.setRepeat(se(t,"repeat",0)),this.setDelay(se(t,"delay",0)),this.setRepeatDelay(se(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=re(this.fromValue,this.toValue,i)}}var ne=function(t,e,i,s){if(void 0===i)i=0;else{var r=typeof i;"boolean"===r?(s=i,i=0):"string"===r&&(i=he[i])}void 0===s?s={}:!0===s&&(s=oe);var a=e.width/t.width,n=e.height/t.height,h=i?Math.max(a,n):Math.min(a,n);return s.width=t.width*h,s.height=t.height*h,s};const he={fit:0,FIT:0,envelop:1,ENVELOP:1};var oe={},le=function(){for(var t=this.scaleMode-1,e=0,i=this.images.length;e0?d.pop().setTexture(u,_):r(c,u,_),o&&c.add.existing(L),l){var M=C+x*T+n*x,w=b+k*S+h*k;L.setOrigin(n,h).setPosition(M,w).setScale(v,f).setRotation(m),De(L,C,b,m)}P.push(L)}return P}(t,e,i,s),n=0,h=a.length;n0&&(n=this.getChildLocalScaleX(s),n/=s.biasScale,this.setChildLocalScale(s,n)),r.biasScale&&(n=this.getChildLocalScaleX(r),n/=r.biasScale,this.setChildLocalScale(r,n))),e?t.call(e,i,s,r,a):t(i,s,r,a),this.scaleMode&&(s.biasScale>0&&(n=this.getChildLocalScaleX(s),n*=s.biasScale,this.setChildLocalScale(s,n)),r.biasScale&&(n=this.getChildLocalScaleX(r),n*=r.biasScale,this.setChildLocalScale(r,n))))};Object.assign(Ye.prototype,Ae);const ze={fit:1,FIT:1,envelop:2,ENVELOP:2};var Be=function(t,e){return void 0===e&&(e=.5),t<=e?t/=e:t=1-(t-e)/(1-e),t};const Ue=Phaser.GameObjects.GetCalcMatrix,We=Phaser.Renderer.Canvas.SetTransform;var Ne={renderWebGL:function(t,e,i,s){e.updateData(),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),a=Ue(e,i,s),n=r.calcMatrix.copyFrom(a.calc),h=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e);for(var d,c=e.geom,u=0,p=c.length;u>>16,h=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+n+","+h+","+o+","+a+")"},si=function(t,e,i,s){var r=i||e.strokeColor,a=s||e.strokeAlpha,n=(16711680&r)>>>16,h=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+n+","+h+","+o+","+a+")",t.lineWidth=e.lineWidth};const ri=Phaser.Geom.Polygon.Earcut;class ai extends Ke{constructor(){super(),this.pathData=[],this.pathIndexes=[],this.closePath=!1}updateData(){return this.pathIndexes=ri(this.pathData),super.updateData(),this}webglRender(t,e,i,s,r){this.isFilled&&function(t,e,i,s,r,a){for(var n=Qe.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),h=i.pathData,o=i.pathIndexes,l=0;l=2){var r=i[s-2],a=i[s-1];if(t===r&&e===a)return i}return i.push(t,e),i};const hi=Phaser.Math.DegToRad;var oi=function(t,e,i,s,r,a,n,h,o){n&&a>r?a-=360:!n&&a0,n=0,h=e.length;n0;this.dirty=this.dirty||this._radiusTL!==t||this._convexTL!==e,this._convexTL=e,this._radiusTL=Math.abs(t)}get radiusTR(){return this._radiusTR}set radiusTR(t){var e=t>0;this.dirty=this.dirty||this._radiusTR!==t||this._convexTR!==e,this._convexTR=e,this._radiusTR=Math.abs(t)}get radiusBL(){return this._radiusBL}set radiusBL(t){var e=t>0;this.dirty=this.dirty||this._radiusBL!==t||this._convexBL!==e,this._convexBL=e,this._radiusBL=Math.abs(t)}get radiusBR(){return this._radiusBR}set radiusBR(t){var e=t>0;this.dirty=this.dirty||this._radiusBR!==t||this._convexBR!==e,this._convexBR=e,this._radiusBR=Math.abs(t)}get radius(){return Math.max(this.radiusTL,this.radiusTR,this.radiusBL,this.radiusBR)}set radius(t){"number"==typeof t?(this.radiusTL=t,this.radiusTR=t,this.radiusBL=t,this.radiusBR=t):(this.radiusTL=Ai(t,"tl",0),this.radiusTR=Ai(t,"tr",0),this.radiusBL=Ai(t,"bl",0),this.radiusBR=Ai(t,"br",0))}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}get iterations(){return this._iterations}set iterations(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t}setIterations(t){return this.iterations=t,this}updateData(){var t=this.pathData;t.length=0;var e,i=this.width,s=this.height,r=this.iterations+1;return(e=this.radiusTL)>0?this._convexTL?oi(e,e,e,e,180,270,!1,r,t):oi(0,0,e,e,90,0,!0,r,t):ni(0,0,t),(e=this.radiusTR)>0?this._convexTR?oi(i-e,e,e,e,270,360,!1,r,t):oi(i,0,e,e,180,90,!0,r,t):ni(i,0,t),(e=this.radiusBR)>0?this._convexBR?oi(i-e,s-e,e,e,0,90,!1,r,t):oi(i,s,e,e,270,180,!0,r,t):ni(i,s,t),(e=this.radiusBL)>0?this._convexBL?oi(e,s-e,e,e,90,180,!1,r,t):oi(0,s,e,e,360,270,!0,r,t):ni(0,s,t),t.push(t[0],t[1]),mi(this.x,this.y,t),super.updateData(),this}},triangle:class extends Ke{constructor(t,e,i,s,r,a){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),void 0===a&&(a=0),super(),this.pathData=[],this.closePath=!0,this.setP0(t,e),this.setP1(i,s),this.setP2(r,a)}get x0(){return this._x0}set x0(t){this.dirty=this.dirty||this._x0!==t,this._x0=t}get y0(){return this._y0}set y0(t){this.dirty=this.dirty||this._y0!==t,this._y0=t}setP0(t,e){return this.x0=t,this.y0=e,this}get x1(){return this._x1}set x1(t){this.dirty=this.dirty||this._x1!==t,this._x1=t}get y1(){return this._y1}set y1(t){this.dirty=this.dirty||this._y1!==t,this._y1=t}setP1(t,e){return this.x1=t,this.y1=e,this}get x2(){return this._x2}set x2(t){this.dirty=this.dirty||this._x2!==t,this._x2=t}get y2(){return this._y2}set y2(t){this.dirty=this.dirty||this._y2!==t,this._y2=t}setP2(t,e){return this.dirty=this.dirty||this.x2!==t||this.y2!==e,this.x2=t,this.y2=e,this}updateData(){return this.pathData.length=0,this.pathData.push(this.x0,this.y0),this.pathData.push(this.x1,this.y1),this.pathData.push(this.x2,this.y2),this.pathData.push(this.x0,this.y0),super.updateData(),this}webglRender(t,e,i,s,r){if(this.isFilled){var a=Oi(this.fillColor,this.fillAlpha*i),n=this.x0-s,h=this.y0-r,o=this.x1-s,l=this.y1-r,d=this.x2-s,c=this.y2-r,u=e.getX(n,h),p=e.getY(n,h),g=e.getX(o,l),v=e.getY(o,l),f=e.getX(d,c),m=e.getY(d,c);t.batchTri(u,p,g,v,f,m,a,a,a)}this.isStroked&&ei(t,this,i,s,r)}canvasRender(t,e,i){var s=this.x1-e,r=this.y1-i,a=this.x2-e,n=this.y2-i,h=this.x3-e,o=this.y3-i;t.beginPath(),t.moveTo(s,r),t.lineTo(a,n),t.lineTo(h,o),t.closePath(),this.isFilled&&(ii(t,this),t.fill()),this.isStroked&&(si(t,this),t.stroke())}}},Xi=Phaser.Utils.Objects.GetValue,Vi=Phaser.Utils.Objects.IsPlainObject,ji=function(){for(var t=this.getShapes(),e=0,i=t.length;e=0;s--)(n=r[s])instanceof e&&(n.destroy(),ls(r,s));else{s=0;for(var r,a=(r=t.postPipelines).length;s0}(e,hs),delete e.effect}})},function(t){t.addTransitionMode("revealRight",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(ds,0,0)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}}).addTransitionMode("revealLeft",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(ds,1,0)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}}).addTransitionMode("revealDown",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(ds,0,1)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}}).addTransitionMode("revealUp",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(ds,1,1)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}})}];class us extends Ye{constructor(t,e,i,s,r,a){super(t,e,i,s,r,a);for(var n=0,h=cs.length;n=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const _=Phaser.Math.DegToRad;var T={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=_(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},k={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=O(t.scaleX,i.scaleX),e.scaleY=O(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},E={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=O(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},L={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},D={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},A={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(t){void 0===t&&(t=!1);var e=this;return this._mask=null,this.setChildMaskVisible(this),this.children.forEach((function(t){t.clearMask&&t.clearMask(!1),t.hasOwnProperty("isRexContainerLite")||e.setChildMaskVisible(t)})),t&&this.mask&&this.mask.destroy(),this}},Y=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},W=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const F=Phaser.Utils.Array;var I={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},ke=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const Ee=/(\S+)\[(\d+)\]/i,Me=Phaser.Utils.Objects.GetValue;var Re=function(t,e){return void 0===e?t:t[e]},Le=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Me(e,"left",0),t.right=Me(e,"right",0),t.top=Me(e,"top",0),t.bottom=Me(e,"bottom",0)),t},De={getInnerPadding(t){return Re(this.space,t)},setInnerPadding(t,e){return Le(this.space,t,e),this},getOuterPadding(t){return Re(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Le(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Re(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Le(this.getSizerConfig(t).padding,e,i),this}},Ae=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Ye=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Xe=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},ze=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},We=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},je=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Fe={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Ie=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?mi:fi,this.repeatCounter=0,this}stop(){return this.state=gi,this}update(t,e){this.state!==gi&&this.state!==bi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=yi)):(this.nowTime=this.duration,this.state=bi):this.nowTime>=0&&(this.state=mi))}get t(){var t;switch(this.state){case gi:case fi:case yi:t=0;break;case mi:t=this.nowTime/this.duration;break;case bi:t=1}return pi(t,0,1)}set t(t){(t=pi(t,-1,1))<0?(this.state=fi,this.nowTime=-this.delay*t):(this.state=mi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===gi}get isDelay(){return this.state===fi}get isCountDown(){return this.state===mi}get isRunning(){return this.state===fi||this.state===mi}get isDone(){return this.state===bi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const gi=0,fi=1,mi=2,yi=3,bi=-1;class xi extends di{constructor(t,e){super(t,e),this.timer=new vi}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const wi=Phaser.Utils.Objects.GetValue,Si=Phaser.Utils.Objects.GetAdvancedValue,Ci=Phaser.Tweens.Builders.GetEaseFunction;class Oi extends xi{resetFromJSON(t){return this.timer.resetFromJSON(wi(t,"timer")),this.setEnable(wi(t,"enable",!0)),this.setTarget(wi(t,"target",this.parent)),this.setDelay(Si(t,"delay",0)),this.setDuration(Si(t,"duration",1e3)),this.setEase(wi(t,"ease","Linear")),this.setRepeat(wi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Ci(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Pi=Phaser.Utils.Objects.GetValue,_i=Phaser.Utils.Objects.GetAdvancedValue,Ti=Phaser.Math.Linear;let ki=class extends Oi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Pi(t,"mode",0)),this.setScaleRange(_i(t,"start",void 0),_i(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ei[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=_i(t,"x",this.parent.scaleX),this.startY=_i(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=_i(e,"x",void 0),this.endY=_i(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Ti(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Ti(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const Ei={stop:0,destroy:1,yoyo:2};var Mi=function(t,e,i,s,r){var n,a;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},a={x:t.scaleX};break;case 1:case"y":n={y:0},a={y:t.scaleY};break;default:n=0,a=t.scale}var h={mode:0,start:n,end:a,duration:e,ease:s};return void 0===r?r=new ki(t,h):r.resetFromJSON(h),r.restart(),r},Ri=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof ki&&(n=r,r=void 0),void 0===r&&(r=!0);var a={};switch(a.mode=r?1:0,i){case 0:case"x":a.end={x:0};break;case 1:case"y":a.end={y:0};break;default:a.end=0}return a.duration=e,a.ease=s,void 0===n?n=new ki(t,a):n.resetFromJSON(a),n.restart(),n},Li=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Di=function(t){return Li(t,"complete")};const Ai=Phaser.Utils.Objects.IsPlainObject;var Yi={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Ai(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Mi(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Di(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Ai(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Ri(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Di(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Di(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Ai(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var a=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,a){var h,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":h={x:t.scaleX},o={x:i};break;case 1:case"y":h={y:t.scaleX},o={y:i};break;default:h=t.scaleX,o=i}var l={mode:2,start:h,end:o,duration:e/2,ease:n,repeat:s};return void 0===a?a=new ki(t,l):a.resetFromJSON(l),a.restart(),a}(this,t,e,i,s,r,this._scaleBehavior),a&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Di(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Xi={};Object.assign(Xi,Yi),Xi.onInitScale=function(){Yi.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=xe.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const zi=Phaser.Utils.Objects.GetValue,Wi=Phaser.Utils.Objects.GetAdvancedValue,ji=Phaser.Math.Linear;class Fi extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(zi(t,"mode",0)),this.setAlphaRange(Wi(t,"start",this.parent.alpha),Wi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ii[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=ji(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ii={stop:0,destroy:1,yoyo:2},Bi=Phaser.Utils.Objects.IsPlainObject;var Hi=function(t,e,i,s){var r,n;Bi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var a={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Fi(t,a):s.resetFromJSON(a),s.restart(),s},Ni=function(t,e,i,s){i instanceof Fi&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Fi(t,r):s.resetFromJSON(r),s.restart(),s};const Gi=Phaser.Utils.Objects.IsPlainObject;var Vi={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Gi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Hi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Di(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Gi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Ni(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Di(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Di(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Ui={};Object.assign(Ui,Vi),Ui.onInitFade=function(){Vi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=xe.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const $i=Phaser.Utils.Objects.GetValue,Ji=Phaser.Utils.Objects.GetAdvancedValue,Ki=Phaser.Math.Linear;class qi extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode($i(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ji(t,"x",void 0),i=Ji(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Zi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Ji(i,"startX",void 0),this.startY=Ji(i,"startY",void 0),this.endX=Ji(i,"endX",void 0),this.endY=Ji(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Ki(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ki(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Zi={stop:0,destroy:1,yoyo:2};var Qi=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const ts=Phaser.Utils.Objects.IsPlainObject,es=Phaser.Math.Distance.Between;var is={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(ts(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*es(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var a=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,a){n instanceof qi&&(a=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=Qi(i,t.x),h.endX=t.x),void 0!==s&&(h.startY=Qi(s,t.y),h.endY=t.y),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===a?a=new qi(t,h):a.resetFromJSON(h),a.restart(),a}(this,t,e,i,s,r,this._easeMove),a&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Di(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Di(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(ts(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*es(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var a=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,a){n instanceof qi&&(a=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=t.x,h.endX=Qi(i,t.x)),void 0!==s&&(h.startY=t.y,h.endY=Qi(s,t.y)),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===a?a=new qi(t,h):a.resetFromJSON(h),a.restart(),a}(this,t,e,i,s,r,this._easeMove),a&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Di(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Di(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},ss={};Object.assign(ss,is),ss.onInitEaseMove=function(){is.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=xe.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const rs=Phaser.Utils.Objects.GetValue;class ns extends hi{constructor(t,e){super(t,e),this.timer=new vi,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(rs(t,"timer")),this.setEnable(rs(t,"enable",!0)),this.setMode(rs(t,"mode",1)),this.isRunning=rs(t,"isRunning",!1),this.setMagnitudeMode(rs(t,"magnitudeMode",1)),this.setAxisMode(rs(t,"axis",0)),this.setDuration(rs(t,"duration",500)),this.setMagnitude(rs(t,"magnitude",10)),this.ox=rs(t,"ox",void 0),this.oy=rs(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=as[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=os[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=hs[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=rs(i,"magnitude",void 0),t=rs(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,a=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=a;break;default:i.x=n,i.y=a}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const as={effect:0,behavior:1},hs={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},os={constant:0,decay:1},ls=Phaser.Utils.Objects.IsPlainObject;var ds={shake(t,e,i){if(ls(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new ns(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Di(this._shake)}};const cs=Phaser.Utils.Objects.GetValue,us=Phaser.Math.Linear;class ps extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=cs(t,"key","value");var i=e[this.propertyKey];return this.fromValue=cs(t,"from",i),this.toValue=cs(t,"to",i),this.setEase(cs(t,"ease",this.ease)),this.setDuration(cs(t,"duration",this.duration)),this.setRepeat(cs(t,"repeat",0)),this.setDelay(cs(t,"delay",0)),this.setRepeatDelay(cs(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=us(this.fromValue,this.toValue,i)}}const vs=Phaser.Utils.Objects.IsPlainObject;class gs extends ii{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new ps(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(vs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(vs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var fs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new gs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Li(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},ms=Phaser.Utils.Array.Remove,ys={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var Ds={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=qe(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},As={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=zt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=zt),this.transitOutCallback=t,this}},Ys={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Xs={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},zs={};Object.assign(zs,Ds,As,Ys,Xs);const Ws=Phaser.Utils.Objects.GetValue;class js extends ii{constructor(t,e){super(t,e),this.setTransitInTime(Ws(e,"duration.in",200)),this.setTransitOutTime(Ws(e,"duration.out",200)),this.setTransitInCallback(Ws(e,"transitIn")),this.setTransitOutCallback(Ws(e,"transitOut")),this.oneShotMode=Ws(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Ls(this,{eventEmitter:!1,initState:Ws(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(js.prototype,zs);var Fs=function(t){if(t.parentContainer)return Fs(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?Fs(e):t};class Is extends ii{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Fs(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,a=1/i.zoom,h=r/2,o=n/2,l=r*a,d=n*a;e.x===h&&e.y===o||e.setPosition(h,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Bs=Phaser.GameObjects.Rectangle;class Hs extends Bs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Is(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Ns=Phaser.Utils.Objects.GetValue;class Gs extends ii{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Ns(t,"hitAreaMode",0)),this.setEnable(Ns(t,"enable",!0)),this.setStopMode(Ns(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Vs[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Vs={default:0,fullWindow:1};const Us=Phaser.Utils.Objects.GetValue;class $s extends Hs{constructor(t,e){super(t,Us(e,"color",0),Us(e,"alpha",.8)),this.touchEventStop=new Gs(this,{hitAreaMode:1})}}var Js={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Mi(t,e)},scaleDown(t,e){Ri(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Hi(t,e)},fadeOut(t,e){Ni(t,e,!1)}},Ks=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Hi(t,e,t.alpha)},qs=function(t,e){Ni(t,e,!1)},Zs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!nt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Qs=Phaser.Utils.Objects.GetValue;let tr=class extends js{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=er.popUp),null==e.transitOut&&(e.transitOut=er.scaleDown),e.destroy=Qs(e,"destroy",!0),super(t,e);var i=Qs(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new $s(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Qs(i,"transitIn",Ks)),this.setCoverTransitOutCallback(Qs(i,"transitOut",qs)));var s=Qs(e,"touchOutsideClose",!1),r=Qs(e,"duration.hold",-1),n=Qs(e,"timeOutClose",r>=0),a=Qs(e,"anyTouchClose",!1);Qs(e,"manualClose",!1)&&(s=!1,a=!1,n=!1),a&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),a?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Qs(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Zs(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=er[t]),t){case er.popUp:t=Js.popUp;break;case er.fadeIn:t=Js.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=er[t]),t){case er.scaleDown:t=Js.scaleDown;break;case er.fadeOut:t=Js.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const er={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var ir=function(t){return t&&"function"==typeof t},sr={modal(t,e){return ir(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new tr(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},rr=function(t,e,i,s,r){ir(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},nr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return rr.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return rr.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return rr.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return rr.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return rr.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return rr.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return rr.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return rr.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return rr.call(this,"shutdown",t,e,i,s),this}},ar=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=hr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},hr={},or=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,a=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return a?Zs(t,e.x,e.y,i,s):!!(r=ar(e,n,!0))&&Zs(t,r.x,r.y,i,s);for(var h=t.scene.input.manager,o=h.pointersTotal,l=h.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const br={press:0,pointerdown:0,release:1,pointerup:1};var xr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new yr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},wr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!Sr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,a=n.pointersTotal,h=n.pointers,o=0;o0)return Cr.length=0,!0;return Cr.length=0,!1},Cr=[];const Or=Phaser.Utils.Objects.GetValue;class Pr extends ii{constructor(t,e){super(t,e),this._enable=void 0;var i=Or(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Or(t,"enable",!0)),this.setMode(Or(t,"mode",1)),this.setClickInterval(Or(t,"clickInterval",100)),this.setDragThreshold(Or(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=_r[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?wr:or)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const _r={press:0,pointerdown:0,release:1,pointerup:1};var Tr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Pr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class kr extends Rs{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Er=Phaser.Utils.Objects.GetValue;class Mr extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new kr,this.parent.setInteractive(Er(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Er(t,"enable",!0)),this.setCooldown(Er(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Rr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&or(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Mr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Mr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Lr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Dr=function(t,e,i,s){if("parent"===t){for(var r,n=0,a=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Jr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Kr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Jr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=qr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&or(t,s,e,i)}}const Jr=0,Kr=1,qr="IDLE",Zr=Phaser.Utils.Objects.GetValue,Qr=Phaser.Math.Distance.Between;class tn extends $r{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=en},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Zr(t,"time",250)),this.setTapInterval(Zr(t,"tapInterval",200)),this.setDragThreshold(Zr(t,"threshold",9)),this.setTapOffset(Zr(t,"tapOffset",10));var e=Zr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Zr(t,"maxTaps",void 0)),this.setMinTaps(Zr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case en:this.state=sn;break;case sn:var t=this.lastPointer;Qr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=rn,this.state=sn);break;case rn:this.state=sn}}onDragEnd(){this.state===sn&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=rn))}onDrag(){this.state!==en&&this.pointer.getDistance()>this.dragThreshold&&(this.state=en)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===sn){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=en):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=rn:this.state=en)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===rn&&(this.state=en)}get isTapped(){return this.state===rn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const en="IDLE",sn="BEGIN",rn="RECOGNIZED",nn=Phaser.Utils.Objects.GetValue;class an extends $r{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=hn},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(nn(t,"threshold",9)),this.setHoldTime(nn(t,"time",251)),this}onDragStart(){this.state=on,0===this.holdTime&&(this.state=ln)}onDragEnd(){this.state=hn}onDrag(){this.state!==hn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=hn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===on&&t-this.pointer.downTime>=this.holdTime&&(this.state=ln)}get isPressed(){return this.state===ln}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const hn="IDLE",on="BEGIN",ln="RECOGNIZED";Phaser.Utils.Objects.GetValue;var dn=function(t){return ti(t).loop.delta};const cn=Phaser.Math.Distance.Between,un=Phaser.Math.Angle.Between;var pn={getDt:function(){return dn(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return cn(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return un(e.x,e.y,t.x,t.y)}},vn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},gn={};const fn=Phaser.Utils.Objects.GetValue,mn=Phaser.Math.RadToDeg;class yn extends $r{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=bn},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(fn(t,"threshold",10)),this.setVelocityThreshold(fn(t,"velocityThreshold",1e3)),this.setDirectionMode(fn(t,"dir","8dir")),this}onDragStart(){this.state=xn}onDragEnd(){this.state=bn}onDrag(){this.state===xn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=wn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===wn&&(this.state=bn)}get isSwiped(){return this.state===wn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=vn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=gn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(mn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(yn.prototype,pn);const bn="IDLE",xn="BEGIN",wn="RECOGNIZED",Sn=Phaser.Utils.Objects.GetValue,Cn=Phaser.Utils.Array.SpliceOne,On=Phaser.Math.Distance.Between,Pn=Phaser.Math.Angle.Between;class _n{constructor(t,e){var i=qe(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(Sn(e,"inputConfig",void 0)),this.setEventEmitter(Sn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(Sn(t,"enable",!0)),this.bounds=Sn(t,"bounds",void 0),this.tracerState=kn,this.pointers.length=0,ft(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,ft(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case kn:this.tracerState=En,this.onDrag1Start();break;case En:this.tracerState=Mn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],Cn(this.pointers,e),this.tracerState){case En:this.tracerState=kn,this.onDrag1End();break;case Mn:this.tracerState=En,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case En:this.onDrag1();break;case Mn:this.onDrag2()}}}dragCancel(){return this.tracerState===Mn&&this.onDrag2End(),this.pointers.length=0,ft(this.movedState),this.tracerState=kn,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0],e=this.pointers[1];return On(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0],e=this.pointers[1];return Pn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Tn.x=e.x-i.x,Tn.y=e.y-i.y}else Tn.x=0,Tn.y=0;return Tn}get centerX(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Mn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Mn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Rn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&or(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&or(t,s,e,i)}}Object.assign(_n.prototype,$e);var Tn={};const kn=0,En=1,Mn=2,Rn="IDLE";Phaser.Utils.Objects.GetValue;const Ln=Phaser.Math.RotateAround;var Dn=function(t,e,i,s){return Ln(t,e,i,s),t.rotation+=s,t},An={};const Yn=Phaser.Utils.Objects.GetValue,Xn=Phaser.Math.Angle.WrapDegrees,zn=Phaser.Math.Angle.ShortestBetween,Wn=Phaser.Math.RadToDeg,jn=Phaser.Math.DegToRad;var Fn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=An),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,a=r.y,h=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Xn(Wn(this.angleBetween));this.angle=zn(this.prevAngle,t),this.prevAngle=t,this.state=Hn}break;case Hn:t=Xn(Wn(this.angleBetween)),this.angle=zn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Hn}get rotation(){return jn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Fn);const In="IDLE",Bn="BEGIN",Hn="RECOGNIZED",Nn=Phaser.Utils.Objects.GetValue;var Gn=function(t){var e=Nn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new tn(this,e),this._tap.on("tap",(function(t,e,s){Ar(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Ar(i.eventEmitter,`${i.eventNamePrefix}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Vn=Phaser.Utils.Objects.GetValue;var Un=function(t){var e=Vn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new an(this,e),this._press.on("pressstart",(function(t,e,s){Ar(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this).on("pressend",(function(t,e,s){Ar(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const $n=Phaser.Utils.Objects.GetValue;var Jn=function(t){var e=$n(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new yn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Ar(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Ar(i.eventEmitter,`${i.eventNamePrefix}swipe`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Kn=Phaser.Utils.Objects.GetValue;var qn=function(t,e){return t.setInteractive(),Kn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Kn(e,"targets",[t]),targetMode:Kn(e,"targetMode","parent"),eventEmitter:Kn(e,"eventEmitter",t),eventNamePrefix:Kn(e,"inputEventPrefix","child.")},Xr.call(t,e),jr.call(t,e),Br.call(t,e),Vr.call(t,e),Gn.call(t,e),Un.call(t,e),Jn.call(t,e),t},Zn={getSizerConfig:function(t){return void 0===t&&(t=this),Mt(t)},getChildPrevState:function(t){var e=Mt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Dt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,a,h=t.scene;if("number"==typeof e)i=e;else{i=oe(e,"color"),s=oe(e,"lineWidth");var o=oe(e,"name",!1);o&&(r=oe(o,"createTextCallback",ce),n=oe(o,"createTextCallbackScope",void 0),"string"==typeof(a=oe(o,"align","left-top"))&&(a=Xt[a]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new le(h),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}var d,c,u=this.getAllShownChildren([this]);ue(u,u);for(var p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=a)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=a+1),r};const ha=Phaser.Utils.Objects.IsPlainObject,oa=Phaser.Utils.Objects.GetValue,la=Phaser.Display.Align.CENTER,da={min:0,full:-1};var ca=function(t,e,i,s,r,n,a,h,o,l){var d,c,u,p;me.call(this,t);var v=t.isRexSpace,g=typeof e;if(null===e)return this;if("number"===g);else if("string"===g)e=da[e];else if(ha(e)){var f;e=oa(f=e,"proportion",void 0),i=oa(f,"align",la),s=oa(f,"padding",0),r=oa(f,"expand",!1),n=oa(f,"key",void 0),a=oa(f,"index",void 0),t.isRexSizer||(h=oa(f,"minWidth",void 0),o=oa(f,"minHeight",void 0)),l=oa(f,"fitRatio",0),d=oa(f,"offsetX",0),c=oa(f,"offsetY",0),u=oa(f,"offsetOriginX",0),p=oa(f,"offsetOriginY",0)}return"string"==typeof i&&(i=Xt[i]),void 0===e&&(e=v?1:0),void 0===i&&(i=la),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===h&&(v?h=0:t.isRexSizer||(h=t._minWidth)),void 0===o&&(v?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),(f=this.getSizerConfig(t)).proportion=e,f.align=i,f.padding=ge(s),f.expand=r,f.fitRatio=0===e?l:0,f.alignOffsetX=d,f.alignOffsetY=c,f.alignOffsetOriginX=u,f.alignOffsetOriginY=p,void 0===a||a>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(a,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===h?Q(t):h:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=h)),void 0!==n&&this.addChildrenMap(n,t),this},ua={add:ca,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),ca.call(this,new na(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,h){return ha(i)&&(i.index=t),ca.call(this,e,i,s,r,n,a,t,h),this},insertAtPosition(t,e,i,s,r,n,a,h,o){var l=aa.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,h,o),this}};const pa=Et.prototype.clear;var va=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),pa.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,va.call(this,t),this}},ma={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=Xt[e]),this.getSizerConfig(t).align=e,this}},ya={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},ba={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},xa={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},wa={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,h=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=h.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,a+=n)));else for(d=0,c=h.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,a+=n)))}return o?void 0:a+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,a=s.padding;i=n-(a.left+a.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,a=s.padding;i=n-(a.top+a.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Ne(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Ie.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,h,o,l,d,c,u=this.sizerChildren,p=this.innerLeft,v=this.innerTop,g=this.innerWidth,f=this.innerHeight,m=p,y=v,b=this.startChildIndex,x=0,w=u.length;x0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=ze.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Ye.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&sa.call(this,t,void 0),Xe.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||We.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&sa.call(this,void 0,t),je.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],a=n&&n.isRexSpace;return"center"===t?a||this.insertSpace(r+1):a&&this.remove(n,!0),this}};Object.assign(wa,ua,fa,ma,ya,ba,xa);var Sa=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},Ca={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},Oa=function(t){return"string"==typeof t&&(t=Ca[t]),t};const Pa=Phaser.Utils.Objects.IsPlainObject,_a=Phaser.Utils.Objects.GetValue;class Ta extends ta{constructor(t,e,i,s,r,n,a){Pa(e)?(e=_a(a=e,"x",0),i=_a(a,"y",0),s=_a(a,"width",void 0),r=_a(a,"height",void 0),n=_a(a,"orientation",0)):Pa(s)?(s=_a(a=s,"width",void 0),r=_a(a,"height",void 0),n=_a(a,"orientation",0)):Pa(n)&&(n=_a(a=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,a),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(_a(a,"space.item",0)),this.setStartChildIndex(_a(a,"startChildIndex",0)),this.setRTL(_a(a,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=Oa(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=Sa.call(this)),this._childrenProportion}}Object.assign(Ta.prototype,wa);var ka=function(t){return class extends t{get isTree(){return!1}get isNode(){return!1}setText(t){return this.text=t,this}get text(){return this.nodeBody.text}set text(t){var e=this.nodeBody;e.setText&&e.setText(t)}setTexture(t,e){var i=this.nodeBody;return i.setTexture&&i.setTexture(t,e),this}get texture(){var t=this.nodeBody;if(t)return t.texture}get frame(){var t=this.nodeBody;if(t)return t.frame}}};class Ea extends js{constructor(t,e){void 0===e&&(e={}),e.destroy=!1,super(t,e)}onOpen(){this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.parent,this),super.onClose()}}var Ma={expand(t){if(!0===this.expanded)return this;void 0===t&&(t=this.transitionDuration),this.expanded=!0;var e=this.childrenMap.title,i=this.childrenMap.child;return this.show(i),this.reLayoutEnable&&(this.reLayoutTarget?this.reLayoutTarget:this.getTopmostSizer()).layout(),e.emit("folder.expand",t,this),i.emit("folder.expand",t,this),this.emit("expand.start",this),this.childTransition.once("open",(function(){this.emit("expand.complete",this)}),this).requestOpen(null,t),this},collapse(t){if(!1===this.expanded)return this;void 0===t&&(t=this.transitionDuration),this.expanded=!1;var e=this.childrenMap.title,i=this.childrenMap.child;return e.emit("folder.collapse",t,this),i.emit("folder.collapse",t,this),this.emit("collapse.start",this),this.childTransition.once("close",(function(){this.setChildScale(i,1,1).hide(i),this.reLayoutEnable&&(this.reLayoutTarget?this.reLayoutTarget:this.getTopmostSizer()).layout(),this.emit("collapse.complete",this)}),this).requestClose(null,t),this},toggle(t){return this.expanded?this.collapse(t):this.expand(t),this},setExpandedState(t){return this.reLayoutEnable=!1,void 0===t?this.expanded=void 0:t?this.expand(0):this.collapse(0),this.reLayoutEnable=!0,this}},Ra=function(t,e){Xi.popUp.call(t,e,this.expandDirection)},La=function(t,e){Xi.scaleDown.call(t,e,this.expandDirection)},Da={setTransitionDuration(t){return this.transitionDuration=t,this.childTransition.setTransitInTime(t).setTransitOutTime(t),this},setExpandCallback(t){return void 0===t&&(t=Ra.bind(this)),this.childTransition.setTransitInCallback(t),this},setCollapseCallback(t){return void 0===t&&(t=La.bind(this)),this.childTransition.setTransitOutCallback(t),this}};const Aa=Phaser.Utils.Objects.GetValue;class Ya extends Ta{constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("orientation")||(e.orientation=1),super(t,e),this.type="rexFolder",this.reLayoutEnable=!0,this.expanded=void 0,this.expandDirection=1===this.orientation?"y":"x";var i=e.background,s=e.title,r=e.child;i&&this.addBackground(i);var n=Aa(e,"space"),a=1===this.orientation?"left":"top",h=Aa(e,"align.title",a),o=Aa(e,"expand.title",!0);this.add(s,{proportion:0,align:h,expand:o,padding:{left:Aa(n,"titleLeft",0),right:Aa(n,"titleRight",0),top:Aa(n,"titleTop",0),bottom:Aa(n,"titleBottom",0)}});var l=Aa(e,"toggleByTarget",void 0),d=Aa(e,"toggleClickConfig");if(void 0===l&&(l=s),l&&xr.onClick.call(l,(function(){this.toggle()}),this,d),this.childTransition=new Ea(r),!Aa(e,"customChildOrigin",!1)){var c=this.rtl?1:0;r.setOrigin(c)}h=Aa(e,"align.child","left");var u=(o=Aa(e,"expand.child",!0))?1:0;this.add(r,{proportion:u,align:h,expand:o,padding:{left:Aa(n,"childLeft",0),right:Aa(n,"childRight",0),top:Aa(n,"childTop",0),bottom:Aa(n,"childBottom",0)}}),this.addChildrenMap("title",s),this.addChildrenMap("child",r),this.addChildrenMap("background",i);var p=e.transition;this.setTransitionDuration(Aa(p,"duration",200)),this.setExpandCallback(Aa(p,"expandCallback",void 0)),this.setCollapseCallback(Aa(p,"collapseCallback",void 0)),this.reLayoutTarget=Aa(e,"reLayoutTarget",void 0);var v=e.onExpandStart;v&&this.on("expand.start",v);var g=e.onExpandComplete;g&&this.on("expand.complete",g);var f=e.onCollapseStart;f&&this.on("collapse.start",f);var m=e.onCollapseComplete;m&&this.on("collapse.complete",m);var y=Aa(e,"expanded",void 0);void 0!==y&&this.setExpandedState(y)}}Object.assign(Ya.prototype,Ma,Da);var Xa={getTreePatent(t){if(void 0===t&&(t=this),t.rexSizer)return t.rexSizer.treeParent},getTreeRoot(t){var e;for(void 0===t&&(t=this);;){if(!t.rexSizer)return;if(null===(e=t.rexSizer.treeParent))return t;t=e}},getTreesSizer(t){var e=this.getTreeRoot(t);return e?e.getParentSizer():null},isGrandsonNode(t){if(void 0===t||!t.rexSizer)return!1;for(var e;;){if(!t.rexSizer)return!1;if((e=t.rexSizer.treeParent)===this)return!0;if(null===e)return!1;t=e}return!1}},za=function(t,e,i,s,r=!1){var n;return bt(e)?(n=e,delete e[key]):ir(e)?(n=e(t,i))&&t.add.existing(n):(r||e)&&s&&(n=s(t,e,i)),n},Wa=Phaser.Renderer.WebGL.Utils,ja=function(t,e,i,s,r,n){for(var a=Wa.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),h=i.pathData,o=i.pathIndexes,l=0;l>>16,h=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+a+","+h+","+o+","+n+")"},Na=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,a=(16711680&r)>>>16,h=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+a+","+h+","+o+","+n+")",t.lineWidth=e.lineWidth};const Ga=Phaser.Renderer.Canvas.SetTransform;var Va={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Ba(e,i,s),a=r.calcMatrix.copyFrom(n.calc),h=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&ja(r,a,e,l,h,o),e.isStroked&&Ia(r,e,l,h,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(Ga(t,r,e,i,s)){var n=e._displayOriginX,a=e._displayOriginY,h=e.pathData,o=h.length-1,l=h[0]-n,d=h[1]-a;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign($a.prototype,Va);const Ja=Phaser.Utils.Objects.GetValue;let Ka=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=Ja(t,"x",0),i=Ja(t,"y",0));var s=this.cornerRadius;s.tl=qa(Ja(t,"tl",void 0),e,i),s.tr=qa(Ja(t,"tr",void 0),e,i),s.bl=qa(Ja(t,"bl",void 0),e,i),s.br=qa(Ja(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Za(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Za(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Za(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Za(this.cornerRadius.br,t)}};var qa=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Qa(t),t},Za=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Ja(e,"x",0),t.y=Ja(e,"y",0)),Qa(t)},Qa=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},th=function(t){return t.x>0&&t.y>0},eh=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const ih=Phaser.Math.DegToRad;var sh=function(t,e,i,s,r,n,a,h,o){a&&n>r?n-=360:!a&&n0,a=0,h=e.length;a=0?t.startAt(a+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(a+n,i):t.startAt(a,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(a,i),t.close(),t};const so=Phaser.Utils.Objects.GetValue,ro=Phaser.Utils.Objects.IsPlainObject;class no extends(Mh(Sh)){constructor(t,e,i,s,r,n,a,h){ro(e)?(e=(h=e).x,i=h.y,s=h.width,r=h.height,n=h.barColor,a=h.value):ro(s)?(s=(h=s).width,r=h.height,n=h.barColor,a=h.value):ro(n)&&(n=(h=n).barColor,a=h.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===a&&(a=0),super(t,e,i,s,r,h),this.type="rexLineProgress",this.bootProgressBase(h),this.addShape((new eo).setName("trackFill")).addShape((new eo).setName("bar")).addShape((new eo).setName("trackStroke")),this.setTrackColor(so(h,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(so(h,"trackStrokeThickness",2),so(h,"trackStrokeColor",void 0)),this.setSkewX(so(h,"skewX",0)),this.setRTL(so(h,"rtl",!1)),this.setValue(a)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var ao={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&io(s,0,0,e,i,t);var r,n,a=this.getShape("bar");a.fillStyle(this.barColor),a.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),io(a,r,0,n,i,t));var h=this.getShape("trackStroke");h.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),h.isStroked&&io(h,0,0,e,i,t)}};Object.assign(no.prototype,ao);var ho=function(t){return null==t||""===t||0===t.length},oo=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(ho(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(ho(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,a=e.length;nTo(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=To(t[i]));return e}const ko=Phaser.Utils.Objects.IsPlainObject,Eo=Phaser.Utils.Objects.GetValue;var Mo=function(t){return"string"==typeof t&&(t=Ro[t]),t};const Ro={scale:0,repeat:1};var Lo=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},Do={_beginDraw:zt,_drawImage:zt,_drawTileSprite:zt,_endDraw:zt,setGetFrameNameCallback:function(t){return void 0===t&&(t=_o),this.getFrameNameCallback=t,this},setBaseTexture:function(t,e,i,s){Array.isArray(e)&&(s=i,i=e,e=void 0),null==e&&(e="__BASE"),"number"==typeof i&&arguments.length>=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=To(i),s=To(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),a=n.width,h=0,o=0,l=i.length;o0?a/h:0,c=n.height,u=0;for(o=0,l=s.length;o0?0:g,b=0,o=0;for(var C=i.length;o0?0:f),f>=1&&g>=1){var O=typeof(m=this.getFrameNameCallback(o,w,e));"string"!==O&&"number"!==O||r.add(m,0,b+n.cutX,x+n.cutY,f,g)}b+=f}x+=g}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,a,h,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/o,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(u,p);if(u>v){var g=(u-v)*o;d>=0?d+=g:d=g,u=v}if(p>v){var f=(p-v)*l;c>=0?c+=f:c=f,p=v}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,x=this.rows.count;b0&&h>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(w,b)?0:1)?this._drawImage(this.textureKey,s,m,y,a,h):this._drawTileSprite(this.textureKey,s,m,y,a,h)),m+=a;y+=h}this._endDraw()},setStretchMode:function(t){return ko(t)?(this.stretchMode.edge=Mo(Eo(t,"edge",0)),this.stretchMode.internal=Mo(Eo(t,"internal",0))):(t=Mo(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Lo.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const Ao=Phaser.Utils.Objects.IsPlainObject,Yo=Phaser.Utils.Objects.GetValue,Xo=Phaser.GameObjects;var zo=void 0,Wo=function(t,e){if(zo||(zo={},ti(t).events.once("destroy",(function(){for(var t in zo)zo[t].destroy();zo=void 0}))),!zo.hasOwnProperty(e)){var i=ti(t).scene.systemScene;(t=new Xo[e](i)).setOrigin(0),zo[e]=t}return zo[e]};const jo=Phaser.GameObjects.RenderTexture;class Fo extends(function(t,e){class i extends t{constructor(t,i,s,r,n,a,h,o,l,d){if(Ao(i)?(i=Yo(d=i,"x",0),s=Yo(d,"y",0),r=Yo(d,"width",1),n=Yo(d,"height",1),a=Yo(d,"key",void 0),h=Yo(d,"baseFrame",void 0),o=Yo(d,"columns",void 0),l=Yo(d,"rows",void 0)):Ao(r)?(r=Yo(d=r,"width",1),n=Yo(d,"height",1),a=Yo(d,"key",void 0),h=Yo(d,"baseFrame",void 0),o=Yo(d,"columns",void 0),l=Yo(d,"rows",void 0)):Ao(a)?(a=Yo(d=a,"key",void 0),h=Yo(d,"baseFrame",void 0),o=Yo(d,"columns",void 0),l=Yo(d,"rows",void 0)):Ao(h)?(h=Yo(d=h,"baseFrame",void 0),o=Yo(d,"columns",void 0),l=Yo(d,"rows",void 0)):Array.isArray(h)?(d=l,l=o,o=h,h=Yo(d,"baseFrame",void 0)):Ao(o)&&(o=Yo(d=o,"columns",void 0),l=Yo(d,"rows",void 0)),void 0===h&&(h=Yo(d,"frame",void 0)),void 0===o){var c=Yo(d,"leftWidth",void 0),u=Yo(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=Yo(d,"topHeight",void 0),v=Yo(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(Yo(d,"getFrameNameCallback",void 0)),this.setStretchMode(Yo(d,"stretchMode",0)),this.setPreserveRatio(Yo(d,"preserveRatio",!0));var g=Yo(d,"maxFixedPartScale",1),f=Yo(d,"maxFixedPartScaleX",g),m=Yo(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(a,h,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,Do),i}(jo,"rexNinePatch")){}var Io={_drawImage:function(t,e,i,s,r,n){var a=Wo(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(a,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var a=Wo(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(a,i,s)}};Object.assign(Fo.prototype,Io);let Bo=class extends ii{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(uo(t,e))return t[e];var i=t.parent;return uo(i,e)?i[e]:void 0}set(t,e,i){return uo(t,e)?t[e]=i:uo(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}};const Ho=Phaser.Utils.Objects.GetValue;class No extends Fo{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=Ho(e,"effects",!0);i&&mo(this,i),this.style=new Bo(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(No.prototype,vh);const Go=["alpha","tint","flipX","flipY"];var Vo=function(t,e){if(!e)return t;for(var i=0,s=Go.length;i0&&r.push(o.join("")),r},ml=0,yl=1,bl=2,xl=0,wl=1,Sl=2,Cl=/(?:\r\n|\r|\n)/;const Ol={none:xl,word:wl,char:Sl,character:Sl,mix:3},Pl=Phaser.Renderer.WebGL.Utils;var _l={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,a=r.height,h=Pl.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,a,e.x,e.y,n/e.resolution,a/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,a,h(e.tintTopLeft,i.alpha*e._alphaTL),h(e.tintTopRight,i.alpha*e._alphaTR),h(e.tintBottomLeft,i.alpha*e._alphaBL),h(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const Tl=Phaser.Display.Color;var kl={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,a,h,o,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===a&&(a=0),void 0===h&&(h=0),void 0===o&&(o=c),void 0===l&&(l=u);var p=d.cutX+a,v=d.cutY+h;return this.context.drawImage(d.source.image,p,v,o,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new Tl);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var a=i;i=a.red,s=a.green,r=a.blue,n=a.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var h=this.context.createImageData(1,1);return h.data[0]=i,h.data[1]=s,h.data[2]=r,h.data[3]=n,this.context.putImageData(h,t,e),this.dirty=!0,this}},El=function(t,e,i,s,r,n,a){var h,o=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===a&&(a=e.height);var d=(h=o.exists(i)?o.get(i):o.createCanvas(i,n,a)).getSourceImage();d.width!==n&&(d.width=n),d.height!==a&&(d.height=a);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,a),c.drawImage(e,s,r,n,a),l.gl&&h&&l.canvasToTexture(d,h.source[0].glTexture,!0,0)},Ml={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,El(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};e();const Rl=Phaser.Display.Canvas.CanvasPool,Ll=Phaser.GameObjects.GameObject,Dl=Phaser.Utils.String.UUID;class Al extends Ll{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=Rl.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=Dl(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){Rl.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}}const Yl=Phaser.GameObjects.Components;Phaser.Class.mixin(Al,[Yl.Alpha,Yl.BlendMode,Yl.Crop,Yl.Depth,Yl.Flip,Yl.GetBounds,Yl.Mask,Yl.Origin,Yl.Pipeline,Yl.PostPipeline,Yl.ScrollFactor,Yl.Tint,Yl.Transform,Yl.Visible,_l,kl,Ml]);class Xl{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}}Object.assign(Xl.prototype,Lh);var zl={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const Wl=Phaser.Math.RotateAround;var jl;const Fl=Phaser.Geom.Rectangle;var Il,Bl=function(t){void 0===Il&&(Il=new Fl);var e=t.drawTLX,i=t.drawTLY;return Il.setTo(e,i,t.drawTRX-e,t.drawBLY-i),Il};const Hl=Phaser.Math.RotateAround;var Nl,Gl=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Nl&&(Nl={}),s=Nl),s.x=e,s.y=i,0!==t.rotation&&Hl(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const Vl=Phaser.GameObjects.Components.TransformMatrix;var Ul,$l,Jl={},Kl=function(t,e,i,s,r){var n=Gl(e,i,s,!0),a=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=Jl);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===Ul&&(Ul=new Vl,$l=new Vl),t.parentContainer?t.getWorldTransformMatrix(Ul,$l):Ul.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),Ul.transformPoint(r,n,s),s}(t,n.x,n.y,r);return a},ql=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,a=e.drawCenterY+s;return Kl(t,e,n,a,r)},Zl={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===jl&&(jl={}),s=jl),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&Wl(s,0,0,-i.rotation),s}(t,e,this,!0);return Bl(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return ql(this.parent,this,t,e,i)}};Object.assign(Zl,zl);const Ql=Phaser.Math.DegToRad,td=Phaser.Math.RadToDeg,ed=Phaser.Utils.Objects.GetValue;class id extends Xl{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return td(this._rotation)}set angle(t){this.rotation=Ql(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=ed(t,"width",void 0),i=ed(t,"height",void 0),s=ed(t,"scaleX",void 0),r=ed(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(id.prototype,Zl);const sd=Phaser.Utils.String.Pad;var rd=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${sd(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},nd=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const ad=Phaser.Math.DegToRad;var hd=function(t){return!t.hasOwnProperty("convex")||t.convex},od=function(t){return t.x>0&&t.y>0},ld=function(t,e,i,s,r,n,a,h,o){if(h&&a>n?a-=360:!h&&a=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),h=m.tl,od(h)?(o=h.x*g,l=h.y*f,hd(h)?ld(t,o,l,o,l,180,270,!1,a):ld(t,0,0,o,l,90,0,!0,a),d=0,c=l):(t.lineTo(0,0),d=0,c=0),h=m.tr,od(h)?(o=h.x*g,l=h.y*f,hd(h)?ld(t,s-o,l,o,l,270,360,!1,a):ld(t,s,0,o,l,180,90,!0,a)):t.lineTo(s,0),h=m.br,od(h)?(o=h.x*g,l=h.y*f,hd(h)?ld(t,s-o,r-l,o,l,0,90,!1,a):ld(t,s,r,o,l,270,180,!0,a)):t.lineTo(s,r),h=m.bl,od(h)?(o=h.x*g,l=h.y*f,hd(h)?ld(t,o,r-l,o,l,90,180,!1,a):ld(t,0,r,o,l,360,270,!0,a)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,a,u),null!=h)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,h),p.addColorStop(1,d),h=p),e.fillStyle=h,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())},cd=function(t,e,i,s,r,n,a,h){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),dd(t.canvas,t.context,d,d,o,l,r,e,i,s,n,a,h)}};const ud=Phaser.Utils.Objects.GetValue;class pd extends id{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(ud(e,"color",null),ud(e,"color2",null),ud(e,"horizontalGradient",!0)),this.setStroke(ud(e,"stroke",null),ud(e,"strokeThickness",2)),this.setCornerRadius(ud(e,"cornerRadius",0),ud(e,"cornerIteration",null))}set color(t){t=rd(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=rd(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=rd(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,nd("color2",t,this),nd("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,nd("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,nd("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){cd(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const vd=Phaser.Utils.Objects.GetValue;class gd extends id{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(vd(e,"color",null),vd(e,"color2",null),vd(e,"horizontalGradient",!0)),this.setStroke(vd(e,"stroke",null),vd(e,"strokeThickness",2))}set color(t){t=rd(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=rd(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=rd(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,vd(t,"color2",null),vd(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,vd(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,a=this.parent.height-i.top-i.bottom,h=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?h.createLinearGradient(0,0,n,0):h.createLinearGradient(0,0,0,a)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,h.fillStyle=t,h.fillRect(s,r,n,a));null!=this.stroke&&this.strokeThickness>0&&(h.strokeStyle=this.stroke,h.lineWidth=this.strokeThickness,h.strokeRect(s,r,n,a))}}const fd=Phaser.Utils.Objects.GetValue;let md=class t{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(fd(t,"bold",!1)),this.setItalic(fd(t,"italic",!1)),this.setFontSize(fd(t,"fontSize","16px")),this.setFontFamily(fd(t,"fontFamily","Courier")),this.setColor(fd(t,"color","#fff")),this.setStrokeStyle(fd(t,"stroke",null),fd(t,"strokeThickness",0)),this.setShadow(fd(t,"shadowColor",null),fd(t,"shadowOffsetX",0),fd(t,"shadowOffsetY",0),fd(t,"shadowBlur",0)),this.setOffset(fd(t,"offsetX",0),fd(t,"offsetY",0)),this.setSpace(fd(t,"leftSpace",0),fd(t,"rightSpace",0)),this.setAlign(fd(t,"align",void 0)),this.setBackgroundColor(fd(t,"backgroundColor",null)),this.setBackgroundHeight(fd(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(fd(t,"backgroundBottomY",void 0)),this.setBackgroundLeftX(fd(t,"backgroundLeftX",0)),this.setBackgroundRightX(fd(t,"backgroundRightX",0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(nd("stroke",t,this),nd("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(nd("shadowOffsetX",t,this),nd("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),t.hasOwnProperty("backgroundLeftX")&&this.setBackgroundLeftX(t.backgroundLeftX),t.hasOwnProperty("backgroundRightX")&&this.setBackgroundRightX(t.backgroundRightX),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new t(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=rd(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=rd(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=rd(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=rd(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setBackgroundLeftX(t){return this.backgroundLeftX=t,this}setBackgroundRightX(t){return this.backgroundRightX=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}};const yd=Phaser.Utils.Array.Remove,bd=Phaser.Utils.Array.Remove,xd="text",wd="image",Sd="drawer",Cd="space",Od="command";var Pd=function(t){return t.type===xd&&"\n"===t.text},_d=function(t){return t.type===xd&&"\f"===t.text},Td=function(t){return t.type===xd};class kd extends id{constructor(t,e,i){super(t,xd),this.updateTextFlag=!1,this.style=new md(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX+e.backgroundLeftX,s=i,r=this.drawTRX+e.backgroundRightX-i+1;if(r>0){var n=e.backgroundBottomY;null==n&&(n=this.drawBLY);var a=e.backgroundHeight;null==a&&(a=n-this.drawTLY);var h=n-a;t.fillRect(s,h,r,a)}}var o=e.hasFill,l=e.hasStroke;(o||l)&&(e.syncFont(t).syncStyle(t),l&&(e.syncShadow(t),t.strokeText(this.text,0,0)),o&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var Ed=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const Md=Phaser.Display.Canvas.CanvasPool;var Rd=function(t,e,i,s,r,n,a,h){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===h&&(h=!1),h&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(a){var l=Md.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=a,d.fillRect(0,0,r,n),o.drawImage(l,0,0,r,n,i,s,r,n),Md.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)};Phaser.Display.Canvas.CanvasPool;class Ld extends id{constructor(t,e,i){super(t,wd),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){Rd(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class Dd extends id{constructor(t,e,i,s){super(t,Sd),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class Ad extends id{constructor(t,e){super(t,Cd),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class Yd extends Xl{constructor(t,e,i,s,r){super(t,Od),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}var Xd=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const zd={none:0,word:1,char:2,character:2,mix:3};var Wd=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,a=!r&&!n,h=t.length,o=e,l=s.word,d=0,c=!1;o0&&!h){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=Bd.call(this)).height,a=l.ascent,i=Math.floor((o-a)/n))}else{var l;n=(l=Bd.call(this)).height,a=l.ascent}}else this.fixedHeight>0?void 0===(i=Nd(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=Nd(t,"maxLines",0);void 0===a&&(a=n);var d=0===i,c=Nd(t,"wrapMode");void 0===c&&(c=Nd(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=zd[c]);var u=Nd(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=Nd(t,"letterSpacing",0),v=Nd(t,"hAlign",0),g=Nd(t,"vAlign",0),f=Nd(t,"justifyPercentage",.25),m=Xd({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:a,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,b=0,x=y.length;b0&&(E.push({children:M,width:R}),L=Math.max(L,R)),m.start+=k.length,m.isLastPage=!D&&m.start===T,m.maxLineWidth=L,m.linesHeight=E.length*n;var F=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,I=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,a=t.vAlign,h=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(a=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=Ud(t,"maxLines",void 0))){var a=this.fixedWidth-r;i=Math.floor(a/n)+1}}else i=Ud(t,"maxLines",0);var h=0===i,o=Ud(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=Ud(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=Ud(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=Ud(t,"letterSpacing",0),p=Ud(t,"rtl",!0),v=Ud(t,"hAlign",p?2:0),g=Ud(t,"vAlign",0),f=Xd({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:o,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(k.push({children:E,height:M}),R=Math.max(R,M)),f.start+=T.length,f.isLastPage=f.start===_,f.maxLineHeight=R,f.linesWidth=k.length*n;var z=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,W=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,a=t.vAlign,h=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}h&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,a=i.bottom;return Le(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||a!=i.bottom,this},getPadding:function(t){return Re(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),yd(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return bd(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(xd);return null===i?i=new kd(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),ql(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const yc=Phaser.Utils.Objects.GetFastValue;var bc={};class xc{constructor(t){this.pools=yc(t,"pools",bc)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new mc),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;ei&&(r=Math.floor(i));for(var n={},a=kc(t,r,e,i,n),h=0;h<=Pc&&0!==a;h++){if((r+=a)<0){r=0;break}a=kc(t,r,e,i,n)}return h===Pc&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),Ec(t,e,i),t},Tc=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},kc=function(t,e,i,s,r){var n,a=Tc(t,e,r),h=Tc(t,e+1,r);if(void 0!==s)if(a.height<=s&&h.height>s)n=0;else{if(a.height>s)return-1;n=Math.floor(s-a.height)}if(a.width<=i&&h.width>i)return 0;if(a.width>i)return-1;var o=Math.floor(i-a.width);return void 0===n?o:Math.min(o,n)},Ec=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const Mc=Phaser.Utils.Objects.GetValue,Rc=Phaser.Utils.Objects.GetValue;class Lc extends Zo{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=Rc(e,"background",void 0),r=Rc(e,"icon",void 0),n=Rc(e,"iconMask",void 0),a=Rc(e,"text",void 0),h=Rc(e,"action",void 0),o=Rc(e,"actionMask",void 0),l=Rc(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(a||h)&&(i={right:Rc(e,"space.icon",0),top:Rc(e,"space.iconTop",0),bottom:Rc(e,"space.iconBottom",0),left:Rc(e,"space.iconLeft",0)}):(a||h)&&(i={bottom:Rc(e,"space.icon",0),left:Rc(e,"space.iconLeft",0),right:Rc(e,"space.iconRight",0),top:Rc(e,"space.iconTop",0)});var d=Rc(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=hl.call(this,r,r,1)),!d){var c=Rc(e,"iconSize",void 0);this.setIconSize(Rc(e,"iconWidth",c),Rc(e,"iconHeight",c))}}if(a){var u=Rc(e,"wrapText",!1),p=Rc(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),function(t,e){switch(ul(t)){case 0:switch("string"==typeof e&&(e=Ol[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=gl;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Ol[e]||0),t.style.wrapMode=e}}(a,u),e.expandTextWidth=!0,Oc(a)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=Mc(e,"minWidth",0),s=Mc(e,"minHeight",0),r=Mc(e,"fitHeight",!1);t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return _c(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),_c(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t})}(a,{fitHeight:!0}));var v,g,f=Rc(e,"space.text",0),m=Rc(e,"expandTextWidth",!1),y=Rc(e,"expandTextHeight",!1);0===this.orientation?(v=m?1:0,h&&(i={right:f}),g=y):(v=y?1:0,h&&(i={bottom:f}),g=m),this.add(a,{proportion:v,expand:g,padding:i})}if(h&&(i=0===this.orientation?{top:Rc(e,"space.actionTop",0),bottom:Rc(e,"space.actionBottom",0),right:Rc(e,"space.actionRight",0)}:{left:Rc(e,"space.actionLeft",0),right:Rc(e,"space.actionRight",0),bottom:Rc(e,"space.actionBottom",0)},d=Rc(e,"squareFitAction",!1)?1:0,this.add(h,{proportion:0,padding:i,fitRatio:d}),o&&(o=hl.call(this,h,h,1)),!d)){var b=Rc(e,"actionSize");this.setActionSize(Rc(e,"actionWidth",b),Rc(e,"actionHeight",b))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",a),this.addChildrenMap("action",h),this.addChildrenMap("actionMask",o)}}const Dc=Phaser.GameObjects.Text,Ac=Phaser.Utils.Objects.GetValue;class Yc extends Dc{constructor(t,e){void 0===e&&(e={}),super(t,Ac(e,"x",0),Ac(e,"y",0),Ac(e,"text",""),e),this.type="rexStatesText",e.style=this.style,e.onModifyStyle=function(t,e){var i=e.hasOwnProperty("fontStyle")||e.hasOwnProperty("fontSize")||e.hasOwnProperty("fontFamily");t.style.update(i)},this.addStyleManager(e),delete e.style}}Object.assign(Yc.prototype,vh);var Xc=Phaser.Renderer.WebGL.Utils,zc={renderWebGL:function(t,e,i,s){if(0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,a=r.height,h=Xc.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,a,e.x,e.y,n/e.style.resolution,a/e.style.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,a,h(e.tintTopLeft,i.alpha*e._alphaTL),h(e.tintTopRight,i.alpha*e._alphaTR),h(e.tintBottomLeft,i.alpha*e._alphaBL),h(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const Wc=Phaser.Display.Canvas.CanvasPool;e();const jc=Phaser.GameObjects.GameObject;class Fc extends jc{setStyle(t){return this.style.setStyle(t)}setFont(t){return this.style.setFont(t)}setFontFamily(t){return this.style.setFontFamily(t)}setFontSize(t){return this.style.setFontSize(t)}setFontStyle(t){return this.style.setFontStyle(t)}setTestString(t){return this.style.setTestString(t)}setFixedSize(t,e){return this.style.setFixedSize(t,e)}setBackgroundColor(t,e,i){return this.style.setBackgroundColor(t,e,i)}setBackgroundStrokeColor(t,e){return this.style.setBackgroundStrokeColor(t,e)}setBackgroundCornerRadius(t,e){return this.style.setBackgroundCornerRadius(t,e)}setFill(t){return this.style.setFill(t)}setColor(t){return this.style.setColor(t)}setStroke(t,e){return this.style.setStroke(t,e)}setShadow(t,e,i,s,r,n){return this.style.setShadow(t,e,i,s,r,n)}setShadowOffset(t,e){return this.style.setShadowOffset(t,e)}setShadowColor(t){return this.style.setShadowColor(t)}setShadowBlur(t){return this.style.setShadowBlur(t)}setShadowStroke(t){return this.style.setShadowStroke(t)}setShadowFill(t){return this.style.setShadowFill(t)}setUnderline(t,e,i){return this.style.setUnderline(t,e,i)}setUnderlineColor(t){return this.style.setUnderlineColor(t)}setUnderlineThickness(t){return this.style.setUnderlineThickness(t)}setUnderlineOffset(t){return this.style.setUnderlineOffset(t)}setStrikethrough(t,e,i){return this.style.setStrikethrough(t,e,i)}setStrikethroughColor(t){return this.style.setStrikethroughColor(t)}setStrikethroughThickness(t){return this.style.setStrikethroughThickness(t)}setStrikethroughOffset(t){return this.style.setStrikethroughOffset(t)}setWrapMode(t){return this.style.setWrapMode(t)}setWrapWidth(t){return this.style.setWrapWidth(t)}setWordWrapWidth(t){return this.style.setWrapWidth(t)}setAlign(t){return this.style.setHAlign(t)}setHAlign(t){return this.style.setHAlign(t)}setVAlign(t){return this.style.setVAlign(t)}get lineSpacing(){return this.style.lineSpacing}set lineSpacing(t){this.style.lineSpacing=t}setLineSpacing(t){return this.style.lineSpacing=t,this.updateText(!0),this}setXOffset(t){return this.style.setXOffset(t)}setMaxLines(t){return this.style.setMaxLines(t)}setResolution(t){return this.style.setResolution(t)}getTextMetrics(){return this.style.getTextMetrics()}setTextMetrics(t,e){return this.style.setTextMetrics(t,e)}measureTextMargins(t,e){return function(t,e,i){void 0===i&&(i={});var s=Wc.create(this),r=s.getContext("2d",{willReadFrequently:!0});t.syncFont(s,r);var n=r.measureText(e),a=Math.ceil(n.width*t.baselineX),h=a,o=2*h;if(h=h*t.baselineY|0,s.width=a,s.height=o,r.fillStyle="#f00",r.fillRect(0,0,a,o),r.font=t._font,r.textBaseline="alphabetic",r.fillStyle="#000",r.fillText(t.testString,0,h),i.left=0,0===a||0===o||!r.getImageData(0,0,a,o))return Wc.remove(s),i;for(var l=r.getImageData(0,0,a,o).data,d=!1,c=0;c=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const _=Phaser.Math.DegToRad;var T={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=_(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},k={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=O(t.scaleX,i.scaleX),e.scaleY=O(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},E={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},M={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=O(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},L={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},D={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},A={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(t){void 0===t&&(t=!1);var e=this;return this._mask=null,this.setChildMaskVisible(this),this.children.forEach((function(t){t.clearMask&&t.clearMask(!1),t.hasOwnProperty("isRexContainerLite")||e.setChildMaskVisible(t)})),t&&this.mask&&this.mask.destroy(),this}},Y=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},W=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const F=Phaser.Utils.Array;var I={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},ke=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const Ee=/(\S+)\[(\d+)\]/i,Me=Phaser.Utils.Objects.GetValue;var Re=function(t,e){return void 0===e?t:t[e]},Le=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Me(e,"left",0),t.right=Me(e,"right",0),t.top=Me(e,"top",0),t.bottom=Me(e,"bottom",0)),t},De={getInnerPadding(t){return Re(this.space,t)},setInnerPadding(t,e){return Le(this.space,t,e),this},getOuterPadding(t){return Re(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Le(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Re(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Le(this.getSizerConfig(t).padding,e,i),this}},Ae=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Ye=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Xe=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},ze=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},We=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},je=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Fe={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Ie=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?mi:fi,this.repeatCounter=0,this}stop(){return this.state=gi,this}update(t,e){this.state!==gi&&this.state!==bi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=yi)):(this.nowTime=this.duration,this.state=bi):this.nowTime>=0&&(this.state=mi))}get t(){var t;switch(this.state){case gi:case fi:case yi:t=0;break;case mi:t=this.nowTime/this.duration;break;case bi:t=1}return pi(t,0,1)}set t(t){(t=pi(t,-1,1))<0?(this.state=fi,this.nowTime=-this.delay*t):(this.state=mi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===gi}get isDelay(){return this.state===fi}get isCountDown(){return this.state===mi}get isRunning(){return this.state===fi||this.state===mi}get isDone(){return this.state===bi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const gi=0,fi=1,mi=2,yi=3,bi=-1;class xi extends di{constructor(t,e){super(t,e),this.timer=new vi}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const wi=Phaser.Utils.Objects.GetValue,Si=Phaser.Utils.Objects.GetAdvancedValue,Ci=Phaser.Tweens.Builders.GetEaseFunction;class Oi extends xi{resetFromJSON(t){return this.timer.resetFromJSON(wi(t,"timer")),this.setEnable(wi(t,"enable",!0)),this.setTarget(wi(t,"target",this.parent)),this.setDelay(Si(t,"delay",0)),this.setDuration(Si(t,"duration",1e3)),this.setEase(wi(t,"ease","Linear")),this.setRepeat(wi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Ci(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Pi=Phaser.Utils.Objects.GetValue,_i=Phaser.Utils.Objects.GetAdvancedValue,Ti=Phaser.Math.Linear;let ki=class extends Oi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Pi(t,"mode",0)),this.setScaleRange(_i(t,"start",void 0),_i(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ei[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=_i(t,"x",this.parent.scaleX),this.startY=_i(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=_i(e,"x",void 0),this.endY=_i(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Ti(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Ti(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const Ei={stop:0,destroy:1,yoyo:2};var Mi=function(t,e,i,s,r){var n,a;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},a={x:t.scaleX};break;case 1:case"y":n={y:0},a={y:t.scaleY};break;default:n=0,a=t.scale}var h={mode:0,start:n,end:a,duration:e,ease:s};return void 0===r?r=new ki(t,h):r.resetFromJSON(h),r.restart(),r},Ri=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof ki&&(n=r,r=void 0),void 0===r&&(r=!0);var a={};switch(a.mode=r?1:0,i){case 0:case"x":a.end={x:0};break;case 1:case"y":a.end={y:0};break;default:a.end=0}return a.duration=e,a.ease=s,void 0===n?n=new ki(t,a):n.resetFromJSON(a),n.restart(),n},Li=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Di=function(t){return Li(t,"complete")};const Ai=Phaser.Utils.Objects.IsPlainObject;var Yi={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Ai(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Mi(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Di(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Ai(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Ri(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Di(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Di(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Ai(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var a=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,a){var h,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":h={x:t.scaleX},o={x:i};break;case 1:case"y":h={y:t.scaleX},o={y:i};break;default:h=t.scaleX,o=i}var l={mode:2,start:h,end:o,duration:e/2,ease:n,repeat:s};return void 0===a?a=new ki(t,l):a.resetFromJSON(l),a.restart(),a}(this,t,e,i,s,r,this._scaleBehavior),a&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Di(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Xi={};Object.assign(Xi,Yi),Xi.onInitScale=function(){Yi.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=xe.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const zi=Phaser.Utils.Objects.GetValue,Wi=Phaser.Utils.Objects.GetAdvancedValue,ji=Phaser.Math.Linear;class Fi extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(zi(t,"mode",0)),this.setAlphaRange(Wi(t,"start",this.parent.alpha),Wi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ii[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=ji(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ii={stop:0,destroy:1,yoyo:2},Bi=Phaser.Utils.Objects.IsPlainObject;var Hi=function(t,e,i,s){var r,n;Bi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var a={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Fi(t,a):s.resetFromJSON(a),s.restart(),s},Ni=function(t,e,i,s){i instanceof Fi&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Fi(t,r):s.resetFromJSON(r),s.restart(),s};const Gi=Phaser.Utils.Objects.IsPlainObject;var Vi={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Gi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Hi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Di(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Gi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Ni(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Di(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Di(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Ui={};Object.assign(Ui,Vi),Ui.onInitFade=function(){Vi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=xe.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const $i=Phaser.Utils.Objects.GetValue,Ji=Phaser.Utils.Objects.GetAdvancedValue,Ki=Phaser.Math.Linear;class qi extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode($i(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ji(t,"x",void 0),i=Ji(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Zi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Ji(i,"startX",void 0),this.startY=Ji(i,"startY",void 0),this.endX=Ji(i,"endX",void 0),this.endY=Ji(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Ki(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ki(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Zi={stop:0,destroy:1,yoyo:2};var Qi=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const ts=Phaser.Utils.Objects.IsPlainObject,es=Phaser.Math.Distance.Between;var is={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(ts(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*es(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var a=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,a){n instanceof qi&&(a=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=Qi(i,t.x),h.endX=t.x),void 0!==s&&(h.startY=Qi(s,t.y),h.endY=t.y),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===a?a=new qi(t,h):a.resetFromJSON(h),a.restart(),a}(this,t,e,i,s,r,this._easeMove),a&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Di(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Di(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(ts(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*es(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var a=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,a){n instanceof qi&&(a=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=t.x,h.endX=Qi(i,t.x)),void 0!==s&&(h.startY=t.y,h.endY=Qi(s,t.y)),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===a?a=new qi(t,h):a.resetFromJSON(h),a.restart(),a}(this,t,e,i,s,r,this._easeMove),a&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Di(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Di(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},ss={};Object.assign(ss,is),ss.onInitEaseMove=function(){is.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=xe.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const rs=Phaser.Utils.Objects.GetValue;class ns extends hi{constructor(t,e){super(t,e),this.timer=new vi,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(rs(t,"timer")),this.setEnable(rs(t,"enable",!0)),this.setMode(rs(t,"mode",1)),this.isRunning=rs(t,"isRunning",!1),this.setMagnitudeMode(rs(t,"magnitudeMode",1)),this.setAxisMode(rs(t,"axis",0)),this.setDuration(rs(t,"duration",500)),this.setMagnitude(rs(t,"magnitude",10)),this.ox=rs(t,"ox",void 0),this.oy=rs(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=as[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=os[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=hs[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=rs(i,"magnitude",void 0),t=rs(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,a=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=a;break;default:i.x=n,i.y=a}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const as={effect:0,behavior:1},hs={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},os={constant:0,decay:1},ls=Phaser.Utils.Objects.IsPlainObject;var ds={shake(t,e,i){if(ls(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new ns(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Di(this._shake)}};const cs=Phaser.Utils.Objects.GetValue,us=Phaser.Math.Linear;class ps extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=cs(t,"key","value");var i=e[this.propertyKey];return this.fromValue=cs(t,"from",i),this.toValue=cs(t,"to",i),this.setEase(cs(t,"ease",this.ease)),this.setDuration(cs(t,"duration",this.duration)),this.setRepeat(cs(t,"repeat",0)),this.setDelay(cs(t,"delay",0)),this.setRepeatDelay(cs(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=us(this.fromValue,this.toValue,i)}}const vs=Phaser.Utils.Objects.IsPlainObject;class gs extends ii{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new ps(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(vs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(vs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var fs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new gs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Li(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},ms=Phaser.Utils.Array.Remove,ys={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var Ds={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=qe(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},As={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=zt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=zt),this.transitOutCallback=t,this}},Ys={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},Xs={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},zs={};Object.assign(zs,Ds,As,Ys,Xs);const Ws=Phaser.Utils.Objects.GetValue;class js extends ii{constructor(t,e){super(t,e),this.setTransitInTime(Ws(e,"duration.in",200)),this.setTransitOutTime(Ws(e,"duration.out",200)),this.setTransitInCallback(Ws(e,"transitIn")),this.setTransitOutCallback(Ws(e,"transitOut")),this.oneShotMode=Ws(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Ls(this,{eventEmitter:!1,initState:Ws(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(js.prototype,zs);var Fs=function(t){if(t.parentContainer)return Fs(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?Fs(e):t};class Is extends ii{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Fs(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,a=1/i.zoom,h=r/2,o=n/2,l=r*a,d=n*a;e.x===h&&e.y===o||e.setPosition(h,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Bs=Phaser.GameObjects.Rectangle;class Hs extends Bs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Is(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Ns=Phaser.Utils.Objects.GetValue;class Gs extends ii{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Ns(t,"hitAreaMode",0)),this.setEnable(Ns(t,"enable",!0)),this.setStopMode(Ns(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Vs[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Vs={default:0,fullWindow:1};const Us=Phaser.Utils.Objects.GetValue;class $s extends Hs{constructor(t,e){super(t,Us(e,"color",0),Us(e,"alpha",.8)),this.touchEventStop=new Gs(this,{hitAreaMode:1})}}var Js={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Mi(t,e)},scaleDown(t,e){Ri(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Hi(t,e)},fadeOut(t,e){Ni(t,e,!1)}},Ks=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Hi(t,e,t.alpha)},qs=function(t,e){Ni(t,e,!1)},Zs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!nt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Qs=Phaser.Utils.Objects.GetValue;let tr=class extends js{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=er.popUp),null==e.transitOut&&(e.transitOut=er.scaleDown),e.destroy=Qs(e,"destroy",!0),super(t,e);var i=Qs(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new $s(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Qs(i,"transitIn",Ks)),this.setCoverTransitOutCallback(Qs(i,"transitOut",qs)));var s=Qs(e,"touchOutsideClose",!1),r=Qs(e,"duration.hold",-1),n=Qs(e,"timeOutClose",r>=0),a=Qs(e,"anyTouchClose",!1);Qs(e,"manualClose",!1)&&(s=!1,a=!1,n=!1),a&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),a?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Qs(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Zs(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=er[t]),t){case er.popUp:t=Js.popUp;break;case er.fadeIn:t=Js.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=er[t]),t){case er.scaleDown:t=Js.scaleDown;break;case er.fadeOut:t=Js.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const er={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var ir=function(t){return t&&"function"==typeof t},sr={modal(t,e){return ir(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new tr(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},rr=function(t,e,i,s,r){ir(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},nr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return rr.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return rr.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return rr.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return rr.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return rr.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return rr.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return rr.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return rr.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return rr.call(this,"shutdown",t,e,i,s),this}},ar=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=hr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},hr={},or=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,a=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return a?Zs(t,e.x,e.y,i,s):!!(r=ar(e,n,!0))&&Zs(t,r.x,r.y,i,s);for(var h=t.scene.input.manager,o=h.pointersTotal,l=h.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const br={press:0,pointerdown:0,release:1,pointerup:1};var xr={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new yr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},wr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!Sr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,a=n.pointersTotal,h=n.pointers,o=0;o0)return Cr.length=0,!0;return Cr.length=0,!1},Cr=[];const Or=Phaser.Utils.Objects.GetValue;class Pr extends ii{constructor(t,e){super(t,e),this._enable=void 0;var i=Or(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Or(t,"enable",!0)),this.setMode(Or(t,"mode",1)),this.setClickInterval(Or(t,"clickInterval",100)),this.setDragThreshold(Or(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=_r[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?wr:or)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const _r={press:0,pointerdown:0,release:1,pointerup:1};var Tr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Pr(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class kr extends Rs{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Er=Phaser.Utils.Objects.GetValue;class Mr extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new kr,this.parent.setInteractive(Er(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Er(t,"enable",!0)),this.setCooldown(Er(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Rr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&or(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Mr(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Mr(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Lr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Dr=function(t,e,i,s){if("parent"===t){for(var r,n=0,a=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Jr,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Kr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Jr,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=qr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&or(t,s,e,i)}}const Jr=0,Kr=1,qr="IDLE",Zr=Phaser.Utils.Objects.GetValue,Qr=Phaser.Math.Distance.Between;class tn extends $r{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=en},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Zr(t,"time",250)),this.setTapInterval(Zr(t,"tapInterval",200)),this.setDragThreshold(Zr(t,"threshold",9)),this.setTapOffset(Zr(t,"tapOffset",10));var e=Zr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Zr(t,"maxTaps",void 0)),this.setMinTaps(Zr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case en:this.state=sn;break;case sn:var t=this.lastPointer;Qr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=rn,this.state=sn);break;case rn:this.state=sn}}onDragEnd(){this.state===sn&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=rn))}onDrag(){this.state!==en&&this.pointer.getDistance()>this.dragThreshold&&(this.state=en)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===sn){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=en):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=rn:this.state=en)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===rn&&(this.state=en)}get isTapped(){return this.state===rn}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const en="IDLE",sn="BEGIN",rn="RECOGNIZED",nn=Phaser.Utils.Objects.GetValue;class an extends $r{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=hn},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(nn(t,"threshold",9)),this.setHoldTime(nn(t,"time",251)),this}onDragStart(){this.state=on,0===this.holdTime&&(this.state=ln)}onDragEnd(){this.state=hn}onDrag(){this.state!==hn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=hn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===on&&t-this.pointer.downTime>=this.holdTime&&(this.state=ln)}get isPressed(){return this.state===ln}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const hn="IDLE",on="BEGIN",ln="RECOGNIZED";Phaser.Utils.Objects.GetValue;var dn=function(t){return ti(t).loop.delta};const cn=Phaser.Math.Distance.Between,un=Phaser.Math.Angle.Between;var pn={getDt:function(){return dn(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return cn(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return un(e.x,e.y,t.x,t.y)}},vn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},gn={};const fn=Phaser.Utils.Objects.GetValue,mn=Phaser.Math.RadToDeg;class yn extends $r{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=bn},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(fn(t,"threshold",10)),this.setVelocityThreshold(fn(t,"velocityThreshold",1e3)),this.setDirectionMode(fn(t,"dir","8dir")),this}onDragStart(){this.state=xn}onDragEnd(){this.state=bn}onDrag(){this.state===xn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=wn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===wn&&(this.state=bn)}get isSwiped(){return this.state===wn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=vn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=gn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(mn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(yn.prototype,pn);const bn="IDLE",xn="BEGIN",wn="RECOGNIZED",Sn=Phaser.Utils.Objects.GetValue,Cn=Phaser.Utils.Array.SpliceOne,On=Phaser.Math.Distance.Between,Pn=Phaser.Math.Angle.Between;class _n{constructor(t,e){var i=qe(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(Sn(e,"inputConfig",void 0)),this.setEventEmitter(Sn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(Sn(t,"enable",!0)),this.bounds=Sn(t,"bounds",void 0),this.tracerState=kn,this.pointers.length=0,ft(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,ft(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case kn:this.tracerState=En,this.onDrag1Start();break;case En:this.tracerState=Mn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],Cn(this.pointers,e),this.tracerState){case En:this.tracerState=kn,this.onDrag1End();break;case Mn:this.tracerState=En,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case En:this.onDrag1();break;case Mn:this.onDrag2()}}}dragCancel(){return this.tracerState===Mn&&this.onDrag2End(),this.pointers.length=0,ft(this.movedState),this.tracerState=kn,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0],e=this.pointers[1];return On(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0],e=this.pointers[1];return Pn(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Tn.x=e.x-i.x,Tn.y=e.y-i.y}else Tn.x=0,Tn.y=0;return Tn}get centerX(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Mn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Mn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Mn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Rn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&or(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&or(t,s,e,i)}}Object.assign(_n.prototype,$e);var Tn={};const kn=0,En=1,Mn=2,Rn="IDLE";Phaser.Utils.Objects.GetValue;const Ln=Phaser.Math.RotateAround;var Dn=function(t,e,i,s){return Ln(t,e,i,s),t.rotation+=s,t},An={};const Yn=Phaser.Utils.Objects.GetValue,Xn=Phaser.Math.Angle.WrapDegrees,zn=Phaser.Math.Angle.ShortestBetween,Wn=Phaser.Math.RadToDeg,jn=Phaser.Math.DegToRad;var Fn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=An),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,a=r.y,h=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Xn(Wn(this.angleBetween));this.angle=zn(this.prevAngle,t),this.prevAngle=t,this.state=Hn}break;case Hn:t=Xn(Wn(this.angleBetween)),this.angle=zn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Hn}get rotation(){return jn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Fn);const In="IDLE",Bn="BEGIN",Hn="RECOGNIZED",Nn=Phaser.Utils.Objects.GetValue;var Gn=function(t){var e=Nn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new tn(this,e),this._tap.on("tap",(function(t,e,s){Ar(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Ar(i.eventEmitter,`${i.eventNamePrefix}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Vn=Phaser.Utils.Objects.GetValue;var Un=function(t){var e=Vn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new an(this,e),this._press.on("pressstart",(function(t,e,s){Ar(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this).on("pressend",(function(t,e,s){Ar(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const $n=Phaser.Utils.Objects.GetValue;var Jn=function(t){var e=$n(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new yn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Ar(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Ar(i.eventEmitter,`${i.eventNamePrefix}swipe`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Kn=Phaser.Utils.Objects.GetValue;var qn=function(t,e){return t.setInteractive(),Kn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Kn(e,"targets",[t]),targetMode:Kn(e,"targetMode","parent"),eventEmitter:Kn(e,"eventEmitter",t),eventNamePrefix:Kn(e,"inputEventPrefix","child.")},Xr.call(t,e),jr.call(t,e),Br.call(t,e),Vr.call(t,e),Gn.call(t,e),Un.call(t,e),Jn.call(t,e),t},Zn={getSizerConfig:function(t){return void 0===t&&(t=this),Mt(t)},getChildPrevState:function(t){var e=Mt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Dt(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,a,h=t.scene;if("number"==typeof e)i=e;else{i=oe(e,"color"),s=oe(e,"lineWidth");var o=oe(e,"name",!1);o&&(r=oe(o,"createTextCallback",ce),n=oe(o,"createTextCallbackScope",void 0),"string"==typeof(a=oe(o,"align","left-top"))&&(a=Xt[a]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new le(h),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}var d,c,u=this.getAllShownChildren([this]);ue(u,u);for(var p=0,v=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=a)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=a+1),r};const ha=Phaser.Utils.Objects.IsPlainObject,oa=Phaser.Utils.Objects.GetValue,la=Phaser.Display.Align.CENTER,da={min:0,full:-1};var ca=function(t,e,i,s,r,n,a,h,o,l){var d,c,u,p;me.call(this,t);var v=t.isRexSpace,g=typeof e;if(null===e)return this;if("number"===g);else if("string"===g)e=da[e];else if(ha(e)){var f;e=oa(f=e,"proportion",void 0),i=oa(f,"align",la),s=oa(f,"padding",0),r=oa(f,"expand",!1),n=oa(f,"key",void 0),a=oa(f,"index",void 0),t.isRexSizer||(h=oa(f,"minWidth",void 0),o=oa(f,"minHeight",void 0)),l=oa(f,"fitRatio",0),d=oa(f,"offsetX",0),c=oa(f,"offsetY",0),u=oa(f,"offsetOriginX",0),p=oa(f,"offsetOriginY",0)}return"string"==typeof i&&(i=Xt[i]),void 0===e&&(e=v?1:0),void 0===i&&(i=la),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===h&&(v?h=0:t.isRexSizer||(h=t._minWidth)),void 0===o&&(v?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),(f=this.getSizerConfig(t)).proportion=e,f.align=i,f.padding=ge(s),f.expand=r,f.fitRatio=0===e?l:0,f.alignOffsetX=d,f.alignOffsetY=c,f.alignOffsetOriginX=u,f.alignOffsetOriginY=p,void 0===a||a>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(a,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===h?Q(t):h:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=h)),void 0!==n&&this.addChildrenMap(n,t),this},ua={add:ca,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),ca.call(this,new na(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,h){return ha(i)&&(i.index=t),ca.call(this,e,i,s,r,n,a,t,h),this},insertAtPosition(t,e,i,s,r,n,a,h,o){var l=aa.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,h,o),this}};const pa=Et.prototype.clear;var va=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),pa.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,va.call(this,t),this}},ma={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=Xt[e]),this.getSizerConfig(t).align=e,this}},ya={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},ba={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},xa={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},wa={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,h=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=h.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,a+=n)));else for(d=0,c=h.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,a+=n)))}return o?void 0:a+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,a=s.padding;i=n-(a.left+a.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,a=s.padding;i=n-(a.top+a.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Ne(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Ie.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,h,o,l,d,c,u=this.sizerChildren,p=this.innerLeft,v=this.innerTop,g=this.innerWidth,f=this.innerHeight,m=p,y=v,b=this.startChildIndex,x=0,w=u.length;x0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=ze.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Ye.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&sa.call(this,t,void 0),Xe.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||We.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&sa.call(this,void 0,t),je.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],a=n&&n.isRexSpace;return"center"===t?a||this.insertSpace(r+1):a&&this.remove(n,!0),this}};Object.assign(wa,ua,fa,ma,ya,ba,xa);var Sa=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},Ca={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},Oa=function(t){return"string"==typeof t&&(t=Ca[t]),t};const Pa=Phaser.Utils.Objects.IsPlainObject,_a=Phaser.Utils.Objects.GetValue;class Ta extends ta{constructor(t,e,i,s,r,n,a){Pa(e)?(e=_a(a=e,"x",0),i=_a(a,"y",0),s=_a(a,"width",void 0),r=_a(a,"height",void 0),n=_a(a,"orientation",0)):Pa(s)?(s=_a(a=s,"width",void 0),r=_a(a,"height",void 0),n=_a(a,"orientation",0)):Pa(n)&&(n=_a(a=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,a),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(_a(a,"space.item",0)),this.setStartChildIndex(_a(a,"startChildIndex",0)),this.setRTL(_a(a,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=Oa(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=Sa.call(this)),this._childrenProportion}}Object.assign(Ta.prototype,wa);var ka=function(t){return class extends t{get isTree(){return!1}get isNode(){return!1}setText(t){return this.text=t,this}get text(){return this.nodeBody.text}set text(t){var e=this.nodeBody;e.setText&&e.setText(t)}setTexture(t,e){var i=this.nodeBody;return i.setTexture&&i.setTexture(t,e),this}get texture(){var t=this.nodeBody;if(t)return t.texture}get frame(){var t=this.nodeBody;if(t)return t.frame}}};class Ea extends js{constructor(t,e){void 0===e&&(e={}),e.destroy=!1,super(t,e)}onOpen(){this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.parent,this),super.onClose()}}var Ma={expand(t){if(!0===this.expanded)return this;void 0===t&&(t=this.transitionDuration),this.expanded=!0;var e=this.childrenMap.title,i=this.childrenMap.child;return this.show(i),this.reLayoutEnable&&(this.reLayoutTarget?this.reLayoutTarget:this.getTopmostSizer()).layout(),e.emit("folder.expand",t,this),i.emit("folder.expand",t,this),this.emit("expand.start",this),this.childTransition.once("open",(function(){this.emit("expand.complete",this)}),this).requestOpen(null,t),this},collapse(t){if(!1===this.expanded)return this;void 0===t&&(t=this.transitionDuration),this.expanded=!1;var e=this.childrenMap.title,i=this.childrenMap.child;return e.emit("folder.collapse",t,this),i.emit("folder.collapse",t,this),this.emit("collapse.start",this),this.childTransition.once("close",(function(){this.setChildScale(i,1,1).hide(i),this.reLayoutEnable&&(this.reLayoutTarget?this.reLayoutTarget:this.getTopmostSizer()).layout(),this.emit("collapse.complete",this)}),this).requestClose(null,t),this},toggle(t){return this.expanded?this.collapse(t):this.expand(t),this},setExpandedState(t){return this.reLayoutEnable=!1,void 0===t?this.expanded=void 0:t?this.expand(0):this.collapse(0),this.reLayoutEnable=!0,this}},Ra=function(t,e){Xi.popUp.call(t,e,this.expandDirection)},La=function(t,e){Xi.scaleDown.call(t,e,this.expandDirection)},Da={setTransitionDuration(t){return this.transitionDuration=t,this.childTransition.setTransitInTime(t).setTransitOutTime(t),this},setExpandCallback(t){return void 0===t&&(t=Ra.bind(this)),this.childTransition.setTransitInCallback(t),this},setCollapseCallback(t){return void 0===t&&(t=La.bind(this)),this.childTransition.setTransitOutCallback(t),this}};const Aa=Phaser.Utils.Objects.GetValue;class Ya extends Ta{constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("orientation")||(e.orientation=1),super(t,e),this.type="rexFolder",this.reLayoutEnable=!0,this.expanded=void 0,this.expandDirection=1===this.orientation?"y":"x";var i=e.background,s=e.title,r=e.child;i&&this.addBackground(i);var n=Aa(e,"space"),a=1===this.orientation?"left":"top",h=Aa(e,"align.title",a),o=Aa(e,"expand.title",!0);this.add(s,{proportion:0,align:h,expand:o,padding:{left:Aa(n,"titleLeft",0),right:Aa(n,"titleRight",0),top:Aa(n,"titleTop",0),bottom:Aa(n,"titleBottom",0)}});var l=Aa(e,"toggleByTarget",void 0),d=Aa(e,"toggleClickConfig");if(void 0===l&&(l=s),l&&xr.onClick.call(l,(function(){this.toggle()}),this,d),this.childTransition=new Ea(r),!Aa(e,"customChildOrigin",!1)){var c=this.rtl?1:0;r.setOrigin(c)}h=Aa(e,"align.child","left");var u=(o=Aa(e,"expand.child",!0))?1:0;this.add(r,{proportion:u,align:h,expand:o,padding:{left:Aa(n,"childLeft",0),right:Aa(n,"childRight",0),top:Aa(n,"childTop",0),bottom:Aa(n,"childBottom",0)}}),this.addChildrenMap("title",s),this.addChildrenMap("child",r),this.addChildrenMap("background",i);var p=e.transition;this.setTransitionDuration(Aa(p,"duration",200)),this.setExpandCallback(Aa(p,"expandCallback",void 0)),this.setCollapseCallback(Aa(p,"collapseCallback",void 0)),this.reLayoutTarget=Aa(e,"reLayoutTarget",void 0);var v=e.onExpandStart;v&&this.on("expand.start",v);var g=e.onExpandComplete;g&&this.on("expand.complete",g);var f=e.onCollapseStart;f&&this.on("collapse.start",f);var m=e.onCollapseComplete;m&&this.on("collapse.complete",m);var y=Aa(e,"expanded",void 0);void 0!==y&&this.setExpandedState(y)}}Object.assign(Ya.prototype,Ma,Da);var Xa={getTreePatent(t){if(void 0===t&&(t=this),t.rexSizer)return t.rexSizer.treeParent},getTreeRoot(t){var e;for(void 0===t&&(t=this);;){if(!t.rexSizer)return;if(null===(e=t.rexSizer.treeParent))return t;t=e}},getTreesSizer(t){var e=this.getTreeRoot(t);return e?e.getParentSizer():null},isGrandsonNode(t){if(void 0===t||!t.rexSizer)return!1;for(var e;;){if(!t.rexSizer)return!1;if((e=t.rexSizer.treeParent)===this)return!0;if(null===e)return!1;t=e}return!1}},za=function(t,e,i,s,r=!1){var n;return bt(e)?(n=e,delete e[key]):ir(e)?(n=e(t,i))&&t.add.existing(n):(r||e)&&s&&(n=s(t,e,i)),n},Wa=Phaser.Renderer.WebGL.Utils,ja=function(t,e,i,s,r,n){for(var a=Wa.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),h=i.pathData,o=i.pathIndexes,l=0;l>>16,h=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+a+","+h+","+o+","+n+")"},Na=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,a=(16711680&r)>>>16,h=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+a+","+h+","+o+","+n+")",t.lineWidth=e.lineWidth};const Ga=Phaser.Renderer.Canvas.SetTransform;var Va={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Ba(e,i,s),a=r.calcMatrix.copyFrom(n.calc),h=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&ja(r,a,e,l,h,o),e.isStroked&&Ia(r,e,l,h,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(Ga(t,r,e,i,s)){var n=e._displayOriginX,a=e._displayOriginY,h=e.pathData,o=h.length-1,l=h[0]-n,d=h[1]-a;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign($a.prototype,Va);const Ja=Phaser.Utils.Objects.GetValue;let Ka=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=Ja(t,"x",0),i=Ja(t,"y",0));var s=this.cornerRadius;s.tl=qa(Ja(t,"tl",void 0),e,i),s.tr=qa(Ja(t,"tr",void 0),e,i),s.bl=qa(Ja(t,"bl",void 0),e,i),s.br=qa(Ja(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Za(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Za(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Za(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Za(this.cornerRadius.br,t)}};var qa=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Qa(t),t},Za=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Ja(e,"x",0),t.y=Ja(e,"y",0)),Qa(t)},Qa=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},th=function(t){return t.x>0&&t.y>0},eh=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const ih=Phaser.Math.DegToRad;var sh=function(t,e,i,s,r,n,a,h,o){a&&n>r?n-=360:!a&&n0,a=0,h=e.length;a=0?t.startAt(a+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(a+n,i):t.startAt(a,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(a,i),t.close(),t};const ro=Phaser.Utils.Objects.GetValue,no=Phaser.Utils.Objects.IsPlainObject;class ao extends(Mh(Sh)){constructor(t,e,i,s,r,n,a,h){no(e)?(e=(h=e).x,i=h.y,s=h.width,r=h.height,n=h.barColor,a=h.value):no(s)?(s=(h=s).width,r=h.height,n=h.barColor,a=h.value):no(n)&&(n=(h=n).barColor,a=h.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===a&&(a=0),super(t,e,i,s,r,h),this.type="rexLineProgress",this.bootProgressBase(h),this.addShape((new io).setName("trackFill")).addShape((new io).setName("bar")).addShape((new io).setName("trackStroke")),this.setTrackColor(ro(h,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(ro(h,"trackStrokeThickness",2),ro(h,"trackStrokeColor",void 0)),this.setSkewX(ro(h,"skewX",0)),this.setRTL(ro(h,"rtl",!1)),this.setValue(a)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var ho={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&so(s,0,0,e,i,t);var r,n,a=this.getShape("bar");a.fillStyle(this.barColor),a.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),so(a,r,0,n,i,t));var h=this.getShape("trackStroke");h.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),h.isStroked&&so(h,0,0,e,i,t)}};Object.assign(ao.prototype,ho);var oo=function(t){return null==t||""===t||0===t.length},lo=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(oo(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(oo(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,a=e.length;nko(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=ko(t[i]));return e}const Eo=Phaser.Utils.Objects.IsPlainObject,Mo=Phaser.Utils.Objects.GetValue;var Ro=function(t){return"string"==typeof t&&(t=Lo[t]),t};const Lo={scale:0,repeat:1};var Do=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},Ao={_beginDraw:zt,_drawImage:zt,_drawTileSprite:zt,_endDraw:zt,setGetFrameNameCallback:function(t){return void 0===t&&(t=To),this.getFrameNameCallback=t,this},setBaseTexture:function(t,e,i,s){Array.isArray(e)&&(s=i,i=e,e=void 0),null==e&&(e="__BASE"),"number"==typeof i&&arguments.length>=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=ko(i),s=ko(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),a=n.width,h=0,o=0,l=i.length;o0?a/h:0,c=n.height,u=0;for(o=0,l=s.length;o0?0:g,b=0,o=0;for(var C=i.length;o0?0:f),f>=1&&g>=1){var O=typeof(m=this.getFrameNameCallback(o,w,e));"string"!==O&&"number"!==O||r.add(m,0,b+n.cutX,x+n.cutY,f,g)}b+=f}x+=g}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,a,h,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/o,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(u,p);if(u>v){var g=(u-v)*o;d>=0?d+=g:d=g,u=v}if(p>v){var f=(p-v)*l;c>=0?c+=f:c=f,p=v}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,x=this.rows.count;b0&&h>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(w,b)?0:1)?this._drawImage(this.textureKey,s,m,y,a,h):this._drawTileSprite(this.textureKey,s,m,y,a,h)),m+=a;y+=h}this._endDraw()},setStretchMode:function(t){return Eo(t)?(this.stretchMode.edge=Ro(Mo(t,"edge",0)),this.stretchMode.internal=Ro(Mo(t,"internal",0))):(t=Ro(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Do.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const Yo=Phaser.Utils.Objects.IsPlainObject,Xo=Phaser.Utils.Objects.GetValue,zo=Phaser.GameObjects;var Wo=void 0,jo=function(t,e){if(Wo||(Wo={},ti(t).events.once("destroy",(function(){for(var t in Wo)Wo[t].destroy();Wo=void 0}))),!Wo.hasOwnProperty(e)){var i=ti(t).scene.systemScene;(t=new zo[e](i)).setOrigin(0),Wo[e]=t}return Wo[e]};const Fo=Phaser.GameObjects.RenderTexture;class Io extends(function(t,e){class i extends t{constructor(t,i,s,r,n,a,h,o,l,d){if(Yo(i)?(i=Xo(d=i,"x",0),s=Xo(d,"y",0),r=Xo(d,"width",1),n=Xo(d,"height",1),a=Xo(d,"key",void 0),h=Xo(d,"baseFrame",void 0),o=Xo(d,"columns",void 0),l=Xo(d,"rows",void 0)):Yo(r)?(r=Xo(d=r,"width",1),n=Xo(d,"height",1),a=Xo(d,"key",void 0),h=Xo(d,"baseFrame",void 0),o=Xo(d,"columns",void 0),l=Xo(d,"rows",void 0)):Yo(a)?(a=Xo(d=a,"key",void 0),h=Xo(d,"baseFrame",void 0),o=Xo(d,"columns",void 0),l=Xo(d,"rows",void 0)):Yo(h)?(h=Xo(d=h,"baseFrame",void 0),o=Xo(d,"columns",void 0),l=Xo(d,"rows",void 0)):Array.isArray(h)?(d=l,l=o,o=h,h=Xo(d,"baseFrame",void 0)):Yo(o)&&(o=Xo(d=o,"columns",void 0),l=Xo(d,"rows",void 0)),void 0===h&&(h=Xo(d,"frame",void 0)),void 0===o){var c=Xo(d,"leftWidth",void 0),u=Xo(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=Xo(d,"topHeight",void 0),v=Xo(d,"bottomHeight",void 0);void 0!==p&&void 0!==v&&(l=[p,void 0,v])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(Xo(d,"getFrameNameCallback",void 0)),this.setStretchMode(Xo(d,"stretchMode",0)),this.setPreserveRatio(Xo(d,"preserveRatio",!0));var g=Xo(d,"maxFixedPartScale",1),f=Xo(d,"maxFixedPartScaleX",g),m=Xo(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(a,h,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,Ao),i}(Fo,"rexNinePatch")){}var Bo={_drawImage:function(t,e,i,s,r,n){var a=jo(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(a,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var a=jo(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(a,i,s)}};Object.assign(Io.prototype,Bo);let Ho=class extends ii{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(po(t,e))return t[e];var i=t.parent;return po(i,e)?i[e]:void 0}set(t,e,i){return po(t,e)?t[e]=i:po(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}};const No=Phaser.Utils.Objects.GetValue;class Go extends Io{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=No(e,"effects",!0);i&&yo(this,i),this.style=new Ho(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Go.prototype,vh);const Vo=["alpha","tint","flipX","flipY"];var Uo=function(t,e){if(!e)return t;for(var i=0,s=Vo.length;i0&&r.push(o.join("")),r},yl=0,bl=1,xl=2,wl=0,Sl=1,Cl=2,Ol=/(?:\r\n|\r|\n)/;const Pl={none:wl,word:Sl,char:Cl,character:Cl,mix:3},_l=Phaser.Renderer.WebGL.Utils;var Tl={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,a=r.height,h=_l.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,a,e.x,e.y,n/e.resolution,a/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,a,h(e.tintTopLeft,i.alpha*e._alphaTL),h(e.tintTopRight,i.alpha*e._alphaTR),h(e.tintBottomLeft,i.alpha*e._alphaBL),h(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const kl=Phaser.Display.Color;var El={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,a,h,o,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===a&&(a=0),void 0===h&&(h=0),void 0===o&&(o=c),void 0===l&&(l=u);var p=d.cutX+a,v=d.cutY+h;return this.context.drawImage(d.source.image,p,v,o,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new kl);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var a=i;i=a.red,s=a.green,r=a.blue,n=a.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var h=this.context.createImageData(1,1);return h.data[0]=i,h.data[1]=s,h.data[2]=r,h.data[3]=n,this.context.putImageData(h,t,e),this.dirty=!0,this}},Ml=function(t,e,i,s,r,n,a){var h,o=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===a&&(a=e.height);var d=(h=o.exists(i)?o.get(i):o.createCanvas(i,n,a)).getSourceImage();d.width!==n&&(d.width=n),d.height!==a&&(d.height=a);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,a),c.drawImage(e,s,r,n,a),l.gl&&h&&l.canvasToTexture(d,h.source[0].glTexture,!0,0)},Rl={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,Ml(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};e();const Ll=Phaser.Display.Canvas.CanvasPool,Dl=Phaser.GameObjects.GameObject,Al=Phaser.Utils.String.UUID;class Yl extends Dl{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=Ll.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=Al(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){Ll.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}}const Xl=Phaser.GameObjects.Components;Phaser.Class.mixin(Yl,[Xl.Alpha,Xl.BlendMode,Xl.Crop,Xl.Depth,Xl.Flip,Xl.GetBounds,Xl.Mask,Xl.Origin,Xl.Pipeline,Xl.PostPipeline,Xl.ScrollFactor,Xl.Tint,Xl.Transform,Xl.Visible,Tl,El,Rl]);class zl{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}}Object.assign(zl.prototype,Lh);var Wl={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const jl=Phaser.Math.RotateAround;var Fl;const Il=Phaser.Geom.Rectangle;var Bl,Hl=function(t){void 0===Bl&&(Bl=new Il);var e=t.drawTLX,i=t.drawTLY;return Bl.setTo(e,i,t.drawTRX-e,t.drawBLY-i),Bl};const Nl=Phaser.Math.RotateAround;var Gl,Vl=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Gl&&(Gl={}),s=Gl),s.x=e,s.y=i,0!==t.rotation&&Nl(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const Ul=Phaser.GameObjects.Components.TransformMatrix;var $l,Jl,Kl={},ql=function(t,e,i,s,r){var n=Vl(e,i,s,!0),a=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=Kl);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===$l&&($l=new Ul,Jl=new Ul),t.parentContainer?t.getWorldTransformMatrix($l,Jl):$l.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),$l.transformPoint(r,n,s),s}(t,n.x,n.y,r);return a},Zl=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,a=e.drawCenterY+s;return ql(t,e,n,a,r)},Ql={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Fl&&(Fl={}),s=Fl),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&jl(s,0,0,-i.rotation),s}(t,e,this,!0);return Hl(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return Zl(this.parent,this,t,e,i)}};Object.assign(Ql,Wl);const td=Phaser.Math.DegToRad,ed=Phaser.Math.RadToDeg,id=Phaser.Utils.Objects.GetValue;class sd extends zl{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return ed(this._rotation)}set angle(t){this.rotation=td(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=id(t,"width",void 0),i=id(t,"height",void 0),s=id(t,"scaleX",void 0),r=id(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(sd.prototype,Ql);const rd=Phaser.Utils.String.Pad;var nd=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${rd(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},ad=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const hd=Phaser.Math.DegToRad;var od=function(t){return!t.hasOwnProperty("convex")||t.convex},ld=function(t){return t.x>0&&t.y>0},dd=function(t,e,i,s,r,n,a,h,o){if(h&&a>n?a-=360:!h&&a=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),h=m.tl,ld(h)?(o=h.x*g,l=h.y*f,od(h)?dd(t,o,l,o,l,180,270,!1,a):dd(t,0,0,o,l,90,0,!0,a),d=0,c=l):(t.lineTo(0,0),d=0,c=0),h=m.tr,ld(h)?(o=h.x*g,l=h.y*f,od(h)?dd(t,s-o,l,o,l,270,360,!1,a):dd(t,s,0,o,l,180,90,!0,a)):t.lineTo(s,0),h=m.br,ld(h)?(o=h.x*g,l=h.y*f,od(h)?dd(t,s-o,r-l,o,l,0,90,!1,a):dd(t,s,r,o,l,270,180,!0,a)):t.lineTo(s,r),h=m.bl,ld(h)?(o=h.x*g,l=h.y*f,od(h)?dd(t,o,r-l,o,l,90,180,!1,a):dd(t,0,r,o,l,360,270,!0,a)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,a,u),null!=h)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,h),p.addColorStop(1,d),h=p),e.fillStyle=h,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())},ud=function(t,e,i,s,r,n,a,h){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),cd(t.canvas,t.context,d,d,o,l,r,e,i,s,n,a,h)}};const pd=Phaser.Utils.Objects.GetValue;class vd extends sd{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(pd(e,"color",null),pd(e,"color2",null),pd(e,"horizontalGradient",!0)),this.setStroke(pd(e,"stroke",null),pd(e,"strokeThickness",2)),this.setCornerRadius(pd(e,"cornerRadius",0),pd(e,"cornerIteration",null))}set color(t){t=nd(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=nd(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=nd(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,ad("color2",t,this),ad("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,ad("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,ad("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){ud(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const gd=Phaser.Utils.Objects.GetValue;class fd extends sd{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(gd(e,"color",null),gd(e,"color2",null),gd(e,"horizontalGradient",!0)),this.setStroke(gd(e,"stroke",null),gd(e,"strokeThickness",2))}set color(t){t=nd(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=nd(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=nd(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,gd(t,"color2",null),gd(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,gd(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,a=this.parent.height-i.top-i.bottom,h=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?h.createLinearGradient(0,0,n,0):h.createLinearGradient(0,0,0,a)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,h.fillStyle=t,h.fillRect(s,r,n,a));null!=this.stroke&&this.strokeThickness>0&&(h.strokeStyle=this.stroke,h.lineWidth=this.strokeThickness,h.strokeRect(s,r,n,a))}}const md=Phaser.Utils.Objects.GetValue;let yd=class t{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(md(t,"bold",!1)),this.setItalic(md(t,"italic",!1)),this.setFontSize(md(t,"fontSize","16px")),this.setFontFamily(md(t,"fontFamily","Courier")),this.setColor(md(t,"color","#fff")),this.setStrokeStyle(md(t,"stroke",null),md(t,"strokeThickness",0)),this.setShadow(md(t,"shadowColor",null),md(t,"shadowOffsetX",0),md(t,"shadowOffsetY",0),md(t,"shadowBlur",0)),this.setOffset(md(t,"offsetX",0),md(t,"offsetY",0)),this.setSpace(md(t,"leftSpace",0),md(t,"rightSpace",0)),this.setAlign(md(t,"align",void 0)),this.setBackgroundColor(md(t,"backgroundColor",null)),this.setBackgroundHeight(md(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(md(t,"backgroundBottomY",void 0)),this.setBackgroundLeftX(md(t,"backgroundLeftX",0)),this.setBackgroundRightX(md(t,"backgroundRightX",0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(ad("stroke",t,this),ad("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(ad("shadowOffsetX",t,this),ad("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),t.hasOwnProperty("backgroundLeftX")&&this.setBackgroundLeftX(t.backgroundLeftX),t.hasOwnProperty("backgroundRightX")&&this.setBackgroundRightX(t.backgroundRightX),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new t(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=nd(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=nd(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=nd(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=nd(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setBackgroundLeftX(t){return this.backgroundLeftX=t,this}setBackgroundRightX(t){return this.backgroundRightX=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}};const bd=Phaser.Utils.Array.Remove,xd=Phaser.Utils.Array.Remove,wd="text",Sd="image",Cd="drawer",Od="space",Pd="command";var _d=function(t){return t.type===wd&&"\n"===t.text},Td=function(t){return t.type===wd&&"\f"===t.text},kd=function(t){return t.type===wd};class Ed extends sd{constructor(t,e,i){super(t,wd),this.updateTextFlag=!1,this.style=new yd(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX+e.backgroundLeftX,s=i,r=this.drawTRX+e.backgroundRightX-i+1;if(r>0){var n=e.backgroundBottomY;null==n&&(n=this.drawBLY);var a=e.backgroundHeight;null==a&&(a=n-this.drawTLY);var h=n-a;t.fillRect(s,h,r,a)}}var o=e.hasFill,l=e.hasStroke;(o||l)&&(e.syncFont(t).syncStyle(t),l&&(e.syncShadow(t),t.strokeText(this.text,0,0)),o&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var Md=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const Rd=Phaser.Display.Canvas.CanvasPool;var Ld=function(t,e,i,s,r,n,a,h){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===h&&(h=!1),h&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(a){var l=Rd.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=a,d.fillRect(0,0,r,n),o.drawImage(l,0,0,r,n,i,s,r,n),Rd.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)};Phaser.Display.Canvas.CanvasPool;class Dd extends sd{constructor(t,e,i){super(t,Sd),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){Ld(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class Ad extends sd{constructor(t,e,i,s){super(t,Cd),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class Yd extends sd{constructor(t,e){super(t,Od),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class Xd extends zl{constructor(t,e,i,s,r){super(t,Pd),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}var zd=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const Wd={none:0,word:1,char:2,character:2,mix:3};var jd=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,a=!r&&!n,h=t.length,o=e,l=s.word,d=0,c=!1;o0&&!h){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=Hd.call(this)).height,a=l.ascent,i=Math.floor((o-a)/n))}else{var l;n=(l=Hd.call(this)).height,a=l.ascent}}else this.fixedHeight>0?void 0===(i=Gd(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=Gd(t,"maxLines",0);void 0===a&&(a=n);var d=0===i,c=Gd(t,"wrapMode");void 0===c&&(c=Gd(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=Wd[c]);var u=Gd(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=Gd(t,"letterSpacing",0),v=Gd(t,"hAlign",0),g=Gd(t,"vAlign",0),f=Gd(t,"justifyPercentage",.25),m=zd({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:a,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,b=0,x=y.length;b0&&(E.push({children:M,width:R}),L=Math.max(L,R)),m.start+=k.length,m.isLastPage=!D&&m.start===T,m.maxLineWidth=L,m.linesHeight=E.length*n;var F=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,I=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,a=t.vAlign,h=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(a=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=$d(t,"maxLines",void 0))){var a=this.fixedWidth-r;i=Math.floor(a/n)+1}}else i=$d(t,"maxLines",0);var h=0===i,o=$d(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=$d(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=$d(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=$d(t,"letterSpacing",0),p=$d(t,"rtl",!0),v=$d(t,"hAlign",p?2:0),g=$d(t,"vAlign",0),f=zd({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:o,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(k.push({children:E,height:M}),R=Math.max(R,M)),f.start+=T.length,f.isLastPage=f.start===_,f.maxLineHeight=R,f.linesWidth=k.length*n;var z=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,W=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,a=t.vAlign,h=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}h&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,a=i.bottom;return Le(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||a!=i.bottom,this},getPadding:function(t){return Re(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),bd(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return xd(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(wd);return null===i?i=new Ed(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),Zl(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const bc=Phaser.Utils.Objects.GetFastValue;var xc={};class wc{constructor(t){this.pools=bc(t,"pools",xc)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new yc),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;ei&&(r=Math.floor(i));for(var n={},a=Ec(t,r,e,i,n),h=0;h<=_c&&0!==a;h++){if((r+=a)<0){r=0;break}a=Ec(t,r,e,i,n)}return h===_c&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),Mc(t,e,i),t},kc=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},Ec=function(t,e,i,s,r){var n,a=kc(t,e,r),h=kc(t,e+1,r);if(void 0!==s)if(a.height<=s&&h.height>s)n=0;else{if(a.height>s)return-1;n=Math.floor(s-a.height)}if(a.width<=i&&h.width>i)return 0;if(a.width>i)return-1;var o=Math.floor(i-a.width);return void 0===n?o:Math.min(o,n)},Mc=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const Rc=Phaser.Utils.Objects.GetValue,Lc=Phaser.Utils.Objects.GetValue;class Dc extends Qo{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=Lc(e,"background",void 0),r=Lc(e,"icon",void 0),n=Lc(e,"iconMask",void 0),a=Lc(e,"text",void 0),h=Lc(e,"action",void 0),o=Lc(e,"actionMask",void 0),l=Lc(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(a||h)&&(i={right:Lc(e,"space.icon",0),top:Lc(e,"space.iconTop",0),bottom:Lc(e,"space.iconBottom",0),left:Lc(e,"space.iconLeft",0)}):(a||h)&&(i={bottom:Lc(e,"space.icon",0),left:Lc(e,"space.iconLeft",0),right:Lc(e,"space.iconRight",0),top:Lc(e,"space.iconTop",0)});var d=Lc(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=ol.call(this,r,r,1)),!d){var c=Lc(e,"iconSize",void 0);this.setIconSize(Lc(e,"iconWidth",c),Lc(e,"iconHeight",c))}}if(a){var u=Lc(e,"wrapText",!1),p=Lc(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),function(t,e){switch(pl(t)){case 0:switch("string"==typeof e&&(e=Pl[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=fl;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Pl[e]||0),t.style.wrapMode=e}}(a,u),e.expandTextWidth=!0,Pc(a)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=Rc(e,"minWidth",0),s=Rc(e,"minHeight",0),r=Rc(e,"fitHeight",!1);t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return Tc(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),Tc(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t})}(a,{fitHeight:!0}));var v,g,f=Lc(e,"space.text",0),m=Lc(e,"expandTextWidth",!1),y=Lc(e,"expandTextHeight",!1);0===this.orientation?(v=m?1:0,h&&(i={right:f}),g=y):(v=y?1:0,h&&(i={bottom:f}),g=m),this.add(a,{proportion:v,expand:g,padding:i})}if(h&&(i=0===this.orientation?{top:Lc(e,"space.actionTop",0),bottom:Lc(e,"space.actionBottom",0),right:Lc(e,"space.actionRight",0)}:{left:Lc(e,"space.actionLeft",0),right:Lc(e,"space.actionRight",0),bottom:Lc(e,"space.actionBottom",0)},d=Lc(e,"squareFitAction",!1)?1:0,this.add(h,{proportion:0,padding:i,fitRatio:d}),o&&(o=ol.call(this,h,h,1)),!d)){var b=Lc(e,"actionSize");this.setActionSize(Lc(e,"actionWidth",b),Lc(e,"actionHeight",b))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",a),this.addChildrenMap("action",h),this.addChildrenMap("actionMask",o)}}const Ac=Phaser.GameObjects.Text,Yc=Phaser.Utils.Objects.GetValue;class Xc extends Ac{constructor(t,e){void 0===e&&(e={}),super(t,Yc(e,"x",0),Yc(e,"y",0),Yc(e,"text",""),e),this.type="rexStatesText",e.style=this.style,e.onModifyStyle=function(t,e){var i=e.hasOwnProperty("fontStyle")||e.hasOwnProperty("fontSize")||e.hasOwnProperty("fontFamily");t.style.update(i)},this.addStyleManager(e),delete e.style}}Object.assign(Xc.prototype,vh);var zc=Phaser.Renderer.WebGL.Utils,Wc={renderWebGL:function(t,e,i,s){if(0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,a=r.height,h=zc.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,a,e.x,e.y,n/e.style.resolution,a/e.style.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,a,h(e.tintTopLeft,i.alpha*e._alphaTL),h(e.tintTopRight,i.alpha*e._alphaTR),h(e.tintBottomLeft,i.alpha*e._alphaBL),h(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const jc=Phaser.Display.Canvas.CanvasPool;e();const Fc=Phaser.GameObjects.GameObject;class Ic extends Fc{setStyle(t){return this.style.setStyle(t)}setFont(t){return this.style.setFont(t)}setFontFamily(t){return this.style.setFontFamily(t)}setFontSize(t){return this.style.setFontSize(t)}setFontStyle(t){return this.style.setFontStyle(t)}setTestString(t){return this.style.setTestString(t)}setFixedSize(t,e){return this.style.setFixedSize(t,e)}setBackgroundColor(t,e,i){return this.style.setBackgroundColor(t,e,i)}setBackgroundStrokeColor(t,e){return this.style.setBackgroundStrokeColor(t,e)}setBackgroundCornerRadius(t,e){return this.style.setBackgroundCornerRadius(t,e)}setFill(t){return this.style.setFill(t)}setColor(t){return this.style.setColor(t)}setStroke(t,e){return this.style.setStroke(t,e)}setShadow(t,e,i,s,r,n){return this.style.setShadow(t,e,i,s,r,n)}setShadowOffset(t,e){return this.style.setShadowOffset(t,e)}setShadowColor(t){return this.style.setShadowColor(t)}setShadowBlur(t){return this.style.setShadowBlur(t)}setShadowStroke(t){return this.style.setShadowStroke(t)}setShadowFill(t){return this.style.setShadowFill(t)}setUnderline(t,e,i){return this.style.setUnderline(t,e,i)}setUnderlineColor(t){return this.style.setUnderlineColor(t)}setUnderlineThickness(t){return this.style.setUnderlineThickness(t)}setUnderlineOffset(t){return this.style.setUnderlineOffset(t)}setStrikethrough(t,e,i){return this.style.setStrikethrough(t,e,i)}setStrikethroughColor(t){return this.style.setStrikethroughColor(t)}setStrikethroughThickness(t){return this.style.setStrikethroughThickness(t)}setStrikethroughOffset(t){return this.style.setStrikethroughOffset(t)}setWrapMode(t){return this.style.setWrapMode(t)}setWrapWidth(t){return this.style.setWrapWidth(t)}setWordWrapWidth(t){return this.style.setWrapWidth(t)}setAlign(t){return this.style.setHAlign(t)}setHAlign(t){return this.style.setHAlign(t)}setVAlign(t){return this.style.setVAlign(t)}get lineSpacing(){return this.style.lineSpacing}set lineSpacing(t){this.style.lineSpacing=t}setLineSpacing(t){return this.style.lineSpacing=t,this.updateText(!0),this}setXOffset(t){return this.style.setXOffset(t)}setMaxLines(t){return this.style.setMaxLines(t)}setResolution(t){return this.style.setResolution(t)}getTextMetrics(){return this.style.getTextMetrics()}setTextMetrics(t,e){return this.style.setTextMetrics(t,e)}measureTextMargins(t,e){return function(t,e,i){void 0===i&&(i={});var s=jc.create(this),r=s.getContext("2d",{willReadFrequently:!0});t.syncFont(s,r);var n=r.measureText(e),a=Math.ceil(n.width*t.baselineX),h=a,o=2*h;if(h=h*t.baselineY|0,s.width=a,s.height=o,r.fillStyle="#f00",r.fillRect(0,0,a,o),r.font=t._font,r.textBaseline="alphabetic",r.fillStyle="#000",r.fillText(t.testString,0,h),i.left=0,0===a||0===o||!r.getImageData(0,0,a,o))return jc.remove(s),i;for(var l=r.getImageData(0,0,a,o).data,d=!1,c=0;c * @copyright 2018 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */const Hc=Phaser.Display.Canvas.CanvasPool;var Nc=function(t){var e=Hc.create(this),i=e.getContext("2d",{willReadFrequently:!0});t.syncFont(e,i);var s=i.measureText(t.testString);if("actualBoundingBoxAscent"in s){var r=s.actualBoundingBoxAscent,n=s.actualBoundingBoxDescent,a={ascent:r,descent:n,fontSize:r+n};return Hc.remove(e),a}var h=Math.ceil(s.width*t.baselineX),o=h,l=2*o;if(o=o*t.baselineY|0,e.width=h,e.height=l,i.fillStyle="#f00",i.fillRect(0,0,h,l),i.font=t._font,i.textBaseline="alphabetic",i.fillStyle="#000",i.fillText(t.testString,0,o),a={ascent:0,descent:0,fontSize:0},!i.getImageData(0,0,h,l))return a.ascent=o,a.descent=o+6,a.fontSize=a.ascent+a.descent,Hc.remove(e),a;var d,c,u=i.getImageData(0,0,h,l).data,p=u.length,v=4*h,g=0,f=!1;for(d=0;do;d--){for(c=0;c0&&this.wrapMode!==xl&&0===this.wrapWidth}setStyle(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wordWrap")){var s=t.wordWrap;s.hasOwnProperty("width")&&(t.wrap={mode:"word",width:s.width})}if(t&&t.hasOwnProperty("wrap")){var r=t.wrap;if(r.hasOwnProperty("mode")){var n=r.mode;"string"==typeof n&&(r.mode=Ol[n])}else r.hasOwnProperty("width")&&(r.mode=1)}t&&t.rtl&&i&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var a=this.propertyMap;for(var h in a){var o=a[h],l=o[0],d=i?o[1]:this[h],c=o[2];if("wrapCallback"===h||"wrapCallbackScope"===h)this[h]=Vc(t,l,d);else{var u=Gc(t,l,d);c&&(u=c(u)),this[h]=u}}var p=Vc(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var v=Vc(t,"fill",null);null!==v&&(this.color=rd(v));var g=Vc(t,"metrics",!1);return g?this.metrics={ascent:Vc(g,"ascent",0),descent:Vc(g,"descent",0),fontSize:Vc(g,"fontSize",0)}:!e&&this.metrics||(this.metrics=Nc(this)),e?this.parent.updateText():this.parent}syncFont(t,e){e.font=this._font}syncStyle(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"}syncShadow(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)}update(t){return t&&(this._font=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim(),this.metrics=Nc(this)),this.parent.updateText(t)}buildFont(){var t=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim();return t!==this._font&&(this._font=t),this}setFont(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=Vc(t,"fontFamily","Courier"),this.fontSize=Vc(t,"fontSize","16px"),this.fontStyle=Vc(t,"fontStyle","")),this.update(!0)}setFontFamily(t){return this.fontFamily=t,this.update(!0)}setFontStyle(t){return this.fontStyle=t,this.update(!0)}setFontSize(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}setTestString(t){return this.testString=t,this.update(!0)}setFixedSize(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}setResolution(t){return this.resolution=t,this.update(!1)}setXOffset(t){return this.xOffset=t,this.update(!1)}setBackgroundColor(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=rd(t,this.parent.canvas,this.parent.context),this.backgroundColor2=rd(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=rd(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}setBackgroundCornerRadius(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}setFill(t){return this.color=rd(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=rd(t,this.parent.canvas,this.parent.context),this.update(!1)}setStroke(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=rd(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}setShadow(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===n&&(n=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=rd(i,this.parent.canvas,this.parent.context),this.shadowBlur=s,this.shadowStroke=r,this.shadowFill=n,this.update(!1)}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}setShadowColor(t){return void 0===t&&(t="#000"),this.shadowColor=rd(t,this.parent.canvas,this.parent.context),this.update(!1)}setShadowBlur(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}setShadowStroke(t){return this.shadowStroke=t,this.update(!1)}setShadowFill(t){return this.shadowFill=t,this.update(!1)}setUnderline(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=rd(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}setUnderlineColor(t){return void 0===t&&(t="#000"),this.underlineColor=rd(t,this.parent.canvas,this.parent.context),this.update(!1)}setUnderlineThickness(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}setUnderlineOffset(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}setStrikethrough(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=rd(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}setStrikethroughColor(t){return void 0===t&&(t="#000"),this.strikethroughColor=rd(t,this.parent.canvas,this.parent.context),this.update(!1)}setStrikethroughThickness(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}setStrikethroughOffset(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}setWrapMode(t){return"string"==typeof t&&(t=Ol[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}setWrapWidth(t){return this.wrapWidth=t,this.update(!1)}setAlign(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}setHAlign(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}setVAlign(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}setMaxLines(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}getTextMetrics(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}setTextMetrics(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=Vc(e,"fontFamily",this.fontFamily),this.fontSize=Vc(e,"fontSize",this.fontSize),this.fontStyle=Vc(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}get lineHeight(){return this.metrics.fontSize+this.parent.lineSpacing}toJSON(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}destroy(){this.parent=void 0}}var $c={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var a=this.defaultStyle;this.clear(),cd(this,a.backgroundColor,a.backgroundStrokeColor,a.backgroundStrokeLineWidth,a.backgroundCornerRadius,a.backgroundColor2,a.backgroundHorizontalGradient,a.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var h,o,l,d,c,u,p=a.halign,v=a.valign,g=a.lineHeight,f=r.lines,m=f.length,y=a.maxLines;y>0&&m>y?(o=y,l="center"===v?Math.floor((m-o)/2):"bottom"===v?m-o:0):(o=m,l=0),d=l+o;var b=this.rtl,x=b?this.parent.width:void 0;u="center"===v?Math.max((s-o*g)/2,0):"bottom"===v?Math.max(s-o*g-2,0):0,u+=e;for(var w=l;w0){var h=this.defaultStyle.metrics,o=i-h.ascent,l=h.fontSize;this.drawRectangle(e,o,t.width,l,a.bgcolor,a)}if(a.underlineThickness>0&&t.width>0){var d=i+a.underlineOffset-a.underlineThickness/2;this.drawLine(e,d,t.width,a.underlineThickness,a.underlineColor,a)}if(t.isTextPen&&(a.buildFont(),a.syncFont(r,n),a.syncStyle(r,n),this.drawText(e,i,t.text,a)),t.isImagePen&&this.drawImage(e,i,t.prop.img,t.prop.color,a),a.strikethroughThickness>0&&t.width>0&&(d=i+a.strikethroughOffset-a.strikethroughThickness/2,this.drawLine(e,d,t.width,a.strikethroughThickness,a.strikethroughColor,a)),n.restore(),t.hasAreaMarker&&t.width>0){var c,u=t.prop.area;if(u)c={key:u};else{var p=t.prop.url;c={key:`url:${p}`,url:p}}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,c)}},clear(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawRectangle(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;a.fillStyle=r,a.fillRect(t,e,i,s)},drawLine(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;n.syncShadow(a,n.shadowStroke);var h=a.lineCap;a.lineCap="butt",a.strokeStyle=r,a.lineWidth=s,a.beginPath(),a.moveTo(t,e),a.lineTo(t+i,e),a.stroke(),a.lineCap=h},drawText(t,e,i,s){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;s.stroke&&"none"!==s.stroke&&s.strokeThickness>0&&(s.syncShadow(r,s.shadowStroke),r.strokeText(i,t,e)),s.color&&"none"!==s.color&&(s.syncShadow(r,s.shadowFill),r.fillText(i,t,e))},drawImage(t,e,i,s,r){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,s,this.autoRound)}};const Jc=Phaser.Utils.Objects.GetValue,Kc=ml,qc=yl;class Zc{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=Jc(t,"text",""),this.x=Jc(t,"x",0),this.y=Jc(t,"y",0),this.width=Jc(t,"width",0);var e=Jc(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=Jc(t,"newLineMode",0),this.startIndex=Jc(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===qc&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==Kc&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===qc&&(t+=1),t}get endIndex(){return this.startIndex+this.rawTextLength}get lastX(){return this.x+this.width}get isTextPen(){return""!==this.text}get isImagePen(){return!!this.prop.img}get hasAreaMarker(){return!!this.prop.area||!!this.prop.url}}const Qc=Phaser.Utils.Objects.GetFastValue,tu=ml,eu=bl;class iu{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=Qc(t,"tagToText",zt),this.tagToTextScope=Qc(t,"tagToTextScope",void 0)}destroy(){this.clear(),this.tagToText=void 0,this.tagToTextScope=void 0}clear(){for(var t=0,e=this.lines.length;t=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}getLineEndIndex(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,s=!1;for(e=t;e>=0&&!(s=null!=(i=this.lines[e])&&i.length>0);e--);return s?i[i.length-1].endIndex:0}getLineWidth(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}getMaxLineWidth(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,s=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}getLineWidths(){for(var t=[],e=0,i=this.lines.length;e=t&&o<=e||(a=a.substring(t-h,e-h)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,a,l,d):c+=this.tagToText(a,l,d),d=l,!(o>=e)));u++);return c}get length(){return this.lines.length}set length(t){this.clear()}}var su={};const ru=Phaser.Geom.Rectangle;var nu=new mc;class au{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&xu(g)){""!==b?a.push(n.getLine(b,x,pu)):0===w&&r>0&&a.push(n.getLine("",0,pu)),a.push(...yu(g,e,fu,s,0,n));var C=a.pop();b=C.text,x=C.width,n.freeLine(C)," "===b&&(b="",x=0)}else(m=x+f)>o?(a.push(n.getLine(b,x,pu)),b=g,x=f,o=s):(b+=g,x=m),w===S-1&&a.push(n.getLine(b,x,l))}return a},bu=function(t,e){var i;switch(e){case gu:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==Su&&i0&&t>e&&(t=e),t}get linesWidth(){return Math.ceil(this.penManager.getMaxLineWidth())}get linesHeight(){var t=this.displayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}get imageManager(){return this.parent.imageManager}get rtl(){return this.parent.style.rtl}newPenManager(){return new iu({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}get tmpPenManager(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}getPlainText(t,e,i){var s;if(null==t)s=this.penManager.plainText;else{var r=this.parser.splitText(t,1);s="";for(var n=0,a=r.length;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return kp(this.sizerChildren,null),va.call(this,t),this}},Mp={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)kp(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},Ap={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,h=this.sizerChildren,o=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=ze.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,kp(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)kp(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},Xp=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const zp=Phaser.Utils.Objects.IsPlainObject,Wp=Phaser.Utils.Objects.GetValue;class jp extends ta{constructor(t,e,i,s,r,n,a,h,o,l){zp(e)?(e=Wp(l=e,"x",0),i=Wp(l,"y",0),s=Wp(l,"width",void 0),r=Wp(l,"height",void 0),n=Wp(l,"column",l.col||0),a=Wp(l,"row",0),h=Wp(l,"columnProportions",0),o=Wp(l,"rowProportions",0)):zp(s)?(s=Wp(l=s,"width",void 0),r=Wp(l,"height",void 0),n=Wp(l,"column",l.col||0),a=Wp(l,"row",0),h=Wp(l,"columnProportions",0),o=Wp(l,"rowProportions",0)):zp(n)?(n=Wp(l=n,"column",l.col||0),a=Wp(l,"row",0),h=Wp(l,"columnProportions",0),o=Wp(l,"rowProportions",0)):zp(h)&&(h=Wp(l=h,"columnProportions",0),o=Wp(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(Wp(l,"createCellContainerCallback")),this.setIndentLeft(Wp(l,"space.indentLeftOdd",0),Wp(l,"space.indentLeftEven",0)),this.setIndentTop(Wp(l,"space.indentTopOdd",0),Wp(l,"space.indentTopEven",0)),this.resetGrid(n,a,h,o,Wp(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=Yp.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=Xp.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(jp.prototype,Ap);const Fp=Phaser.Utils.Objects.GetValue,Ip=Phaser.Math.Percent;var Bp=function(t,e,i){var s;return t.y===e.y?s=Ip(i.x,t.x,e.x):t.x===e.x&&(s=Ip(i.y,t.y,e.y)),s},Hp=function(t,e,i){var s,r;this.enable&&(Np.x=e,Np.y=i,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint()),this.value=Bp(s,r,Np))},Np={},Gp=function(t,e,i){if(this.enable&&t.isDown){var s,r;Vp.x=t.worldX,Vp.y=t.worldY,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint());var n=Bp(s,r,Vp);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-n)<.1?this.value=n:this.easeValueTo(n)}},Vp={},Up=function(t,e){void 0===e&&(e=$p);var i=this.childrenMap.thumb,s=i.x,r=i.y;return he(i,this.innerLeft,this.innerTop,this.innerWidth,this.innerHeight,t),e.x=i.x,e.y=i.y,i.x=s,i.y=r,e},$p={};const Jp=Phaser.Display.Align.LEFT_CENTER,Kp=Phaser.Display.Align.TOP_CENTER;var qp={};const Zp=Phaser.Display.Align.RIGHT_CENTER,Qp=Phaser.Display.Align.BOTTOM_CENTER;var tv={};const ev=Phaser.Math.Linear;var iv={};const sv=Phaser.Display.Align.LEFT_CENTER,rv=Phaser.Display.Align.TOP_CENTER,nv=Phaser.Display.Align.RIGHT_CENTER,av=Phaser.Display.Align.BOTTOM_CENTER,hv=Phaser.Utils.Objects.GetValue,ov=Phaser.Utils.Objects.IsPlainObject,lv=Phaser.Math.Clamp,dv=Phaser.Math.Snap.To;class cv extends(Mh(Ta)){constructor(t,e){super(t,e),this.type="rexSlider",this.bootProgressBase(e),this.reverseAxis=hv(e,"reverseAxis",!1);var i=hv(e,"background",void 0),s=hv(e,"track",void 0),r=hv(e,"indicator",void 0),n=hv(e,"thumb",void 0);if(i&&(ov(i)&&(i=Uo(t,i)),this.addBackground(i)),s&&(ov(s)&&(s=Uo(t,s)),this.add(s,{proportion:1,expand:!0,minWidth:0===this.orientation?0:void 0,minHeight:1===this.orientation?0:void 0})),r&&(ov(r)&&(r=Uo(t,r)),this.pin(r)),n){ov(n)&&(n=Uo(t,n)),this.pin(n);var a=hv(e,"thumbOffsetX",0),h=hv(e,"thumbOffsetY",0);this.setThumbOffset(a,h)}var o=hv(e,"input",0);switch("string"==typeof o&&(o=uv[o]),o){case 0:n&&(n.setInteractive(),this.scene.input.setDraggable(n),n.on("drag",Hp,this).on("dragstart",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("dragend",(function(t){this.eventEmitter.emit("inputend",t)}),this));break;case 1:this.on("pointerdown",Gp,this).on("pointermove",Gp,this).on("pointerdown",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("pointerup",(function(t){this.eventEmitter.emit("inputend",t)}),this).on("pointerover",(function(t){t.isDown&&this.eventEmitter.emit("inputstart",t)}),this).on("pointerout",(function(t){t.isDown&&this.eventEmitter.emit("inputend",t)}),this).setInteractive()}this.addChildrenMap("background",i),this.addChildrenMap("track",s),this.addChildrenMap("indicator",r),this.addChildrenMap("thumb",n),this.setEnable(hv(e,"enable",void 0));var l=hv(e,"tick",void 0);void 0===l&&(l=hv(e,"gap",void 0)),this.setGap(l),this.setValue(hv(e,"value",0),hv(e,"min",void 0),hv(e,"max",void 0))}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setGap(t,e,i){return t&&void 0!==e&&(t/=i-e),this.gap=t,this}setTick(t,e,i){return this.setGap(t,e,i),this}get tick(){return this.gap}set tick(t){this.gap=t}setThumbOffset(t,e){return this.thumbOffsetX=t,this.thumbOffsetY=e,this}get value(){return this._value}set value(t){void 0!==this.gap&&(t=dv(t,this.gap));var e=this._value;this._value=lv(t,0,1),e!==this._value&&(this.updateThumb(this._value),this.updateIndicator(this._value),this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter))}postLayout(t,e,i){return this.updateThumb(),this.updateIndicator(),super.postLayout(t,e,i),this}}const uv={pan:0,drag:0,click:1,none:-1};var pv={getStartPoint:function(t){if(void 0===t&&(t=qp),this.childrenMap.thumb){var e=0===this.orientation?Jp:Kp;Up.call(this,e,t)}else 0===this.orientation?(t.x=this.innerLeft+1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerTop+1);return t},getEndPoint:function(t){if(void 0===t&&(t=tv),this.childrenMap.thumb){var e=0===this.orientation?Zp:Qp;Up.call(this,e,t)}else 0===this.orientation?(t.x=this.innerRight-1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerBottom-1);return t},updateThumb:function(t){var e,i,s=this.childrenMap.thumb;return void 0===s||(void 0===t&&(t=this.value),this.reverseAxis?(e=this.getEndPoint(),i=this.getStartPoint()):(e=this.getStartPoint(),i=this.getEndPoint()),function(t,e,i,s){void 0===s&&(s=iv),s.x=ev(e.x,i.x,t),s.y=ev(e.y,i.y,t)}(t,e,i,s),s.x+=this.thumbOffsetX,s.y+=this.thumbOffsetY,this.resetChildPositionState(s)),this},updateIndicator:function(t){var e=this.childrenMap.indicator;if(void 0===e)return this;void 0===t&&(t=this.value);var i,s,r,n=this.reverseAxis,a=this.childrenMap.thumb;if(a)if(0===this.orientation){var h,o=Q(a);if(n)h=a.x-o*a.originX,i=this.right-h;else i=(h=a.x-o*a.originX)+o-this.left}else{var l,d=tt(a);if(n)l=a.y-d*a.originY,s=this.bottom-l;else s=(l=a.y-d*a.originY)+d-this.top}else 0===this.orientation?i=this.width*t:s=this.height*t;Ne(e,i,s),r=n?0===this.orientation?nv:av:0===this.orientation?sv:rv,ae(e,this,r),this.resetChildPositionState(e)}};Object.assign(cv.prototype,pv);const vv=Phaser.Utils.Objects.GetValue;class gv extends Ta{constructor(t,e){super(t,e),this.type="rexScrollBar";var i,s,r=vv(e,"background",void 0),n=vv(e,"buttons",void 0),a=vv(n,"top",vv(n,"left",void 0)),h=vv(n,"bottom",vv(n,"right",void 0)),o=vv(e,"slider",void 0);(r&&this.addBackground(r),a&&(this.add(a),new Mr(a).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?this.scrollStep:-this.scrollStep;this.value+=t}}),this)),o)&&(o.orientation=this.orientation,o.eventEmitter=this,o.value=null,s=0===this.orientation?void 0===vv(o,"width",void 0)?1:0:void 0===vv(o,"height",void 0)?1:0,i=new cv(t,o),t.add.existing(i),this.add(i,{proportion:s}));h&&(this.add(h),new Mr(h).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?-this.scrollStep:this.scrollStep;this.value+=t}}),this));var l=[a,h];this.addChildrenMap("background",r),this.addChildrenMap("slider",i),this.addChildrenMap("buttons",l);var d=vv(e,"valuechangeCallback",null);if(null!==d){var c=vv(e,"valuechangeCallbackScope",void 0);this.on("valuechange",d,c)}this.setEnable(vv(e,"enable",void 0)),this.setValue(vv(e,"value",0)),this.setScrollStep(vv(n,"step",.01))}setScrollStep(t){return this.scrollStep=t,this}get enable(){return!!this.childrenMap.slider&&this.childrenMap.slider.enable}set enable(t){this.childrenMap.slider&&this.childrenMap.slider.setEnable(t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get value(){return this.childrenMap.slider?this.childrenMap.slider.value:0}set value(t){this.childrenMap.slider&&(this.childrenMap.slider.value=t)}setValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setValue(t,e,i),this}addValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.addValue(t,e,i),this}getValue(t,e){return this.childrenMap.slider?this.childrenMap.slider.getValue(t,e):0}easeValueTo(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.easeValueTo(t,e,i),this}stopEaseValue(){return this.childrenMap.slider&&this.childrenMap.slider.stopEaseValue(),this}setEaseValueDuration(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueDuration(t),this}setEaseValueFunction(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueFunction(t),this}setGap(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setGap(t,e,i),this}get gap(){if(this.childrenMap.slider)return this.childrenMap.slider.gap}set gap(t){this.childrenMap.slider&&(this.childrenMap.slider.gap=t)}setTick(t,e,i){return this.setGap(t,e,i),this}get tick(){if(this.childrenMap.slider)return this.childrenMap.slider.tick}set tick(t){this.childrenMap.slider&&(this.childrenMap.slider.tick=t)}}class fv extends Rs{constructor(t,e){super(e),this.parent=t,this.init()}init(){this.start("IDLE")}next_IDLE(){var t,e=this.parent;return e.dragState.isDown&&(t=0===e.dragThreshold?"DRAG":"DRAGBEGIN"),t}update_IDLE(t,e){this.next()}next_DRAGBEGIN(){var t=this.parent,e=t.dragState;return e.isDown?e.pointer.getDistance()>=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const mv=Phaser.Utils.Objects.GetValue,yv=Phaser.Math.Distance.Between;class bv extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=mv(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(mv(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(mv(t,"enable",!0)),this.holdThreshold=mv(t,"holdThreshold",50),this.pointerOutReleaseEnable=mv(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return dn(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:yv(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!or(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!or(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const xv=Phaser.Utils.Objects.GetValue;class wv{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(xv(t,"value",0)),this.setSpeed(xv(t,"speed",0)),this.setAcceleration(xv(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class Sv{constructor(){this.value,this.dir,this.movement=new wv}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const _v={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},Tv=Phaser.Utils.Objects.GetValue;class kv extends ii{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=Tv(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(Tv(e,"speed",.1)),this.setEnable(Tv(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(Tv(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||or(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const Ev=Phaser.Utils.Objects.GetValue;var Mv=function(t,e,i,s){var r,n,a="Y"===(i=i.toUpperCase()),h=2===t.scrollMode,o=t.childrenMap.child,l=`slider${i}`;if(r=h||s.hasOwnProperty(l)?Ev(s,l,void 0):Ev(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=a?1:0,n=function(t,e){void 0===e&&(e={});var i=mt(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new gv(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r),n.tickLength=Ev(r,"tickLength",void 0);var p=Ev(r,"position",0);"string"==typeof p&&(p=Rv[p]);var v,g,f=Ev(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=Ev(s,"space.slider",void 0))&&(h?f=0:v=Ev(s,"space.child",0)),g=void 0===v?"number"==typeof f:"number"==typeof v,a?0===p?(d=2,c=1,u=void 0===v?g?{left:f}:f:{left:Ev(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:Ev(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:Ev(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:Ev(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=Ev(r,"hideUnscrollableSlider",!1),t[`disableUnscrollableDrag${i}`]=Ev(r,"disableUnscrollableDrag",!1),t[`adaptThumb${i}SizeMode`]=Ev(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=Ev(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`disableUnscrollableDrag${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=Ev(s,"scrollDetectionMode");"string"==typeof b&&(b=Lv[b]);var x=`scroller${i}`;(m=h||s.hasOwnProperty(x)?Ev(s,x,!0):Ev(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=a?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new Pv(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var w,S,C,O,P,_=Ev(s,h?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);_&&o&&(void 0!==b&&(_.focus=1===b?2:0),w=new kv(o,_)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,w),h&&!a||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.disableUnscrollableDrag=t[`disableUnscrollableDrag${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",w)),n&&(h?(S=a?"t":"s",O=`scroll${i}`):(S="t",O="scroll"),n.on("valuechange",(function(e){t[S]=e,t.emit(O,t)}))),y&&(h?(C=`childO${i}`,O=`scroll${i}`):(C="childOY",O="scroll"),y.on("valuechange",(function(e){t[C]=e,t.emit(O,t)}))),w&&(P=h?`addChildO${i}`:"addChildOY",w.on("scroll",(function(e){t[P](-e,!0)})))};const Rv={right:0,left:1,bottom:0,top:1},Lv={gameObject:0,rectBounds:1},Dv=Phaser.Utils.Objects.GetValue;var Av=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=Dv(e,"width"),a=Dv(e,"height");n||Dv(e,"child.expandWidth",!0)||(s[1]=0),a||Dv(e,"child.expandHeight",!0)||(r[1]=0);var h=new jp(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=Fp(i,"child"),r=Fp(s,"gameObject",void 0);if(r){var n=Fp(i,"space.child",0);t.childMargin={};var a=t.childMargin,h={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:a.top=0,a.bottom=0,a.left=0,a.right=0;break;default:a.top=n,a.bottom=n,a.left=n,a.right=n}else switch(t.scrollMode){case 0:a.top=Fp(n,"top",0),a.bottom=Fp(n,"bottom",0),h.left=Fp(n,"left",0),h.right=Fp(n,"right",0);break;case 1:a.top=Fp(n,"left",0),a.bottom=Fp(n,"right",0),h.top=Fp(n,"top",0),h.bottom=Fp(n,"bottom",0);break;default:a.top=Fp(n,"top",0),a.bottom=Fp(n,"bottom",0),a.left=Fp(n,"left",0),a.right=Fp(n,"right",0)}e.add(r,{column:1,row:1,align:Fp(s,"align","center"),padding:h,expand:{width:Fp(s,"expandWidth",!0),height:Fp(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,h,e),t.scrollMode){case 0:Mv(t,h,"y",e);break;case 1:Mv(t,h,"x",e);break;default:Mv(t,h,"y",e),Mv(t,h,"x",e)}return h},Yv=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}i*="Y"===t?this.scaleY:this.scaleX,s&&s.setBounds(e,i),r&&(r.setEnable(e!==i),r.tickLength&&r.setTick(r.tickLength,e,i))},Xv=function(t){switch(this.scrollMode){case 0:case 1:(i=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(i,this.isOverflow),(r=this.childrenMap.scroller)&&this.disableUnscrollableDrag&&r.setEnable(this.isOverflow);break;default:var e=this[`isOverflow${t=t.toUpperCase()}`],i=this.childrenMap[`slider${t}`],s=this[`hideUnscrollableSlider${t}`];i&&s&&this.setChildVisible(i,e);var r=this.childrenMap.scroller,n=this[`disableUnscrollableDrag${t}`];r&&n&&r.setEnable(e)}},zv=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(h=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=h.childrenMap.track,s=h.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&n0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n")}return i}(this.textObject,this.text,this.lines),this.linesCount=this.lines.length,this._textHeight=void 0,this._textVisibleHeight=void 0,this.updateTextObject(),this},updateTextObject:function(){var t=Math.max(Math.floor(Hv.call(this,-this.textOY)),0),e=Nv.call(this,t)+this.textOY,i=Gv.call(this,t);return function(t,e){switch(ul(t)){case 0:var i=(r=t.style).wordWrapWidth,s=r.wordWrapCallback;r.wordWrapWidth=0,r.wordWrapCallback=void 0,t.setText(e),r.wordWrapWidth=i,r.wordWrapCallback=s;break;case 1:var r,n=(r=t.style).wrapMode;r.wrapMode=0,t.setText(e),r.wrapMode=n;break;case 2:var a=t._maxWidth;t._maxWidth=0,t.setText(e),t._maxWidth=a}}(this.textObject,i),this.textObject.rexSizer.offsetY=e,Vv.call(this),this},preLayout:function(){return this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,Ie.call(this),this},layoutChildren:function(){var t,e,i,s,r,n,a,h=this.left,o=this.top;(t=this.textObject).rexSizer.hidden||(s=h+(i=(e=t.rexSizer).padding).left*this.scaleX,r=o+i.top*this.scaleY,n=this.width*this.scaleX-(i.left+i.right)*this.scaleX,a=this.height*this.scaleY-(i.top+i.bottom)*this.scaleY,$v.call(this,t,n,a),he(t,s,r,n,a,e.align),e.preOffsetY=0,Vv.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const Kv=Phaser.Utils.Objects.IsPlainObject,qv=Phaser.Utils.Objects.GetValue,Zv=Phaser.Display.Align.TOP_LEFT;class Qv extends ta{constructor(t,e,i,s,r,n){Kv(e)?(e=qv(n=e,"x",0),i=qv(n,"y",0),s=qv(n,"width",void 0),r=qv(n,"height",void 0)):Kv(s)&&(s=qv(n=s,"width",void 0),r=qv(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexTextBlock",this.textObject=void 0,this.linesCount=0,this.textMask=void 0,this.textObjectType=void 0,this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,this._textObjectRealHeight=0,this.lines=void 0,this.text=qv(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode(qv(n,"clampTextOY",!0)),this.alwaysScrollable=qv(n,"alwaysScrollable",!1);var a=qv(n,"background",void 0),h=qv(n,"text",void 0);void 0===h&&(h=tg(t)),this.textCropEnable=qv(n,"textCrop",!!h.setCrop);var o=qv(n,"textMask",!this.textCropEnable);a&&this.addBackground(a),this.add(h),this.sizerChildren=[h];var l=this.getSizerConfig(h);l.align=Zv,l.padding=ge(0),l.expand=!0,this.textObject=h,this.textObjectType=ul(h),l.preOffsetY=0,l.offsetY=0,o&&(this.textMask=hl.call(this,this.textObject,this)),this.addChildrenMap("background",a),this.addChildrenMap("text",h)}destroy(t){if(this.scene&&!this.ignoreDestroy){if(this.textObject=void 0,this.textMask=void 0,this.lines){switch(this.textObjectType){case 0:case 2:this.lines.length=0;break;case 1:this.lines.destroy()}this.lines=void 0}super.destroy(t)}}setClampMode(t){return void 0===t&&(t=!0),this.clampTextOY=t,this}get textLineHeight(){if(void 0===this._textLineHeight){var t;switch(this.textObjectType){case 0:case 1:var e=this.textObject.style;t=e.metrics.fontSize+e.strokeThickness;break;case 2:var i=this.textObject.fontSize/this.textObject.fontData.size;t=this.textObject.fontData.lineHeight*i}this._textLineHeight=t}return this._textLineHeight}get textLineSpacing(){if(void 0===this._textLineSpacing){var t;switch(this.textObjectType){case 0:case 1:t=this.textObject.lineSpacing;break;case 2:t=0}this._textLineSpacing=t}return this._textLineSpacing}get visibleLinesCount(){return void 0===this._visibleLinesCount&&(this._visibleLinesCount=Math.floor(Hv.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=Nv.call(this,this.linesCount)),this._textHeight}get textObjectHeight(){return this._textObjectRealHeight-(this.textLineHeight+this.textLineSpacing)}get textVisibleHeight(){if(void 0===this._textVisibleHeight){var t=this.textHeight-this.textObjectHeight;!this.alwaysScrollable&&t<0&&(t=0),this._textVisibleHeight=t}return this._textVisibleHeight}textOYExceedTop(t){return void 0===t&&(t=this.textOY),t>this.topTextOY}textOYExeceedBottom(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:s?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}setTextOY(t){return this.textOY=t,this}set t(t){this.textOY=-this.textVisibleHeight*t}get t(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t}setTextOYByPercentage(t){return this.t=t,this}}var tg=function(t){return t.add.text(0,0,"")};Object.assign(Qv.prototype,Jv);var eg={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},ig={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const sg=Phaser.Utils.Objects.GetValue;class rg extends Iv{constructor(t,e){void 0===e&&(e={});var i=sg(e,"text",void 0),s=sg(e,"textWidth",void 0),r=sg(e,"textHeight",void 0),n=sg(e,"textCrop",!!i.setCrop),a=sg(e,"textMask",!n),h=sg(e,"content",""),o=new Qv(t,{width:s,height:r,text:i,textMask:a,textCrop:n&&!a,content:h,clampTextOY:sg(e,"clampChildOY",!1),alwaysScrollable:sg(e,"alwaysScrollable",!1)});t.add.existing(o),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textObjectHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.textHeight}})}(o),e.scrollMode=0,e.type="rexTextArea",e.child={gameObject:o,expandWidth:void 0===s,expandHeight:void 0===r};var l=sg(e,"space",void 0);l&&(l.child=sg(l,"text",0)),super(t,e),this.addChildrenMap("text",i)}get text(){return this.childrenMap.child.text}get lineHeight(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.textHeight}}Object.assign(rg.prototype,eg,ig);const ng=Phaser.Utils.Objects.GetValue;var ag=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("key")&&(i="bitmaptext",e.font=e.key)),i){case"bitmaptext":case"bitmap":s=new yp(t,e);break;case"bbcodetext":case"bbcode":s=new vp(t,0,0,"",e);break;case"label":s=new lg(t,e);break;case"textarea":s=function(t,e,i){e=e?To(e):{};var s=ng(i,"background",Uo),r=ng(i,"text",ag),n=ng(i,"track",Uo),a=ng(i,"thumb",Uo);s?e.background=s(t,e.background):delete e.background,r?e.text=r(t,e.text):delete e.text;var h=e.slider;!1!==h&&null!==h&&(void 0===h&&(h={}),n?h.track=n(t,h.track):delete h.track,a?h.thumb=a(t,h.thumb):delete h.thumb,e.slider=h);var o=new rg(t,e);return t.add.existing(o),o}(t,e);break;default:s=new Yc(t,e)}return Vo(s,e),t.add.existing(s),s},hg=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("leftWidth")?i="nineSlice":(e.hasOwnProperty("color")||e.hasOwnProperty("strokeColor"))&&(i="roundRectangle")),i){case"nineSlice":s=e.hasOwnProperty("stretchMode")?new No(t,e):new wo(t,e);break;case"roundRectangle":s=new gh(t,e);break;default:s=new Po(t,e)}return Vo(s,e),t.add.existing(s),s};const og=Phaser.Utils.Objects.GetValue;class lg extends Lc{constructor(t,e,i){e=function(t,e,i){e=e?To(e):{};var s=og(i,"background",Uo),r=og(i,"text",ag),n=og(i,"icon",hg),a=og(i,"action",hg);return null!==e.background&&s?e.background=s(t,e.background):delete e.background,null!==e.text&&r?e.text=r(t,e.text):delete e.text,null!==e.icon&&n?e.icon=n(t,e.icon):delete e.icon,null!==e.action&&a?e.action=a(t,e.action):delete e.action,e}(t,e,i),super(t,e),this.type="rexSimpleLabel"}setActiveState(t){return dg(this.getChildren(),"setActiveState",t),this}setHoverState(t){return dg(this.getChildren(),"setHoverState",t),this}setDisableState(t){return dg(this.getChildren(),"setDisableState",t),this}}var dg=function(t,e,i){for(var s=0,r=t.length;s0&&void 0!==this._direction?this.previousDirection=this._direction:this.previousDirection=void 0,this._direction=t,this.verticeAngle=90*t,this.dirty=!0,void 0!==this.previousDirection?this.playEaseDirectionation():this.stopEaseDirection())}setDirection(t,e){return void 0!==e&&this.setEaseDuration(e),this.direction=t,this}toggleDirection(t){return this.setDirection(this.direction+2,t),this}get easeDirectionProgress(){return this._easeDirectionProgress}set easeDirectionProgress(t){this._easeDirectionProgress!==t&&(this._easeDirectionProgress=t,this.dirty=!0)}setPadding(t,e,i,s){if("object"==typeof t){var r=t,n=_g(r,"x",null);null!==n?(t=n,i=n):(t=_g(r,"left",0),i=_g(r,"right",t));var a=_g(r,"y",null);null!==a?(e=a,s=a):(e=_g(r,"top",0),s=_g(r,"bottom",e))}else void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=t),void 0===s&&(s=e);return void 0===this.padding&&(this.padding={}),this.dirty=this.dirty||this.padding.left!=t||this.padding.top!=e||this.padding.right!=i||this.padding.bottom!=s,this.padding.left=t,this.padding.top=e,this.padding.right=i,this.padding.bottom=s,this.setRadius(),this}get radius(){return this._radius}set radius(t){this.dirty=this.dirty||this._radius!=t,this._radius=t}setRadius(t){return this.radius=t,this.shapeMode=null==t?0:1,this}get verticeRotation(){return this._verticeRotation}set verticeRotation(t){this.dirty=this.dirty||this._verticeRotation!=t,this._verticeRotation=t}setVerticeRotation(t){return this.verticeRotation=t,this}get verticeAngle(){return Eg(this.verticeRotation)}set verticeAngle(t){this.verticeRotation=kg(t)}setVerticeAngle(t){return this.verticeAngle=t,this}}const Rg={right:0,down:1,left:2,up:3};var Lg=function(t){return"string"==typeof t&&(t=Rg[t]),t%=4};Object.assign(Mg.prototype,Og,Pg);var Dg=function(t,e,i){var s=new Mg(t,e);return t.add.existing(s),s.on("expand.start",(function(t){t.setDirection("down")})).on("collapse.complete",(function(t){t.setDirection("right")})),s};const Ag=Phaser.Utils.Objects.GetValue,Yg=Phaser.Utils.Objects.GetValue,Xg=Phaser.Utils.Objects.Clone,zg=Phaser.Utils.Objects.GetValue;class Wg extends(ka(Ya)){constructor(t,e){void 0===e&&(e={});var i=za(t,zg(e,"background"),{isLeaf:!1},$o,!1),s=function(t,e){var i=new Ta(t,{orientation:Yg(e,"childrenOrientation","y")});t.add.existing(i);var s=za(t,Yg(e,"childrenBackground"),{isLeaf:!1},$o,!1);return s&&i.addBackground(s),i}(t,e),r=s.childrenMap.items,n=function(t,e){var i=new pg(t,e,{isLeaf:!1});t.add.existing(i);var s=za(t,Ag(e,"toggleButton"),{isLeaf:!1},Dg,!0);return i.insert(0,s,{padding:{right:Ag(e,"space.toggleButton",0)},fitRatio:1}),i.addChildrenMap("toggleButton",s),i}(t,e),a=n.childrenMap.toggleButton,h=n.childrenMap.nodeBody,o=Oa(zg(e,"orientation","y")),l=e.space;if(l){var d=zg(l,"indent",0);l.childLeft=zg(l,"indentLeft",1===o?d:0),l.childRight=zg(l,"indentRight",0),l.childTop=zg(l,"indentTop",0===o?d:0),l.childBottom=zg(l,"indentBottom",0)}super(t,{background:i,title:n,child:s,toggleByTarget:a,transition:e.transition,orientation:o,space:l,align:e.align,expand:e.expand}),this.type="rexTree",this.rexSizer.treeParent=null,this.nodesMap={},this.configSave=e,this.nodeBody=h,this.addChildrenMap("toggleButton",a),this.addChildrenMap("nodeBody",h),this.addChildrenMap("childrenNodes",r),this.on("expand.start",(function(){a.emit("expand.start",a),jg(this,"expand.start")}),this).on("expand.complete",(function(){a.emit("expand.complete",a),jg(this,"expand.complete")})).on("collapse.start",(function(){a.emit("collapse.start",a),jg(this,"collapse.start")})).on("collapse.complete",(function(){a.emit("collapse.complete",a),jg(this,"collapse.complete")}));var c=this;c._postAddCallback=function(){var t=zg(e,"expanded",!0);void 0!==t&&c.setExpandedState(t),delete c._postAddCallback}}destroy(t){this.scene&&!this.ignoreDestroy&&(this.configSave=void 0,Clear(this.nodesMap),this.nodesMap=void 0,super.destroy(t))}get isTree(){return!0}createTree(t){return Wg.CreateTree(this.scene,this.configSave,t)}isTreeObject(t){return t&&t instanceof Wg}}Wg.CreateTree=function(t,e,i){return new Wg(t,function(t,e){var i=t?Xg(t):{};if(!e)return i;for(var s in e)i[s]=e[s];return i}(e,i))};var jg=function(t,e){var i=t.getTreesSizer();i&&i.emit(e,t)};Object.assign(Wg.prototype,bg);const Fg=Phaser.Utils.String.UUID;var Ig={addTree(t){return bt(t)&&(t={nodeBody:t,nodeKey:nodeKey}),this.insertTree(void 0,t)},insertTree(t,e){var i;"string"==typeof e?(i=e,e=void 0):e&&(i=e.nodeKey,delete e.nodeKey),void 0===i&&(i=Fg());var s=Wg.CreateTree(this.scene,this.treeConfig,e);return vg(this,s),s.nodeKey=i,this.treesMap[i]=s,this.insert(t,s,{expand:!0}),s._postAddCallback(),s}},Bg={removeTree(t,e){return"string"==typeof t&&(t=this.getTree(t)),t?(delete this.treesMap[t.nodeKey],t.nodeKey=null,this.remove(t,e),this):this},removeAllNodes(t){var e=this.treesMap;for(var i in e)this.removeTree(e[i],t);return this}},Hg={getTree(t){return this.treesMap[t]},getTrees(t){for(var e in void 0===t&&(t=[]),this.treesMap)t.push(this.treesMap[e]);return t},getNode(t){var e=t.indexOf(".");if(-1===e)return this.getTree(t);var i=this.getTree(t.substring(0,e));return i?i.getNode(t.substring(e+1)):void 0}},Ng={pointToChild:function(t,e,i,s){for(var r in this.treesMap){var n=this.treesMap[r];if(lr(n.nodeBody,t,e,i,s))return n;var a=n.pointToChild(t,e,i,s);if(a)return a}return null},setChildrenInteractive:function(t){return void 0===t&&(t={}),t.targetMode="parent",t.targetSizers=[this],qn(this,t),this}};Object.assign(Ng,Ig,Bg,Hg);const Gg=Phaser.Utils.Objects.GetValue;class Vg extends Ta{constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("orientation")||(e.orientation="y"),super(t,e),this.type="rexTrees",this.treesMap={},this.treeConfig=Gg(e,"tree")}destroy(t){this.scene&&!this.ignoreDestroy&&(this.treeConfig=void 0,Clear(this.treesMap),this.treesMap=void 0,super.destroy(t))}}return Object.assign(Vg.prototype,Ng),Vg},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rextrees=e(); + */const Nc=Phaser.Display.Canvas.CanvasPool;var Gc=function(t){var e=Nc.create(this),i=e.getContext("2d",{willReadFrequently:!0});t.syncFont(e,i);var s=i.measureText(t.testString);if("actualBoundingBoxAscent"in s){var r=s.actualBoundingBoxAscent,n=s.actualBoundingBoxDescent,a={ascent:r,descent:n,fontSize:r+n};return Nc.remove(e),a}var h=Math.ceil(s.width*t.baselineX),o=h,l=2*o;if(o=o*t.baselineY|0,e.width=h,e.height=l,i.fillStyle="#f00",i.fillRect(0,0,h,l),i.font=t._font,i.textBaseline="alphabetic",i.fillStyle="#000",i.fillText(t.testString,0,o),a={ascent:0,descent:0,fontSize:0},!i.getImageData(0,0,h,l))return a.ascent=o,a.descent=o+6,a.fontSize=a.ascent+a.descent,Nc.remove(e),a;var d,c,u=i.getImageData(0,0,h,l).data,p=u.length,v=4*h,g=0,f=!1;for(d=0;do;d--){for(c=0;c0&&this.wrapMode!==wl&&0===this.wrapWidth}setStyle(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wordWrap")){var s=t.wordWrap;s.hasOwnProperty("width")&&(t.wrap={mode:"word",width:s.width})}if(t&&t.hasOwnProperty("wrap")){var r=t.wrap;if(r.hasOwnProperty("mode")){var n=r.mode;"string"==typeof n&&(r.mode=Pl[n])}else r.hasOwnProperty("width")&&(r.mode=1)}t&&t.rtl&&i&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var a=this.propertyMap;for(var h in a){var o=a[h],l=o[0],d=i?o[1]:this[h],c=o[2];if("wrapCallback"===h||"wrapCallbackScope"===h)this[h]=Uc(t,l,d);else{var u=Vc(t,l,d);c&&(u=c(u)),this[h]=u}}var p=Uc(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var v=Uc(t,"fill",null);null!==v&&(this.color=nd(v));var g=Uc(t,"metrics",!1);return g?this.metrics={ascent:Uc(g,"ascent",0),descent:Uc(g,"descent",0),fontSize:Uc(g,"fontSize",0)}:!e&&this.metrics||(this.metrics=Gc(this)),e?this.parent.updateText():this.parent}syncFont(t,e){e.font=this._font}syncStyle(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"}syncShadow(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)}update(t){return t&&(this._font=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim(),this.metrics=Gc(this)),this.parent.updateText(t)}buildFont(){var t=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim();return t!==this._font&&(this._font=t),this}setFont(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=Uc(t,"fontFamily","Courier"),this.fontSize=Uc(t,"fontSize","16px"),this.fontStyle=Uc(t,"fontStyle","")),this.update(!0)}setFontFamily(t){return this.fontFamily=t,this.update(!0)}setFontStyle(t){return this.fontStyle=t,this.update(!0)}setFontSize(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}setTestString(t){return this.testString=t,this.update(!0)}setFixedSize(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}setResolution(t){return this.resolution=t,this.update(!1)}setXOffset(t){return this.xOffset=t,this.update(!1)}setBackgroundColor(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=nd(t,this.parent.canvas,this.parent.context),this.backgroundColor2=nd(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=nd(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}setBackgroundCornerRadius(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}setFill(t){return this.color=nd(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=nd(t,this.parent.canvas,this.parent.context),this.update(!1)}setStroke(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=nd(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}setShadow(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===n&&(n=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=nd(i,this.parent.canvas,this.parent.context),this.shadowBlur=s,this.shadowStroke=r,this.shadowFill=n,this.update(!1)}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}setShadowColor(t){return void 0===t&&(t="#000"),this.shadowColor=nd(t,this.parent.canvas,this.parent.context),this.update(!1)}setShadowBlur(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}setShadowStroke(t){return this.shadowStroke=t,this.update(!1)}setShadowFill(t){return this.shadowFill=t,this.update(!1)}setUnderline(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=nd(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}setUnderlineColor(t){return void 0===t&&(t="#000"),this.underlineColor=nd(t,this.parent.canvas,this.parent.context),this.update(!1)}setUnderlineThickness(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}setUnderlineOffset(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}setStrikethrough(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=nd(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}setStrikethroughColor(t){return void 0===t&&(t="#000"),this.strikethroughColor=nd(t,this.parent.canvas,this.parent.context),this.update(!1)}setStrikethroughThickness(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}setStrikethroughOffset(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}setWrapMode(t){return"string"==typeof t&&(t=Pl[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}setWrapWidth(t){return this.wrapWidth=t,this.update(!1)}setAlign(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}setHAlign(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}setVAlign(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}setMaxLines(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}getTextMetrics(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}setTextMetrics(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=Uc(e,"fontFamily",this.fontFamily),this.fontSize=Uc(e,"fontSize",this.fontSize),this.fontStyle=Uc(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}get lineHeight(){return this.metrics.fontSize+this.parent.lineSpacing}toJSON(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}destroy(){this.parent=void 0}}var Jc={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var a=this.defaultStyle;this.clear(),ud(this,a.backgroundColor,a.backgroundStrokeColor,a.backgroundStrokeLineWidth,a.backgroundCornerRadius,a.backgroundColor2,a.backgroundHorizontalGradient,a.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var h,o,l,d,c,u,p=a.halign,v=a.valign,g=a.lineHeight,f=r.lines,m=f.length,y=a.maxLines;y>0&&m>y?(o=y,l="center"===v?Math.floor((m-o)/2):"bottom"===v?m-o:0):(o=m,l=0),d=l+o;var b=this.rtl,x=b?this.parent.width:void 0;u="center"===v?Math.max((s-o*g)/2,0):"bottom"===v?Math.max(s-o*g-2,0):0,u+=e;for(var w=l;w0){var h=this.defaultStyle.metrics,o=i-h.ascent,l=h.fontSize;this.drawRectangle(e,o,t.width,l,a.bgcolor,a)}if(a.underlineThickness>0&&t.width>0){var d=i+a.underlineOffset-a.underlineThickness/2;this.drawLine(e,d,t.width,a.underlineThickness,a.underlineColor,a)}if(t.isTextPen&&(a.buildFont(),a.syncFont(r,n),a.syncStyle(r,n),this.drawText(e,i,t.text,a)),t.isImagePen&&this.drawImage(e,i,t.prop.img,t.prop.color,a),a.strikethroughThickness>0&&t.width>0&&(d=i+a.strikethroughOffset-a.strikethroughThickness/2,this.drawLine(e,d,t.width,a.strikethroughThickness,a.strikethroughColor,a)),n.restore(),t.hasAreaMarker&&t.width>0){var c,u=t.prop.area;if(u)c={key:u};else{var p=t.prop.url;c={key:`url:${p}`,url:p}}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,c)}},clear(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawRectangle(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;a.fillStyle=r,a.fillRect(t,e,i,s)},drawLine(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;n.syncShadow(a,n.shadowStroke);var h=a.lineCap;a.lineCap="butt",a.strokeStyle=r,a.lineWidth=s,a.beginPath(),a.moveTo(t,e),a.lineTo(t+i,e),a.stroke(),a.lineCap=h},drawText(t,e,i,s){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;s.stroke&&"none"!==s.stroke&&s.strokeThickness>0&&(s.syncShadow(r,s.shadowStroke),r.strokeText(i,t,e)),s.color&&"none"!==s.color&&(s.syncShadow(r,s.shadowFill),r.fillText(i,t,e))},drawImage(t,e,i,s,r){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,s,this.autoRound)}};const Kc=Phaser.Utils.Objects.GetValue,qc=yl,Zc=bl;class Qc{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=Kc(t,"text",""),this.x=Kc(t,"x",0),this.y=Kc(t,"y",0),this.width=Kc(t,"width",0);var e=Kc(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=Kc(t,"newLineMode",0),this.startIndex=Kc(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===Zc&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==qc&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===Zc&&(t+=1),t}get endIndex(){return this.startIndex+this.rawTextLength}get lastX(){return this.x+this.width}get isTextPen(){return""!==this.text}get isImagePen(){return!!this.prop.img}get hasAreaMarker(){return!!this.prop.area||!!this.prop.url}}const tu=Phaser.Utils.Objects.GetFastValue,eu=yl,iu=xl;class su{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=tu(t,"tagToText",zt),this.tagToTextScope=tu(t,"tagToTextScope",void 0)}destroy(){this.clear(),this.tagToText=void 0,this.tagToTextScope=void 0}clear(){for(var t=0,e=this.lines.length;t=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}getLineEndIndex(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,s=!1;for(e=t;e>=0&&!(s=null!=(i=this.lines[e])&&i.length>0);e--);return s?i[i.length-1].endIndex:0}getLineWidth(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}getMaxLineWidth(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,s=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}getLineWidths(){for(var t=[],e=0,i=this.lines.length;e=t&&o<=e||(a=a.substring(t-h,e-h)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,a,l,d):c+=this.tagToText(a,l,d),d=l,!(o>=e)));u++);return c}get length(){return this.lines.length}set length(t){this.clear()}}var ru={};const nu=Phaser.Geom.Rectangle;var au=new yc;class hu{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&wu(g)){""!==b?a.push(n.getLine(b,x,vu)):0===w&&r>0&&a.push(n.getLine("",0,vu)),a.push(...bu(g,e,mu,s,0,n));var C=a.pop();b=C.text,x=C.width,n.freeLine(C)," "===b&&(b="",x=0)}else(m=x+f)>o?(a.push(n.getLine(b,x,vu)),b=g,x=f,o=s):(b+=g,x=m),w===S-1&&a.push(n.getLine(b,x,l))}return a},xu=function(t,e){var i;switch(e){case fu:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==Cu&&i0&&t>e&&(t=e),t}get linesWidth(){return Math.ceil(this.penManager.getMaxLineWidth())}get linesHeight(){var t=this.displayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}get imageManager(){return this.parent.imageManager}get rtl(){return this.parent.style.rtl}newPenManager(){return new su({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}get tmpPenManager(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}getPlainText(t,e,i){var s;if(null==t)s=this.penManager.plainText;else{var r=this.parser.splitText(t,1);s="";for(var n=0,a=r.length;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return Ep(this.sizerChildren,null),va.call(this,t),this}},Rp={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)Ep(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},Yp={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,h=this.sizerChildren,o=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=ze.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,Ep(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Ep(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},zp=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const Wp=Phaser.Utils.Objects.IsPlainObject,jp=Phaser.Utils.Objects.GetValue;class Fp extends ta{constructor(t,e,i,s,r,n,a,h,o,l){Wp(e)?(e=jp(l=e,"x",0),i=jp(l,"y",0),s=jp(l,"width",void 0),r=jp(l,"height",void 0),n=jp(l,"column",l.col||0),a=jp(l,"row",0),h=jp(l,"columnProportions",0),o=jp(l,"rowProportions",0)):Wp(s)?(s=jp(l=s,"width",void 0),r=jp(l,"height",void 0),n=jp(l,"column",l.col||0),a=jp(l,"row",0),h=jp(l,"columnProportions",0),o=jp(l,"rowProportions",0)):Wp(n)?(n=jp(l=n,"column",l.col||0),a=jp(l,"row",0),h=jp(l,"columnProportions",0),o=jp(l,"rowProportions",0)):Wp(h)&&(h=jp(l=h,"columnProportions",0),o=jp(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(jp(l,"createCellContainerCallback")),this.setIndentLeft(jp(l,"space.indentLeftOdd",0),jp(l,"space.indentLeftEven",0)),this.setIndentTop(jp(l,"space.indentTopOdd",0),jp(l,"space.indentTopEven",0)),this.resetGrid(n,a,h,o,jp(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=Xp.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=zp.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(Fp.prototype,Yp);const Ip=Phaser.Utils.Objects.GetValue,Bp=Phaser.Math.Percent;var Hp=function(t,e,i){var s;return t.y===e.y?s=Bp(i.x,t.x,e.x):t.x===e.x&&(s=Bp(i.y,t.y,e.y)),s},Np=function(t,e,i){var s,r;this.enable&&(Gp.x=e,Gp.y=i,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint()),this.value=Hp(s,r,Gp))},Gp={},Vp=function(t,e,i){if(this.enable&&t.isDown){var s,r;Up.x=t.worldX,Up.y=t.worldY,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint());var n=Hp(s,r,Up);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-n)<.1?this.value=n:this.easeValueTo(n)}},Up={},$p=function(t,e){void 0===e&&(e=Jp);var i=this.childrenMap.thumb,s=i.x,r=i.y;return he(i,this.innerLeft,this.innerTop,this.innerWidth,this.innerHeight,t),e.x=i.x,e.y=i.y,i.x=s,i.y=r,e},Jp={};const Kp=Phaser.Display.Align.LEFT_CENTER,qp=Phaser.Display.Align.TOP_CENTER;var Zp={};const Qp=Phaser.Display.Align.RIGHT_CENTER,tv=Phaser.Display.Align.BOTTOM_CENTER;var ev={};const iv=Phaser.Math.Linear;var sv={};const rv=Phaser.Display.Align.LEFT_CENTER,nv=Phaser.Display.Align.TOP_CENTER,av=Phaser.Display.Align.RIGHT_CENTER,hv=Phaser.Display.Align.BOTTOM_CENTER,ov=Phaser.Utils.Objects.GetValue,lv=Phaser.Utils.Objects.IsPlainObject,dv=Phaser.Math.Clamp,cv=Phaser.Math.Snap.To;class uv extends(Mh(Ta)){constructor(t,e){super(t,e),this.type="rexSlider",this.bootProgressBase(e),this.reverseAxis=ov(e,"reverseAxis",!1);var i=ov(e,"background",void 0),s=ov(e,"track",void 0),r=ov(e,"indicator",void 0),n=ov(e,"thumb",void 0);if(i&&(lv(i)&&(i=$o(t,i)),this.addBackground(i)),s&&(lv(s)&&(s=$o(t,s)),this.add(s,{proportion:1,expand:!0,minWidth:0===this.orientation?0:void 0,minHeight:1===this.orientation?0:void 0})),r&&(lv(r)&&(r=$o(t,r)),this.pin(r)),n){lv(n)&&(n=$o(t,n)),this.pin(n);var a=ov(e,"thumbOffsetX",0),h=ov(e,"thumbOffsetY",0);this.setThumbOffset(a,h)}var o=ov(e,"input",0);switch("string"==typeof o&&(o=pv[o]),o){case 0:n&&(n.setInteractive(),this.scene.input.setDraggable(n),n.on("drag",Np,this).on("dragstart",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("dragend",(function(t){this.eventEmitter.emit("inputend",t)}),this));break;case 1:this.on("pointerdown",Vp,this).on("pointermove",Vp,this).on("pointerdown",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("pointerup",(function(t){this.eventEmitter.emit("inputend",t)}),this).on("pointerover",(function(t){t.isDown&&this.eventEmitter.emit("inputstart",t)}),this).on("pointerout",(function(t){t.isDown&&this.eventEmitter.emit("inputend",t)}),this).setInteractive()}this.addChildrenMap("background",i),this.addChildrenMap("track",s),this.addChildrenMap("indicator",r),this.addChildrenMap("thumb",n),this.setEnable(ov(e,"enable",void 0));var l=ov(e,"tick",void 0);void 0===l&&(l=ov(e,"gap",void 0)),this.setGap(l),this.setValue(ov(e,"value",0),ov(e,"min",void 0),ov(e,"max",void 0))}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setGap(t,e,i){return t&&void 0!==e&&(t/=i-e),this.gap=t,this}setTick(t,e,i){return this.setGap(t,e,i),this}get tick(){return this.gap}set tick(t){this.gap=t}setThumbOffset(t,e){return this.thumbOffsetX=t,this.thumbOffsetY=e,this}get value(){return this._value}set value(t){void 0!==this.gap&&(t=cv(t,this.gap));var e=this._value;this._value=dv(t,0,1),e!==this._value&&(this.updateThumb(this._value),this.updateIndicator(this._value),this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter))}postLayout(t,e,i){return this.updateThumb(),this.updateIndicator(),super.postLayout(t,e,i),this}}const pv={pan:0,drag:0,click:1,none:-1};var vv={getStartPoint:function(t){if(void 0===t&&(t=Zp),this.childrenMap.thumb){var e=0===this.orientation?Kp:qp;$p.call(this,e,t)}else 0===this.orientation?(t.x=this.innerLeft+1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerTop+1);return t},getEndPoint:function(t){if(void 0===t&&(t=ev),this.childrenMap.thumb){var e=0===this.orientation?Qp:tv;$p.call(this,e,t)}else 0===this.orientation?(t.x=this.innerRight-1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerBottom-1);return t},updateThumb:function(t){var e,i,s=this.childrenMap.thumb;return void 0===s||(void 0===t&&(t=this.value),this.reverseAxis?(e=this.getEndPoint(),i=this.getStartPoint()):(e=this.getStartPoint(),i=this.getEndPoint()),function(t,e,i,s){void 0===s&&(s=sv),s.x=iv(e.x,i.x,t),s.y=iv(e.y,i.y,t)}(t,e,i,s),s.x+=this.thumbOffsetX,s.y+=this.thumbOffsetY,this.resetChildPositionState(s)),this},updateIndicator:function(t){var e=this.childrenMap.indicator;if(void 0===e)return this;void 0===t&&(t=this.value);var i,s,r,n=this.reverseAxis,a=this.childrenMap.thumb;if(a)if(0===this.orientation){var h,o=Q(a);if(n)h=a.x-o*a.originX,i=this.right-h;else i=(h=a.x-o*a.originX)+o-this.left}else{var l,d=tt(a);if(n)l=a.y-d*a.originY,s=this.bottom-l;else s=(l=a.y-d*a.originY)+d-this.top}else 0===this.orientation?i=this.width*t:s=this.height*t;Ne(e,i,s),r=n?0===this.orientation?av:hv:0===this.orientation?rv:nv,ae(e,this,r),this.resetChildPositionState(e)}};Object.assign(uv.prototype,vv);const gv=Phaser.Utils.Objects.GetValue;class fv extends Ta{constructor(t,e){super(t,e),this.type="rexScrollBar";var i,s,r=gv(e,"background",void 0),n=gv(e,"buttons",void 0),a=gv(n,"top",gv(n,"left",void 0)),h=gv(n,"bottom",gv(n,"right",void 0)),o=gv(e,"slider",void 0);(r&&this.addBackground(r),a&&(this.add(a),new Mr(a).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?this.scrollStep:-this.scrollStep;this.value+=t}}),this)),o)&&(o.orientation=this.orientation,o.eventEmitter=this,o.value=null,s=0===this.orientation?void 0===gv(o,"width",void 0)?1:0:void 0===gv(o,"height",void 0)?1:0,i=new uv(t,o),t.add.existing(i),this.add(i,{proportion:s}));h&&(this.add(h),new Mr(h).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?-this.scrollStep:this.scrollStep;this.value+=t}}),this));var l=[a,h];this.addChildrenMap("background",r),this.addChildrenMap("slider",i),this.addChildrenMap("buttons",l);var d=gv(e,"valuechangeCallback",null);if(null!==d){var c=gv(e,"valuechangeCallbackScope",void 0);this.on("valuechange",d,c)}this.setEnable(gv(e,"enable",void 0)),this.setValue(gv(e,"value",0)),this.setScrollStep(gv(n,"step",.01))}setScrollStep(t){return this.scrollStep=t,this}get enable(){return!!this.childrenMap.slider&&this.childrenMap.slider.enable}set enable(t){this.childrenMap.slider&&this.childrenMap.slider.setEnable(t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get value(){return this.childrenMap.slider?this.childrenMap.slider.value:0}set value(t){this.childrenMap.slider&&(this.childrenMap.slider.value=t)}setValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setValue(t,e,i),this}addValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.addValue(t,e,i),this}getValue(t,e){return this.childrenMap.slider?this.childrenMap.slider.getValue(t,e):0}easeValueTo(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.easeValueTo(t,e,i),this}stopEaseValue(){return this.childrenMap.slider&&this.childrenMap.slider.stopEaseValue(),this}setEaseValueDuration(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueDuration(t),this}setEaseValueFunction(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueFunction(t),this}setGap(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setGap(t,e,i),this}get gap(){if(this.childrenMap.slider)return this.childrenMap.slider.gap}set gap(t){this.childrenMap.slider&&(this.childrenMap.slider.gap=t)}setTick(t,e,i){return this.setGap(t,e,i),this}get tick(){if(this.childrenMap.slider)return this.childrenMap.slider.tick}set tick(t){this.childrenMap.slider&&(this.childrenMap.slider.tick=t)}}class mv extends Rs{constructor(t,e){super(e),this.parent=t,this.init()}init(){this.start("IDLE")}next_IDLE(){var t,e=this.parent;return e.dragState.isDown&&(t=0===e.dragThreshold?"DRAG":"DRAGBEGIN"),t}update_IDLE(t,e){this.next()}next_DRAGBEGIN(){var t=this.parent,e=t.dragState;return e.isDown?e.pointer.getDistance()>=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const yv=Phaser.Utils.Objects.GetValue,bv=Phaser.Math.Distance.Between;class xv extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=yv(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(yv(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(yv(t,"enable",!0)),this.holdThreshold=yv(t,"holdThreshold",50),this.pointerOutReleaseEnable=yv(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return dn(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:bv(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!or(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!or(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const wv=Phaser.Utils.Objects.GetValue;class Sv{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(wv(t,"value",0)),this.setSpeed(wv(t,"speed",0)),this.setAcceleration(wv(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class Cv{constructor(){this.value,this.dir,this.movement=new Sv}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const Tv={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},kv=Phaser.Utils.Objects.GetValue;class Ev extends ii{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=kv(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(kv(e,"speed",.1)),this.setEnable(kv(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(kv(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||or(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const Mv=Phaser.Utils.Objects.GetValue;var Rv=function(t,e,i,s){var r,n,a="Y"===(i=i.toUpperCase()),h=2===t.scrollMode,o=t.childrenMap.child,l=`slider${i}`;if(r=h||s.hasOwnProperty(l)?Mv(s,l,void 0):Mv(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=a?1:0,n=function(t,e){void 0===e&&(e={});var i=mt(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new fv(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r),n.tickLength=Mv(r,"tickLength",void 0);var p=Mv(r,"position",0);"string"==typeof p&&(p=Lv[p]);var v,g,f=Mv(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=Mv(s,"space.slider",void 0))&&(h?f=0:v=Mv(s,"space.child",0)),g=void 0===v?"number"==typeof f:"number"==typeof v,a?0===p?(d=2,c=1,u=void 0===v?g?{left:f}:f:{left:Mv(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:Mv(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:Mv(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:Mv(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=Mv(r,"hideUnscrollableSlider",!1),t[`disableUnscrollableDrag${i}`]=Mv(r,"disableUnscrollableDrag",!1),t[`adaptThumb${i}SizeMode`]=Mv(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=Mv(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`disableUnscrollableDrag${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=Mv(s,"scrollDetectionMode");"string"==typeof b&&(b=Dv[b]);var x=`scroller${i}`;(m=h||s.hasOwnProperty(x)?Mv(s,x,!0):Mv(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=a?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new _v(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var w,S,C,O,P,_=Mv(s,h?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);_&&o&&(void 0!==b&&(_.focus=1===b?2:0),w=new Ev(o,_)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,w),h&&!a||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.disableUnscrollableDrag=t[`disableUnscrollableDrag${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",w)),n&&(h?(S=a?"t":"s",O=`scroll${i}`):(S="t",O="scroll"),n.on("valuechange",(function(e){t[S]=e,t.emit(O,t)}))),y&&(h?(C=`childO${i}`,O=`scroll${i}`):(C="childOY",O="scroll"),y.on("valuechange",(function(e){t[C]=e,t.emit(O,t)}))),w&&(P=h?`addChildO${i}`:"addChildOY",w.on("scroll",(function(e){t[P](-e,!0)})))};const Lv={right:0,left:1,bottom:0,top:1},Dv={gameObject:0,rectBounds:1},Av=Phaser.Utils.Objects.GetValue;var Yv=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=Av(e,"width"),a=Av(e,"height");n||Av(e,"child.expandWidth",!0)||(s[1]=0),a||Av(e,"child.expandHeight",!0)||(r[1]=0);var h=new Fp(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=Ip(i,"child"),r=Ip(s,"gameObject",void 0);if(r){var n=Ip(i,"space.child",0);t.childMargin={};var a=t.childMargin,h={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:a.top=0,a.bottom=0,a.left=0,a.right=0;break;default:a.top=n,a.bottom=n,a.left=n,a.right=n}else switch(t.scrollMode){case 0:a.top=Ip(n,"top",0),a.bottom=Ip(n,"bottom",0),h.left=Ip(n,"left",0),h.right=Ip(n,"right",0);break;case 1:a.top=Ip(n,"left",0),a.bottom=Ip(n,"right",0),h.top=Ip(n,"top",0),h.bottom=Ip(n,"bottom",0);break;default:a.top=Ip(n,"top",0),a.bottom=Ip(n,"bottom",0),a.left=Ip(n,"left",0),a.right=Ip(n,"right",0)}e.add(r,{column:1,row:1,align:Ip(s,"align","center"),padding:h,expand:{width:Ip(s,"expandWidth",!0),height:Ip(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,h,e),t.scrollMode){case 0:Rv(t,h,"y",e);break;case 1:Rv(t,h,"x",e);break;default:Rv(t,h,"y",e),Rv(t,h,"x",e)}return h},Xv=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}i*="Y"===t?this.scaleY:this.scaleX,s&&s.setBounds(e,i),r&&(r.setEnable(e!==i),r.tickLength&&r.setTick(r.tickLength,e,i))},zv=function(t){switch(this.scrollMode){case 0:case 1:(i=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(i,this.isOverflow),(r=this.childrenMap.scroller)&&this.disableUnscrollableDrag&&r.setEnable(this.isOverflow);break;default:var e=this[`isOverflow${t=t.toUpperCase()}`],i=this.childrenMap[`slider${t}`],s=this[`hideUnscrollableSlider${t}`];i&&s&&this.setChildVisible(i,e);var r=this.childrenMap.scroller,n=this[`disableUnscrollableDrag${t}`];r&&n&&r.setEnable(e)}},Wv=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(h=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=h.childrenMap.track,s=h.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&n0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n")}return i}(this.textObject,this.text,this.lines),this.linesCount=this.lines.length,this._textHeight=void 0,this._textVisibleHeight=void 0,this.updateTextObject(),this},updateTextObject:function(){var t=Math.max(Math.floor(Nv.call(this,-this.textOY)),0),e=Gv.call(this,t)+this.textOY,i=Vv.call(this,t);return function(t,e){switch(pl(t)){case 0:var i=(r=t.style).wordWrapWidth,s=r.wordWrapCallback;r.wordWrapWidth=0,r.wordWrapCallback=void 0,t.setText(e),r.wordWrapWidth=i,r.wordWrapCallback=s;break;case 1:var r,n=(r=t.style).wrapMode;r.wrapMode=0,t.setText(e),r.wrapMode=n;break;case 2:var a=t._maxWidth;t._maxWidth=0,t.setText(e),t._maxWidth=a}}(this.textObject,i),this.textObject.rexSizer.offsetY=e,Uv.call(this),this},preLayout:function(){return this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,Ie.call(this),this},layoutChildren:function(){var t,e,i,s,r,n,a,h=this.left,o=this.top;(t=this.textObject).rexSizer.hidden||(s=h+(i=(e=t.rexSizer).padding).left*this.scaleX,r=o+i.top*this.scaleY,n=this.width*this.scaleX-(i.left+i.right)*this.scaleX,a=this.height*this.scaleY-(i.top+i.bottom)*this.scaleY,Jv.call(this,t,n,a),he(t,s,r,n,a,e.align),e.preOffsetY=0,Uv.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const qv=Phaser.Utils.Objects.IsPlainObject,Zv=Phaser.Utils.Objects.GetValue,Qv=Phaser.Display.Align.TOP_LEFT;class tg extends ta{constructor(t,e,i,s,r,n){qv(e)?(e=Zv(n=e,"x",0),i=Zv(n,"y",0),s=Zv(n,"width",void 0),r=Zv(n,"height",void 0)):qv(s)&&(s=Zv(n=s,"width",void 0),r=Zv(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexTextBlock",this.textObject=void 0,this.linesCount=0,this.textMask=void 0,this.textObjectType=void 0,this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,this._textObjectRealHeight=0,this.lines=void 0,this.text=Zv(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode(Zv(n,"clampTextOY",!0)),this.alwaysScrollable=Zv(n,"alwaysScrollable",!1);var a=Zv(n,"background",void 0),h=Zv(n,"text",void 0);void 0===h&&(h=eg(t)),this.textCropEnable=Zv(n,"textCrop",!!h.setCrop);var o=Zv(n,"textMask",!this.textCropEnable);a&&this.addBackground(a),this.add(h),this.sizerChildren=[h];var l=this.getSizerConfig(h);l.align=Qv,l.padding=ge(0),l.expand=!0,this.textObject=h,this.textObjectType=pl(h),l.preOffsetY=0,l.offsetY=0,o&&(this.textMask=ol.call(this,this.textObject,this)),this.addChildrenMap("background",a),this.addChildrenMap("text",h)}destroy(t){if(this.scene&&!this.ignoreDestroy){if(this.textObject=void 0,this.textMask=void 0,this.lines){switch(this.textObjectType){case 0:case 2:this.lines.length=0;break;case 1:this.lines.destroy()}this.lines=void 0}super.destroy(t)}}setClampMode(t){return void 0===t&&(t=!0),this.clampTextOY=t,this}get textLineHeight(){if(void 0===this._textLineHeight){var t;switch(this.textObjectType){case 0:case 1:var e=this.textObject.style;t=e.metrics.fontSize+e.strokeThickness;break;case 2:var i=this.textObject.fontSize/this.textObject.fontData.size;t=this.textObject.fontData.lineHeight*i}this._textLineHeight=t}return this._textLineHeight}get textLineSpacing(){if(void 0===this._textLineSpacing){var t;switch(this.textObjectType){case 0:case 1:t=this.textObject.lineSpacing;break;case 2:t=0}this._textLineSpacing=t}return this._textLineSpacing}get visibleLinesCount(){return void 0===this._visibleLinesCount&&(this._visibleLinesCount=Math.floor(Nv.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=Gv.call(this,this.linesCount)),this._textHeight}get textObjectHeight(){return this._textObjectRealHeight-(this.textLineHeight+this.textLineSpacing)}get textVisibleHeight(){if(void 0===this._textVisibleHeight){var t=this.textHeight-this.textObjectHeight;!this.alwaysScrollable&&t<0&&(t=0),this._textVisibleHeight=t}return this._textVisibleHeight}textOYExceedTop(t){return void 0===t&&(t=this.textOY),t>this.topTextOY}textOYExeceedBottom(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:s?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}setTextOY(t){return this.textOY=t,this}set t(t){this.textOY=-this.textVisibleHeight*t}get t(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t}setTextOYByPercentage(t){return this.t=t,this}}var eg=function(t){return t.add.text(0,0,"")};Object.assign(tg.prototype,Kv);var ig={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},sg={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const rg=Phaser.Utils.Objects.GetValue;class ng extends Bv{constructor(t,e){void 0===e&&(e={});var i=rg(e,"text",void 0),s=rg(e,"textWidth",void 0),r=rg(e,"textHeight",void 0),n=rg(e,"textCrop",!!i.setCrop),a=rg(e,"textMask",!n),h=rg(e,"content",""),o=new tg(t,{width:s,height:r,text:i,textMask:a,textCrop:n&&!a,content:h,clampTextOY:rg(e,"clampChildOY",!1),alwaysScrollable:rg(e,"alwaysScrollable",!1)});t.add.existing(o),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textObjectHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.textHeight}})}(o),e.scrollMode=0,e.type="rexTextArea",e.child={gameObject:o,expandWidth:void 0===s,expandHeight:void 0===r};var l=rg(e,"space",void 0);l&&(l.child=rg(l,"text",0)),super(t,e),this.addChildrenMap("text",i)}get text(){return this.childrenMap.child.text}get lineHeight(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.textHeight}}Object.assign(ng.prototype,ig,sg);const ag=Phaser.Utils.Objects.GetValue;var hg=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("key")&&(i="bitmaptext",e.font=e.key)),i){case"bitmaptext":case"bitmap":s=new bp(t,e);break;case"bbcodetext":case"bbcode":s=new gp(t,0,0,"",e);break;case"label":s=new dg(t,e);break;case"textarea":s=function(t,e,i){e=e?ko(e):{};var s=ag(i,"background",$o),r=ag(i,"text",hg),n=ag(i,"track",$o),a=ag(i,"thumb",$o);s?e.background=s(t,e.background):delete e.background,r?e.text=r(t,e.text):delete e.text;var h=e.slider;!1!==h&&null!==h&&(void 0===h&&(h={}),n?h.track=n(t,h.track):delete h.track,a?h.thumb=a(t,h.thumb):delete h.thumb,e.slider=h);var o=new ng(t,e);return t.add.existing(o),o}(t,e);break;default:s=new Xc(t,e)}return Uo(s,e),t.add.existing(s),s},og=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("leftWidth")?i="nineSlice":(e.hasOwnProperty("color")||e.hasOwnProperty("strokeColor"))&&(i="roundRectangle")),i){case"nineSlice":s=e.hasOwnProperty("stretchMode")?new Go(t,e):new So(t,e);break;case"roundRectangle":s=new gh(t,e);break;default:s=new _o(t,e)}return Uo(s,e),t.add.existing(s),s};const lg=Phaser.Utils.Objects.GetValue;class dg extends Dc{constructor(t,e,i){e=function(t,e,i){e=e?ko(e):{};var s=lg(i,"background",$o),r=lg(i,"text",hg),n=lg(i,"icon",og),a=lg(i,"action",og);return null!==e.background&&s?e.background=s(t,e.background):delete e.background,null!==e.text&&r?e.text=r(t,e.text):delete e.text,null!==e.icon&&n?e.icon=n(t,e.icon):delete e.icon,null!==e.action&&a?e.action=a(t,e.action):delete e.action,e}(t,e,i),super(t,e),this.type="rexSimpleLabel"}setActiveState(t){return cg(this.getChildren(),"setActiveState",t),this}setHoverState(t){return cg(this.getChildren(),"setHoverState",t),this}setDisableState(t){return cg(this.getChildren(),"setDisableState",t),this}}var cg=function(t,e,i){for(var s=0,r=t.length;s0&&void 0!==this._direction?this.previousDirection=this._direction:this.previousDirection=void 0,this._direction=t,this.verticeAngle=90*t,this.dirty=!0,void 0!==this.previousDirection?this.playEaseDirectionation():this.stopEaseDirection())}setDirection(t,e){return void 0!==e&&this.setEaseDuration(e),this.direction=t,this}toggleDirection(t){return this.setDirection(this.direction+2,t),this}get easeDirectionProgress(){return this._easeDirectionProgress}set easeDirectionProgress(t){this._easeDirectionProgress!==t&&(this._easeDirectionProgress=t,this.dirty=!0)}setPadding(t,e,i,s){if("object"==typeof t){var r=t,n=Tg(r,"x",null);null!==n?(t=n,i=n):(t=Tg(r,"left",0),i=Tg(r,"right",t));var a=Tg(r,"y",null);null!==a?(e=a,s=a):(e=Tg(r,"top",0),s=Tg(r,"bottom",e))}else void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=t),void 0===s&&(s=e);return void 0===this.padding&&(this.padding={}),this.dirty=this.dirty||this.padding.left!=t||this.padding.top!=e||this.padding.right!=i||this.padding.bottom!=s,this.padding.left=t,this.padding.top=e,this.padding.right=i,this.padding.bottom=s,this.setRadius(),this}get radius(){return this._radius}set radius(t){this.dirty=this.dirty||this._radius!=t,this._radius=t}setRadius(t){return this.radius=t,this.shapeMode=null==t?0:1,this}get verticeRotation(){return this._verticeRotation}set verticeRotation(t){this.dirty=this.dirty||this._verticeRotation!=t,this._verticeRotation=t}setVerticeRotation(t){return this.verticeRotation=t,this}get verticeAngle(){return Mg(this.verticeRotation)}set verticeAngle(t){this.verticeRotation=Eg(t)}setVerticeAngle(t){return this.verticeAngle=t,this}}const Lg={right:0,down:1,left:2,up:3};var Dg=function(t){return"string"==typeof t&&(t=Lg[t]),t%=4};Object.assign(Rg.prototype,Pg,_g);var Ag=function(t,e,i){var s=new Rg(t,e);return t.add.existing(s),s.on("expand.start",(function(t){t.setDirection("down")})).on("collapse.complete",(function(t){t.setDirection("right")})),s};const Yg=Phaser.Utils.Objects.GetValue,Xg=Phaser.Utils.Objects.GetValue,zg=Phaser.Utils.Objects.Clone,Wg=Phaser.Utils.Objects.GetValue;class jg extends(ka(Ya)){constructor(t,e){void 0===e&&(e={});var i=za(t,Wg(e,"background"),{isLeaf:!1},Jo,!1),s=function(t,e){var i=new Ta(t,{orientation:Xg(e,"childrenOrientation","y")});t.add.existing(i);var s=za(t,Xg(e,"childrenBackground"),{isLeaf:!1},Jo,!1);return s&&i.addBackground(s),i}(t,e),r=s.childrenMap.items,n=function(t,e){var i=new vg(t,e,{isLeaf:!1});t.add.existing(i);var s=za(t,Yg(e,"toggleButton"),{isLeaf:!1},Ag,!0);return i.insert(0,s,{padding:{right:Yg(e,"space.toggleButton",0)},fitRatio:1}),i.addChildrenMap("toggleButton",s),i}(t,e),a=n.childrenMap.toggleButton,h=n.childrenMap.nodeBody,o=Oa(Wg(e,"orientation","y")),l=e.space;if(l){var d=Wg(l,"indent",0);l.childLeft=Wg(l,"indentLeft",1===o?d:0),l.childRight=Wg(l,"indentRight",0),l.childTop=Wg(l,"indentTop",0===o?d:0),l.childBottom=Wg(l,"indentBottom",0)}super(t,{background:i,title:n,child:s,toggleByTarget:a,transition:e.transition,orientation:o,space:l,align:e.align,expand:e.expand}),this.type="rexTree",this.rexSizer.treeParent=null,this.nodesMap={},this.configSave=e,this.nodeBody=h,this.addChildrenMap("toggleButton",a),this.addChildrenMap("nodeBody",h),this.addChildrenMap("childrenNodes",r),this.on("expand.start",(function(){a.emit("expand.start",a),Fg(this,"expand.start")}),this).on("expand.complete",(function(){a.emit("expand.complete",a),Fg(this,"expand.complete")})).on("collapse.start",(function(){a.emit("collapse.start",a),Fg(this,"collapse.start")})).on("collapse.complete",(function(){a.emit("collapse.complete",a),Fg(this,"collapse.complete")}));var c=this;c._postAddCallback=function(){var t=Wg(e,"expanded",!0);void 0!==t&&c.setExpandedState(t),delete c._postAddCallback}}destroy(t){this.scene&&!this.ignoreDestroy&&(this.configSave=void 0,Clear(this.nodesMap),this.nodesMap=void 0,super.destroy(t))}get isTree(){return!0}createTree(t){return jg.CreateTree(this.scene,this.configSave,t)}isTreeObject(t){return t&&t instanceof jg}}jg.CreateTree=function(t,e,i){return new jg(t,function(t,e){var i=t?zg(t):{};if(!e)return i;for(var s in e)i[s]=e[s];return i}(e,i))};var Fg=function(t,e){var i=t.getTreesSizer();i&&i.emit(e,t)};Object.assign(jg.prototype,xg);const Ig=Phaser.Utils.String.UUID;var Bg={addTree(t){return bt(t)&&(t={nodeBody:t,nodeKey:nodeKey}),this.insertTree(void 0,t)},insertTree(t,e){var i;"string"==typeof e?(i=e,e=void 0):e&&(i=e.nodeKey,delete e.nodeKey),void 0===i&&(i=Ig());var s=jg.CreateTree(this.scene,this.treeConfig,e);return gg(this,s),s.nodeKey=i,this.treesMap[i]=s,this.insert(t,s,{expand:!0}),s._postAddCallback(),s}},Hg={removeTree(t,e){return"string"==typeof t&&(t=this.getTree(t)),t?(delete this.treesMap[t.nodeKey],t.nodeKey=null,this.remove(t,e),this):this},removeAllNodes(t){var e=this.treesMap;for(var i in e)this.removeTree(e[i],t);return this}},Ng={getTree(t){return this.treesMap[t]},getTrees(t){for(var e in void 0===t&&(t=[]),this.treesMap)t.push(this.treesMap[e]);return t},getNode(t){var e=t.indexOf(".");if(-1===e)return this.getTree(t);var i=this.getTree(t.substring(0,e));return i?i.getNode(t.substring(e+1)):void 0}},Gg={pointToChild:function(t,e,i,s){for(var r in this.treesMap){var n=this.treesMap[r];if(lr(n.nodeBody,t,e,i,s))return n;var a=n.pointToChild(t,e,i,s);if(a)return a}return null},setChildrenInteractive:function(t){return void 0===t&&(t={}),t.targetMode="parent",t.targetSizers=[this],qn(this,t),this}};Object.assign(Gg,Bg,Hg,Ng);const Vg=Phaser.Utils.Objects.GetValue;class Ug extends Ta{constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("orientation")||(e.orientation="y"),super(t,e),this.type="rexTrees",this.treesMap={},this.treeConfig=Vg(e,"tree")}destroy(t){this.scene&&!this.ignoreDestroy&&(this.treeConfig=void 0,Clear(this.treesMap),this.treesMap=void 0,super.destroy(t))}}return Object.assign(Ug.prototype,Gg),Ug},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rextrees=e(); diff --git a/dist/rextriangle.js b/dist/rextriangle.js index 8ef0dd96aa..3284a5f918 100644 --- a/dist/rextriangle.js +++ b/dist/rextriangle.js @@ -751,6 +751,32 @@ return pathData; }; + //import CatmullRomInterpolation from '../../utils/math/interpolation/CatmullRomInterpolation.js'; + + const CatmullRomInterpolation = Phaser.Math.Interpolation.CatmullRom; + + var CatmullRomTo = function (points, iterations, pathData) { + var pathDataCnt = pathData.length; + var p0x = pathData[pathDataCnt - 2]; + var p0y = pathData[pathDataCnt - 1]; + + var xList = [p0x]; + var yList = [p0y]; + for (var i = 0, cnt = points.length; i < cnt; i += 2) { + xList.push(points[i]); + yList.push(points[i + 1]); + } + + for (var i = 1, last = iterations - 1; i <= last; i++) { + var t = i / last; + pathData.push( + CatmullRomInterpolation(xList, t), + CatmullRomInterpolation(yList, t) + ); + } + return pathData; + }; + var DuplicateLast = function (pathData) { var len = pathData.length; if (len < 2) { @@ -862,6 +888,18 @@ return this; }, + catmullRomTo(...points) { + CatmullRomTo( + points, + this.iterations, + this.pathData + ); + + this.lastPointX = points[points.length-2]; + this.lastPointY = points[points.length-1]; + return this; + }, + close() { // Line to first point var startX = this.pathData[0], @@ -1299,6 +1337,13 @@ return this; } + catmullRomTo(...points) { + this.builder.catmullRomTo(...points); + + this.dirty = true; + return this; + } + close() { this.builder.close(); diff --git a/dist/rextriangle.min.js b/dist/rextriangle.min.js index 7e84cb401a..f2ae198231 100644 --- a/dist/rextriangle.min.js +++ b/dist/rextriangle.min.js @@ -1 +1 @@ -var t,e;t=void 0,e=function(){const t=Phaser.GameObjects.GetCalcMatrix,e=Phaser.Renderer.Canvas.SetTransform;var i={renderWebGL:function(e,i,s,r){i.updateData(),s.addToRenderList(i);var h=e.pipelines.set(i.pipeline),a=t(i,s,r),n=h.calcMatrix.copyFrom(a.calc),o=i._displayOriginX,l=i._displayOriginY,u=s.alpha*i.alpha;e.pipelines.preBatch(i);for(var d,p=i.geom,c=0,v=p.length;c>>16,n=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+a+","+n+","+o+","+h+")"}(t,this),t.fill()),this.isStroked&&(function(t,e,i,s){var r=i||e.strokeColor,h=s||e.strokeAlpha,a=(16711680&r)>>>16,n=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+a+","+n+","+o+","+h+")",t.lineWidth=e.lineWidth}(t,this),t.stroke())}}var v=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],h=i[s-1];if(t===r&&e===h)return i}return i.push(t,e),i};const g=Phaser.Math.DegToRad;Phaser.Math.DegToRad;const y=Phaser.Math.Interpolation.QuadraticBezier,m=Phaser.Math.Interpolation.CubicBezier;var f=function(t){var e=t.length;if(e<2)return t;var i=t[e-2],s=t[e-1];return t.push(i),t.push(s),t},D={clear(){return this.start(),this},start(){return this.startAt(),this},startAt(t,e){return this.restorePathData(),this.accumulationLengths=void 0,function(t,e,i){i.length=0,null!=t&&i.push(t,e)}(t,e,this.pathData),this.firstPointX=t,this.firstPointY=e,this.lastPointX=t,this.lastPointY=e,this},lineTo(t,e,i){return void 0===i&&(i=!1),i&&(t+=this.lastPointX,e+=this.lastPointY),v(t,e,this.pathData),this.lastPointX=t,this.lastPointY=e,this},verticalLineTo(t,e){return this.lineTo(t,this.lastPointY,e),this},horizontalLineTo(t,e){return this.lineTo(this.lastPointX,t,e),this},ellipticalArc(t,e,i,s,r,h,a){return void 0===a&&(a=!1),function(t,e,i,s,r,h,a,n,o){a&&h>r?h-=360:!a&&h0,a=0,n=e.length;a0?-this.delay:0,this.state=this.nowTime>=0?ht:rt,this.repeatCounter=0,this}stop(){return this.state=st,this}update(t,e){this.state!==st&&this.state!==nt&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=at)):(this.nowTime=this.duration,this.state=nt):this.nowTime>=0&&(this.state=ht))}get t(){var t;switch(this.state){case st:case rt:case at:t=0;break;case ht:t=this.nowTime/this.duration;break;case nt:t=1}return et(t,0,1)}set t(t){(t=et(t,-1,1))<0?(this.state=rt,this.nowTime=-this.delay*t):(this.state=ht,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===st}get isDelay(){return this.state===rt}get isCountDown(){return this.state===ht}get isRunning(){return this.state===rt||this.state===ht}get isDone(){return this.state===nt}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const st=0,rt=1,ht=2,at=3,nt=-1;class ot extends Z{constructor(t,e){super(t,e),this.timer=new it}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const lt=Phaser.Utils.Objects.GetValue,ut=Phaser.Utils.Objects.GetAdvancedValue,dt=Phaser.Tweens.Builders.GetEaseFunction;class pt extends ot{resetFromJSON(t){return this.timer.resetFromJSON(lt(t,"timer")),this.setEnable(lt(t,"enable",!0)),this.setTarget(lt(t,"target",this.parent)),this.setDelay(ut(t,"delay",0)),this.setDuration(ut(t,"duration",1e3)),this.setEase(lt(t,"ease","Linear")),this.setRepeat(lt(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=dt(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const ct=Phaser.Utils.Objects.GetValue,vt=Phaser.Math.Linear;class gt extends pt{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=ct(t,"key","value");var i=e[this.propertyKey];return this.fromValue=ct(t,"from",i),this.toValue=ct(t,"to",i),this.setEase(ct(t,"ease",this.ease)),this.setDuration(ct(t,"duration",this.duration)),this.setRepeat(ct(t,"repeat",0)),this.setDelay(ct(t,"delay",0)),this.setRepeatDelay(ct(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=vt(this.fromValue,this.toValue,i)}}var yt={setEaseDuration(t){return void 0===t&&(t=0),this.easeDuration=t,this},playEaseDirectionation(){return void 0===this.easeDirectionProgressTask&&(this.easeDirectionProgressTask=new gt(this,{eventEmitter:null})),this.easeDirectionProgressTask.restart({key:"easeDirectionProgress",from:0,to:1,duration:this.easeDuration}),this},stopEaseDirection(){return void 0===this.easeDirectionProgressTask||this.easeDirectionProgressTask.stop(),this}};const mt=Phaser.Utils.Objects.GetValue,ft=Phaser.Utils.Objects.IsPlainObject,Dt=Phaser.Math.DegToRad,Pt=Phaser.Math.RadToDeg;class bt extends a{constructor(t,e,i,s,r,h,a){var n,o,l,u,d,p,c,v;if(ft(e)){var g=e;e=g.x,i=g.y,s=g.width,r=g.height,h=g.color,a=g.alpha,n=g.strokeColor,o=g.strokeAlpha,l=g.strokeWidth,u=g.arrowOnly,d=g.direction,p=g.easeDuration,c=g.padding,v=g.radius}void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=s),void 0===u&&(u=!1),void 0===d&&(d=0),void 0===p&&(p=0),void 0===c&&(c=0),void 0===v&&(v=void 0),super(t,e,i,s,r),this.type="rexTriangle",this.setFillStyle(h,a),void 0!==n&&void 0===l&&(l=2),this.setStrokeStyle(l,n,o),this.setArrowOnly(u),this.setDirection(d,p),this.setPadding(c),this.setRadius(v),this.buildShapes()}get arrowOnly(){return this._arrowOnly}set arrowOnly(t){this.dirty=this.dirty||this._arrowOnly!=t,this._arrowOnly=t}setArrowOnly(t){return void 0===t&&(t=!0),this.arrowOnly=t,this}get direction(){return this._direction}set direction(t){t=Tt(t),this._direction!==t&&(this.easeDuration>0&&void 0!==this._direction?this.previousDirection=this._direction:this.previousDirection=void 0,this._direction=t,this.verticeAngle=90*t,this.dirty=!0,void 0!==this.previousDirection?this.playEaseDirectionation():this.stopEaseDirection())}setDirection(t,e){return void 0!==e&&this.setEaseDuration(e),this.direction=t,this}toggleDirection(t){return this.setDirection(this.direction+2,t),this}get easeDirectionProgress(){return this._easeDirectionProgress}set easeDirectionProgress(t){this._easeDirectionProgress!==t&&(this._easeDirectionProgress=t,this.dirty=!0)}setPadding(t,e,i,s){if("object"==typeof t){var r=t,h=mt(r,"x",null);null!==h?(t=h,i=h):(t=mt(r,"left",0),i=mt(r,"right",t));var a=mt(r,"y",null);null!==a?(e=a,s=a):(e=mt(r,"top",0),s=mt(r,"bottom",e))}else void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=t),void 0===s&&(s=e);return void 0===this.padding&&(this.padding={}),this.dirty=this.dirty||this.padding.left!=t||this.padding.top!=e||this.padding.right!=i||this.padding.bottom!=s,this.padding.left=t,this.padding.top=e,this.padding.right=i,this.padding.bottom=s,this.setRadius(),this}get radius(){return this._radius}set radius(t){this.dirty=this.dirty||this._radius!=t,this._radius=t}setRadius(t){return this.radius=t,this.shapeMode=null==t?0:1,this}get verticeRotation(){return this._verticeRotation}set verticeRotation(t){this.dirty=this.dirty||this._verticeRotation!=t,this._verticeRotation=t}setVerticeRotation(t){return this.verticeRotation=t,this}get verticeAngle(){return Pt(this.verticeRotation)}set verticeAngle(t){this.verticeRotation=Dt(t)}setVerticeAngle(t){return this.verticeAngle=t,this}}const St={right:0,down:1,left:2,up:3};var Tt=function(t){return"string"==typeof t&&(t=St[t]),t%=4};return Object.assign(bt.prototype,Y,yt),bt},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rextriangle=e(); +var t,e;t=void 0,e=function(){const t=Phaser.GameObjects.GetCalcMatrix,e=Phaser.Renderer.Canvas.SetTransform;var i={renderWebGL:function(e,i,s,r){i.updateData(),s.addToRenderList(i);var h=e.pipelines.set(i.pipeline),a=t(i,s,r),n=h.calcMatrix.copyFrom(a.calc),o=i._displayOriginX,l=i._displayOriginY,u=s.alpha*i.alpha;e.pipelines.preBatch(i);for(var d,p=i.geom,c=0,v=p.length;c>>16,n=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+a+","+n+","+o+","+h+")"}(t,this),t.fill()),this.isStroked&&(function(t,e,i,s){var r=i||e.strokeColor,h=s||e.strokeAlpha,a=(16711680&r)>>>16,n=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+a+","+n+","+o+","+h+")",t.lineWidth=e.lineWidth}(t,this),t.stroke())}}var v=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],h=i[s-1];if(t===r&&e===h)return i}return i.push(t,e),i};const g=Phaser.Math.DegToRad;Phaser.Math.DegToRad;const y=Phaser.Math.Interpolation.QuadraticBezier,m=Phaser.Math.Interpolation.CubicBezier,f=Phaser.Math.Interpolation.CatmullRom;var D=function(t){var e=t.length;if(e<2)return t;var i=t[e-2],s=t[e-1];return t.push(i),t.push(s),t},P={clear(){return this.start(),this},start(){return this.startAt(),this},startAt(t,e){return this.restorePathData(),this.accumulationLengths=void 0,function(t,e,i){i.length=0,null!=t&&i.push(t,e)}(t,e,this.pathData),this.firstPointX=t,this.firstPointY=e,this.lastPointX=t,this.lastPointY=e,this},lineTo(t,e,i){return void 0===i&&(i=!1),i&&(t+=this.lastPointX,e+=this.lastPointY),v(t,e,this.pathData),this.lastPointX=t,this.lastPointY=e,this},verticalLineTo(t,e){return this.lineTo(t,this.lastPointY,e),this},horizontalLineTo(t,e){return this.lineTo(this.lastPointX,t,e),this},ellipticalArc(t,e,i,s,r,h,a){return void 0===a&&(a=!1),function(t,e,i,s,r,h,a,n,o){a&&h>r?h-=360:!a&&h0,a=0,n=e.length;a0?-this.delay:0,this.state=this.nowTime>=0?at:ht,this.repeatCounter=0,this}stop(){return this.state=rt,this}update(t,e){this.state!==rt&&this.state!==ot&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=nt)):(this.nowTime=this.duration,this.state=ot):this.nowTime>=0&&(this.state=at))}get t(){var t;switch(this.state){case rt:case ht:case nt:t=0;break;case at:t=this.nowTime/this.duration;break;case ot:t=1}return it(t,0,1)}set t(t){(t=it(t,-1,1))<0?(this.state=ht,this.nowTime=-this.delay*t):(this.state=at,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===rt}get isDelay(){return this.state===ht}get isCountDown(){return this.state===at}get isRunning(){return this.state===ht||this.state===at}get isDone(){return this.state===ot}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const rt=0,ht=1,at=2,nt=3,ot=-1;class lt extends ${constructor(t,e){super(t,e),this.timer=new st}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const ut=Phaser.Utils.Objects.GetValue,dt=Phaser.Utils.Objects.GetAdvancedValue,pt=Phaser.Tweens.Builders.GetEaseFunction;class ct extends lt{resetFromJSON(t){return this.timer.resetFromJSON(ut(t,"timer")),this.setEnable(ut(t,"enable",!0)),this.setTarget(ut(t,"target",this.parent)),this.setDelay(dt(t,"delay",0)),this.setDuration(dt(t,"duration",1e3)),this.setEase(ut(t,"ease","Linear")),this.setRepeat(ut(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=pt(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const vt=Phaser.Utils.Objects.GetValue,gt=Phaser.Math.Linear;class yt extends ct{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=vt(t,"key","value");var i=e[this.propertyKey];return this.fromValue=vt(t,"from",i),this.toValue=vt(t,"to",i),this.setEase(vt(t,"ease",this.ease)),this.setDuration(vt(t,"duration",this.duration)),this.setRepeat(vt(t,"repeat",0)),this.setDelay(vt(t,"delay",0)),this.setRepeatDelay(vt(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=gt(this.fromValue,this.toValue,i)}}var mt={setEaseDuration(t){return void 0===t&&(t=0),this.easeDuration=t,this},playEaseDirectionation(){return void 0===this.easeDirectionProgressTask&&(this.easeDirectionProgressTask=new yt(this,{eventEmitter:null})),this.easeDirectionProgressTask.restart({key:"easeDirectionProgress",from:0,to:1,duration:this.easeDuration}),this},stopEaseDirection(){return void 0===this.easeDirectionProgressTask||this.easeDirectionProgressTask.stop(),this}};const ft=Phaser.Utils.Objects.GetValue,Dt=Phaser.Utils.Objects.IsPlainObject,Pt=Phaser.Math.DegToRad,bt=Phaser.Math.RadToDeg;class St extends a{constructor(t,e,i,s,r,h,a){var n,o,l,u,d,p,c,v;if(Dt(e)){var g=e;e=g.x,i=g.y,s=g.width,r=g.height,h=g.color,a=g.alpha,n=g.strokeColor,o=g.strokeAlpha,l=g.strokeWidth,u=g.arrowOnly,d=g.direction,p=g.easeDuration,c=g.padding,v=g.radius}void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=s),void 0===u&&(u=!1),void 0===d&&(d=0),void 0===p&&(p=0),void 0===c&&(c=0),void 0===v&&(v=void 0),super(t,e,i,s,r),this.type="rexTriangle",this.setFillStyle(h,a),void 0!==n&&void 0===l&&(l=2),this.setStrokeStyle(l,n,o),this.setArrowOnly(u),this.setDirection(d,p),this.setPadding(c),this.setRadius(v),this.buildShapes()}get arrowOnly(){return this._arrowOnly}set arrowOnly(t){this.dirty=this.dirty||this._arrowOnly!=t,this._arrowOnly=t}setArrowOnly(t){return void 0===t&&(t=!0),this.arrowOnly=t,this}get direction(){return this._direction}set direction(t){t=_t(t),this._direction!==t&&(this.easeDuration>0&&void 0!==this._direction?this.previousDirection=this._direction:this.previousDirection=void 0,this._direction=t,this.verticeAngle=90*t,this.dirty=!0,void 0!==this.previousDirection?this.playEaseDirectionation():this.stopEaseDirection())}setDirection(t,e){return void 0!==e&&this.setEaseDuration(e),this.direction=t,this}toggleDirection(t){return this.setDirection(this.direction+2,t),this}get easeDirectionProgress(){return this._easeDirectionProgress}set easeDirectionProgress(t){this._easeDirectionProgress!==t&&(this._easeDirectionProgress=t,this.dirty=!0)}setPadding(t,e,i,s){if("object"==typeof t){var r=t,h=ft(r,"x",null);null!==h?(t=h,i=h):(t=ft(r,"left",0),i=ft(r,"right",t));var a=ft(r,"y",null);null!==a?(e=a,s=a):(e=ft(r,"top",0),s=ft(r,"bottom",e))}else void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=t),void 0===s&&(s=e);return void 0===this.padding&&(this.padding={}),this.dirty=this.dirty||this.padding.left!=t||this.padding.top!=e||this.padding.right!=i||this.padding.bottom!=s,this.padding.left=t,this.padding.top=e,this.padding.right=i,this.padding.bottom=s,this.setRadius(),this}get radius(){return this._radius}set radius(t){this.dirty=this.dirty||this._radius!=t,this._radius=t}setRadius(t){return this.radius=t,this.shapeMode=null==t?0:1,this}get verticeRotation(){return this._verticeRotation}set verticeRotation(t){this.dirty=this.dirty||this._verticeRotation!=t,this._verticeRotation=t}setVerticeRotation(t){return this.verticeRotation=t,this}get verticeAngle(){return bt(this.verticeRotation)}set verticeAngle(t){this.verticeRotation=Pt(t)}setVerticeAngle(t){return this.verticeAngle=t,this}}const Tt={right:0,down:1,left:2,up:3};var _t=function(t){return"string"==typeof t&&(t=Tt[t]),t%=4};return Object.assign(St.prototype,G,mt),St},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rextriangle=e(); diff --git a/dist/rextriangleplugin.js b/dist/rextriangleplugin.js index b3585529a9..0946de410a 100644 --- a/dist/rextriangleplugin.js +++ b/dist/rextriangleplugin.js @@ -751,6 +751,32 @@ return pathData; }; + //import CatmullRomInterpolation from '../../utils/math/interpolation/CatmullRomInterpolation.js'; + + const CatmullRomInterpolation = Phaser.Math.Interpolation.CatmullRom; + + var CatmullRomTo = function (points, iterations, pathData) { + var pathDataCnt = pathData.length; + var p0x = pathData[pathDataCnt - 2]; + var p0y = pathData[pathDataCnt - 1]; + + var xList = [p0x]; + var yList = [p0y]; + for (var i = 0, cnt = points.length; i < cnt; i += 2) { + xList.push(points[i]); + yList.push(points[i + 1]); + } + + for (var i = 1, last = iterations - 1; i <= last; i++) { + var t = i / last; + pathData.push( + CatmullRomInterpolation(xList, t), + CatmullRomInterpolation(yList, t) + ); + } + return pathData; + }; + var DuplicateLast = function (pathData) { var len = pathData.length; if (len < 2) { @@ -862,6 +888,18 @@ return this; }, + catmullRomTo(...points) { + CatmullRomTo( + points, + this.iterations, + this.pathData + ); + + this.lastPointX = points[points.length-2]; + this.lastPointY = points[points.length-1]; + return this; + }, + close() { // Line to first point var startX = this.pathData[0], @@ -1299,6 +1337,13 @@ return this; } + catmullRomTo(...points) { + this.builder.catmullRomTo(...points); + + this.dirty = true; + return this; + } + close() { this.builder.close(); diff --git a/dist/rextriangleplugin.min.js b/dist/rextriangleplugin.min.js index b376681364..2ea4c949e5 100644 --- a/dist/rextriangleplugin.min.js +++ b/dist/rextriangleplugin.min.js @@ -1 +1 @@ -var t,e;t=void 0,e=function(){const t=Phaser.GameObjects.GetCalcMatrix,e=Phaser.Renderer.Canvas.SetTransform;var i={renderWebGL:function(e,i,s,r){i.updateData(),s.addToRenderList(i);var h=e.pipelines.set(i.pipeline),a=t(i,s,r),n=h.calcMatrix.copyFrom(a.calc),o=i._displayOriginX,l=i._displayOriginY,u=s.alpha*i.alpha;e.pipelines.preBatch(i);for(var d,p=i.geom,c=0,v=p.length;c>>16,n=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+a+","+n+","+o+","+h+")"}(t,this),t.fill()),this.isStroked&&(function(t,e,i,s){var r=i||e.strokeColor,h=s||e.strokeAlpha,a=(16711680&r)>>>16,n=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+a+","+n+","+o+","+h+")",t.lineWidth=e.lineWidth}(t,this),t.stroke())}}var v=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],h=i[s-1];if(t===r&&e===h)return i}return i.push(t,e),i};const g=Phaser.Math.DegToRad;Phaser.Math.DegToRad;const y=Phaser.Math.Interpolation.QuadraticBezier,m=Phaser.Math.Interpolation.CubicBezier;var f=function(t){var e=t.length;if(e<2)return t;var i=t[e-2],s=t[e-1];return t.push(i),t.push(s),t},D={clear(){return this.start(),this},start(){return this.startAt(),this},startAt(t,e){return this.restorePathData(),this.accumulationLengths=void 0,function(t,e,i){i.length=0,null!=t&&i.push(t,e)}(t,e,this.pathData),this.firstPointX=t,this.firstPointY=e,this.lastPointX=t,this.lastPointY=e,this},lineTo(t,e,i){return void 0===i&&(i=!1),i&&(t+=this.lastPointX,e+=this.lastPointY),v(t,e,this.pathData),this.lastPointX=t,this.lastPointY=e,this},verticalLineTo(t,e){return this.lineTo(t,this.lastPointY,e),this},horizontalLineTo(t,e){return this.lineTo(this.lastPointX,t,e),this},ellipticalArc(t,e,i,s,r,h,a){return void 0===a&&(a=!1),function(t,e,i,s,r,h,a,n,o){a&&h>r?h-=360:!a&&h0,a=0,n=e.length;a0?-this.delay:0,this.state=this.nowTime>=0?ht:rt,this.repeatCounter=0,this}stop(){return this.state=st,this}update(t,e){this.state!==st&&this.state!==nt&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=at)):(this.nowTime=this.duration,this.state=nt):this.nowTime>=0&&(this.state=ht))}get t(){var t;switch(this.state){case st:case rt:case at:t=0;break;case ht:t=this.nowTime/this.duration;break;case nt:t=1}return et(t,0,1)}set t(t){(t=et(t,-1,1))<0?(this.state=rt,this.nowTime=-this.delay*t):(this.state=ht,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===st}get isDelay(){return this.state===rt}get isCountDown(){return this.state===ht}get isRunning(){return this.state===rt||this.state===ht}get isDone(){return this.state===nt}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const st=0,rt=1,ht=2,at=3,nt=-1;class ot extends Z{constructor(t,e){super(t,e),this.timer=new it}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const lt=Phaser.Utils.Objects.GetValue,ut=Phaser.Utils.Objects.GetAdvancedValue,dt=Phaser.Tweens.Builders.GetEaseFunction;class pt extends ot{resetFromJSON(t){return this.timer.resetFromJSON(lt(t,"timer")),this.setEnable(lt(t,"enable",!0)),this.setTarget(lt(t,"target",this.parent)),this.setDelay(ut(t,"delay",0)),this.setDuration(ut(t,"duration",1e3)),this.setEase(lt(t,"ease","Linear")),this.setRepeat(lt(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=dt(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const ct=Phaser.Utils.Objects.GetValue,vt=Phaser.Math.Linear;class gt extends pt{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=ct(t,"key","value");var i=e[this.propertyKey];return this.fromValue=ct(t,"from",i),this.toValue=ct(t,"to",i),this.setEase(ct(t,"ease",this.ease)),this.setDuration(ct(t,"duration",this.duration)),this.setRepeat(ct(t,"repeat",0)),this.setDelay(ct(t,"delay",0)),this.setRepeatDelay(ct(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=vt(this.fromValue,this.toValue,i)}}var yt={setEaseDuration(t){return void 0===t&&(t=0),this.easeDuration=t,this},playEaseDirectionation(){return void 0===this.easeDirectionProgressTask&&(this.easeDirectionProgressTask=new gt(this,{eventEmitter:null})),this.easeDirectionProgressTask.restart({key:"easeDirectionProgress",from:0,to:1,duration:this.easeDuration}),this},stopEaseDirection(){return void 0===this.easeDirectionProgressTask||this.easeDirectionProgressTask.stop(),this}};const mt=Phaser.Utils.Objects.GetValue,ft=Phaser.Utils.Objects.IsPlainObject,Dt=Phaser.Math.DegToRad,Pt=Phaser.Math.RadToDeg;class bt extends a{constructor(t,e,i,s,r,h,a){var n,o,l,u,d,p,c,v;if(ft(e)){var g=e;e=g.x,i=g.y,s=g.width,r=g.height,h=g.color,a=g.alpha,n=g.strokeColor,o=g.strokeAlpha,l=g.strokeWidth,u=g.arrowOnly,d=g.direction,p=g.easeDuration,c=g.padding,v=g.radius}void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=s),void 0===u&&(u=!1),void 0===d&&(d=0),void 0===p&&(p=0),void 0===c&&(c=0),void 0===v&&(v=void 0),super(t,e,i,s,r),this.type="rexTriangle",this.setFillStyle(h,a),void 0!==n&&void 0===l&&(l=2),this.setStrokeStyle(l,n,o),this.setArrowOnly(u),this.setDirection(d,p),this.setPadding(c),this.setRadius(v),this.buildShapes()}get arrowOnly(){return this._arrowOnly}set arrowOnly(t){this.dirty=this.dirty||this._arrowOnly!=t,this._arrowOnly=t}setArrowOnly(t){return void 0===t&&(t=!0),this.arrowOnly=t,this}get direction(){return this._direction}set direction(t){t=Tt(t),this._direction!==t&&(this.easeDuration>0&&void 0!==this._direction?this.previousDirection=this._direction:this.previousDirection=void 0,this._direction=t,this.verticeAngle=90*t,this.dirty=!0,void 0!==this.previousDirection?this.playEaseDirectionation():this.stopEaseDirection())}setDirection(t,e){return void 0!==e&&this.setEaseDuration(e),this.direction=t,this}toggleDirection(t){return this.setDirection(this.direction+2,t),this}get easeDirectionProgress(){return this._easeDirectionProgress}set easeDirectionProgress(t){this._easeDirectionProgress!==t&&(this._easeDirectionProgress=t,this.dirty=!0)}setPadding(t,e,i,s){if("object"==typeof t){var r=t,h=mt(r,"x",null);null!==h?(t=h,i=h):(t=mt(r,"left",0),i=mt(r,"right",t));var a=mt(r,"y",null);null!==a?(e=a,s=a):(e=mt(r,"top",0),s=mt(r,"bottom",e))}else void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=t),void 0===s&&(s=e);return void 0===this.padding&&(this.padding={}),this.dirty=this.dirty||this.padding.left!=t||this.padding.top!=e||this.padding.right!=i||this.padding.bottom!=s,this.padding.left=t,this.padding.top=e,this.padding.right=i,this.padding.bottom=s,this.setRadius(),this}get radius(){return this._radius}set radius(t){this.dirty=this.dirty||this._radius!=t,this._radius=t}setRadius(t){return this.radius=t,this.shapeMode=null==t?0:1,this}get verticeRotation(){return this._verticeRotation}set verticeRotation(t){this.dirty=this.dirty||this._verticeRotation!=t,this._verticeRotation=t}setVerticeRotation(t){return this.verticeRotation=t,this}get verticeAngle(){return Pt(this.verticeRotation)}set verticeAngle(t){this.verticeRotation=Dt(t)}setVerticeAngle(t){return this.verticeAngle=t,this}}const St={right:0,down:1,left:2,up:3};var Tt=function(t){return"string"==typeof t&&(t=St[t]),t%=4};function _t(t,e,i,s,r,h){var a=new bt(this.scene,t,e,i,s,r,h);return this.scene.add.existing(a),a}Object.assign(bt.prototype,X,yt);const kt=Phaser.GameObjects.BuildGameObject;function Et(t,e){void 0===t&&(t={}),void 0!==e&&(t.add=e);var i=new bt(this.scene,t);return kt(this.scene,i,t),i}var wt=function(t){return null==t||""===t||0===t.length};class Rt extends Phaser.Plugins.BasePlugin{constructor(t){super(t),t.registerGameObject("rexTriangle",_t,Et)}start(){this.game.events.on("destroy",this.destroy,this)}}return function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t)if(wt(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),h=function(t,e,i){var s=t;if(wt(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var h=0,a=e.length;h>>16,n=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+a+","+n+","+o+","+h+")"}(t,this),t.fill()),this.isStroked&&(function(t,e,i,s){var r=i||e.strokeColor,h=s||e.strokeAlpha,a=(16711680&r)>>>16,n=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+a+","+n+","+o+","+h+")",t.lineWidth=e.lineWidth}(t,this),t.stroke())}}var v=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],h=i[s-1];if(t===r&&e===h)return i}return i.push(t,e),i};const g=Phaser.Math.DegToRad;Phaser.Math.DegToRad;const y=Phaser.Math.Interpolation.QuadraticBezier,m=Phaser.Math.Interpolation.CubicBezier,f=Phaser.Math.Interpolation.CatmullRom;var D=function(t){var e=t.length;if(e<2)return t;var i=t[e-2],s=t[e-1];return t.push(i),t.push(s),t},P={clear(){return this.start(),this},start(){return this.startAt(),this},startAt(t,e){return this.restorePathData(),this.accumulationLengths=void 0,function(t,e,i){i.length=0,null!=t&&i.push(t,e)}(t,e,this.pathData),this.firstPointX=t,this.firstPointY=e,this.lastPointX=t,this.lastPointY=e,this},lineTo(t,e,i){return void 0===i&&(i=!1),i&&(t+=this.lastPointX,e+=this.lastPointY),v(t,e,this.pathData),this.lastPointX=t,this.lastPointY=e,this},verticalLineTo(t,e){return this.lineTo(t,this.lastPointY,e),this},horizontalLineTo(t,e){return this.lineTo(this.lastPointX,t,e),this},ellipticalArc(t,e,i,s,r,h,a){return void 0===a&&(a=!1),function(t,e,i,s,r,h,a,n,o){a&&h>r?h-=360:!a&&h0,a=0,n=e.length;a0?-this.delay:0,this.state=this.nowTime>=0?at:ht,this.repeatCounter=0,this}stop(){return this.state=rt,this}update(t,e){this.state!==rt&&this.state!==ot&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=nt)):(this.nowTime=this.duration,this.state=ot):this.nowTime>=0&&(this.state=at))}get t(){var t;switch(this.state){case rt:case ht:case nt:t=0;break;case at:t=this.nowTime/this.duration;break;case ot:t=1}return it(t,0,1)}set t(t){(t=it(t,-1,1))<0?(this.state=ht,this.nowTime=-this.delay*t):(this.state=at,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===rt}get isDelay(){return this.state===ht}get isCountDown(){return this.state===at}get isRunning(){return this.state===ht||this.state===at}get isDone(){return this.state===ot}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const rt=0,ht=1,at=2,nt=3,ot=-1;class lt extends ${constructor(t,e){super(t,e),this.timer=new st}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const ut=Phaser.Utils.Objects.GetValue,dt=Phaser.Utils.Objects.GetAdvancedValue,pt=Phaser.Tweens.Builders.GetEaseFunction;class ct extends lt{resetFromJSON(t){return this.timer.resetFromJSON(ut(t,"timer")),this.setEnable(ut(t,"enable",!0)),this.setTarget(ut(t,"target",this.parent)),this.setDelay(dt(t,"delay",0)),this.setDuration(dt(t,"duration",1e3)),this.setEase(ut(t,"ease","Linear")),this.setRepeat(ut(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=pt(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const vt=Phaser.Utils.Objects.GetValue,gt=Phaser.Math.Linear;class yt extends ct{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=vt(t,"key","value");var i=e[this.propertyKey];return this.fromValue=vt(t,"from",i),this.toValue=vt(t,"to",i),this.setEase(vt(t,"ease",this.ease)),this.setDuration(vt(t,"duration",this.duration)),this.setRepeat(vt(t,"repeat",0)),this.setDelay(vt(t,"delay",0)),this.setRepeatDelay(vt(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=gt(this.fromValue,this.toValue,i)}}var mt={setEaseDuration(t){return void 0===t&&(t=0),this.easeDuration=t,this},playEaseDirectionation(){return void 0===this.easeDirectionProgressTask&&(this.easeDirectionProgressTask=new yt(this,{eventEmitter:null})),this.easeDirectionProgressTask.restart({key:"easeDirectionProgress",from:0,to:1,duration:this.easeDuration}),this},stopEaseDirection(){return void 0===this.easeDirectionProgressTask||this.easeDirectionProgressTask.stop(),this}};const ft=Phaser.Utils.Objects.GetValue,Dt=Phaser.Utils.Objects.IsPlainObject,Pt=Phaser.Math.DegToRad,bt=Phaser.Math.RadToDeg;class St extends a{constructor(t,e,i,s,r,h,a){var n,o,l,u,d,p,c,v;if(Dt(e)){var g=e;e=g.x,i=g.y,s=g.width,r=g.height,h=g.color,a=g.alpha,n=g.strokeColor,o=g.strokeAlpha,l=g.strokeWidth,u=g.arrowOnly,d=g.direction,p=g.easeDuration,c=g.padding,v=g.radius}void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=s),void 0===u&&(u=!1),void 0===d&&(d=0),void 0===p&&(p=0),void 0===c&&(c=0),void 0===v&&(v=void 0),super(t,e,i,s,r),this.type="rexTriangle",this.setFillStyle(h,a),void 0!==n&&void 0===l&&(l=2),this.setStrokeStyle(l,n,o),this.setArrowOnly(u),this.setDirection(d,p),this.setPadding(c),this.setRadius(v),this.buildShapes()}get arrowOnly(){return this._arrowOnly}set arrowOnly(t){this.dirty=this.dirty||this._arrowOnly!=t,this._arrowOnly=t}setArrowOnly(t){return void 0===t&&(t=!0),this.arrowOnly=t,this}get direction(){return this._direction}set direction(t){t=_t(t),this._direction!==t&&(this.easeDuration>0&&void 0!==this._direction?this.previousDirection=this._direction:this.previousDirection=void 0,this._direction=t,this.verticeAngle=90*t,this.dirty=!0,void 0!==this.previousDirection?this.playEaseDirectionation():this.stopEaseDirection())}setDirection(t,e){return void 0!==e&&this.setEaseDuration(e),this.direction=t,this}toggleDirection(t){return this.setDirection(this.direction+2,t),this}get easeDirectionProgress(){return this._easeDirectionProgress}set easeDirectionProgress(t){this._easeDirectionProgress!==t&&(this._easeDirectionProgress=t,this.dirty=!0)}setPadding(t,e,i,s){if("object"==typeof t){var r=t,h=ft(r,"x",null);null!==h?(t=h,i=h):(t=ft(r,"left",0),i=ft(r,"right",t));var a=ft(r,"y",null);null!==a?(e=a,s=a):(e=ft(r,"top",0),s=ft(r,"bottom",e))}else void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=t),void 0===s&&(s=e);return void 0===this.padding&&(this.padding={}),this.dirty=this.dirty||this.padding.left!=t||this.padding.top!=e||this.padding.right!=i||this.padding.bottom!=s,this.padding.left=t,this.padding.top=e,this.padding.right=i,this.padding.bottom=s,this.setRadius(),this}get radius(){return this._radius}set radius(t){this.dirty=this.dirty||this._radius!=t,this._radius=t}setRadius(t){return this.radius=t,this.shapeMode=null==t?0:1,this}get verticeRotation(){return this._verticeRotation}set verticeRotation(t){this.dirty=this.dirty||this._verticeRotation!=t,this._verticeRotation=t}setVerticeRotation(t){return this.verticeRotation=t,this}get verticeAngle(){return bt(this.verticeRotation)}set verticeAngle(t){this.verticeRotation=Pt(t)}setVerticeAngle(t){return this.verticeAngle=t,this}}const Tt={right:0,down:1,left:2,up:3};var _t=function(t){return"string"==typeof t&&(t=Tt[t]),t%=4};function kt(t,e,i,s,r,h){var a=new St(this.scene,t,e,i,s,r,h);return this.scene.add.existing(a),a}Object.assign(St.prototype,W,mt);const Et=Phaser.GameObjects.BuildGameObject;function wt(t,e){void 0===t&&(t={}),void 0!==e&&(t.add=e);var i=new St(this.scene,t);return Et(this.scene,i,t),i}var Rt=function(t){return null==t||""===t||0===t.length};class At extends Phaser.Plugins.BasePlugin{constructor(t){super(t),t.registerGameObject("rexTriangle",kt,wt)}start(){this.game.events.on("destroy",this.destroy,this)}}return function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t)if(Rt(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),h=function(t,e,i){var s=t;if(Rt(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var h=0,a=e.length;h=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const P=Phaser.Math.DegToRad;var T={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=P(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},_={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=k(t.scaleX,i.scaleX),e.scaleY=k(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},M={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},E={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=k(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},L={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},D={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},A={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(t){void 0===t&&(t=!1);var e=this;return this._mask=null,this.setChildMaskVisible(this),this.children.forEach((function(t){t.clearMask&&t.clearMask(!1),t.hasOwnProperty("isRexContainerLite")||e.setChildMaskVisible(t)})),t&&this.mask&&this.mask.destroy(),this}},B=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},I=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const j=Phaser.Utils.Array;var X={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Me=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const Ee=/(\S+)\[(\d+)\]/i,Re=Phaser.Utils.Objects.GetValue;var Le=function(t,e){return void 0===e?t:t[e]},De=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Re(e,"left",0),t.right=Re(e,"right",0),t.top=Re(e,"top",0),t.bottom=Re(e,"bottom",0)),t},Ae={getInnerPadding(t){return Le(this.space,t)},setInnerPadding(t,e){return De(this.space,t,e),this},getOuterPadding(t){return Le(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return De(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Le(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),De(this.getSizerConfig(t).padding,e,i),this}},Be=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},We=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},ze=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Ie=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Ye=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},je=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Xe={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Fe=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?yi:mi,this.repeatCounter=0,this}stop(){return this.state=fi,this}update(t,e){this.state!==fi&&this.state!==xi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=bi)):(this.nowTime=this.duration,this.state=xi):this.nowTime>=0&&(this.state=yi))}get t(){var t;switch(this.state){case fi:case mi:case bi:t=0;break;case yi:t=this.nowTime/this.duration;break;case xi:t=1}return gi(t,0,1)}set t(t){(t=gi(t,-1,1))<0?(this.state=mi,this.nowTime=-this.delay*t):(this.state=yi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===fi}get isDelay(){return this.state===mi}get isCountDown(){return this.state===yi}get isRunning(){return this.state===mi||this.state===yi}get isDone(){return this.state===xi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const fi=0,mi=1,yi=2,bi=3,xi=-1;class Ci extends ci{constructor(t,e){super(t,e),this.timer=new vi}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const wi=Phaser.Utils.Objects.GetValue,Si=Phaser.Utils.Objects.GetAdvancedValue,ki=Phaser.Tweens.Builders.GetEaseFunction;class Oi extends Ci{resetFromJSON(t){return this.timer.resetFromJSON(wi(t,"timer")),this.setEnable(wi(t,"enable",!0)),this.setTarget(wi(t,"target",this.parent)),this.setDelay(Si(t,"delay",0)),this.setDuration(Si(t,"duration",1e3)),this.setEase(wi(t,"ease","Linear")),this.setRepeat(wi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=ki(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Pi=Phaser.Utils.Objects.GetValue,Ti=Phaser.Utils.Objects.GetAdvancedValue,_i=Phaser.Math.Linear;let Mi=class extends Oi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Pi(t,"mode",0)),this.setScaleRange(Ti(t,"start",void 0),Ti(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ei[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Ti(t,"x",this.parent.scaleX),this.startY=Ti(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Ti(e,"x",void 0),this.endY=Ti(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=_i(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=_i(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const Ei={stop:0,destroy:1,yoyo:2};var Ri=function(t,e,i,s,r){var n,a;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},a={x:t.scaleX};break;case 1:case"y":n={y:0},a={y:t.scaleY};break;default:n=0,a=t.scale}var h={mode:0,start:n,end:a,duration:e,ease:s};return void 0===r?r=new Mi(t,h):r.resetFromJSON(h),r.restart(),r},Li=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Mi&&(n=r,r=void 0),void 0===r&&(r=!0);var a={};switch(a.mode=r?1:0,i){case 0:case"x":a.end={x:0};break;case 1:case"y":a.end={y:0};break;default:a.end=0}return a.duration=e,a.ease=s,void 0===n?n=new Mi(t,a):n.resetFromJSON(a),n.restart(),n},Di=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Ai=function(t){return Di(t,"complete")};const Bi=Phaser.Utils.Objects.IsPlainObject;var Wi={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Bi(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Ri(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Ai(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Bi(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Li(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Ai(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Ai(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Bi(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var a=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,a){var h,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":h={x:t.scaleX},o={x:i};break;case 1:case"y":h={y:t.scaleX},o={y:i};break;default:h=t.scaleX,o=i}var l={mode:2,start:h,end:o,duration:e/2,ease:n,repeat:s};return void 0===a?a=new Mi(t,l):a.resetFromJSON(l),a.restart(),a}(this,t,e,i,s,r,this._scaleBehavior),a&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Ai(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},zi={};Object.assign(zi,Wi),zi.onInitScale=function(){Wi.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=Ce.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Ii=Phaser.Utils.Objects.GetValue,Yi=Phaser.Utils.Objects.GetAdvancedValue,ji=Phaser.Math.Linear;class Xi extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Ii(t,"mode",0)),this.setAlphaRange(Yi(t,"start",this.parent.alpha),Yi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Fi[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=ji(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Fi={stop:0,destroy:1,yoyo:2},Hi=Phaser.Utils.Objects.IsPlainObject;var Vi=function(t,e,i,s){var r,n;Hi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var a={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Xi(t,a):s.resetFromJSON(a),s.restart(),s},Gi=function(t,e,i,s){i instanceof Xi&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Xi(t,r):s.resetFromJSON(r),s.restart(),s};const Ui=Phaser.Utils.Objects.IsPlainObject;var Ni={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Ui(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Vi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Ai(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Ui(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Gi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Ai(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Ai(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},$i={};Object.assign($i,Ni),$i.onInitFade=function(){Ni.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=Ce.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Ki=Phaser.Utils.Objects.GetValue,Ji=Phaser.Utils.Objects.GetAdvancedValue,qi=Phaser.Math.Linear;class Zi extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Ki(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ji(t,"x",void 0),i=Ji(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Qi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Ji(i,"startX",void 0),this.startY=Ji(i,"startY",void 0),this.endX=Ji(i,"endX",void 0),this.endY=Ji(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=qi(this.startX,this.endX,i)),this.hasMoveY&&(t.y=qi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Qi={stop:0,destroy:1,yoyo:2};var ts=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const es=Phaser.Utils.Objects.IsPlainObject,is=Phaser.Math.Distance.Between;var ss={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(es(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*is(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var a=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,a){n instanceof Zi&&(a=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=ts(i,t.x),h.endX=t.x),void 0!==s&&(h.startY=ts(s,t.y),h.endY=t.y),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===a?a=new Zi(t,h):a.resetFromJSON(h),a.restart(),a}(this,t,e,i,s,r,this._easeMove),a&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Ai(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Ai(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(es(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*is(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var a=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,a){n instanceof Zi&&(a=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=t.x,h.endX=ts(i,t.x)),void 0!==s&&(h.startY=t.y,h.endY=ts(s,t.y)),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===a?a=new Zi(t,h):a.resetFromJSON(h),a.restart(),a}(this,t,e,i,s,r,this._easeMove),a&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Ai(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Ai(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},rs={};Object.assign(rs,ss),rs.onInitEaseMove=function(){ss.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=Ce.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const ns=Phaser.Utils.Objects.GetValue;class as extends oi{constructor(t,e){super(t,e),this.timer=new vi,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(ns(t,"timer")),this.setEnable(ns(t,"enable",!0)),this.setMode(ns(t,"mode",1)),this.isRunning=ns(t,"isRunning",!1),this.setMagnitudeMode(ns(t,"magnitudeMode",1)),this.setAxisMode(ns(t,"axis",0)),this.setDuration(ns(t,"duration",500)),this.setMagnitude(ns(t,"magnitude",10)),this.ox=ns(t,"ox",void 0),this.oy=ns(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=hs[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ls[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=os[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=ns(i,"magnitude",void 0),t=ns(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,a=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=a;break;default:i.x=n,i.y=a}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const hs={effect:0,behavior:1},os={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ls={constant:0,decay:1},ds=Phaser.Utils.Objects.IsPlainObject;var cs={shake(t,e,i){if(ds(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new as(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Ai(this._shake)}};const us=Phaser.Utils.Objects.GetValue,ps=Phaser.Math.Linear;class gs extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=us(t,"key","value");var i=e[this.propertyKey];return this.fromValue=us(t,"from",i),this.toValue=us(t,"to",i),this.setEase(us(t,"ease",this.ease)),this.setDuration(us(t,"duration",this.duration)),this.setRepeat(us(t,"repeat",0)),this.setDelay(us(t,"delay",0)),this.setRepeatDelay(us(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=ps(this.fromValue,this.toValue,i)}}const vs=Phaser.Utils.Objects.IsPlainObject;class fs extends si{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new gs(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(vs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(vs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var ms={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new fs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Di(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},ys=Phaser.Utils.Array.Remove,bs={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var zs={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Ze(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Is={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=It),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=It),this.transitOutCallback=t,this}},Ys={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},js={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Xs={};Object.assign(Xs,zs,Is,Ys,js);const Fs=Phaser.Utils.Objects.GetValue;class Hs extends si{constructor(t,e){super(t,e),this.setTransitInTime(Fs(e,"duration.in",200)),this.setTransitOutTime(Fs(e,"duration.out",200)),this.setTransitInCallback(Fs(e,"transitIn")),this.setTransitOutCallback(Fs(e,"transitOut")),this.oneShotMode=Fs(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Ws(this,{eventEmitter:!1,initState:Fs(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Hs.prototype,Xs);var Vs=function(t){if(t.parentContainer)return Vs(t.parentContainer);var e=function(t){var e=t.displayList;return N(e)?e:null}(t);return e?Vs(e):t};class Gs extends si{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Vs(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,a=1/i.zoom,h=r/2,o=n/2,l=r*a,d=n*a;e.x===h&&e.y===o||e.setPosition(h,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Us=Phaser.GameObjects.Rectangle;let Ns=class extends Us{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Gs(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}};const $s=Phaser.Utils.Objects.GetValue;class Ks extends si{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode($s(t,"hitAreaMode",0)),this.setEnable($s(t,"enable",!0)),this.setStopMode($s(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Js[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Js={default:0,fullWindow:1};const qs=Phaser.Utils.Objects.GetValue;class Zs extends Ns{constructor(t,e){super(t,qs(e,"color",0),qs(e,"alpha",.8)),this.touchEventStop=new Ks(this,{hitAreaMode:1})}}var Qs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Ri(t,e)},scaleDown(t,e){Li(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Vi(t,e)},fadeOut(t,e){Gi(t,e,!1)}},tr=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Vi(t,e,t.alpha)},er=function(t,e){Gi(t,e,!1)},ir=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!nt(t,!0).contains(e,i)||r&&!r(t,e,i))};const sr=Phaser.Utils.Objects.GetValue;let rr=class extends Hs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=nr.popUp),null==e.transitOut&&(e.transitOut=nr.scaleDown),e.destroy=sr(e,"destroy",!0),super(t,e);var i=sr(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Zs(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(sr(i,"transitIn",tr)),this.setCoverTransitOutCallback(sr(i,"transitOut",er)));var s=sr(e,"touchOutsideClose",!1),r=sr(e,"duration.hold",-1),n=sr(e,"timeOutClose",r>=0),a=sr(e,"anyTouchClose",!1);sr(e,"manualClose",!1)&&(s=!1,a=!1,n=!1),a&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),a?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),sr(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&ir(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=nr[t]),t){case nr.popUp:t=Qs.popUp;break;case nr.fadeIn:t=Qs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=nr[t]),t){case nr.scaleDown:t=Qs.scaleDown;break;case nr.fadeOut:t=Qs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const nr={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var ar=function(t){return t&&"function"==typeof t},hr={modal(t,e){return ar(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new rr(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},or=function(t,e,i,s,r){ar(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},lr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return or.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return or.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return or.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return or.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return or.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return or.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return or.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return or.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return or.call(this,"shutdown",t,e,i,s),this}},dr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=cr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},cr={},ur=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,a=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return a?ir(t,e.x,e.y,i,s):!!(r=dr(e,n,!0))&&ir(t,r.x,r.y,i,s);for(var h=t.scene.input.manager,o=h.pointersTotal,l=h.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const kr={press:0,pointerdown:0,release:1,pointerup:1};var Or={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new Sr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},Pr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!Tr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,a=n.pointersTotal,h=n.pointers,o=0;o0)return _r.length=0,!0;return _r.length=0,!1},_r=[];const Mr=Phaser.Utils.Objects.GetValue;class Er extends si{constructor(t,e){super(t,e),this._enable=void 0;var i=Mr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Mr(t,"enable",!0)),this.setMode(Mr(t,"mode",1)),this.setClickInterval(Mr(t,"clickInterval",100)),this.setDragThreshold(Mr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Rr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?Pr:ur)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Rr={press:0,pointerdown:0,release:1,pointerup:1};var Lr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Er(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Dr extends Bs{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Ar=Phaser.Utils.Objects.GetValue;class Br extends si{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Dr,this.parent.setInteractive(Ar(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Ar(t,"enable",!0)),this.setCooldown(Ar(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Wr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&ur(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Br(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Br(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},zr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Ir=function(t,e,i,s){if("parent"===t){for(var r,n=0,a=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=tn,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===en&&this.onDragEnd(),this.pointer=void 0,this.tracerState=tn,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=sn,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&ur(t,s,e,i)}}const tn=0,en=1,sn="IDLE",rn=Phaser.Utils.Objects.GetValue,nn=Phaser.Math.Distance.Between;class an extends Qr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=hn},eventEmitter:!1};this.setRecongizedStateObject(new Bs(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(rn(t,"time",250)),this.setTapInterval(rn(t,"tapInterval",200)),this.setDragThreshold(rn(t,"threshold",9)),this.setTapOffset(rn(t,"tapOffset",10));var e=rn(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(rn(t,"maxTaps",void 0)),this.setMinTaps(rn(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case hn:this.state=on;break;case on:var t=this.lastPointer;nn(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=ln,this.state=on);break;case ln:this.state=on}}onDragEnd(){this.state===on&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=ln))}onDrag(){this.state!==hn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=hn)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===on){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=hn):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=ln:this.state=hn)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===ln&&(this.state=hn)}get isTapped(){return this.state===ln}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const hn="IDLE",on="BEGIN",ln="RECOGNIZED",dn=Phaser.Utils.Objects.GetValue;class cn extends Qr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=un},eventEmitter:!1};this.setRecongizedStateObject(new Bs(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(dn(t,"threshold",9)),this.setHoldTime(dn(t,"time",251)),this}onDragStart(){this.state=pn,0===this.holdTime&&(this.state=gn)}onDragEnd(){this.state=un}onDrag(){this.state!==un&&this.pointer.getDistance()>this.dragThreshold&&(this.state=un)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===pn&&t-this.pointer.downTime>=this.holdTime&&(this.state=gn)}get isPressed(){return this.state===gn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const un="IDLE",pn="BEGIN",gn="RECOGNIZED";Phaser.Utils.Objects.GetValue;var vn=function(t){return ei(t).loop.delta};const fn=Phaser.Math.Distance.Between,mn=Phaser.Math.Angle.Between;var yn={getDt:function(){return vn(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return fn(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return mn(e.x,e.y,t.x,t.y)}},bn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},xn={};const Cn=Phaser.Utils.Objects.GetValue,wn=Phaser.Math.RadToDeg;class Sn extends Qr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=kn},eventEmitter:!1};this.setRecongizedStateObject(new Bs(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Cn(t,"threshold",10)),this.setVelocityThreshold(Cn(t,"velocityThreshold",1e3)),this.setDirectionMode(Cn(t,"dir","8dir")),this}onDragStart(){this.state=On}onDragEnd(){this.state=kn}onDrag(){this.state===On&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=Pn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Pn&&(this.state=kn)}get isSwiped(){return this.state===Pn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=bn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=xn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(wn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(Sn.prototype,yn);const kn="IDLE",On="BEGIN",Pn="RECOGNIZED",Tn=Phaser.Utils.Objects.GetValue,_n=Phaser.Utils.Array.SpliceOne,Mn=Phaser.Math.Distance.Between,En=Phaser.Math.Angle.Between;class Rn{constructor(t,e){var i=Ze(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(Tn(e,"inputConfig",void 0)),this.setEventEmitter(Tn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(Tn(t,"enable",!0)),this.bounds=Tn(t,"bounds",void 0),this.tracerState=Dn,this.pointers.length=0,mt(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,mt(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case Dn:this.tracerState=An,this.onDrag1Start();break;case An:this.tracerState=Bn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],_n(this.pointers,e),this.tracerState){case An:this.tracerState=Dn,this.onDrag1End();break;case Bn:this.tracerState=An,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case An:this.onDrag1();break;case Bn:this.onDrag2()}}}dragCancel(){return this.tracerState===Bn&&this.onDrag2End(),this.pointers.length=0,mt(this.movedState),this.tracerState=Dn,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Bn)return 0;var t=this.pointers[0],e=this.pointers[1];return Mn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Bn)return 0;var t=this.pointers[0],e=this.pointers[1];return En(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Ln.x=e.x-i.x,Ln.y=e.y-i.y}else Ln.x=0,Ln.y=0;return Ln}get centerX(){if(this.tracerState!==Bn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Bn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Bn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Bn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Wn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&ur(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&ur(t,s,e,i)}}Object.assign(Rn.prototype,Ke);var Ln={};const Dn=0,An=1,Bn=2,Wn="IDLE";Phaser.Utils.Objects.GetValue;const zn=Phaser.Math.RotateAround;var In=function(t,e,i,s){return zn(t,e,i,s),t.rotation+=s,t},Yn={};const jn=Phaser.Utils.Objects.GetValue,Xn=Phaser.Math.Angle.WrapDegrees,Fn=Phaser.Math.Angle.ShortestBetween,Hn=Phaser.Math.RadToDeg,Vn=Phaser.Math.DegToRad;var Gn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Yn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,a=r.y,h=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Xn(Hn(this.angleBetween));this.angle=Fn(this.prevAngle,t),this.prevAngle=t,this.state=$n}break;case $n:t=Xn(Hn(this.angleBetween)),this.angle=Fn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===$n}get rotation(){return Vn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Gn);const Un="IDLE",Nn="BEGIN",$n="RECOGNIZED",Kn=Phaser.Utils.Objects.GetValue;var Jn=function(t){var e=Kn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new an(this,e),this._tap.on("tap",(function(t,e,s){Yr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Yr(i.eventEmitter,`${i.eventNamePrefix}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const qn=Phaser.Utils.Objects.GetValue;var Zn=function(t){var e=qn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new cn(this,e),this._press.on("pressstart",(function(t,e,s){Yr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this).on("pressend",(function(t,e,s){Yr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Qn=Phaser.Utils.Objects.GetValue;var ta=function(t){var e=Qn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new Sn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Yr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Yr(i.eventEmitter,`${i.eventNamePrefix}swipe`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const ea=Phaser.Utils.Objects.GetValue;var ia=function(t,e){return t.setInteractive(),ea(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:ea(e,"targets",[t]),targetMode:ea(e,"targetMode","parent"),eventEmitter:ea(e,"eventEmitter",t),eventNamePrefix:ea(e,"inputEventPrefix","child.")},Xr.call(t,e),Vr.call(t,e),Nr.call(t,e),qr.call(t,e),Jn.call(t,e),Zn.call(t,e),ta.call(t,e),t},sa={getSizerConfig:function(t){return void 0===t&&(t=this),Rt(t)},getChildPrevState:function(t){var e=Rt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=At(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,a,h=t.scene;if("number"==typeof e)i=e;else{i=le(e,"color"),s=le(e,"lineWidth");var o=le(e,"name",!1);o&&(r=le(o,"createTextCallback",ue),n=le(o,"createTextCallbackScope",void 0),"string"==typeof(a=le(o,"align","left-top"))&&(a=zt[a]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new de(h),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}var d,c,u=this.getAllShownChildren([this]);pe(u,u);for(var p=0,g=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=a)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=a+1),r};const ua=Phaser.Utils.Objects.IsPlainObject,pa=Phaser.Utils.Objects.GetValue,ga=Phaser.Display.Align.CENTER,va={min:0,full:-1};var fa=function(t,e,i,s,r,n,a,h,o,l){var d,c,u,p;ye.call(this,t);var g=t.isRexSpace,v=typeof e;if(null===e)return this;if("number"===v);else if("string"===v)e=va[e];else if(ua(e)){var f;e=pa(f=e,"proportion",void 0),i=pa(f,"align",ga),s=pa(f,"padding",0),r=pa(f,"expand",!1),n=pa(f,"key",void 0),a=pa(f,"index",void 0),t.isRexSizer||(h=pa(f,"minWidth",void 0),o=pa(f,"minHeight",void 0)),l=pa(f,"fitRatio",0),d=pa(f,"offsetX",0),c=pa(f,"offsetY",0),u=pa(f,"offsetOriginX",0),p=pa(f,"offsetOriginY",0)}return"string"==typeof i&&(i=zt[i]),void 0===e&&(e=g?1:0),void 0===i&&(i=ga),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===h&&(g?h=0:t.isRexSizer||(h=t._minWidth)),void 0===o&&(g?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),(f=this.getSizerConfig(t)).proportion=e,f.align=i,f.padding=fe(s),f.expand=r,f.fitRatio=0===e?l:0,f.alignOffsetX=d,f.alignOffsetY=c,f.alignOffsetOriginX=u,f.alignOffsetOriginY=p,void 0===a||a>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(a,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===h?Q(t):h:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=h)),void 0!==n&&this.addChildrenMap(n,t),this},ma={add:fa,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),fa.call(this,new da(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,h){return ua(i)&&(i.index=t),fa.call(this,e,i,s,r,n,a,t,h),this},insertAtPosition(t,e,i,s,r,n,a,h,o){var l=ca.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,h,o),this}};const ya=Et.prototype.clear;var ba=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),ya.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,ba.call(this,t),this}},wa={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=zt[e]),this.getSizerConfig(t).align=e,this}},Sa={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},ka={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},Oa={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},Pa={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,h=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=h.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,a+=n)));else for(d=0,c=h.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,a+=n)))}return o?void 0:a+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,a=s.padding;i=n-(a.left+a.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,a=s.padding;i=n-(a.top+a.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Ge(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Fe.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,h,o,l,d,c,u=this.sizerChildren,p=this.innerLeft,g=this.innerTop,v=this.innerWidth,f=this.innerHeight,m=p,y=g,b=this.startChildIndex,x=0,C=u.length;x0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Ie.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||We.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&oa.call(this,t,void 0),ze.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Ye.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&oa.call(this,void 0,t),je.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],a=n&&n.isRexSpace;return"center"===t?a||this.insertSpace(r+1):a&&this.remove(n,!0),this}};Object.assign(Pa,ma,Ca,wa,Sa,ka,Oa);var Ta=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},_a={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},Ma=function(t){return"string"==typeof t&&(t=_a[t]),t};const Ea=Phaser.Utils.Objects.IsPlainObject,Ra=Phaser.Utils.Objects.GetValue;class La extends na{constructor(t,e,i,s,r,n,a){Ea(e)?(e=Ra(a=e,"x",0),i=Ra(a,"y",0),s=Ra(a,"width",void 0),r=Ra(a,"height",void 0),n=Ra(a,"orientation",0)):Ea(s)?(s=Ra(a=s,"width",void 0),r=Ra(a,"height",void 0),n=Ra(a,"orientation",0)):Ea(n)&&(n=Ra(a=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,a),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Ra(a,"space.item",0)),this.setStartChildIndex(Ra(a,"startChildIndex",0)),this.setRTL(Ra(a,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=Ma(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=Ta.call(this)),this._childrenProportion}}Object.assign(La.prototype,Pa);var Da=function(t,e,i,s){return e/t<=i?e/(s-1):0},Aa=function(t){var e,i,s,r,n,a={lines:[],width:0,height:0},h=this.sizerChildren,o=0,l=a.lines,d=void 0;if(0===this.orientation){for(var c=0,u=h.length;ch.height/2)){r>(o=Ba(h.left,h.centerY,t,e))&&(r=o,s=n);var o,l=i[n+1];l&&l.y===h.y||r>(o=Ba(h.right,h.centerY,t,e))&&(r=o,s=n+1)}}return s};const za=Phaser.Utils.Objects.IsPlainObject,Ia=Phaser.Utils.Objects.GetValue,Ya=Phaser.Display.Align.CENTER;var ja=function(t,e,i,s){return"\n"===t?(this.addNewLine(),this):(ye.call(this,t),za(e)&&(e=Ia(o=e,"padding",0),i=Ia(o,"key",void 0),s=Ia(o,"index",void 0),r=Ia(o,"offsetX",0),n=Ia(o,"offsetY",0),a=Ia(o,"offsetOriginX",0),h=Ia(o,"offsetOriginY",0)),void 0===e&&(e=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=0),void 0===h&&(h=0),(o=this.getSizerConfig(t)).align=Ya,o.padding=fe(e),o.alignOffsetX=r,o.alignOffsetY=n,o.alignOffsetOriginX=a,o.alignOffsetOriginY=h,void 0===s||s>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(s,0,t),void 0!==i&&this.addChildrenMap(i,t),this);var r,n,a,h,o},Xa={add(t,e,i){if(pr(t))for(var s=t,r=0,n=s.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,ba.call(this,t),this}},Va={getChildrenWidth:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=0===this.orientation&&t?this.maxChildWidth:this.rexSizer.resolved?this.wrapResult.width:void 0)?e+(this.space.left+this.space.right)*this.scaleX:void 0);var e},getChildrenHeight:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=1===this.orientation&&t?this.maxChildHeight:this.rexSizer.resolved?this.wrapResult.height:void 0)?e+(this.space.top+this.space.bottom)*this.scaleY:void 0);var e},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&r.push(o.join("")),r},wh=0,Sh=1,kh=2,Oh=0,Ph=1,Th=2,_h=/(?:\r\n|\r|\n)/;const Mh={none:Oh,word:Ph,char:Th,character:Th,mix:3},Eh=Phaser.Renderer.WebGL.Utils;var Rh={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,a=r.height,h=Eh.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,a,e.x,e.y,n/e.resolution,a/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,a,h(e.tintTopLeft,i.alpha*e._alphaTL),h(e.tintTopRight,i.alpha*e._alphaTR),h(e.tintBottomLeft,i.alpha*e._alphaBL),h(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const Lh=Phaser.Display.Color;var Dh={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,a,h,o,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===a&&(a=0),void 0===h&&(h=0),void 0===o&&(o=c),void 0===l&&(l=u);var p=d.cutX+a,g=d.cutY+h;return this.context.drawImage(d.source.image,p,g,o,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new Lh);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var a=i;i=a.red,s=a.green,r=a.blue,n=a.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var h=this.context.createImageData(1,1);return h.data[0]=i,h.data[1]=s,h.data[2]=r,h.data[3]=n,this.context.putImageData(h,t,e),this.dirty=!0,this}},Ah=function(t,e,i,s,r,n,a){var h,o=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===a&&(a=e.height);var d=(h=o.exists(i)?o.get(i):o.createCanvas(i,n,a)).getSourceImage();d.width!==n&&(d.width=n),d.height!==a&&(d.height=a);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,a),c.drawImage(e,s,r,n,a),l.gl&&h&&l.canvasToTexture(d,h.source[0].glTexture,!0,0)},Bh={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,Ah(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};e();const Wh=Phaser.Display.Canvas.CanvasPool,zh=Phaser.GameObjects.GameObject,Ih=Phaser.Utils.String.UUID;let Yh=class extends zh{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=Wh.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=Ih(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){Wh.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}};const jh=Phaser.GameObjects.Components;Phaser.Class.mixin(Yh,[jh.Alpha,jh.BlendMode,jh.Crop,jh.Depth,jh.Flip,jh.GetBounds,jh.Mask,jh.Origin,jh.Pipeline,jh.PostPipeline,jh.ScrollFactor,jh.Tint,jh.Transform,jh.Visible,Rh,Dh,Bh]);var Xh={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:Es(this.data,t,e)},incData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)+e),this},mulData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)*e),this},clearData(){return this.data&&mt(this.data),this}};class Fh{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}}Object.assign(Fh.prototype,Xh);var Hh={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const Vh=Phaser.Math.RotateAround;var Gh;const Uh=Phaser.Geom.Rectangle;var Nh,$h=function(t){void 0===Nh&&(Nh=new Uh);var e=t.drawTLX,i=t.drawTLY;return Nh.setTo(e,i,t.drawTRX-e,t.drawBLY-i),Nh};const Kh=Phaser.Math.RotateAround;var Jh,qh=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Jh&&(Jh={}),s=Jh),s.x=e,s.y=i,0!==t.rotation&&Kh(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const Zh=Phaser.GameObjects.Components.TransformMatrix;var Qh,to,eo={},io=function(t,e,i,s,r){var n=qh(e,i,s,!0),a=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=eo);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===Qh&&(Qh=new Zh,to=new Zh),t.parentContainer?t.getWorldTransformMatrix(Qh,to):Qh.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),Qh.transformPoint(r,n,s),s}(t,n.x,n.y,r);return a},so=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,a=e.drawCenterY+s;return io(t,e,n,a,r)},ro={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Gh&&(Gh={}),s=Gh),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&Vh(s,0,0,-i.rotation),s}(t,e,this,!0);return $h(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return so(this.parent,this,t,e,i)}};Object.assign(ro,Hh);const no=Phaser.Math.DegToRad,ao=Phaser.Math.RadToDeg,ho=Phaser.Utils.Objects.GetValue;class oo extends Fh{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return ao(this._rotation)}set angle(t){this.rotation=no(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=ho(t,"width",void 0),i=ho(t,"height",void 0),s=ho(t,"scaleX",void 0),r=ho(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(oo.prototype,ro);const lo=Phaser.Utils.String.Pad;var co=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${lo(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},uo=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const po=Phaser.Utils.Objects.GetValue;let go=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=po(t,"x",0),i=po(t,"y",0));var s=this.cornerRadius;s.tl=vo(po(t,"tl",void 0),e,i),s.tr=vo(po(t,"tr",void 0),e,i),s.bl=vo(po(t,"bl",void 0),e,i),s.br=vo(po(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){fo(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){fo(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){fo(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){fo(this.cornerRadius.br,t)}};var vo=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),mo(t),t},fo=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=po(e,"x",0),t.y=po(e,"y",0)),mo(t)},mo=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const yo=Phaser.Math.DegToRad;var bo=function(t){return!t.hasOwnProperty("convex")||t.convex},xo=function(t){return t.x>0&&t.y>0},Co=function(t,e,i,s,r,n,a,h,o){if(h&&a>n?a-=360:!h&&a=p?1:s/p,f=r>=g?1:r/g,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),h=m.tl,xo(h)?(o=h.x*v,l=h.y*f,bo(h)?Co(t,o,l,o,l,180,270,!1,a):Co(t,0,0,o,l,90,0,!0,a),d=0,c=l):(t.lineTo(0,0),d=0,c=0),h=m.tr,xo(h)?(o=h.x*v,l=h.y*f,bo(h)?Co(t,s-o,l,o,l,270,360,!1,a):Co(t,s,0,o,l,180,90,!0,a)):t.lineTo(s,0),h=m.br,xo(h)?(o=h.x*v,l=h.y*f,bo(h)?Co(t,s-o,r-l,o,l,0,90,!1,a):Co(t,s,r,o,l,270,180,!0,a)):t.lineTo(s,r),h=m.bl,xo(h)?(o=h.x*v,l=h.y*f,bo(h)?Co(t,o,r-l,o,l,90,180,!1,a):Co(t,0,r,o,l,360,270,!0,a)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,a,u),null!=h)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,h),p.addColorStop(1,d),h=p),e.fillStyle=h,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())},So=function(t,e,i,s,r,n,a,h){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),wo(t.canvas,t.context,d,d,o,l,r,e,i,s,n,a,h)}};const ko=Phaser.Utils.Objects.GetValue;class Oo extends oo{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(ko(e,"color",null),ko(e,"color2",null),ko(e,"horizontalGradient",!0)),this.setStroke(ko(e,"stroke",null),ko(e,"strokeThickness",2)),this.setCornerRadius(ko(e,"cornerRadius",0),ko(e,"cornerIteration",null))}set color(t){t=co(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=co(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=co(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,uo("color2",t,this),uo("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,uo("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,uo("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){So(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Po=Phaser.Utils.Objects.GetValue;class To extends oo{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(Po(e,"color",null),Po(e,"color2",null),Po(e,"horizontalGradient",!0)),this.setStroke(Po(e,"stroke",null),Po(e,"strokeThickness",2))}set color(t){t=co(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=co(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=co(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,Po(t,"color2",null),Po(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Po(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,a=this.parent.height-i.top-i.bottom,h=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?h.createLinearGradient(0,0,n,0):h.createLinearGradient(0,0,0,a)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,h.fillStyle=t,h.fillRect(s,r,n,a));null!=this.stroke&&this.strokeThickness>0&&(h.strokeStyle=this.stroke,h.lineWidth=this.strokeThickness,h.strokeRect(s,r,n,a))}}const _o=Phaser.Utils.Objects.GetValue;let Mo=class t{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(_o(t,"bold",!1)),this.setItalic(_o(t,"italic",!1)),this.setFontSize(_o(t,"fontSize","16px")),this.setFontFamily(_o(t,"fontFamily","Courier")),this.setColor(_o(t,"color","#fff")),this.setStrokeStyle(_o(t,"stroke",null),_o(t,"strokeThickness",0)),this.setShadow(_o(t,"shadowColor",null),_o(t,"shadowOffsetX",0),_o(t,"shadowOffsetY",0),_o(t,"shadowBlur",0)),this.setOffset(_o(t,"offsetX",0),_o(t,"offsetY",0)),this.setSpace(_o(t,"leftSpace",0),_o(t,"rightSpace",0)),this.setAlign(_o(t,"align",void 0)),this.setBackgroundColor(_o(t,"backgroundColor",null)),this.setBackgroundHeight(_o(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(_o(t,"backgroundBottomY",void 0)),this.setBackgroundLeftX(_o(t,"backgroundLeftX",0)),this.setBackgroundRightX(_o(t,"backgroundRightX",0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(uo("stroke",t,this),uo("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(uo("shadowOffsetX",t,this),uo("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),t.hasOwnProperty("backgroundLeftX")&&this.setBackgroundLeftX(t.backgroundLeftX),t.hasOwnProperty("backgroundRightX")&&this.setBackgroundRightX(t.backgroundRightX),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new t(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=co(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=co(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=co(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=co(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setBackgroundLeftX(t){return this.backgroundLeftX=t,this}setBackgroundRightX(t){return this.backgroundRightX=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}};const Eo=Phaser.Utils.Array.Remove,Ro=Phaser.Utils.Array.Remove,Lo="text",Do="image",Ao="drawer",Bo="space",Wo="command";var zo=function(t){return t.type===Lo&&"\n"===t.text},Io=function(t){return t.type===Lo&&"\f"===t.text},Yo=function(t){return t.type===Lo};class jo extends oo{constructor(t,e,i){super(t,Lo),this.updateTextFlag=!1,this.style=new Mo(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX+e.backgroundLeftX,s=i,r=this.drawTRX+e.backgroundRightX-i+1;if(r>0){var n=e.backgroundBottomY;null==n&&(n=this.drawBLY);var a=e.backgroundHeight;null==a&&(a=n-this.drawTLY);var h=n-a;t.fillRect(s,h,r,a)}}var o=e.hasFill,l=e.hasStroke;(o||l)&&(e.syncFont(t).syncStyle(t),l&&(e.syncShadow(t),t.strokeText(this.text,0,0)),o&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var Xo=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const Fo=Phaser.Display.Canvas.CanvasPool;var Ho=function(t,e,i,s,r,n,a,h){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===h&&(h=!1),h&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(a){var l=Fo.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=a,d.fillRect(0,0,r,n),o.drawImage(l,0,0,r,n,i,s,r,n),Fo.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)};Phaser.Display.Canvas.CanvasPool;class Vo extends oo{constructor(t,e,i){super(t,Do),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){Ho(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class Go extends oo{constructor(t,e,i,s){super(t,Ao),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class Uo extends oo{constructor(t,e){super(t,Bo),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class No extends Fh{constructor(t,e,i,s,r){super(t,Wo),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}function $o(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>$o(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=$o(t[i]));return e}var Ko=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const Jo={none:0,word:1,char:2,character:2,mix:3};var qo=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,a=!r&&!n,h=t.length,o=e,l=s.word,d=0,c=!1;o0&&!h){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=el.call(this)).height,a=l.ascent,i=Math.floor((o-a)/n))}else{var l;n=(l=el.call(this)).height,a=l.ascent}}else this.fixedHeight>0?void 0===(i=sl(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=sl(t,"maxLines",0);void 0===a&&(a=n);var d=0===i,c=sl(t,"wrapMode");void 0===c&&(c=sl(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=Jo[c]);var u=sl(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=sl(t,"letterSpacing",0),g=sl(t,"hAlign",0),v=sl(t,"vAlign",0),f=sl(t,"justifyPercentage",.25),m=Ko({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:g,vAlign:v,justifyPercentage:f,ascent:a,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,b=0,x=y.length;b0&&(M.push({children:E,width:R}),L=Math.max(L,R)),m.start+=_.length,m.isLastPage=!D&&m.start===T,m.maxLineWidth=L,m.linesHeight=M.length*n;var j=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,X=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,a=t.vAlign,h=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(a=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=al(t,"maxLines",void 0))){var a=this.fixedWidth-r;i=Math.floor(a/n)+1}}else i=al(t,"maxLines",0);var h=0===i,o=al(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=al(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=al(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=al(t,"letterSpacing",0),p=al(t,"rtl",!0),g=al(t,"hAlign",p?2:0),v=al(t,"vAlign",0),f=Ko({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:g,vAlign:v,lineWidth:n,fixedCharacterHeight:o,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(_.push({children:M,height:E}),R=Math.max(R,E)),f.start+=T.length,f.isLastPage=f.start===P,f.maxLineHeight=R,f.linesWidth=_.length*n;var z=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,I=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,a=t.vAlign,h=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}h&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,a=i.bottom;return De(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||a!=i.bottom,this},getPadding:function(t){return Le(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),Eo(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return Ro(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(Lo);return null===i?i=new jo(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),so(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const Rl=Phaser.Utils.Objects.GetFastValue;var Ll={};class Dl{constructor(t){this.pools=Rl(t,"pools",Ll)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new El),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;ei&&(r=Math.floor(i));for(var n={},a=Xl(t,r,e,i,n),h=0;h<=Il&&0!==a;h++){if((r+=a)<0){r=0;break}a=Xl(t,r,e,i,n)}return h===Il&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),Fl(t,e,i),t},jl=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},Xl=function(t,e,i,s,r){var n,a=jl(t,e,r),h=jl(t,e+1,r);if(void 0!==s)if(a.height<=s&&h.height>s)n=0;else{if(a.height>s)return-1;n=Math.floor(s-a.height)}if(a.width<=i&&h.width>i)return 0;if(a.width>i)return-1;var o=Math.floor(i-a.width);return void 0===n?o:Math.min(o,n)},Fl=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const Hl=Phaser.Utils.Objects.GetValue,Vl=Phaser.Utils.Objects.GetValue;class Gl extends ih{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=Vl(e,"background",void 0),r=Vl(e,"icon",void 0),n=Vl(e,"iconMask",void 0),a=Vl(e,"text",void 0),h=Vl(e,"action",void 0),o=Vl(e,"actionMask",void 0),l=Vl(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(a||h)&&(i={right:Vl(e,"space.icon",0),top:Vl(e,"space.iconTop",0),bottom:Vl(e,"space.iconBottom",0),left:Vl(e,"space.iconLeft",0)}):(a||h)&&(i={bottom:Vl(e,"space.icon",0),left:Vl(e,"space.iconLeft",0),right:Vl(e,"space.iconRight",0),top:Vl(e,"space.iconTop",0)});var d=Vl(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=uh.call(this,r,r,1)),!d){var c=Vl(e,"iconSize",void 0);this.setIconSize(Vl(e,"iconWidth",c),Vl(e,"iconHeight",c))}}if(a){var u=Vl(e,"wrapText",!1),p=Vl(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),function(t,e){switch(mh(t)){case 0:switch("string"==typeof e&&(e=Mh[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=xh;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Mh[e]||0),t.style.wrapMode=e}}(a,u),e.expandTextWidth=!0,zl(a)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=Hl(e,"minWidth",0),s=Hl(e,"minHeight",0),r=Hl(e,"fitHeight",!1);t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return Yl(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),Yl(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t})}(a,{fitHeight:!0}));var g,v,f=Vl(e,"space.text",0),m=Vl(e,"expandTextWidth",!1),y=Vl(e,"expandTextHeight",!1);0===this.orientation?(g=m?1:0,h&&(i={right:f}),v=y):(g=y?1:0,h&&(i={bottom:f}),v=m),this.add(a,{proportion:g,expand:v,padding:i})}if(h&&(i=0===this.orientation?{top:Vl(e,"space.actionTop",0),bottom:Vl(e,"space.actionBottom",0),right:Vl(e,"space.actionRight",0)}:{left:Vl(e,"space.actionLeft",0),right:Vl(e,"space.actionRight",0),bottom:Vl(e,"space.actionBottom",0)},d=Vl(e,"squareFitAction",!1)?1:0,this.add(h,{proportion:0,padding:i,fitRatio:d}),o&&(o=uh.call(this,h,h,1)),!d)){var b=Vl(e,"actionSize");this.setActionSize(Vl(e,"actionWidth",b),Vl(e,"actionHeight",b))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",a),this.addChildrenMap("action",h),this.addChildrenMap("actionMask",o)}}var Ul=Phaser.Renderer.WebGL.Utils,Nl=function(t,e,i,s,r,n){for(var a=Ul.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),h=i.pathData,o=i.pathIndexes,l=0;l>>16,h=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+a+","+h+","+o+","+n+")"},Zl=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,a=(16711680&r)>>>16,h=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+a+","+h+","+o+","+n+")",t.lineWidth=e.lineWidth};const Ql=Phaser.Renderer.Canvas.SetTransform;var td={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Jl(e,i,s),a=r.calcMatrix.copyFrom(n.calc),h=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&Nl(r,a,e,l,h,o),e.isStroked&&Kl(r,e,l,h,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(Ql(t,r,e,i,s)){var n=e._displayOriginX,a=e._displayOriginY,h=e.pathData,o=h.length-1,l=h[0]-n,d=h[1]-a;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(id.prototype,td);var sd=function(t){return t.x>0&&t.y>0},rd=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const nd=Phaser.Math.DegToRad;var ad=function(t,e,i,s,r,n,a,h,o){a&&n>r?n-=360:!a&&n0,a=0,h=e.length;a0;this.dirty=this.dirty||this._radiusTL!==t||this._convexTL!==e,this._convexTL=e,this._radiusTL=Math.abs(t)}get radiusTR(){return this._radiusTR}set radiusTR(t){var e=t>0;this.dirty=this.dirty||this._radiusTR!==t||this._convexTR!==e,this._convexTR=e,this._radiusTR=Math.abs(t)}get radiusBL(){return this._radiusBL}set radiusBL(t){var e=t>0;this.dirty=this.dirty||this._radiusBL!==t||this._convexBL!==e,this._convexBL=e,this._radiusBL=Math.abs(t)}get radiusBR(){return this._radiusBR}set radiusBR(t){var e=t>0;this.dirty=this.dirty||this._radiusBR!==t||this._convexBR!==e,this._convexBR=e,this._radiusBR=Math.abs(t)}get radius(){return Math.max(this.radiusTL,this.radiusTR,this.radiusBL,this.radiusBR)}set radius(t){"number"==typeof t?(this.radiusTL=t,this.radiusTR=t,this.radiusBL=t,this.radiusBR=t):(this.radiusTL=ac(t,"tl",0),this.radiusTR=ac(t,"tr",0),this.radiusBL=ac(t,"bl",0),this.radiusBR=ac(t,"br",0))}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}get iterations(){return this._iterations}set iterations(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t}setIterations(t){return this.iterations=t,this}updateData(){var t=this.pathData;t.length=0;var e,i=this.width,s=this.height,r=this.iterations+1;return(e=this.radiusTL)>0?this._convexTL?ad(e,e,e,e,180,270,!1,r,t):ad(0,0,e,e,90,0,!0,r,t):rd(0,0,t),(e=this.radiusTR)>0?this._convexTR?ad(i-e,e,e,e,270,360,!1,r,t):ad(i,0,e,e,180,90,!0,r,t):rd(i,0,t),(e=this.radiusBR)>0?this._convexBR?ad(i-e,s-e,e,e,0,90,!1,r,t):ad(i,s,e,e,270,180,!0,r,t):rd(i,s,t),(e=this.radiusBL)>0?this._convexBL?ad(e,s-e,e,e,90,180,!1,r,t):ad(0,s,e,e,360,270,!0,r,t):rd(0,s,t),t.push(t[0],t[1]),Vd(this.x,this.y,t),super.updateData(),this}}Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlpha;var oc=function(t,e,i,s,r,n){var a=(e+s)/2;return n>=0?t.startAt(a+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(a+n,i):t.startAt(a,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(a,i),t.close(),t};const lc=Phaser.Utils.Objects.GetValue,dc=Phaser.Utils.Objects.IsPlainObject;class cc extends(Ad(Pd)){constructor(t,e,i,s,r,n,a,h){dc(e)?(e=(h=e).x,i=h.y,s=h.width,r=h.height,n=h.barColor,a=h.value):dc(s)?(s=(h=s).width,r=h.height,n=h.barColor,a=h.value):dc(n)&&(n=(h=n).barColor,a=h.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===a&&(a=0),super(t,e,i,s,r,h),this.type="rexLineProgress",this.bootProgressBase(h),this.addShape((new nc).setName("trackFill")).addShape((new nc).setName("bar")).addShape((new nc).setName("trackStroke")),this.setTrackColor(lc(h,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(lc(h,"trackStrokeThickness",2),lc(h,"trackStrokeColor",void 0)),this.setSkewX(lc(h,"skewX",0)),this.setRTL(lc(h,"rtl",!1)),this.setValue(a)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var uc={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&oc(s,0,0,e,i,t);var r,n,a=this.getShape("bar");a.fillStyle(this.barColor),a.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),oc(a,r,0,n,i,t));var h=this.getShape("trackStroke");h.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),h.isStroked&&oc(h,0,0,e,i,t)}};Object.assign(cc.prototype,uc);var pc=function(t){return null==t||""===t||0===t.length},gc=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(pc(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(pc(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,a=e.length;n=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=$o(i),s=$o(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),a=n.width,h=0,o=0,l=i.length;o0?a/h:0,c=n.height,u=0;for(o=0,l=s.length;o0?0:v,b=0,o=0;for(var S=i.length;o0?0:f),f>=1&&v>=1){var k=typeof(m=this.getFrameNameCallback(o,C,e));"string"!==k&&"number"!==k||r.add(m,0,b+n.cutX,x+n.cutY,f,v)}b+=f}x+=v}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,a,h,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/o,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var g=Math.min(u,p);if(u>g){var v=(u-g)*o;d>=0?d+=v:d=v,u=g}if(p>g){var f=(p-g)*l;c>=0?c+=f:c=f,p=g}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,x=this.rows.count;b0&&h>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(C,b)?0:1)?this._drawImage(this.textureKey,s,m,y,a,h):this._drawTileSprite(this.textureKey,s,m,y,a,h)),m+=a;y+=h}this._endDraw()},setStretchMode:function(t){return Lc(t)?(this.stretchMode.edge=Ac(Dc(t,"edge",0)),this.stretchMode.internal=Ac(Dc(t,"internal",0))):(t=Ac(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Wc.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const Ic=Phaser.Utils.Objects.IsPlainObject,Yc=Phaser.Utils.Objects.GetValue,jc=Phaser.GameObjects;var Xc=void 0,Fc=function(t,e){if(Xc||(Xc={},ei(t).events.once("destroy",(function(){for(var t in Xc)Xc[t].destroy();Xc=void 0}))),!Xc.hasOwnProperty(e)){var i=ei(t).scene.systemScene;(t=new jc[e](i)).setOrigin(0),Xc[e]=t}return Xc[e]};const Hc=Phaser.GameObjects.RenderTexture;class Vc extends(function(t,e){class i extends t{constructor(t,i,s,r,n,a,h,o,l,d){if(Ic(i)?(i=Yc(d=i,"x",0),s=Yc(d,"y",0),r=Yc(d,"width",1),n=Yc(d,"height",1),a=Yc(d,"key",void 0),h=Yc(d,"baseFrame",void 0),o=Yc(d,"columns",void 0),l=Yc(d,"rows",void 0)):Ic(r)?(r=Yc(d=r,"width",1),n=Yc(d,"height",1),a=Yc(d,"key",void 0),h=Yc(d,"baseFrame",void 0),o=Yc(d,"columns",void 0),l=Yc(d,"rows",void 0)):Ic(a)?(a=Yc(d=a,"key",void 0),h=Yc(d,"baseFrame",void 0),o=Yc(d,"columns",void 0),l=Yc(d,"rows",void 0)):Ic(h)?(h=Yc(d=h,"baseFrame",void 0),o=Yc(d,"columns",void 0),l=Yc(d,"rows",void 0)):Array.isArray(h)?(d=l,l=o,o=h,h=Yc(d,"baseFrame",void 0)):Ic(o)&&(o=Yc(d=o,"columns",void 0),l=Yc(d,"rows",void 0)),void 0===h&&(h=Yc(d,"frame",void 0)),void 0===o){var c=Yc(d,"leftWidth",void 0),u=Yc(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=Yc(d,"topHeight",void 0),g=Yc(d,"bottomHeight",void 0);void 0!==p&&void 0!==g&&(l=[p,void 0,g])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(Yc(d,"getFrameNameCallback",void 0)),this.setStretchMode(Yc(d,"stretchMode",0)),this.setPreserveRatio(Yc(d,"preserveRatio",!0));var v=Yc(d,"maxFixedPartScale",1),f=Yc(d,"maxFixedPartScaleX",v),m=Yc(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(a,h,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,zc),i}(Hc,"rexNinePatch")){}var Gc={_drawImage:function(t,e,i,s,r,n){var a=Fc(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(a,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var a=Fc(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(a,i,s)}};Object.assign(Vc.prototype,Gc);let Uc=class extends si{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(mc(t,e))return t[e];var i=t.parent;return mc(i,e)?i[e]:void 0}set(t,e,i){return mc(t,e)?t[e]=i:mc(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}};const Nc=Phaser.Utils.Objects.GetValue;class $c extends Vc{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=Nc(e,"effects",!0);i&&wc(this,i),this.style=new Uc(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign($c.prototype,yd);const Kc=["alpha","tint","flipX","flipY"];var Jc=function(t,e){if(!e)return t;for(var i=0,s=Kc.length;i=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return s(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return r(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;id(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;ed(t).x,getChildLocalY:t=>d(t).y};const P=Phaser.Math.DegToRad;var T={updateChildRotation(t){var e=d(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=d(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return d(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return d(t).rotation=P(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=d(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>d(t).rotation},_={updateChildScale(t){var e=d(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=d(t),i=e.parent;return e.scaleX=k(t.scaleX,i.scaleX),e.scaleY=k(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=d(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=d(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>d(t).scaleX,getChildLocalScaleY:t=>d(t).scaleY},M={updateChildVisible(t){var e=d(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=d(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),d(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),d(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=d(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>d(t).visible},E={updateChildAlpha(t){var e=d(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=d(t),i=e.parent;return e.alpha=k(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return d(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=d(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>d(t).alpha},R={updateChildActive(t){var e=d(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return d(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),d(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=d(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>d(t).active},L={updateChildScrollFactor(t){var e=d(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},D={updateCameraFilter(t){var e=d(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},A={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(t){void 0===t&&(t=!1);var e=this;return this._mask=null,this.setChildMaskVisible(this),this.children.forEach((function(t){t.clearMask&&t.clearMask(!1),t.hasOwnProperty("isRexContainerLite")||e.setChildMaskVisible(t)})),t&&this.mask&&this.mask.destroy(),this}},B=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},I=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const j=Phaser.Utils.Array;var X={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Me=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const Ee=/(\S+)\[(\d+)\]/i,Re=Phaser.Utils.Objects.GetValue;var Le=function(t,e){return void 0===e?t:t[e]},De=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Re(e,"left",0),t.right=Re(e,"right",0),t.top=Re(e,"top",0),t.bottom=Re(e,"bottom",0)),t},Ae={getInnerPadding(t){return Le(this.space,t)},setInnerPadding(t,e){return De(this.space,t,e),this},getOuterPadding(t){return Le(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return De(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Le(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),De(this.getSizerConfig(t).padding,e,i),this}},Be=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},We=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},ze=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Ie=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Ye=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},je=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},Xe={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},Fe=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?yi:mi,this.repeatCounter=0,this}stop(){return this.state=fi,this}update(t,e){this.state!==fi&&this.state!==xi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=bi)):(this.nowTime=this.duration,this.state=xi):this.nowTime>=0&&(this.state=yi))}get t(){var t;switch(this.state){case fi:case mi:case bi:t=0;break;case yi:t=this.nowTime/this.duration;break;case xi:t=1}return gi(t,0,1)}set t(t){(t=gi(t,-1,1))<0?(this.state=mi,this.nowTime=-this.delay*t):(this.state=yi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===fi}get isDelay(){return this.state===mi}get isCountDown(){return this.state===yi}get isRunning(){return this.state===mi||this.state===yi}get isDone(){return this.state===xi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const fi=0,mi=1,yi=2,bi=3,xi=-1;class Ci extends ci{constructor(t,e){super(t,e),this.timer=new vi}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const wi=Phaser.Utils.Objects.GetValue,Si=Phaser.Utils.Objects.GetAdvancedValue,ki=Phaser.Tweens.Builders.GetEaseFunction;class Oi extends Ci{resetFromJSON(t){return this.timer.resetFromJSON(wi(t,"timer")),this.setEnable(wi(t,"enable",!0)),this.setTarget(wi(t,"target",this.parent)),this.setDelay(Si(t,"delay",0)),this.setDuration(Si(t,"duration",1e3)),this.setEase(wi(t,"ease","Linear")),this.setRepeat(wi(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=ki(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Pi=Phaser.Utils.Objects.GetValue,Ti=Phaser.Utils.Objects.GetAdvancedValue,_i=Phaser.Math.Linear;let Mi=class extends Oi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Pi(t,"mode",0)),this.setScaleRange(Ti(t,"start",void 0),Ti(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ei[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Ti(t,"x",this.parent.scaleX),this.startY=Ti(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Ti(e,"x",void 0),this.endY=Ti(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=_i(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=_i(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const Ei={stop:0,destroy:1,yoyo:2};var Ri=function(t,e,i,s,r){var n,a;switch(void 0===s&&(s="Cubic"),i){case 0:case"x":n={x:0},a={x:t.scaleX};break;case 1:case"y":n={y:0},a={y:t.scaleY};break;default:n=0,a=t.scale}var h={mode:0,start:n,end:a,duration:e,ease:s};return void 0===r?r=new Mi(t,h):r.resetFromJSON(h),r.restart(),r},Li=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Mi&&(n=r,r=void 0),void 0===r&&(r=!0);var a={};switch(a.mode=r?1:0,i){case 0:case"x":a.end={x:0};break;case 1:case"y":a.end={y:0};break;default:a.end=0}return a.duration=e,a.ease=s,void 0===n?n=new Mi(t,a):n.resetFromJSON(a),n.restart(),n},Di=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Ai=function(t){return Di(t,"complete")};const Bi=Phaser.Utils.Objects.IsPlainObject;var Wi={onInitScale(){var t=this,e=this._scaleBehavior;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},popUp(t,e,i){if(Bi(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Ri(this,t,e,i,this._scaleBehavior),r&&this.onInitScale(),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise(t,e,i){return this.popUp(t,e,i),Ai(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Bi(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,s=r.destroy}var n=void 0===this._scaleBehavior;return this._scaleBehavior=Li(this,t,e,i,s,this._scaleBehavior),n&&this.onInitScale(),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise(t,e,i,s){return this.scaleDownDestroy(t,e,i,s),Ai(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Ai(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Bi(t)){var n=t;t=n.duration,e=n.peakValue,i=n.repeat,s=n.orientation,r=n.ease}var a=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,s,r,n,a){var h,o;switch(void 0===i&&(i=1.2),void 0===s&&(s=0),void 0===n&&(n="Cubic"),r){case 0:case"x":h={x:t.scaleX},o={x:i};break;case 1:case"y":h={y:t.scaleX},o={y:i};break;default:h=t.scaleX,o=i}var l={mode:2,start:h,end:o,duration:e/2,ease:n,repeat:s};return void 0===a?a=new Mi(t,l):a.resetFromJSON(l),a.restart(),a}(this,t,e,i,s,r,this._scaleBehavior),a&&this.onInitScale(),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise(t,e,i,s,r){return this.scaleYoyo(t,e,i,s,r),Ai(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},zi={};Object.assign(zi,Wi),zi.onInitScale=function(){Wi.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=Ce.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Ii=Phaser.Utils.Objects.GetValue,Yi=Phaser.Utils.Objects.GetAdvancedValue,ji=Phaser.Math.Linear;class Xi extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Ii(t,"mode",0)),this.setAlphaRange(Yi(t,"start",this.parent.alpha),Yi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Fi[t]),this.mode=t,this}setAlphaRange(t,e){return this.alphaStart=t,this.alphaEnd=e,this}start(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start()),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=ji(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Fi={stop:0,destroy:1,yoyo:2},Hi=Phaser.Utils.Objects.IsPlainObject;var Vi=function(t,e,i,s){var r,n;Hi(i)?(r=i.start,n=i.end):n=i,void 0===r&&(r=0),void 0===n&&(n=1);var a={mode:0,start:r,end:n,duration:e};return void 0===s?s=new Xi(t,a):s.resetFromJSON(a),s.restart(),s},Gi=function(t,e,i,s){i instanceof Xi&&(s=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===s?s=new Xi(t,r):s.resetFromJSON(r),s.restart(),s};const Ui=Phaser.Utils.Objects.IsPlainObject;var Ni={onInitFade(){var t=this,e=this._fade;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},fadeIn(t,e){if(Ui(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Vi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Ai(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(Ui(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Gi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Ai(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Ai(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},$i={};Object.assign($i,Ni),$i.onInitFade=function(){Ni.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=Ce.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Ki=Phaser.Utils.Objects.GetValue,Ji=Phaser.Utils.Objects.GetAdvancedValue,qi=Phaser.Math.Linear;class Zi extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Ki(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ji(t,"x",void 0),i=Ji(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Qi[t]),this.mode=t,this}setTargetPosition(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=Ji(i,"startX",void 0),this.startY=Ji(i,"startY",void 0),this.endX=Ji(i,"endX",void 0),this.endY=Ji(i,"endY",void 0)}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),super.start(),this}updateTarget(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=qi(this.startX,this.endX,i)),this.hasMoveY&&(t.y=qi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Qi={stop:0,destroy:1,yoyo:2};var ts=function(t,e){if("number"==typeof t)return t;var i=t[0],s=parseFloat(t.substr(2));switch(i){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return e/s}};const es=Phaser.Utils.Objects.IsPlainObject,is=Phaser.Math.Distance.Between;var ss={onInitEaseMove(){var t=this,e=this._easeMove;e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0)}))},moveFrom(t,e,i,s,r){if(es(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*is(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var a=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,a){n instanceof Zi&&(a=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=ts(i,t.x),h.endX=t.x),void 0!==s&&(h.startY=ts(s,t.y),h.endY=t.y),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===a?a=new Zi(t,h):a.resetFromJSON(h),a.restart(),a}(this,t,e,i,s,r,this._easeMove),a&&this.onInitEaseMove(),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise(t,e,i,s,r){return this.moveFrom(t,e,i,s,r),Ai(this._easeMove)},moveFromDestroy(t,e,i,s){return this.moveFrom(t,e,i,s,!0),this},moveFromDestroyPromise(t,e,i,s){return this.moveFromDestroy(t,e,i,s),Ai(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if(es(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*is(e,i,this.x,this.y)/n.speed:n.duration,s=n.ease}var a=void 0===this._easeMove;return this._easeMove=function(t,e,i,s,r,n,a){n instanceof Zi&&(a=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=t.x,h.endX=ts(i,t.x)),void 0!==s&&(h.startY=t.y,h.endY=ts(s,t.y)),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===a?a=new Zi(t,h):a.resetFromJSON(h),a.restart(),a}(this,t,e,i,s,r,this._easeMove),a&&this.onInitEaseMove(),this._easeMove.completeEventName,this},moveToPromise(t,e,i,s,r){return this.moveTo(t,e,i,s,r),Ai(this._easeMove)},moveToDestroy(t,e,i,s){return this.moveTo(t,e,i,s,!0),this},moveToDestroyPromise(t,e,i,s){return this.moveToDestroy(t,e,i,s,!0),Ai(this._easeMove)},isRunningMoveTo(){return this._easeMove&&"moveto.complete"===this._easeMove.completeEventName},isRunningEaseMove(){return this.isRunningMoveFrom()||this.isRunningMoveTo()},moveStop(t){return this._easeMove?(this._easeMove.stop(t),this):this}},rs={};Object.assign(rs,ss),rs.onInitEaseMove=function(){ss.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=Ce.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const ns=Phaser.Utils.Objects.GetValue;class as extends oi{constructor(t,e){super(t,e),this.timer=new vi,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(ns(t,"timer")),this.setEnable(ns(t,"enable",!0)),this.setMode(ns(t,"mode",1)),this.isRunning=ns(t,"isRunning",!1),this.setMagnitudeMode(ns(t,"magnitudeMode",1)),this.setAxisMode(ns(t,"axis",0)),this.setDuration(ns(t,"duration",500)),this.setMagnitude(ns(t,"magnitude",10)),this.ox=ns(t,"ox",void 0),this.oy=ns(t,"oy",void 0),this}toJSON(){return{timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}startTicking(){super.startTicking(),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this)}stopTicking(){super.stopTicking(),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this))}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setMode(t){return"string"==typeof t&&(t=hs[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ls[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=os[t]),this.axisMode=t,this}setDuration(t){return this.duration=t,this}setMagnitude(t){return this.magnitude=t,this}start(t,e){if("number"!=typeof t){var i=t;e=ns(i,"magnitude",void 0),t=ns(i,"duration",void 0)}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),super.start(),this}shake(t,e){return this.start(t,e),this}update(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else{void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var s=this.magnitude;1===this.magnitudeMode&&(s*=1-this.timer.t);var r=Math.random()*Math.PI*2,n=this.ox+Math.cos(r)*s,a=this.oy+Math.sin(r)*s;switch(this.axisMode){case 1:i.x=n;break;case 2:i.y=a;break;default:i.x=n,i.y=a}}return this}backToOrigin(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy}return this.ox=void 0,this.oy=void 0,this}}const hs={effect:0,behavior:1},os={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ls={constant:0,decay:1},ds=Phaser.Utils.Objects.IsPlainObject;var cs={shake(t,e,i){if(ds(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new as(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t)}))}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise(t,e){return this.shake(t,e),Ai(this._shake)}};const us=Phaser.Utils.Objects.GetValue,ps=Phaser.Math.Linear;class gs extends Oi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=us(t,"key","value");var i=e[this.propertyKey];return this.fromValue=us(t,"from",i),this.toValue=us(t,"to",i),this.setEase(us(t,"ease",this.ease)),this.setDuration(us(t,"duration",this.duration)),this.setRepeat(us(t,"repeat",0)),this.setDelay(us(t,"delay",0)),this.setRepeatDelay(us(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=ps(this.fromValue,this.toValue,i)}}const vs=Phaser.Utils.Objects.IsPlainObject;class fs extends si{constructor(t,e){super(t,e),this.parent.setDataEnabled(),this.easeTasks={}}complete(t){this.emit(`complete-${t}`,this.parent,this),this.emit("complete",t,this.parent,this)}getEaseTask(t){var e=this.easeTasks[t];return void 0===e&&(e=new gs(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t)}),this)),e}easeTo(t,e,i,s){if(vs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:s}),this}easeFrom(t,e,i,s){if(vs(t)){var r=t;t=r.key,e=r.value,i=r.duration,s=r.ease;var n=r.speed;void 0===i&&void 0!==n&&(i=Math.abs(e-this.parent.data.values[t])/n*1e3)}return void 0===i&&(i=1e3),void 0===s&&(s="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:s}),this}stopEase(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}stopAll(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}var ms={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new fs(this),function(t,e){e.on("complete",(function(e){t.emit(`easedata.${e}.complete`,t),t.emit("easedata.complete",e,t)}))}(this,this._easeData)),this._easeData.easeTo(t,e,i,s),this},easeDataToPromise(t,e,i,s){return this.easeDataTo(t,e,i,s),Di(this._easeData,`complete-${t}`)},stopEaseData(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData(t){return this._easeData?(this._easeData.stopAll(t),this):this}},ys=Phaser.Utils.Array.Remove,bs={delayCall(t,e,i){var s;void 0===this._delayCallTimers&&function(t){t._delayCallTimers=[],t.once("destroy",(function(){for(var e=t._delayCallTimers,i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var zs={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Ze(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Is={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=It),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=It),this.transitOutCallback=t,this}},Ys={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},js={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Xs={};Object.assign(Xs,zs,Is,Ys,js);const Fs=Phaser.Utils.Objects.GetValue;class Hs extends si{constructor(t,e){super(t,e),this.setTransitInTime(Fs(e,"duration.in",200)),this.setTransitOutTime(Fs(e,"duration.out",200)),this.setTransitInCallback(Fs(e,"transitIn")),this.setTransitOutCallback(Fs(e,"transitOut")),this.oneShotMode=Fs(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Ws(this,{eventEmitter:!1,initState:Fs(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Hs.prototype,Xs);var Vs=function(t){if(t.parentContainer)return Vs(t.parentContainer);var e=function(t){var e=t.displayList;return N(e)?e:null}(t);return e?Vs(e):t};class Gs extends si{constructor(t,e){super(t),this.targetCamera=void 0,this.boot()}boot(){this.scene.sys.events.on("prerender",this.resize,this)}destroy(){this.scene&&(this.scene.sys.events.off("prerender",this.resize,this),super.destroy())}resize(){var t=this.scene,e=this.parent,i=function(t){for(var e,i=Vs(t).cameraFilter,s=t.scene.sys.cameras.cameras,r=0,n=s.length;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,a=1/i.zoom,h=r/2,o=n/2,l=r*a,d=n*a;e.x===h&&e.y===o||e.setPosition(h,o),e.width===l&&e.height===d||e.setSize(l,d)}}}const Us=Phaser.GameObjects.Rectangle;let Ns=class extends Us{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Gs(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}};const $s=Phaser.Utils.Objects.GetValue;class Ks extends si{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode($s(t,"hitAreaMode",0)),this.setEnable($s(t,"enable",!0)),this.setStopMode($s(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Js[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Js={default:0,fullWindow:1};const qs=Phaser.Utils.Objects.GetValue;class Zs extends Ns{constructor(t,e){super(t,qs(e,"color",0),qs(e,"alpha",.8)),this.touchEventStop=new Ks(this,{hitAreaMode:1})}}var Qs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Ri(t,e)},scaleDown(t,e){Li(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Vi(t,e)},fadeOut(t,e){Gi(t,e,!1)}},tr=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Vi(t,e,t.alpha)},er=function(t,e){Gi(t,e,!1)},ir=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!nt(t,!0).contains(e,i)||r&&!r(t,e,i))};const sr=Phaser.Utils.Objects.GetValue;let rr=class extends Hs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=nr.popUp),null==e.transitOut&&(e.transitOut=nr.scaleDown),e.destroy=sr(e,"destroy",!0),super(t,e);var i=sr(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Zs(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(sr(i,"transitIn",tr)),this.setCoverTransitOutCallback(sr(i,"transitOut",er)));var s=sr(e,"touchOutsideClose",!1),r=sr(e,"duration.hold",-1),n=sr(e,"timeOutClose",r>=0),a=sr(e,"anyTouchClose",!1);sr(e,"manualClose",!1)&&(s=!1,a=!1,n=!1),a&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),a?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),sr(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&ir(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=nr[t]),t){case nr.popUp:t=Qs.popUp;break;case nr.fadeIn:t=Qs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=nr[t]),t){case nr.scaleDown:t=Qs.scaleDown;break;case nr.fadeOut:t=Qs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const nr={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var ar=function(t){return t&&"function"==typeof t},hr={modal(t,e){return ar(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new rr(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return function(t,e){t.emit("modal.requestClose",e)}(this,t),this}},or=function(t,e,i,s,r){ar(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},lr={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return or.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return or.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return or.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return or.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return or.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return or.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return or.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return or.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return or.call(this,"shutdown",t,e,i,s),this}},dr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=cr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},cr={},ur=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,a=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return a?ir(t,e.x,e.y,i,s):!!(r=dr(e,n,!0))&&ir(t,r.x,r.y,i,s);for(var h=t.scene.input.manager,o=h.pointersTotal,l=h.pointers,d=0;d=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const kr={press:0,pointerdown:0,release:1,pointerup:1};var Or={onClick(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new Sr(t,s)),t._click.on("click",e,i),this):this},offClick(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._click||t._click.setEnable(e),this},disableClick(t){return void 0===t&&(t=this),void 0===t._click||t._click.setEnable(!1),this}},Pr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!Tr(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,a=n.pointersTotal,h=n.pointers,o=0;o0)return _r.length=0,!0;return _r.length=0,!1},_r=[];const Mr=Phaser.Utils.Objects.GetValue;class Er extends si{constructor(t,e){super(t,e),this._enable=void 0;var i=Mr(e,"inputConfig",void 0);i&&t.setInteractive(i),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Mr(t,"enable",!0)),this.setMode(Mr(t,"mode",1)),this.setClickInterval(Mr(t,"clickInterval",100)),this.setDragThreshold(Mr(t,"threshold",void 0)),this}boot(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this)}shutdown(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,super.shutdown(t)}}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=Rr[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}isPointerInside(t){var e=this.parent;return(e.input?Pr:ur)(e,t)}onPress(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.isPointerInside(t)||(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t))))}onRelease(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0)}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const Rr={press:0,pointerdown:0,release:1,pointerup:1};var Lr={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Er(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class Dr extends Bs{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const Ar=Phaser.Utils.Objects.GetValue;class Br extends si{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Dr,this.parent.setInteractive(Ar(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Ar(t,"enable",!0)),this.setCooldown(Ar(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var Wr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&ur(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Br(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Br(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},zr={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},Ir=function(t,e,i,s){if("parent"===t){for(var r,n=0,a=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=tn,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===en&&this.onDragEnd(),this.pointer=void 0,this.tracerState=tn,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=sn,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&ur(t,s,e,i)}}const tn=0,en=1,sn="IDLE",rn=Phaser.Utils.Objects.GetValue,nn=Phaser.Math.Distance.Between;class an extends Qr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=hn},eventEmitter:!1};this.setRecongizedStateObject(new Bs(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(rn(t,"time",250)),this.setTapInterval(rn(t,"tapInterval",200)),this.setDragThreshold(rn(t,"threshold",9)),this.setTapOffset(rn(t,"tapOffset",10));var e=rn(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(rn(t,"maxTaps",void 0)),this.setMinTaps(rn(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case hn:this.state=on;break;case on:var t=this.lastPointer;nn(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=ln,this.state=on);break;case ln:this.state=on}}onDragEnd(){this.state===on&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=ln))}onDrag(){this.state!==hn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=hn)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===on){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=hn):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=ln:this.state=hn)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===ln&&(this.state=hn)}get isTapped(){return this.state===ln}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const hn="IDLE",on="BEGIN",ln="RECOGNIZED",dn=Phaser.Utils.Objects.GetValue;class cn extends Qr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=un},eventEmitter:!1};this.setRecongizedStateObject(new Bs(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(dn(t,"threshold",9)),this.setHoldTime(dn(t,"time",251)),this}onDragStart(){this.state=pn,0===this.holdTime&&(this.state=gn)}onDragEnd(){this.state=un}onDrag(){this.state!==un&&this.pointer.getDistance()>this.dragThreshold&&(this.state=un)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===pn&&t-this.pointer.downTime>=this.holdTime&&(this.state=gn)}get isPressed(){return this.state===gn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const un="IDLE",pn="BEGIN",gn="RECOGNIZED";Phaser.Utils.Objects.GetValue;var vn=function(t){return ei(t).loop.delta};const fn=Phaser.Math.Distance.Between,mn=Phaser.Math.Angle.Between;var yn={getDt:function(){return vn(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return fn(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return mn(e.x,e.y,t.x,t.y)}},bn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},xn={};const Cn=Phaser.Utils.Objects.GetValue,wn=Phaser.Math.RadToDeg;class Sn extends Qr{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=kn},eventEmitter:!1};this.setRecongizedStateObject(new Bs(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Cn(t,"threshold",10)),this.setVelocityThreshold(Cn(t,"velocityThreshold",1e3)),this.setDirectionMode(Cn(t,"dir","8dir")),this}onDragStart(){this.state=On}onDragEnd(){this.state=kn}onDrag(){this.state===On&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=Pn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Pn&&(this.state=kn)}get isSwiped(){return this.state===Pn}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=bn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=xn),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(wn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(Sn.prototype,yn);const kn="IDLE",On="BEGIN",Pn="RECOGNIZED",Tn=Phaser.Utils.Objects.GetValue,_n=Phaser.Utils.Array.SpliceOne,Mn=Phaser.Math.Distance.Between,En=Phaser.Math.Angle.Between;class Rn{constructor(t,e){var i=Ze(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(Tn(e,"inputConfig",void 0)),this.setEventEmitter(Tn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(Tn(t,"enable",!0)),this.bounds=Tn(t,"bounds",void 0),this.tracerState=Dn,this.pointers.length=0,mt(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,mt(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case Dn:this.tracerState=An,this.onDrag1Start();break;case An:this.tracerState=Bn,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],_n(this.pointers,e),this.tracerState){case An:this.tracerState=Dn,this.onDrag1End();break;case Bn:this.tracerState=An,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case An:this.onDrag1();break;case Bn:this.onDrag2()}}}dragCancel(){return this.tracerState===Bn&&this.onDrag2End(),this.pointers.length=0,mt(this.movedState),this.tracerState=Dn,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==Bn)return 0;var t=this.pointers[0],e=this.pointers[1];return Mn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Bn)return 0;var t=this.pointers[0],e=this.pointers[1];return En(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Ln.x=e.x-i.x,Ln.y=e.y-i.y}else Ln.x=0,Ln.y=0;return Ln}get centerX(){if(this.tracerState!==Bn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Bn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Bn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==Bn)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Wn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&ur(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&ur(t,s,e,i)}}Object.assign(Rn.prototype,Ke);var Ln={};const Dn=0,An=1,Bn=2,Wn="IDLE";Phaser.Utils.Objects.GetValue;const zn=Phaser.Math.RotateAround;var In=function(t,e,i,s){return zn(t,e,i,s),t.rotation+=s,t},Yn={};const jn=Phaser.Utils.Objects.GetValue,Xn=Phaser.Math.Angle.WrapDegrees,Fn=Phaser.Math.Angle.ShortestBetween,Hn=Phaser.Math.RadToDeg,Vn=Phaser.Math.DegToRad;var Gn={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Yn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,a=r.y,h=this.rotation;if(Array.isArray(t))for(var o=t,l=0,d=o.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Xn(Hn(this.angleBetween));this.angle=Fn(this.prevAngle,t),this.prevAngle=t,this.state=$n}break;case $n:t=Xn(Hn(this.angleBetween)),this.angle=Fn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===$n}get rotation(){return Vn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Gn);const Un="IDLE",Nn="BEGIN",$n="RECOGNIZED",Kn=Phaser.Utils.Objects.GetValue;var Jn=function(t){var e=Kn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new an(this,e),this._tap.on("tap",(function(t,e,s){Yr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Yr(i.eventEmitter,`${i.eventNamePrefix}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const qn=Phaser.Utils.Objects.GetValue;var Zn=function(t){var e=qn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new cn(this,e),this._press.on("pressstart",(function(t,e,s){Yr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this).on("pressend",(function(t,e,s){Yr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const Qn=Phaser.Utils.Objects.GetValue;var ta=function(t){var e=Qn(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new Sn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Yr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t),Yr(i.eventEmitter,`${i.eventNamePrefix}swipe`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s,t)}),this)}};const ea=Phaser.Utils.Objects.GetValue;var ia=function(t,e){return t.setInteractive(),ea(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:ea(e,"targets",[t]),targetMode:ea(e,"targetMode","parent"),eventEmitter:ea(e,"eventEmitter",t),eventNamePrefix:ea(e,"inputEventPrefix","child.")},Xr.call(t,e),Vr.call(t,e),Nr.call(t,e),qr.call(t,e),Jn.call(t,e),Zn.call(t,e),ta.call(t,e),t},sa={getSizerConfig:function(t){return void 0===t&&(t=this),Rt(t)},getChildPrevState:function(t){var e=Rt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=At(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,s,r,n,a,h=t.scene;if("number"==typeof e)i=e;else{i=le(e,"color"),s=le(e,"lineWidth");var o=le(e,"name",!1);o&&(r=le(o,"createTextCallback",ue),n=le(o,"createTextCallbackScope",void 0),"string"==typeof(a=le(o,"align","left-top"))&&(a=zt[a]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new de(h),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0}));var l=t.clear.bind(t);t.clear=function(){l(),t.children.clear(!1,!0)}}var d,c,u=this.getAllShownChildren([this]);pe(u,u);for(var p=0,g=u.length;p(i=0===this.orientation?Math.abs(o.left-t):Math.abs(o.top-e))&&(n=i,r=a)}return o=s[s.length-1],n>(i=0===this.orientation?Math.abs(o.right-t):Math.abs(o.bottom-e))&&(n=i,r=a+1),r};const ua=Phaser.Utils.Objects.IsPlainObject,pa=Phaser.Utils.Objects.GetValue,ga=Phaser.Display.Align.CENTER,va={min:0,full:-1};var fa=function(t,e,i,s,r,n,a,h,o,l){var d,c,u,p;ye.call(this,t);var g=t.isRexSpace,v=typeof e;if(null===e)return this;if("number"===v);else if("string"===v)e=va[e];else if(ua(e)){var f;e=pa(f=e,"proportion",void 0),i=pa(f,"align",ga),s=pa(f,"padding",0),r=pa(f,"expand",!1),n=pa(f,"key",void 0),a=pa(f,"index",void 0),t.isRexSizer||(h=pa(f,"minWidth",void 0),o=pa(f,"minHeight",void 0)),l=pa(f,"fitRatio",0),d=pa(f,"offsetX",0),c=pa(f,"offsetY",0),u=pa(f,"offsetOriginX",0),p=pa(f,"offsetOriginY",0)}return"string"==typeof i&&(i=zt[i]),void 0===e&&(e=g?1:0),void 0===i&&(i=ga),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===h&&(g?h=0:t.isRexSizer||(h=t._minWidth)),void 0===o&&(g?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),void 0===d&&(d=0),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),(f=this.getSizerConfig(t)).proportion=e,f.align=i,f.padding=fe(s),f.expand=r,f.fitRatio=0===e?l:0,f.alignOffsetX=d,f.alignOffsetY=c,f.alignOffsetOriginX=u,f.alignOffsetOriginY=p,void 0===a||a>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(a,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===h?Q(t):h:t.minHeight=void 0===o?tt(t):o),r&&(0===this.orientation?t.minHeight=o:t.minWidth=h)),void 0!==n&&this.addChildrenMap(n,t),this},ma={add:fa,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),fa.call(this,new da(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,h){return ua(i)&&(i.index=t),fa.call(this,e,i,s,r,n,a,t,h),this},insertAtPosition(t,e,i,s,r,n,a,h,o){var l=ca.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,h,o),this}};const ya=Et.prototype.clear;var ba=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),ya.call(this,t),i)for(var s,r=0,n=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,ba.call(this,t),this}},wa={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=zt[e]),this.getSizerConfig(t).align=e,this}},Sa={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},ka={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},Oa={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},Pa={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,h=this.sizerChildren,o=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=h.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,a+=n)));else for(d=0,c=h.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?o=!0:n=0)):n=0,o||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,a+=n)))}return o?void 0:a+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,a=s.padding;i=n-(a.left+a.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,a=s.padding;i=n-(a.top+a.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(Ge(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Fe.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,h,o,l,d,c,u=this.sizerChildren,p=this.innerLeft,g=this.innerTop,v=this.innerWidth,f=this.innerHeight,m=p,y=g,b=this.startChildIndex,x=0,C=u.length;x0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Ie.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||We.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&oa.call(this,t,void 0),ze.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Ye.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&oa.call(this,void 0,t),je.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],a=n&&n.isRexSpace;return"center"===t?a||this.insertSpace(r+1):a&&this.remove(n,!0),this}};Object.assign(Pa,ma,Ca,wa,Sa,ka,Oa);var Ta=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i},_a={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},Ma=function(t){return"string"==typeof t&&(t=_a[t]),t};const Ea=Phaser.Utils.Objects.IsPlainObject,Ra=Phaser.Utils.Objects.GetValue;class La extends na{constructor(t,e,i,s,r,n,a){Ea(e)?(e=Ra(a=e,"x",0),i=Ra(a,"y",0),s=Ra(a,"width",void 0),r=Ra(a,"height",void 0),n=Ra(a,"orientation",0)):Ea(s)?(s=Ra(a=s,"width",void 0),r=Ra(a,"height",void 0),n=Ra(a,"orientation",0)):Ea(n)&&(n=Ra(a=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,a),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Ra(a,"space.item",0)),this.setStartChildIndex(Ra(a,"startChildIndex",0)),this.setRTL(Ra(a,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=Ma(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=Ta.call(this)),this._childrenProportion}}Object.assign(La.prototype,Pa);var Da=function(t,e,i,s){return e/t<=i?e/(s-1):0},Aa=function(t){var e,i,s,r,n,a={lines:[],width:0,height:0},h=this.sizerChildren,o=0,l=a.lines,d=void 0;if(0===this.orientation){for(var c=0,u=h.length;ch.height/2)){r>(o=Ba(h.left,h.centerY,t,e))&&(r=o,s=n);var o,l=i[n+1];l&&l.y===h.y||r>(o=Ba(h.right,h.centerY,t,e))&&(r=o,s=n+1)}}return s};const za=Phaser.Utils.Objects.IsPlainObject,Ia=Phaser.Utils.Objects.GetValue,Ya=Phaser.Display.Align.CENTER;var ja=function(t,e,i,s){return"\n"===t?(this.addNewLine(),this):(ye.call(this,t),za(e)&&(e=Ia(o=e,"padding",0),i=Ia(o,"key",void 0),s=Ia(o,"index",void 0),r=Ia(o,"offsetX",0),n=Ia(o,"offsetY",0),a=Ia(o,"offsetOriginX",0),h=Ia(o,"offsetOriginY",0)),void 0===e&&(e=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=0),void 0===h&&(h=0),(o=this.getSizerConfig(t)).align=Ya,o.padding=fe(e),o.alignOffsetX=r,o.alignOffsetY=n,o.alignOffsetOriginX=a,o.alignOffsetOriginY=h,void 0===s||s>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(s,0,t),void 0!==i&&this.addChildrenMap(i,t),this);var r,n,a,h,o},Xa={add(t,e,i){if(pr(t))for(var s=t,r=0,n=s.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,ba.call(this,t),this}},Va={getChildrenWidth:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=0===this.orientation&&t?this.maxChildWidth:this.rexSizer.resolved?this.wrapResult.width:void 0)?e+(this.space.left+this.space.right)*this.scaleX:void 0);var e},getChildrenHeight:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=1===this.orientation&&t?this.maxChildHeight:this.rexSizer.resolved?this.wrapResult.height:void 0)?e+(this.space.top+this.space.bottom)*this.scaleY:void 0);var e},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&r.push(o.join("")),r},wh=0,Sh=1,kh=2,Oh=0,Ph=1,Th=2,_h=/(?:\r\n|\r|\n)/;const Mh={none:Oh,word:Ph,char:Th,character:Th,mix:3},Eh=Phaser.Renderer.WebGL.Utils;var Rh={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,n=r.width,a=r.height,h=Eh.getTintAppendFloatAlpha,o=t.pipelines.set(e.pipeline,e),l=o.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),o.batchTexture(e,r.glTexture,n,a,e.x,e.y,n/e.resolution,a/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,n,a,h(e.tintTopLeft,i.alpha*e._alphaTL),h(e.tintTopRight,i.alpha*e._alphaTR),h(e.tintBottomLeft,i.alpha*e._alphaBL),h(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,l),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const Lh=Phaser.Display.Color;var Dh={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,a,h,o,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===a&&(a=0),void 0===h&&(h=0),void 0===o&&(o=c),void 0===l&&(l=u);var p=d.cutX+a,g=d.cutY+h;return this.context.drawImage(d.source.image,p,g,o,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new Lh);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var a=i;i=a.red,s=a.green,r=a.blue,n=a.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var h=this.context.createImageData(1,1);return h.data[0]=i,h.data[1]=s,h.data[2]=r,h.data[3]=n,this.context.putImageData(h,t,e),this.dirty=!0,this}},Ah=function(t,e,i,s,r,n,a){var h,o=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===a&&(a=e.height);var d=(h=o.exists(i)?o.get(i):o.createCanvas(i,n,a)).getSourceImage();d.width!==n&&(d.width=n),d.height!==a&&(d.height=a);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,a),c.drawImage(e,s,r,n,a),l.gl&&h&&l.canvasToTexture(d,h.source[0].glTexture,!0,0)},Bh={updateTexture(t,e){if(t){var i=this.resolution;1!==i&&(this.context.save(),this.context.scale(i,i)),e?t.call(e,this.canvas,this.context):t(this.canvas,this.context),1!==i&&this.context.restore()}this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=this.width,s.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,Ah(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};e();const Wh=Phaser.Display.Canvas.CanvasPool,zh=Phaser.GameObjects.GameObject,Ih=Phaser.Utils.String.UUID;let Yh=class extends zh{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=Wh.create(this,s,r),this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initPipeline(),this.initPostPipeline(!0),this._crop=this.resetCropObject(),this._textureKey=Ih(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){Wh.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}};const jh=Phaser.GameObjects.Components;Phaser.Class.mixin(Yh,[jh.Alpha,jh.BlendMode,jh.Crop,jh.Depth,jh.Flip,jh.GetBounds,jh.Mask,jh.Origin,jh.Pipeline,jh.PostPipeline,jh.ScrollFactor,jh.Tint,jh.Transform,jh.Visible,Rh,Dh,Bh]);var Xh={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:Es(this.data,t,e)},incData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)+e),this},mulData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)*e),this},clearData(){return this.data&&mt(this.data),this}};class Fh{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}}Object.assign(Fh.prototype,Xh);var Hh={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const Vh=Phaser.Math.RotateAround;var Gh;const Uh=Phaser.Geom.Rectangle;var Nh,$h=function(t){void 0===Nh&&(Nh=new Uh);var e=t.drawTLX,i=t.drawTLY;return Nh.setTo(e,i,t.drawTRX-e,t.drawBLY-i),Nh};const Kh=Phaser.Math.RotateAround;var Jh,qh=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Jh&&(Jh={}),s=Jh),s.x=e,s.y=i,0!==t.rotation&&Kh(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const Zh=Phaser.GameObjects.Components.TransformMatrix;var Qh,to,eo={},io=function(t,e,i,s,r){var n=qh(e,i,s,!0),a=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=eo);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===Qh&&(Qh=new Zh,to=new Zh),t.parentContainer?t.getWorldTransformMatrix(Qh,to):Qh.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),Qh.transformPoint(r,n,s),s}(t,n.x,n.y,r);return a},so=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,a=e.drawCenterY+s;return io(t,e,n,a,r)},ro={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Gh&&(Gh={}),s=Gh),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&Vh(s,0,0,-i.rotation),s}(t,e,this,!0);return $h(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return so(this.parent,this,t,e,i)}};Object.assign(ro,Hh);const no=Phaser.Math.DegToRad,ao=Phaser.Math.RadToDeg,ho=Phaser.Utils.Objects.GetValue;class oo extends Fh{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return ao(this._rotation)}set angle(t){this.rotation=no(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=ho(t,"width",void 0),i=ho(t,"height",void 0),s=ho(t,"scaleX",void 0),r=ho(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(oo.prototype,ro);const lo=Phaser.Utils.String.Pad;var co=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${lo(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}},uo=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const po=Phaser.Utils.Objects.GetValue;let go=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=po(t,"x",0),i=po(t,"y",0));var s=this.cornerRadius;s.tl=vo(po(t,"tl",void 0),e,i),s.tr=vo(po(t,"tr",void 0),e,i),s.bl=vo(po(t,"bl",void 0),e,i),s.br=vo(po(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){fo(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){fo(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){fo(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){fo(this.cornerRadius.br,t)}};var vo=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),mo(t),t},fo=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=po(e,"x",0),t.y=po(e,"y",0)),mo(t)},mo=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const yo=Phaser.Math.DegToRad;var bo=function(t){return!t.hasOwnProperty("convex")||t.convex},xo=function(t){return t.x>0&&t.y>0},Co=function(t,e,i,s,r,n,a,h,o){if(h&&a>n?a-=360:!h&&a=p?1:s/p,f=r>=g?1:r/g,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),h=m.tl,xo(h)?(o=h.x*v,l=h.y*f,bo(h)?Co(t,o,l,o,l,180,270,!1,a):Co(t,0,0,o,l,90,0,!0,a),d=0,c=l):(t.lineTo(0,0),d=0,c=0),h=m.tr,xo(h)?(o=h.x*v,l=h.y*f,bo(h)?Co(t,s-o,l,o,l,270,360,!1,a):Co(t,s,0,o,l,180,90,!0,a)):t.lineTo(s,0),h=m.br,xo(h)?(o=h.x*v,l=h.y*f,bo(h)?Co(t,s-o,r-l,o,l,0,90,!1,a):Co(t,s,r,o,l,270,180,!0,a)):t.lineTo(s,r),h=m.bl,xo(h)?(o=h.x*v,l=h.y*f,bo(h)?Co(t,o,r-l,o,l,90,180,!1,a):Co(t,0,r,o,l,360,270,!0,a)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()}(e,i,s,r,n,a,u),null!=h)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,h),p.addColorStop(1,d),h=p),e.fillStyle=h,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())},So=function(t,e,i,s,r,n,a,h){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),wo(t.canvas,t.context,d,d,o,l,r,e,i,s,n,a,h)}};const ko=Phaser.Utils.Objects.GetValue;class Oo extends oo{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(ko(e,"color",null),ko(e,"color2",null),ko(e,"horizontalGradient",!0)),this.setStroke(ko(e,"stroke",null),ko(e,"strokeThickness",2)),this.setCornerRadius(ko(e,"cornerRadius",0),ko(e,"cornerIteration",null))}set color(t){t=co(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=co(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=co(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,uo("color2",t,this),uo("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,uo("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,uo("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){So(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Po=Phaser.Utils.Objects.GetValue;class To extends oo{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(Po(e,"color",null),Po(e,"color2",null),Po(e,"horizontalGradient",!0)),this.setStroke(Po(e,"stroke",null),Po(e,"strokeThickness",2))}set color(t){t=co(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=co(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=co(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,Po(t,"color2",null),Po(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Po(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,a=this.parent.height-i.top-i.bottom,h=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?h.createLinearGradient(0,0,n,0):h.createLinearGradient(0,0,0,a)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,h.fillStyle=t,h.fillRect(s,r,n,a));null!=this.stroke&&this.strokeThickness>0&&(h.strokeStyle=this.stroke,h.lineWidth=this.strokeThickness,h.strokeRect(s,r,n,a))}}const _o=Phaser.Utils.Objects.GetValue;let Mo=class t{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(_o(t,"bold",!1)),this.setItalic(_o(t,"italic",!1)),this.setFontSize(_o(t,"fontSize","16px")),this.setFontFamily(_o(t,"fontFamily","Courier")),this.setColor(_o(t,"color","#fff")),this.setStrokeStyle(_o(t,"stroke",null),_o(t,"strokeThickness",0)),this.setShadow(_o(t,"shadowColor",null),_o(t,"shadowOffsetX",0),_o(t,"shadowOffsetY",0),_o(t,"shadowBlur",0)),this.setOffset(_o(t,"offsetX",0),_o(t,"offsetY",0)),this.setSpace(_o(t,"leftSpace",0),_o(t,"rightSpace",0)),this.setAlign(_o(t,"align",void 0)),this.setBackgroundColor(_o(t,"backgroundColor",null)),this.setBackgroundHeight(_o(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(_o(t,"backgroundBottomY",void 0)),this.setBackgroundLeftX(_o(t,"backgroundLeftX",0)),this.setBackgroundRightX(_o(t,"backgroundRightX",0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(uo("stroke",t,this),uo("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(uo("shadowOffsetX",t,this),uo("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),t.hasOwnProperty("backgroundLeftX")&&this.setBackgroundLeftX(t.backgroundLeftX),t.hasOwnProperty("backgroundRightX")&&this.setBackgroundRightX(t.backgroundRightX),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new t(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=co(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=co(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=co(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=co(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setBackgroundLeftX(t){return this.backgroundLeftX=t,this}setBackgroundRightX(t){return this.backgroundRightX=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}};const Eo=Phaser.Utils.Array.Remove,Ro=Phaser.Utils.Array.Remove,Lo="text",Do="image",Ao="drawer",Bo="space",Wo="command";var zo=function(t){return t.type===Lo&&"\n"===t.text},Io=function(t){return t.type===Lo&&"\f"===t.text},Yo=function(t){return t.type===Lo};class jo extends oo{constructor(t,e,i){super(t,Lo),this.updateTextFlag=!1,this.style=new Mo(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX+e.backgroundLeftX,s=i,r=this.drawTRX+e.backgroundRightX-i+1;if(r>0){var n=e.backgroundBottomY;null==n&&(n=this.drawBLY);var a=e.backgroundHeight;null==a&&(a=n-this.drawTLY);var h=n-a;t.fillRect(s,h,r,a)}}var o=e.hasFill,l=e.hasStroke;(o||l)&&(e.syncFont(t).syncStyle(t),l&&(e.syncShadow(t),t.strokeText(this.text,0,0)),o&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var Xo=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const Fo=Phaser.Display.Canvas.CanvasPool;var Ho=function(t,e,i,s,r,n,a,h){void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=t.cutWidth),void 0===n&&(n=t.cutHeight),void 0===h&&(h=!1),h&&(i=Math.round(i),s=Math.round(s));var o=e.getContext("2d",{willReadFrequently:!0});if(a){var l=Fo.create(null,r,n,Phaser.CANVAS,!0),d=l.getContext("2d",{willReadFrequently:!0});d.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,0,0,r,n),d.globalCompositeOperation="source-in",d.fillStyle=a,d.fillRect(0,0,r,n),o.drawImage(l,0,0,r,n,i,s,r,n),Fo.remove(l)}else o.drawImage(t.source.image,t.cutX,t.cutY,t.cutWidth,t.cutHeight,i,s,r,n)};Phaser.Display.Canvas.CanvasPool;class Vo extends oo{constructor(t,e,i){super(t,Do),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){Ho(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}class Go extends oo{constructor(t,e,i,s){super(t,Ao),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}class Uo extends oo{constructor(t,e){super(t,Bo),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}}class No extends Fh{constructor(t,e,i,s,r){super(t,Wo),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}function $o(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>$o(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=$o(t[i]));return e}var Ko=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const Jo={none:0,word:1,char:2,character:2,mix:3};var qo=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,a=!r&&!n,h=t.length,o=e,l=s.word,d=0,c=!1;o0&&!h){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=el.call(this)).height,a=l.ascent,i=Math.floor((o-a)/n))}else{var l;n=(l=el.call(this)).height,a=l.ascent}}else this.fixedHeight>0?void 0===(i=sl(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=sl(t,"maxLines",0);void 0===a&&(a=n);var d=0===i,c=sl(t,"wrapMode");void 0===c&&(c=sl(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=Jo[c]);var u=sl(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=sl(t,"letterSpacing",0),g=sl(t,"hAlign",0),v=sl(t,"vAlign",0),f=sl(t,"justifyPercentage",.25),m=Ko({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:g,vAlign:v,justifyPercentage:f,ascent:a,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,b=0,x=y.length;b0&&(M.push({children:E,width:R}),L=Math.max(L,R)),m.start+=_.length,m.isLastPage=!D&&m.start===T,m.maxLineWidth=L,m.linesHeight=M.length*n;var j=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,X=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,a=t.vAlign,h=t.justifyPercentage,o=t.lines,l=0,d=o.length;l0?(a=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=al(t,"maxLines",void 0))){var a=this.fixedWidth-r;i=Math.floor(a/n)+1}}else i=al(t,"maxLines",0);var h=0===i,o=al(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=al(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=al(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=al(t,"letterSpacing",0),p=al(t,"rtl",!0),g=al(t,"hAlign",p?2:0),v=al(t,"vAlign",0),f=Ko({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:g,vAlign:v,lineWidth:n,fixedCharacterHeight:o,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(_.push({children:M,height:E}),R=Math.max(R,E)),f.start+=T.length,f.isLastPage=f.start===P,f.maxLineHeight=R,f.linesWidth=_.length*n;var z=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,I=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,a=t.vAlign,h=t.rtl,o=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}h&&(s+=l);for(var c=0,u=o.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,a=i.bottom;return De(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||a!=i.bottom,this},getPadding:function(t){return Le(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),Eo(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return Ro(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(Lo);return null===i?i=new jo(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),so(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const Rl=Phaser.Utils.Objects.GetFastValue;var Ll={};class Dl{constructor(t){this.pools=Rl(t,"pools",Ll)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new El),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;ei&&(r=Math.floor(i));for(var n={},a=Xl(t,r,e,i,n),h=0;h<=Il&&0!==a;h++){if((r+=a)<0){r=0;break}a=Xl(t,r,e,i,n)}return h===Il&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),Fl(t,e,i),t},jl=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},Xl=function(t,e,i,s,r){var n,a=jl(t,e,r),h=jl(t,e+1,r);if(void 0!==s)if(a.height<=s&&h.height>s)n=0;else{if(a.height>s)return-1;n=Math.floor(s-a.height)}if(a.width<=i&&h.width>i)return 0;if(a.width>i)return-1;var o=Math.floor(i-a.width);return void 0===n?o:Math.min(o,n)},Fl=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const Hl=Phaser.Utils.Objects.GetValue,Vl=Phaser.Utils.Objects.GetValue;class Gl extends ih{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=Vl(e,"background",void 0),r=Vl(e,"icon",void 0),n=Vl(e,"iconMask",void 0),a=Vl(e,"text",void 0),h=Vl(e,"action",void 0),o=Vl(e,"actionMask",void 0),l=Vl(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(a||h)&&(i={right:Vl(e,"space.icon",0),top:Vl(e,"space.iconTop",0),bottom:Vl(e,"space.iconBottom",0),left:Vl(e,"space.iconLeft",0)}):(a||h)&&(i={bottom:Vl(e,"space.icon",0),left:Vl(e,"space.iconLeft",0),right:Vl(e,"space.iconRight",0),top:Vl(e,"space.iconTop",0)});var d=Vl(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=uh.call(this,r,r,1)),!d){var c=Vl(e,"iconSize",void 0);this.setIconSize(Vl(e,"iconWidth",c),Vl(e,"iconHeight",c))}}if(a){var u=Vl(e,"wrapText",!1),p=Vl(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),function(t,e){switch(mh(t)){case 0:switch("string"==typeof e&&(e=Mh[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=xh;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Mh[e]||0),t.style.wrapMode=e}}(a,u),e.expandTextWidth=!0,zl(a)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=Hl(e,"minWidth",0),s=Hl(e,"minHeight",0),r=Hl(e,"fitHeight",!1);t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return Yl(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),Yl(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t})}(a,{fitHeight:!0}));var g,v,f=Vl(e,"space.text",0),m=Vl(e,"expandTextWidth",!1),y=Vl(e,"expandTextHeight",!1);0===this.orientation?(g=m?1:0,h&&(i={right:f}),v=y):(g=y?1:0,h&&(i={bottom:f}),v=m),this.add(a,{proportion:g,expand:v,padding:i})}if(h&&(i=0===this.orientation?{top:Vl(e,"space.actionTop",0),bottom:Vl(e,"space.actionBottom",0),right:Vl(e,"space.actionRight",0)}:{left:Vl(e,"space.actionLeft",0),right:Vl(e,"space.actionRight",0),bottom:Vl(e,"space.actionBottom",0)},d=Vl(e,"squareFitAction",!1)?1:0,this.add(h,{proportion:0,padding:i,fitRatio:d}),o&&(o=uh.call(this,h,h,1)),!d)){var b=Vl(e,"actionSize");this.setActionSize(Vl(e,"actionWidth",b),Vl(e,"actionHeight",b))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",a),this.addChildrenMap("action",h),this.addChildrenMap("actionMask",o)}}var Ul=Phaser.Renderer.WebGL.Utils,Nl=function(t,e,i,s,r,n){for(var a=Ul.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),h=i.pathData,o=i.pathIndexes,l=0;l>>16,h=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+a+","+h+","+o+","+n+")"},Zl=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,a=(16711680&r)>>>16,h=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+a+","+h+","+o+","+n+")",t.lineWidth=e.lineWidth};const Ql=Phaser.Renderer.Canvas.SetTransform;var td={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Jl(e,i,s),a=r.calcMatrix.copyFrom(n.calc),h=e._displayOriginX,o=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&Nl(r,a,e,l,h,o),e.isStroked&&Kl(r,e,l,h,o),t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(Ql(t,r,e,i,s)){var n=e._displayOriginX,a=e._displayOriginY,h=e.pathData,o=h.length-1,l=h[0]-n,d=h[1]-a;r.beginPath(),r.moveTo(l,d),e.closePath||(o-=2);for(var c=2;c0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(id.prototype,td);var sd=function(t){return t.x>0&&t.y>0},rd=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const nd=Phaser.Math.DegToRad;var ad=function(t,e,i,s,r,n,a,h,o){a&&n>r?n-=360:!a&&n0,a=0,h=e.length;a0;this.dirty=this.dirty||this._radiusTL!==t||this._convexTL!==e,this._convexTL=e,this._radiusTL=Math.abs(t)}get radiusTR(){return this._radiusTR}set radiusTR(t){var e=t>0;this.dirty=this.dirty||this._radiusTR!==t||this._convexTR!==e,this._convexTR=e,this._radiusTR=Math.abs(t)}get radiusBL(){return this._radiusBL}set radiusBL(t){var e=t>0;this.dirty=this.dirty||this._radiusBL!==t||this._convexBL!==e,this._convexBL=e,this._radiusBL=Math.abs(t)}get radiusBR(){return this._radiusBR}set radiusBR(t){var e=t>0;this.dirty=this.dirty||this._radiusBR!==t||this._convexBR!==e,this._convexBR=e,this._radiusBR=Math.abs(t)}get radius(){return Math.max(this.radiusTL,this.radiusTR,this.radiusBL,this.radiusBR)}set radius(t){"number"==typeof t?(this.radiusTL=t,this.radiusTR=t,this.radiusBL=t,this.radiusBR=t):(this.radiusTL=hc(t,"tl",0),this.radiusTR=hc(t,"tr",0),this.radiusBL=hc(t,"bl",0),this.radiusBR=hc(t,"br",0))}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}get iterations(){return this._iterations}set iterations(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t}setIterations(t){return this.iterations=t,this}updateData(){var t=this.pathData;t.length=0;var e,i=this.width,s=this.height,r=this.iterations+1;return(e=this.radiusTL)>0?this._convexTL?ad(e,e,e,e,180,270,!1,r,t):ad(0,0,e,e,90,0,!0,r,t):rd(0,0,t),(e=this.radiusTR)>0?this._convexTR?ad(i-e,e,e,e,270,360,!1,r,t):ad(i,0,e,e,180,90,!0,r,t):rd(i,0,t),(e=this.radiusBR)>0?this._convexBR?ad(i-e,s-e,e,e,0,90,!1,r,t):ad(i,s,e,e,270,180,!0,r,t):rd(i,s,t),(e=this.radiusBL)>0?this._convexBL?ad(e,s-e,e,e,90,180,!1,r,t):ad(0,s,e,e,360,270,!0,r,t):rd(0,s,t),t.push(t[0],t[1]),Gd(this.x,this.y,t),super.updateData(),this}}Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlpha;var lc=function(t,e,i,s,r,n){var a=(e+s)/2;return n>=0?t.startAt(a+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(a+n,i):t.startAt(a,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(a,i),t.close(),t};const dc=Phaser.Utils.Objects.GetValue,cc=Phaser.Utils.Objects.IsPlainObject;class uc extends(Ad(Pd)){constructor(t,e,i,s,r,n,a,h){cc(e)?(e=(h=e).x,i=h.y,s=h.width,r=h.height,n=h.barColor,a=h.value):cc(s)?(s=(h=s).width,r=h.height,n=h.barColor,a=h.value):cc(n)&&(n=(h=n).barColor,a=h.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===a&&(a=0),super(t,e,i,s,r,h),this.type="rexLineProgress",this.bootProgressBase(h),this.addShape((new ac).setName("trackFill")).addShape((new ac).setName("bar")).addShape((new ac).setName("trackStroke")),this.setTrackColor(dc(h,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(dc(h,"trackStrokeThickness",2),dc(h,"trackStrokeColor",void 0)),this.setSkewX(dc(h,"skewX",0)),this.setRTL(dc(h,"rtl",!1)),this.setValue(a)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}}var pc={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&lc(s,0,0,e,i,t);var r,n,a=this.getShape("bar");a.fillStyle(this.barColor),a.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),lc(a,r,0,n,i,t));var h=this.getShape("trackStroke");h.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),h.isStroked&&lc(h,0,0,e,i,t)}};Object.assign(uc.prototype,pc);var gc=function(t){return null==t||""===t||0===t.length},vc=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(gc(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(gc(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,a=e.length;n=6?(i=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):void 0===i&&void 0===s&&void 0!==this.columns.data&&void 0!==this.rows.data?(i=this.columns.data,s=this.rows.data):(i=$o(i),s=$o(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=i,this.columns.count=i?i.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=s,this.rows.count=s?s.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var r=this.scene.sys.textures.get(t);if(!r)return this.clear(),this;if(!i||!s)return this.clear(),this;for(var n=r.get(e),a=n.width,h=0,o=0,l=i.length;o0?a/h:0,c=n.height,u=0;for(o=0,l=s.length;o0?0:v,b=0,o=0;for(var S=i.length;o0?0:f),f>=1&&v>=1){var k=typeof(m=this.getFrameNameCallback(o,C,e));"string"!==k&&"number"!==k||r.add(m,0,b+n.cutX,x+n.cutY,f,v)}b+=f}x+=v}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,a,h,o=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-o,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/o,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var g=Math.min(u,p);if(u>g){var v=(u-g)*o;d>=0?d+=v:d=v,u=g}if(p>g){var f=(p-g)*l;c>=0?c+=f:c=f,p=g}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,x=this.rows.count;b0&&h>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(C,b)?0:1)?this._drawImage(this.textureKey,s,m,y,a,h):this._drawTileSprite(this.textureKey,s,m,y,a,h)),m+=a;y+=h}this._endDraw()},setStretchMode:function(t){return Dc(t)?(this.stretchMode.edge=Bc(Ac(t,"edge",0)),this.stretchMode.internal=Bc(Ac(t,"internal",0))):(t=Bc(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return zc.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const Yc=Phaser.Utils.Objects.IsPlainObject,jc=Phaser.Utils.Objects.GetValue,Xc=Phaser.GameObjects;var Fc=void 0,Hc=function(t,e){if(Fc||(Fc={},ei(t).events.once("destroy",(function(){for(var t in Fc)Fc[t].destroy();Fc=void 0}))),!Fc.hasOwnProperty(e)){var i=ei(t).scene.systemScene;(t=new Xc[e](i)).setOrigin(0),Fc[e]=t}return Fc[e]};const Vc=Phaser.GameObjects.RenderTexture;class Gc extends(function(t,e){class i extends t{constructor(t,i,s,r,n,a,h,o,l,d){if(Yc(i)?(i=jc(d=i,"x",0),s=jc(d,"y",0),r=jc(d,"width",1),n=jc(d,"height",1),a=jc(d,"key",void 0),h=jc(d,"baseFrame",void 0),o=jc(d,"columns",void 0),l=jc(d,"rows",void 0)):Yc(r)?(r=jc(d=r,"width",1),n=jc(d,"height",1),a=jc(d,"key",void 0),h=jc(d,"baseFrame",void 0),o=jc(d,"columns",void 0),l=jc(d,"rows",void 0)):Yc(a)?(a=jc(d=a,"key",void 0),h=jc(d,"baseFrame",void 0),o=jc(d,"columns",void 0),l=jc(d,"rows",void 0)):Yc(h)?(h=jc(d=h,"baseFrame",void 0),o=jc(d,"columns",void 0),l=jc(d,"rows",void 0)):Array.isArray(h)?(d=l,l=o,o=h,h=jc(d,"baseFrame",void 0)):Yc(o)&&(o=jc(d=o,"columns",void 0),l=jc(d,"rows",void 0)),void 0===h&&(h=jc(d,"frame",void 0)),void 0===o){var c=jc(d,"leftWidth",void 0),u=jc(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=jc(d,"topHeight",void 0),g=jc(d,"bottomHeight",void 0);void 0!==p&&void 0!==g&&(l=[p,void 0,g])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(jc(d,"getFrameNameCallback",void 0)),this.setStretchMode(jc(d,"stretchMode",0)),this.setPreserveRatio(jc(d,"preserveRatio",!0));var v=jc(d,"maxFixedPartScale",1),f=jc(d,"maxFixedPartScaleX",v),m=jc(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(a,h,o,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,Ic),i}(Vc,"rexNinePatch")){}var Uc={_drawImage:function(t,e,i,s,r,n){var a=Hc(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(a,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var a=Hc(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(a,i,s)}};Object.assign(Gc.prototype,Uc);let Nc=class extends si{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(yc(t,e))return t[e];var i=t.parent;return yc(i,e)?i[e]:void 0}set(t,e,i){return yc(t,e)?t[e]=i:yc(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}};const $c=Phaser.Utils.Objects.GetValue;class Kc extends Gc{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=$c(e,"effects",!0);i&&Sc(this,i),this.style=new Nc(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Kc.prototype,yd);const Jc=["alpha","tint","flipX","flipY"];var qc=function(t,e){if(!e)return t;for(var i=0,s=Jc.length;i * @copyright 2018 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */const ou=Phaser.Display.Canvas.CanvasPool;var lu=function(t){var e=ou.create(this),i=e.getContext("2d",{willReadFrequently:!0});t.syncFont(e,i);var s=i.measureText(t.testString);if("actualBoundingBoxAscent"in s){var r=s.actualBoundingBoxAscent,n=s.actualBoundingBoxDescent,a={ascent:r,descent:n,fontSize:r+n};return ou.remove(e),a}var h=Math.ceil(s.width*t.baselineX),o=h,l=2*o;if(o=o*t.baselineY|0,e.width=h,e.height=l,i.fillStyle="#f00",i.fillRect(0,0,h,l),i.font=t._font,i.textBaseline="alphabetic",i.fillStyle="#000",i.fillText(t.testString,0,o),a={ascent:0,descent:0,fontSize:0},!i.getImageData(0,0,h,l))return a.ascent=o,a.descent=o+6,a.fontSize=a.ascent+a.descent,ou.remove(e),a;var d,c,u=i.getImageData(0,0,h,l).data,p=u.length,g=4*h,v=0,f=!1;for(d=0;do;d--){for(c=0;c0&&this.wrapMode!==Oh&&0===this.wrapWidth}setStyle(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wordWrap")){var s=t.wordWrap;s.hasOwnProperty("width")&&(t.wrap={mode:"word",width:s.width})}if(t&&t.hasOwnProperty("wrap")){var r=t.wrap;if(r.hasOwnProperty("mode")){var n=r.mode;"string"==typeof n&&(r.mode=Mh[n])}else r.hasOwnProperty("width")&&(r.mode=1)}t&&t.rtl&&i&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var a=this.propertyMap;for(var h in a){var o=a[h],l=o[0],d=i?o[1]:this[h],c=o[2];if("wrapCallback"===h||"wrapCallbackScope"===h)this[h]=cu(t,l,d);else{var u=du(t,l,d);c&&(u=c(u)),this[h]=u}}var p=cu(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var g=cu(t,"fill",null);null!==g&&(this.color=co(g));var v=cu(t,"metrics",!1);return v?this.metrics={ascent:cu(v,"ascent",0),descent:cu(v,"descent",0),fontSize:cu(v,"fontSize",0)}:!e&&this.metrics||(this.metrics=lu(this)),e?this.parent.updateText():this.parent}syncFont(t,e){e.font=this._font}syncStyle(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"}syncShadow(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)}update(t){return t&&(this._font=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim(),this.metrics=lu(this)),this.parent.updateText(t)}buildFont(){var t=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim();return t!==this._font&&(this._font=t),this}setFont(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=cu(t,"fontFamily","Courier"),this.fontSize=cu(t,"fontSize","16px"),this.fontStyle=cu(t,"fontStyle","")),this.update(!0)}setFontFamily(t){return this.fontFamily=t,this.update(!0)}setFontStyle(t){return this.fontStyle=t,this.update(!0)}setFontSize(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}setTestString(t){return this.testString=t,this.update(!0)}setFixedSize(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}setResolution(t){return this.resolution=t,this.update(!1)}setXOffset(t){return this.xOffset=t,this.update(!1)}setBackgroundColor(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=co(t,this.parent.canvas,this.parent.context),this.backgroundColor2=co(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=co(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}setBackgroundCornerRadius(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}setFill(t){return this.color=co(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=co(t,this.parent.canvas,this.parent.context),this.update(!1)}setStroke(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=co(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}setShadow(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===n&&(n=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=co(i,this.parent.canvas,this.parent.context),this.shadowBlur=s,this.shadowStroke=r,this.shadowFill=n,this.update(!1)}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}setShadowColor(t){return void 0===t&&(t="#000"),this.shadowColor=co(t,this.parent.canvas,this.parent.context),this.update(!1)}setShadowBlur(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}setShadowStroke(t){return this.shadowStroke=t,this.update(!1)}setShadowFill(t){return this.shadowFill=t,this.update(!1)}setUnderline(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=co(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}setUnderlineColor(t){return void 0===t&&(t="#000"),this.underlineColor=co(t,this.parent.canvas,this.parent.context),this.update(!1)}setUnderlineThickness(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}setUnderlineOffset(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}setStrikethrough(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=co(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}setStrikethroughColor(t){return void 0===t&&(t="#000"),this.strikethroughColor=co(t,this.parent.canvas,this.parent.context),this.update(!1)}setStrikethroughThickness(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}setStrikethroughOffset(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}setWrapMode(t){return"string"==typeof t&&(t=Mh[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}setWrapWidth(t){return this.wrapWidth=t,this.update(!1)}setAlign(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}setHAlign(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}setVAlign(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}setMaxLines(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}getTextMetrics(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}setTextMetrics(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=cu(e,"fontFamily",this.fontFamily),this.fontSize=cu(e,"fontSize",this.fontSize),this.fontStyle=cu(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}get lineHeight(){return this.metrics.fontSize+this.parent.lineSpacing}toJSON(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}destroy(){this.parent=void 0}}var pu={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var a=this.defaultStyle;this.clear(),So(this,a.backgroundColor,a.backgroundStrokeColor,a.backgroundStrokeLineWidth,a.backgroundCornerRadius,a.backgroundColor2,a.backgroundHorizontalGradient,a.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var h,o,l,d,c,u,p=a.halign,g=a.valign,v=a.lineHeight,f=r.lines,m=f.length,y=a.maxLines;y>0&&m>y?(o=y,l="center"===g?Math.floor((m-o)/2):"bottom"===g?m-o:0):(o=m,l=0),d=l+o;var b=this.rtl,x=b?this.parent.width:void 0;u="center"===g?Math.max((s-o*v)/2,0):"bottom"===g?Math.max(s-o*v-2,0):0,u+=e;for(var C=l;C0){var h=this.defaultStyle.metrics,o=i-h.ascent,l=h.fontSize;this.drawRectangle(e,o,t.width,l,a.bgcolor,a)}if(a.underlineThickness>0&&t.width>0){var d=i+a.underlineOffset-a.underlineThickness/2;this.drawLine(e,d,t.width,a.underlineThickness,a.underlineColor,a)}if(t.isTextPen&&(a.buildFont(),a.syncFont(r,n),a.syncStyle(r,n),this.drawText(e,i,t.text,a)),t.isImagePen&&this.drawImage(e,i,t.prop.img,t.prop.color,a),a.strikethroughThickness>0&&t.width>0&&(d=i+a.strikethroughOffset-a.strikethroughThickness/2,this.drawLine(e,d,t.width,a.strikethroughThickness,a.strikethroughColor,a)),n.restore(),t.hasAreaMarker&&t.width>0){var c,u=t.prop.area;if(u)c={key:u};else{var p=t.prop.url;c={key:`url:${p}`,url:p}}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,c)}},clear(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawRectangle(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;a.fillStyle=r,a.fillRect(t,e,i,s)},drawLine(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;n.syncShadow(a,n.shadowStroke);var h=a.lineCap;a.lineCap="butt",a.strokeStyle=r,a.lineWidth=s,a.beginPath(),a.moveTo(t,e),a.lineTo(t+i,e),a.stroke(),a.lineCap=h},drawText(t,e,i,s){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;s.stroke&&"none"!==s.stroke&&s.strokeThickness>0&&(s.syncShadow(r,s.shadowStroke),r.strokeText(i,t,e)),s.color&&"none"!==s.color&&(s.syncShadow(r,s.shadowFill),r.fillText(i,t,e))},drawImage(t,e,i,s,r){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,s,this.autoRound)}};const gu=Phaser.Utils.Objects.GetValue,vu=wh,fu=Sh;class mu{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=gu(t,"text",""),this.x=gu(t,"x",0),this.y=gu(t,"y",0),this.width=gu(t,"width",0);var e=gu(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=gu(t,"newLineMode",0),this.startIndex=gu(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===fu&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==vu&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===fu&&(t+=1),t}get endIndex(){return this.startIndex+this.rawTextLength}get lastX(){return this.x+this.width}get isTextPen(){return""!==this.text}get isImagePen(){return!!this.prop.img}get hasAreaMarker(){return!!this.prop.area||!!this.prop.url}}const yu=Phaser.Utils.Objects.GetFastValue,bu=wh,xu=kh;class Cu{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=yu(t,"tagToText",It),this.tagToTextScope=yu(t,"tagToTextScope",void 0)}destroy(){this.clear(),this.tagToText=void 0,this.tagToTextScope=void 0}clear(){for(var t=0,e=this.lines.length;t=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}getLineEndIndex(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,s=!1;for(e=t;e>=0&&!(s=null!=(i=this.lines[e])&&i.length>0);e--);return s?i[i.length-1].endIndex:0}getLineWidth(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}getMaxLineWidth(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,s=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}getLineWidths(){for(var t=[],e=0,i=this.lines.length;e=t&&o<=e||(a=a.substring(t-h,e-h)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,a,l,d):c+=this.tagToText(a,l,d),d=l,!(o>=e)));u++);return c}get length(){return this.lines.length}set length(t){this.clear()}}var wu={};const Su=Phaser.Geom.Rectangle;var ku=new El;class Ou{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&Yu(v)){""!==b?a.push(n.getLine(b,x,Lu)):0===C&&r>0&&a.push(n.getLine("",0,Lu)),a.push(...zu(v,e,Bu,s,0,n));var S=a.pop();b=S.text,x=S.width,n.freeLine(S)," "===b&&(b="",x=0)}else(m=x+f)>o?(a.push(n.getLine(b,x,Lu)),b=v,x=f,o=s):(b+=v,x=m),C===w-1&&a.push(n.getLine(b,x,l))}return a},Iu=function(t,e){var i;switch(e){case Au:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==Xu&&i0&&t>e&&(t=e),t}get linesWidth(){return Math.ceil(this.penManager.getMaxLineWidth())}get linesHeight(){var t=this.displayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}get imageManager(){return this.parent.imageManager}get rtl(){return this.parent.style.rtl}newPenManager(){return new Cu({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}get tmpPenManager(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}getPlainText(t,e,i){var s;if(null==t)s=this.penManager.plainText;else{var r=this.parser.splitText(t,1);s="";for(var n=0,a=r.length;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return Jp(this.sizerChildren,null),ba.call(this,t),this}},Zp={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)Jp(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},ig={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,h=this.sizerChildren,o=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Ie.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,Jp(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Jp(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},rg=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const ng=Phaser.Utils.Objects.IsPlainObject,ag=Phaser.Utils.Objects.GetValue;class hg extends na{constructor(t,e,i,s,r,n,a,h,o,l){ng(e)?(e=ag(l=e,"x",0),i=ag(l,"y",0),s=ag(l,"width",void 0),r=ag(l,"height",void 0),n=ag(l,"column",l.col||0),a=ag(l,"row",0),h=ag(l,"columnProportions",0),o=ag(l,"rowProportions",0)):ng(s)?(s=ag(l=s,"width",void 0),r=ag(l,"height",void 0),n=ag(l,"column",l.col||0),a=ag(l,"row",0),h=ag(l,"columnProportions",0),o=ag(l,"rowProportions",0)):ng(n)?(n=ag(l=n,"column",l.col||0),a=ag(l,"row",0),h=ag(l,"columnProportions",0),o=ag(l,"rowProportions",0)):ng(h)&&(h=ag(l=h,"columnProportions",0),o=ag(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(ag(l,"createCellContainerCallback")),this.setIndentLeft(ag(l,"space.indentLeftOdd",0),ag(l,"space.indentLeftEven",0)),this.setIndentTop(ag(l,"space.indentTopOdd",0),ag(l,"space.indentTopEven",0)),this.resetGrid(n,a,h,o,ag(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=sg.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=rg.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(hg.prototype,ig);const og=Phaser.Utils.Objects.GetValue,lg=Phaser.Math.Percent;var dg=function(t,e,i){var s;return t.y===e.y?s=lg(i.x,t.x,e.x):t.x===e.x&&(s=lg(i.y,t.y,e.y)),s},cg=function(t,e,i){var s,r;this.enable&&(ug.x=e,ug.y=i,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint()),this.value=dg(s,r,ug))},ug={},pg=function(t,e,i){if(this.enable&&t.isDown){var s,r;gg.x=t.worldX,gg.y=t.worldY,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint());var n=dg(s,r,gg);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-n)<.1?this.value=n:this.easeValueTo(n)}},gg={},vg=function(t,e){void 0===e&&(e=fg);var i=this.childrenMap.thumb,s=i.x,r=i.y;return oe(i,this.innerLeft,this.innerTop,this.innerWidth,this.innerHeight,t),e.x=i.x,e.y=i.y,i.x=s,i.y=r,e},fg={};const mg=Phaser.Display.Align.LEFT_CENTER,yg=Phaser.Display.Align.TOP_CENTER;var bg={};const xg=Phaser.Display.Align.RIGHT_CENTER,Cg=Phaser.Display.Align.BOTTOM_CENTER;var wg={};const Sg=Phaser.Math.Linear;var kg={};const Og=Phaser.Display.Align.LEFT_CENTER,Pg=Phaser.Display.Align.TOP_CENTER,Tg=Phaser.Display.Align.RIGHT_CENTER,_g=Phaser.Display.Align.BOTTOM_CENTER,Mg=Phaser.Utils.Objects.GetValue,Eg=Phaser.Utils.Objects.IsPlainObject,Rg=Phaser.Math.Clamp,Lg=Phaser.Math.Snap.To;class Dg extends(Ad(La)){constructor(t,e){super(t,e),this.type="rexSlider",this.bootProgressBase(e),this.reverseAxis=Mg(e,"reverseAxis",!1);var i=Mg(e,"background",void 0),s=Mg(e,"track",void 0),r=Mg(e,"indicator",void 0),n=Mg(e,"thumb",void 0);if(i&&(Eg(i)&&(i=qc(t,i)),this.addBackground(i)),s&&(Eg(s)&&(s=qc(t,s)),this.add(s,{proportion:1,expand:!0,minWidth:0===this.orientation?0:void 0,minHeight:1===this.orientation?0:void 0})),r&&(Eg(r)&&(r=qc(t,r)),this.pin(r)),n){Eg(n)&&(n=qc(t,n)),this.pin(n);var a=Mg(e,"thumbOffsetX",0),h=Mg(e,"thumbOffsetY",0);this.setThumbOffset(a,h)}var o=Mg(e,"input",0);switch("string"==typeof o&&(o=Ag[o]),o){case 0:n&&(n.setInteractive(),this.scene.input.setDraggable(n),n.on("drag",cg,this).on("dragstart",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("dragend",(function(t){this.eventEmitter.emit("inputend",t)}),this));break;case 1:this.on("pointerdown",pg,this).on("pointermove",pg,this).on("pointerdown",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("pointerup",(function(t){this.eventEmitter.emit("inputend",t)}),this).on("pointerover",(function(t){t.isDown&&this.eventEmitter.emit("inputstart",t)}),this).on("pointerout",(function(t){t.isDown&&this.eventEmitter.emit("inputend",t)}),this).setInteractive()}this.addChildrenMap("background",i),this.addChildrenMap("track",s),this.addChildrenMap("indicator",r),this.addChildrenMap("thumb",n),this.setEnable(Mg(e,"enable",void 0));var l=Mg(e,"tick",void 0);void 0===l&&(l=Mg(e,"gap",void 0)),this.setGap(l),this.setValue(Mg(e,"value",0),Mg(e,"min",void 0),Mg(e,"max",void 0))}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setGap(t,e,i){return t&&void 0!==e&&(t/=i-e),this.gap=t,this}setTick(t,e,i){return this.setGap(t,e,i),this}get tick(){return this.gap}set tick(t){this.gap=t}setThumbOffset(t,e){return this.thumbOffsetX=t,this.thumbOffsetY=e,this}get value(){return this._value}set value(t){void 0!==this.gap&&(t=Lg(t,this.gap));var e=this._value;this._value=Rg(t,0,1),e!==this._value&&(this.updateThumb(this._value),this.updateIndicator(this._value),this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter))}postLayout(t,e,i){return this.updateThumb(),this.updateIndicator(),super.postLayout(t,e,i),this}}const Ag={pan:0,drag:0,click:1,none:-1};var Bg={getStartPoint:function(t){if(void 0===t&&(t=bg),this.childrenMap.thumb){var e=0===this.orientation?mg:yg;vg.call(this,e,t)}else 0===this.orientation?(t.x=this.innerLeft+1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerTop+1);return t},getEndPoint:function(t){if(void 0===t&&(t=wg),this.childrenMap.thumb){var e=0===this.orientation?xg:Cg;vg.call(this,e,t)}else 0===this.orientation?(t.x=this.innerRight-1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerBottom-1);return t},updateThumb:function(t){var e,i,s=this.childrenMap.thumb;return void 0===s||(void 0===t&&(t=this.value),this.reverseAxis?(e=this.getEndPoint(),i=this.getStartPoint()):(e=this.getStartPoint(),i=this.getEndPoint()),function(t,e,i,s){void 0===s&&(s=kg),s.x=Sg(e.x,i.x,t),s.y=Sg(e.y,i.y,t)}(t,e,i,s),s.x+=this.thumbOffsetX,s.y+=this.thumbOffsetY,this.resetChildPositionState(s)),this},updateIndicator:function(t){var e=this.childrenMap.indicator;if(void 0===e)return this;void 0===t&&(t=this.value);var i,s,r,n=this.reverseAxis,a=this.childrenMap.thumb;if(a)if(0===this.orientation){var h,o=Q(a);if(n)h=a.x-o*a.originX,i=this.right-h;else i=(h=a.x-o*a.originX)+o-this.left}else{var l,d=tt(a);if(n)l=a.y-d*a.originY,s=this.bottom-l;else s=(l=a.y-d*a.originY)+d-this.top}else 0===this.orientation?i=this.width*t:s=this.height*t;Ge(e,i,s),r=n?0===this.orientation?Tg:_g:0===this.orientation?Og:Pg,he(e,this,r),this.resetChildPositionState(e)}};Object.assign(Dg.prototype,Bg);const Wg=Phaser.Utils.Objects.GetValue;class zg extends La{constructor(t,e){super(t,e),this.type="rexScrollBar";var i,s,r=Wg(e,"background",void 0),n=Wg(e,"buttons",void 0),a=Wg(n,"top",Wg(n,"left",void 0)),h=Wg(n,"bottom",Wg(n,"right",void 0)),o=Wg(e,"slider",void 0);(r&&this.addBackground(r),a&&(this.add(a),new Br(a).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?this.scrollStep:-this.scrollStep;this.value+=t}}),this)),o)&&(o.orientation=this.orientation,o.eventEmitter=this,o.value=null,s=0===this.orientation?void 0===Wg(o,"width",void 0)?1:0:void 0===Wg(o,"height",void 0)?1:0,i=new Dg(t,o),t.add.existing(i),this.add(i,{proportion:s}));h&&(this.add(h),new Br(h).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?-this.scrollStep:this.scrollStep;this.value+=t}}),this));var l=[a,h];this.addChildrenMap("background",r),this.addChildrenMap("slider",i),this.addChildrenMap("buttons",l);var d=Wg(e,"valuechangeCallback",null);if(null!==d){var c=Wg(e,"valuechangeCallbackScope",void 0);this.on("valuechange",d,c)}this.setEnable(Wg(e,"enable",void 0)),this.setValue(Wg(e,"value",0)),this.setScrollStep(Wg(n,"step",.01))}setScrollStep(t){return this.scrollStep=t,this}get enable(){return!!this.childrenMap.slider&&this.childrenMap.slider.enable}set enable(t){this.childrenMap.slider&&this.childrenMap.slider.setEnable(t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get value(){return this.childrenMap.slider?this.childrenMap.slider.value:0}set value(t){this.childrenMap.slider&&(this.childrenMap.slider.value=t)}setValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setValue(t,e,i),this}addValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.addValue(t,e,i),this}getValue(t,e){return this.childrenMap.slider?this.childrenMap.slider.getValue(t,e):0}easeValueTo(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.easeValueTo(t,e,i),this}stopEaseValue(){return this.childrenMap.slider&&this.childrenMap.slider.stopEaseValue(),this}setEaseValueDuration(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueDuration(t),this}setEaseValueFunction(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueFunction(t),this}setGap(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setGap(t,e,i),this}get gap(){if(this.childrenMap.slider)return this.childrenMap.slider.gap}set gap(t){this.childrenMap.slider&&(this.childrenMap.slider.gap=t)}setTick(t,e,i){return this.setGap(t,e,i),this}get tick(){if(this.childrenMap.slider)return this.childrenMap.slider.tick}set tick(t){this.childrenMap.slider&&(this.childrenMap.slider.tick=t)}}class Ig extends Bs{constructor(t,e){super(e),this.parent=t,this.init()}init(){this.start("IDLE")}next_IDLE(){var t,e=this.parent;return e.dragState.isDown&&(t=0===e.dragThreshold?"DRAG":"DRAGBEGIN"),t}update_IDLE(t,e){this.next()}next_DRAGBEGIN(){var t=this.parent,e=t.dragState;return e.isDown?e.pointer.getDistance()>=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const Yg=Phaser.Utils.Objects.GetValue,jg=Phaser.Math.Distance.Between;class Xg extends si{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=Yg(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(Yg(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(Yg(t,"enable",!0)),this.holdThreshold=Yg(t,"holdThreshold",50),this.pointerOutReleaseEnable=Yg(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return vn(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:jg(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!ur(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!ur(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const Fg=Phaser.Utils.Objects.GetValue;class Hg{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(Fg(t,"value",0)),this.setSpeed(Fg(t,"speed",0)),this.setAcceleration(Fg(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class Vg{constructor(){this.value,this.dir,this.movement=new Hg}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const $g={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},Kg=Phaser.Utils.Objects.GetValue;class Jg extends si{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=Kg(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(Kg(e,"speed",.1)),this.setEnable(Kg(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(Kg(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||ur(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const qg=Phaser.Utils.Objects.GetValue;var Zg=function(t,e,i,s){var r,n,a="Y"===(i=i.toUpperCase()),h=2===t.scrollMode,o=t.childrenMap.child,l=`slider${i}`;if(r=h||s.hasOwnProperty(l)?qg(s,l,void 0):qg(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=a?1:0,n=function(t,e){void 0===e&&(e={});var i=yt(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new zg(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r),n.tickLength=qg(r,"tickLength",void 0);var p=qg(r,"position",0);"string"==typeof p&&(p=Qg[p]);var g,v,f=qg(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=qg(s,"space.slider",void 0))&&(h?f=0:g=qg(s,"space.child",0)),v=void 0===g?"number"==typeof f:"number"==typeof g,a?0===p?(d=2,c=1,u=void 0===g?v?{left:f}:f:{left:qg(g,"right",g)}):(d=0,c=1,u=void 0===g?v?{right:f}:f:{right:qg(g,"left",g)}):0===p?(d=1,c=2,u=void 0===g?v?{top:f}:f:{top:qg(g,"bottom",g)}):(d=1,c=0,u=void 0===g?v?{bottom:f}:f:{bottom:qg(g,"top",g)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=qg(r,"hideUnscrollableSlider",!1),t[`disableUnscrollableDrag${i}`]=qg(r,"disableUnscrollableDrag",!1),t[`adaptThumb${i}SizeMode`]=qg(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=qg(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`disableUnscrollableDrag${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=qg(s,"scrollDetectionMode");"string"==typeof b&&(b=tv[b]);var x=`scroller${i}`;(m=h||s.hasOwnProperty(x)?qg(s,x,!0):qg(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=a?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new Ng(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var C,w,S,k,O,P=qg(s,h?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);P&&o&&(void 0!==b&&(P.focus=1===b?2:0),C=new Jg(o,P)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,C),h&&!a||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.disableUnscrollableDrag=t[`disableUnscrollableDrag${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",C)),n&&(h?(w=a?"t":"s",k=`scroll${i}`):(w="t",k="scroll"),n.on("valuechange",(function(e){t[w]=e,t.emit(k,t)}))),y&&(h?(S=`childO${i}`,k=`scroll${i}`):(S="childOY",k="scroll"),y.on("valuechange",(function(e){t[S]=e,t.emit(k,t)}))),C&&(O=h?`addChildO${i}`:"addChildOY",C.on("scroll",(function(e){t[O](-e,!0)})))};const Qg={right:0,left:1,bottom:0,top:1},tv={gameObject:0,rectBounds:1},ev=Phaser.Utils.Objects.GetValue;var iv=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=ev(e,"width"),a=ev(e,"height");n||ev(e,"child.expandWidth",!0)||(s[1]=0),a||ev(e,"child.expandHeight",!0)||(r[1]=0);var h=new hg(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=og(i,"child"),r=og(s,"gameObject",void 0);if(r){var n=og(i,"space.child",0);t.childMargin={};var a=t.childMargin,h={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:a.top=0,a.bottom=0,a.left=0,a.right=0;break;default:a.top=n,a.bottom=n,a.left=n,a.right=n}else switch(t.scrollMode){case 0:a.top=og(n,"top",0),a.bottom=og(n,"bottom",0),h.left=og(n,"left",0),h.right=og(n,"right",0);break;case 1:a.top=og(n,"left",0),a.bottom=og(n,"right",0),h.top=og(n,"top",0),h.bottom=og(n,"bottom",0);break;default:a.top=og(n,"top",0),a.bottom=og(n,"bottom",0),a.left=og(n,"left",0),a.right=og(n,"right",0)}e.add(r,{column:1,row:1,align:og(s,"align","center"),padding:h,expand:{width:og(s,"expandWidth",!0),height:og(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,h,e),t.scrollMode){case 0:Zg(t,h,"y",e);break;case 1:Zg(t,h,"x",e);break;default:Zg(t,h,"y",e),Zg(t,h,"x",e)}return h},sv=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}i*="Y"===t?this.scaleY:this.scaleX,s&&s.setBounds(e,i),r&&(r.setEnable(e!==i),r.tickLength&&r.setTick(r.tickLength,e,i))},rv=function(t){switch(this.scrollMode){case 0:case 1:(i=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(i,this.isOverflow),(r=this.childrenMap.scroller)&&this.disableUnscrollableDrag&&r.setEnable(this.isOverflow);break;default:var e=this[`isOverflow${t=t.toUpperCase()}`],i=this.childrenMap[`slider${t}`],s=this[`hideUnscrollableSlider${t}`];i&&s&&this.setChildVisible(i,e);var r=this.childrenMap.scroller,n=this[`disableUnscrollableDrag${t}`];r&&n&&r.setEnable(e)}},nv=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(h=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=h.childrenMap.track,s=h.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&n0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n")}return i}(this.textObject,this.text,this.lines),this.linesCount=this.lines.length,this._textHeight=void 0,this._textVisibleHeight=void 0,this.updateTextObject(),this},updateTextObject:function(){var t=Math.max(Math.floor(cv.call(this,-this.textOY)),0),e=uv.call(this,t)+this.textOY,i=pv.call(this,t);return function(t,e){switch(mh(t)){case 0:var i=(r=t.style).wordWrapWidth,s=r.wordWrapCallback;r.wordWrapWidth=0,r.wordWrapCallback=void 0,t.setText(e),r.wordWrapWidth=i,r.wordWrapCallback=s;break;case 1:var r,n=(r=t.style).wrapMode;r.wrapMode=0,t.setText(e),r.wrapMode=n;break;case 2:var a=t._maxWidth;t._maxWidth=0,t.setText(e),t._maxWidth=a}}(this.textObject,i),this.textObject.rexSizer.offsetY=e,gv.call(this),this},preLayout:function(){return this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,Fe.call(this),this},layoutChildren:function(){var t,e,i,s,r,n,a,h=this.left,o=this.top;(t=this.textObject).rexSizer.hidden||(s=h+(i=(e=t.rexSizer).padding).left*this.scaleX,r=o+i.top*this.scaleY,n=this.width*this.scaleX-(i.left+i.right)*this.scaleX,a=this.height*this.scaleY-(i.top+i.bottom)*this.scaleY,fv.call(this,t,n,a),oe(t,s,r,n,a,e.align),e.preOffsetY=0,gv.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const yv=Phaser.Utils.Objects.IsPlainObject,bv=Phaser.Utils.Objects.GetValue,xv=Phaser.Display.Align.TOP_LEFT;class Cv extends na{constructor(t,e,i,s,r,n){yv(e)?(e=bv(n=e,"x",0),i=bv(n,"y",0),s=bv(n,"width",void 0),r=bv(n,"height",void 0)):yv(s)&&(s=bv(n=s,"width",void 0),r=bv(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexTextBlock",this.textObject=void 0,this.linesCount=0,this.textMask=void 0,this.textObjectType=void 0,this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,this._textObjectRealHeight=0,this.lines=void 0,this.text=bv(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode(bv(n,"clampTextOY",!0)),this.alwaysScrollable=bv(n,"alwaysScrollable",!1);var a=bv(n,"background",void 0),h=bv(n,"text",void 0);void 0===h&&(h=wv(t)),this.textCropEnable=bv(n,"textCrop",!!h.setCrop);var o=bv(n,"textMask",!this.textCropEnable);a&&this.addBackground(a),this.add(h),this.sizerChildren=[h];var l=this.getSizerConfig(h);l.align=xv,l.padding=fe(0),l.expand=!0,this.textObject=h,this.textObjectType=mh(h),l.preOffsetY=0,l.offsetY=0,o&&(this.textMask=uh.call(this,this.textObject,this)),this.addChildrenMap("background",a),this.addChildrenMap("text",h)}destroy(t){if(this.scene&&!this.ignoreDestroy){if(this.textObject=void 0,this.textMask=void 0,this.lines){switch(this.textObjectType){case 0:case 2:this.lines.length=0;break;case 1:this.lines.destroy()}this.lines=void 0}super.destroy(t)}}setClampMode(t){return void 0===t&&(t=!0),this.clampTextOY=t,this}get textLineHeight(){if(void 0===this._textLineHeight){var t;switch(this.textObjectType){case 0:case 1:var e=this.textObject.style;t=e.metrics.fontSize+e.strokeThickness;break;case 2:var i=this.textObject.fontSize/this.textObject.fontData.size;t=this.textObject.fontData.lineHeight*i}this._textLineHeight=t}return this._textLineHeight}get textLineSpacing(){if(void 0===this._textLineSpacing){var t;switch(this.textObjectType){case 0:case 1:t=this.textObject.lineSpacing;break;case 2:t=0}this._textLineSpacing=t}return this._textLineSpacing}get visibleLinesCount(){return void 0===this._visibleLinesCount&&(this._visibleLinesCount=Math.floor(cv.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=uv.call(this,this.linesCount)),this._textHeight}get textObjectHeight(){return this._textObjectRealHeight-(this.textLineHeight+this.textLineSpacing)}get textVisibleHeight(){if(void 0===this._textVisibleHeight){var t=this.textHeight-this.textObjectHeight;!this.alwaysScrollable&&t<0&&(t=0),this._textVisibleHeight=t}return this._textVisibleHeight}textOYExceedTop(t){return void 0===t&&(t=this.textOY),t>this.topTextOY}textOYExeceedBottom(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:s?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}setTextOY(t){return this.textOY=t,this}set t(t){this.textOY=-this.textVisibleHeight*t}get t(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t}setTextOYByPercentage(t){return this.t=t,this}}var wv=function(t){return t.add.text(0,0,"")};Object.assign(Cv.prototype,mv);var Sv={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},kv={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const Ov=Phaser.Utils.Objects.GetValue;class Pv extends lv{constructor(t,e){void 0===e&&(e={});var i=Ov(e,"text",void 0),s=Ov(e,"textWidth",void 0),r=Ov(e,"textHeight",void 0),n=Ov(e,"textCrop",!!i.setCrop),a=Ov(e,"textMask",!n),h=Ov(e,"content",""),o=new Cv(t,{width:s,height:r,text:i,textMask:a,textCrop:n&&!a,content:h,clampTextOY:Ov(e,"clampChildOY",!1),alwaysScrollable:Ov(e,"alwaysScrollable",!1)});t.add.existing(o),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textObjectHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.textHeight}})}(o),e.scrollMode=0,e.type="rexTextArea",e.child={gameObject:o,expandWidth:void 0===s,expandHeight:void 0===r};var l=Ov(e,"space",void 0);l&&(l.child=Ov(l,"text",0)),super(t,e),this.addChildrenMap("text",i)}get text(){return this.childrenMap.child.text}get lineHeight(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.textHeight}}Object.assign(Pv.prototype,Sv,kv);const Tv=Phaser.Utils.Objects.GetValue;var _v=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("key")&&(i="bitmaptext",e.font=e.key)),i){case"bitmaptext":case"bitmap":s=new zp(t,e);break;case"bbcodetext":case"bbcode":s=new Dp(t,0,0,"",e);break;case"label":s=new Ip(t,e);break;case"textarea":s=function(t,e,i){e=e?$o(e):{};var s=Tv(i,"background",qc),r=Tv(i,"text",_v),n=Tv(i,"track",qc),a=Tv(i,"thumb",qc);s?e.background=s(t,e.background):delete e.background,r?e.text=r(t,e.text):delete e.text;var h=e.slider;!1!==h&&null!==h&&(void 0===h&&(h={}),n?h.track=n(t,h.track):delete h.track,a?h.thumb=a(t,h.thumb):delete h.thumb,e.slider=h);var o=new Pv(t,e);return t.add.existing(o),o}(t,e);break;default:s=new tu(t,e)}return Jc(s,e),t.add.existing(s),s},Mv=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("leftWidth")?i="nineSlice":(e.hasOwnProperty("color")||e.hasOwnProperty("strokeColor"))&&(i="roundRectangle")),i){case"nineSlice":s=e.hasOwnProperty("stretchMode")?new $c(t,e):new Pc(t,e);break;case"roundRectangle":s=new bd(t,e);break;default:s=new Ec(t,e)}return Jc(s,e),t.add.existing(s),s};const Ev=Phaser.Utils.Objects.GetValue;var Rv=function(t,e,i){e=e?$o(e):{};var s=Ev(i,"background",qc),r=Ev(i,"text",_v),n=Ev(i,"icon",Mv),a=Ev(i,"action",Mv);return null!==e.background&&s?e.background=s(t,e.background):delete e.background,null!==e.text&&r?e.text=r(t,e.text):delete e.text,null!==e.icon&&n?e.icon=n(t,e.icon):delete e.icon,null!==e.action&&a?e.action=a(t,e.action):delete e.action,e};class Lv extends Gl{constructor(t,e){super(t,e=Rv(t,e)),this.type="rexTweaker.Title"}setTitle(t){return(t=t?$o(t):{}).hasOwnProperty("text")||(t.hasOwnProperty("title")?t.text=t.title:t.text=""),this.resetDisplayContent(t),this}}Phaser.Math.Wrap;const Dv=Phaser.Math.Linear;var Av=function(){var t,e,i,s,r,n,a=this.getShape("triangle"),h=this.padding,o=this.width-h.right,l=0+h.left,d=this.height-h.bottom,c=0+h.top,u=(l+o)/2,p=(c+d)/2,g={0:{a:{x:l,y:c},b:{x:o,y:p},c:{x:l,y:d}},1:{a:{x:l,y:c},b:{x:u,y:d},c:{x:o,y:c}},2:{a:{x:o,y:c},b:{x:l,y:p},c:{x:o,y:d}},3:{a:{x:l,y:d},b:{x:u,y:c},c:{x:o,y:d}}};if(void 0===this.previousDirection){var v=g[this.direction],f=v.a,m=v.b,y=v.c;t=f.x,e=f.y,i=m.x,s=m.y,r=y.x,n=y.y}else{var b=g[this.previousDirection],x=g[this.direction],C=this.easeDirectionProgress;t=Dv(b.a.x,x.a.x,C),e=Dv(b.a.y,x.a.y,C),i=Dv(b.b.x,x.b.x,C),s=Dv(b.b.y,x.b.y,C),r=Dv(b.c.x,x.c.x,C),n=Dv(b.c.y,x.c.y,C)}a.startAt(t,e).lineTo(i,s).lineTo(r,n),this.arrowOnly?a.end():a.close()};const Bv=(0,Phaser.Math.DegToRad)(120);var Wv=function(t){t=this.getShape("triangle");var e=this.width/2,i=this.height/2,s=Math.min(e,i)*this.radius,r=this.verticeRotation;t.startAt(e+s*Math.cos(r+Bv),i+s*Math.sin(r+Bv)).lineTo(e+s*Math.cos(r),i+s*Math.sin(r)).lineTo(e+s*Math.cos(r-Bv),i+s*Math.sin(r-Bv)),this.arrowOnly?t.end():t.close()},zv={buildShapes(){this.addShape((new nc).setName("triangle"))},updateShapes(){var t=this.getShape("triangle");this.arrowOnly?t.fillStyle().lineStyle(this.lineWidth,this.strokeColor,this.strokeAlpha):t.fillStyle(this.fillColor,this.fillAlpha).lineStyle(this.lineWidth,this.strokeColor,this.strokeAlpha),0===this.shapeMode?Av.call(this):Wv.call(this)}},Iv={setEaseDuration(t){return void 0===t&&(t=0),this.easeDuration=t,this},playEaseDirectionation(){return void 0===this.easeDirectionProgressTask&&(this.easeDirectionProgressTask=new gs(this,{eventEmitter:null})),this.easeDirectionProgressTask.restart({key:"easeDirectionProgress",from:0,to:1,duration:this.easeDuration}),this},stopEaseDirection(){return void 0===this.easeDirectionProgressTask||this.easeDirectionProgressTask.stop(),this}};const Yv=Phaser.Utils.Objects.GetValue,jv=Phaser.Utils.Objects.IsPlainObject,Xv=Phaser.Math.DegToRad,Fv=Phaser.Math.RadToDeg;class Hv extends Pd{constructor(t,e,i,s,r,n,a){var h,o,l,d,c,u,p,g;if(jv(e)){var v=e;e=v.x,i=v.y,s=v.width,r=v.height,n=v.color,a=v.alpha,h=v.strokeColor,o=v.strokeAlpha,l=v.strokeWidth,d=v.arrowOnly,c=v.direction,u=v.easeDuration,p=v.padding,g=v.radius}void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=s),void 0===d&&(d=!1),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),void 0===g&&(g=void 0),super(t,e,i,s,r),this.type="rexTriangle",this.setFillStyle(n,a),void 0!==h&&void 0===l&&(l=2),this.setStrokeStyle(l,h,o),this.setArrowOnly(d),this.setDirection(c,u),this.setPadding(p),this.setRadius(g),this.buildShapes()}get arrowOnly(){return this._arrowOnly}set arrowOnly(t){this.dirty=this.dirty||this._arrowOnly!=t,this._arrowOnly=t}setArrowOnly(t){return void 0===t&&(t=!0),this.arrowOnly=t,this}get direction(){return this._direction}set direction(t){t=Gv(t),this._direction!==t&&(this.easeDuration>0&&void 0!==this._direction?this.previousDirection=this._direction:this.previousDirection=void 0,this._direction=t,this.verticeAngle=90*t,this.dirty=!0,void 0!==this.previousDirection?this.playEaseDirectionation():this.stopEaseDirection())}setDirection(t,e){return void 0!==e&&this.setEaseDuration(e),this.direction=t,this}toggleDirection(t){return this.setDirection(this.direction+2,t),this}get easeDirectionProgress(){return this._easeDirectionProgress}set easeDirectionProgress(t){this._easeDirectionProgress!==t&&(this._easeDirectionProgress=t,this.dirty=!0)}setPadding(t,e,i,s){if("object"==typeof t){var r=t,n=Yv(r,"x",null);null!==n?(t=n,i=n):(t=Yv(r,"left",0),i=Yv(r,"right",t));var a=Yv(r,"y",null);null!==a?(e=a,s=a):(e=Yv(r,"top",0),s=Yv(r,"bottom",e))}else void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=t),void 0===s&&(s=e);return void 0===this.padding&&(this.padding={}),this.dirty=this.dirty||this.padding.left!=t||this.padding.top!=e||this.padding.right!=i||this.padding.bottom!=s,this.padding.left=t,this.padding.top=e,this.padding.right=i,this.padding.bottom=s,this.setRadius(),this}get radius(){return this._radius}set radius(t){this.dirty=this.dirty||this._radius!=t,this._radius=t}setRadius(t){return this.radius=t,this.shapeMode=null==t?0:1,this}get verticeRotation(){return this._verticeRotation}set verticeRotation(t){this.dirty=this.dirty||this._verticeRotation!=t,this._verticeRotation=t}setVerticeRotation(t){return this.verticeRotation=t,this}get verticeAngle(){return Fv(this.verticeRotation)}set verticeAngle(t){this.verticeRotation=Xv(t)}setVerticeAngle(t){return this.verticeAngle=t,this}}const Vv={right:0,down:1,left:2,up:3};var Gv=function(t){return"string"==typeof t&&(t=Vv[t]),t%=4};Object.assign(Hv.prototype,zv,Iv);class Uv extends Lv{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexTweaker.FolderTitle";var i=new Hv(t,e.expandedIcon);t.add.existing(i),this.addSpace().add(i,{proportion:0,expand:!1,padding:1,fitRatio:1}),this.addChildrenMap("expandedIcon",i)}setExpandedState(t){void 0===t&&(t=!0);var e=t?"down":"right";return this.childrenMap.expandedIcon.setDirection(e),this}} + */const lu=Phaser.Display.Canvas.CanvasPool;var du=function(t){var e=lu.create(this),i=e.getContext("2d",{willReadFrequently:!0});t.syncFont(e,i);var s=i.measureText(t.testString);if("actualBoundingBoxAscent"in s){var r=s.actualBoundingBoxAscent,n=s.actualBoundingBoxDescent,a={ascent:r,descent:n,fontSize:r+n};return lu.remove(e),a}var h=Math.ceil(s.width*t.baselineX),o=h,l=2*o;if(o=o*t.baselineY|0,e.width=h,e.height=l,i.fillStyle="#f00",i.fillRect(0,0,h,l),i.font=t._font,i.textBaseline="alphabetic",i.fillStyle="#000",i.fillText(t.testString,0,o),a={ascent:0,descent:0,fontSize:0},!i.getImageData(0,0,h,l))return a.ascent=o,a.descent=o+6,a.fontSize=a.ascent+a.descent,lu.remove(e),a;var d,c,u=i.getImageData(0,0,h,l).data,p=u.length,g=4*h,v=0,f=!1;for(d=0;do;d--){for(c=0;c0&&this.wrapMode!==Oh&&0===this.wrapWidth}setStyle(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wordWrap")){var s=t.wordWrap;s.hasOwnProperty("width")&&(t.wrap={mode:"word",width:s.width})}if(t&&t.hasOwnProperty("wrap")){var r=t.wrap;if(r.hasOwnProperty("mode")){var n=r.mode;"string"==typeof n&&(r.mode=Mh[n])}else r.hasOwnProperty("width")&&(r.mode=1)}t&&t.rtl&&i&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var a=this.propertyMap;for(var h in a){var o=a[h],l=o[0],d=i?o[1]:this[h],c=o[2];if("wrapCallback"===h||"wrapCallbackScope"===h)this[h]=uu(t,l,d);else{var u=cu(t,l,d);c&&(u=c(u)),this[h]=u}}var p=uu(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var g=uu(t,"fill",null);null!==g&&(this.color=co(g));var v=uu(t,"metrics",!1);return v?this.metrics={ascent:uu(v,"ascent",0),descent:uu(v,"descent",0),fontSize:uu(v,"fontSize",0)}:!e&&this.metrics||(this.metrics=du(this)),e?this.parent.updateText():this.parent}syncFont(t,e){e.font=this._font}syncStyle(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"}syncShadow(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)}update(t){return t&&(this._font=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim(),this.metrics=du(this)),this.parent.updateText(t)}buildFont(){var t=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim();return t!==this._font&&(this._font=t),this}setFont(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=uu(t,"fontFamily","Courier"),this.fontSize=uu(t,"fontSize","16px"),this.fontStyle=uu(t,"fontStyle","")),this.update(!0)}setFontFamily(t){return this.fontFamily=t,this.update(!0)}setFontStyle(t){return this.fontStyle=t,this.update(!0)}setFontSize(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}setTestString(t){return this.testString=t,this.update(!0)}setFixedSize(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}setResolution(t){return this.resolution=t,this.update(!1)}setXOffset(t){return this.xOffset=t,this.update(!1)}setBackgroundColor(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=co(t,this.parent.canvas,this.parent.context),this.backgroundColor2=co(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=co(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}setBackgroundCornerRadius(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}setFill(t){return this.color=co(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=co(t,this.parent.canvas,this.parent.context),this.update(!1)}setStroke(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=co(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}setShadow(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===n&&(n=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=co(i,this.parent.canvas,this.parent.context),this.shadowBlur=s,this.shadowStroke=r,this.shadowFill=n,this.update(!1)}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}setShadowColor(t){return void 0===t&&(t="#000"),this.shadowColor=co(t,this.parent.canvas,this.parent.context),this.update(!1)}setShadowBlur(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}setShadowStroke(t){return this.shadowStroke=t,this.update(!1)}setShadowFill(t){return this.shadowFill=t,this.update(!1)}setUnderline(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=co(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}setUnderlineColor(t){return void 0===t&&(t="#000"),this.underlineColor=co(t,this.parent.canvas,this.parent.context),this.update(!1)}setUnderlineThickness(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}setUnderlineOffset(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}setStrikethrough(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=co(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}setStrikethroughColor(t){return void 0===t&&(t="#000"),this.strikethroughColor=co(t,this.parent.canvas,this.parent.context),this.update(!1)}setStrikethroughThickness(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}setStrikethroughOffset(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}setWrapMode(t){return"string"==typeof t&&(t=Mh[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}setWrapWidth(t){return this.wrapWidth=t,this.update(!1)}setAlign(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}setHAlign(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}setVAlign(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}setMaxLines(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}getTextMetrics(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}setTextMetrics(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=uu(e,"fontFamily",this.fontFamily),this.fontSize=uu(e,"fontSize",this.fontSize),this.fontStyle=uu(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}get lineHeight(){return this.metrics.fontSize+this.parent.lineSpacing}toJSON(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}destroy(){this.parent=void 0}}var gu={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var a=this.defaultStyle;this.clear(),So(this,a.backgroundColor,a.backgroundStrokeColor,a.backgroundStrokeLineWidth,a.backgroundCornerRadius,a.backgroundColor2,a.backgroundHorizontalGradient,a.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var h,o,l,d,c,u,p=a.halign,g=a.valign,v=a.lineHeight,f=r.lines,m=f.length,y=a.maxLines;y>0&&m>y?(o=y,l="center"===g?Math.floor((m-o)/2):"bottom"===g?m-o:0):(o=m,l=0),d=l+o;var b=this.rtl,x=b?this.parent.width:void 0;u="center"===g?Math.max((s-o*v)/2,0):"bottom"===g?Math.max(s-o*v-2,0):0,u+=e;for(var C=l;C0){var h=this.defaultStyle.metrics,o=i-h.ascent,l=h.fontSize;this.drawRectangle(e,o,t.width,l,a.bgcolor,a)}if(a.underlineThickness>0&&t.width>0){var d=i+a.underlineOffset-a.underlineThickness/2;this.drawLine(e,d,t.width,a.underlineThickness,a.underlineColor,a)}if(t.isTextPen&&(a.buildFont(),a.syncFont(r,n),a.syncStyle(r,n),this.drawText(e,i,t.text,a)),t.isImagePen&&this.drawImage(e,i,t.prop.img,t.prop.color,a),a.strikethroughThickness>0&&t.width>0&&(d=i+a.strikethroughOffset-a.strikethroughThickness/2,this.drawLine(e,d,t.width,a.strikethroughThickness,a.strikethroughColor,a)),n.restore(),t.hasAreaMarker&&t.width>0){var c,u=t.prop.area;if(u)c={key:u};else{var p=t.prop.url;c={key:`url:${p}`,url:p}}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,c)}},clear(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawRectangle(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;a.fillStyle=r,a.fillRect(t,e,i,s)},drawLine(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;n.syncShadow(a,n.shadowStroke);var h=a.lineCap;a.lineCap="butt",a.strokeStyle=r,a.lineWidth=s,a.beginPath(),a.moveTo(t,e),a.lineTo(t+i,e),a.stroke(),a.lineCap=h},drawText(t,e,i,s){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;s.stroke&&"none"!==s.stroke&&s.strokeThickness>0&&(s.syncShadow(r,s.shadowStroke),r.strokeText(i,t,e)),s.color&&"none"!==s.color&&(s.syncShadow(r,s.shadowFill),r.fillText(i,t,e))},drawImage(t,e,i,s,r){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,s,this.autoRound)}};const vu=Phaser.Utils.Objects.GetValue,fu=wh,mu=Sh;class yu{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=vu(t,"text",""),this.x=vu(t,"x",0),this.y=vu(t,"y",0),this.width=vu(t,"width",0);var e=vu(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=vu(t,"newLineMode",0),this.startIndex=vu(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===mu&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==fu&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===mu&&(t+=1),t}get endIndex(){return this.startIndex+this.rawTextLength}get lastX(){return this.x+this.width}get isTextPen(){return""!==this.text}get isImagePen(){return!!this.prop.img}get hasAreaMarker(){return!!this.prop.area||!!this.prop.url}}const bu=Phaser.Utils.Objects.GetFastValue,xu=wh,Cu=kh;class wu{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=bu(t,"tagToText",It),this.tagToTextScope=bu(t,"tagToTextScope",void 0)}destroy(){this.clear(),this.tagToText=void 0,this.tagToTextScope=void 0}clear(){for(var t=0,e=this.lines.length;t=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}getLineEndIndex(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,s=!1;for(e=t;e>=0&&!(s=null!=(i=this.lines[e])&&i.length>0);e--);return s?i[i.length-1].endIndex:0}getLineWidth(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}getMaxLineWidth(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,s=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}getLineWidths(){for(var t=[],e=0,i=this.lines.length;e=t&&o<=e||(a=a.substring(t-h,e-h)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,a,l,d):c+=this.tagToText(a,l,d),d=l,!(o>=e)));u++);return c}get length(){return this.lines.length}set length(t){this.clear()}}var Su={};const ku=Phaser.Geom.Rectangle;var Ou=new El;class Pu{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&ju(v)){""!==b?a.push(n.getLine(b,x,Du)):0===C&&r>0&&a.push(n.getLine("",0,Du)),a.push(...Iu(v,e,Wu,s,0,n));var S=a.pop();b=S.text,x=S.width,n.freeLine(S)," "===b&&(b="",x=0)}else(m=x+f)>o?(a.push(n.getLine(b,x,Du)),b=v,x=f,o=s):(b+=v,x=m),C===w-1&&a.push(n.getLine(b,x,l))}return a},Yu=function(t,e){var i;switch(e){case Bu:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==Fu&&i0&&t>e&&(t=e),t}get linesWidth(){return Math.ceil(this.penManager.getMaxLineWidth())}get linesHeight(){var t=this.displayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}get imageManager(){return this.parent.imageManager}get rtl(){return this.parent.style.rtl}newPenManager(){return new wu({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}get tmpPenManager(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}getPlainText(t,e,i){var s;if(null==t)s=this.penManager.plainText;else{var r=this.parser.splitText(t,1);s="";for(var n=0,a=r.length;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return qp(this.sizerChildren,null),ba.call(this,t),this}},Qp={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)qp(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},sg={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,h=this.sizerChildren,o=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Ie.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,qp(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)qp(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},ng=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const ag=Phaser.Utils.Objects.IsPlainObject,hg=Phaser.Utils.Objects.GetValue;class og extends na{constructor(t,e,i,s,r,n,a,h,o,l){ag(e)?(e=hg(l=e,"x",0),i=hg(l,"y",0),s=hg(l,"width",void 0),r=hg(l,"height",void 0),n=hg(l,"column",l.col||0),a=hg(l,"row",0),h=hg(l,"columnProportions",0),o=hg(l,"rowProportions",0)):ag(s)?(s=hg(l=s,"width",void 0),r=hg(l,"height",void 0),n=hg(l,"column",l.col||0),a=hg(l,"row",0),h=hg(l,"columnProportions",0),o=hg(l,"rowProportions",0)):ag(n)?(n=hg(l=n,"column",l.col||0),a=hg(l,"row",0),h=hg(l,"columnProportions",0),o=hg(l,"rowProportions",0)):ag(h)&&(h=hg(l=h,"columnProportions",0),o=hg(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(hg(l,"createCellContainerCallback")),this.setIndentLeft(hg(l,"space.indentLeftOdd",0),hg(l,"space.indentLeftEven",0)),this.setIndentTop(hg(l,"space.indentTopOdd",0),hg(l,"space.indentTopEven",0)),this.resetGrid(n,a,h,o,hg(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=rg.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=ng.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(og.prototype,sg);const lg=Phaser.Utils.Objects.GetValue,dg=Phaser.Math.Percent;var cg=function(t,e,i){var s;return t.y===e.y?s=dg(i.x,t.x,e.x):t.x===e.x&&(s=dg(i.y,t.y,e.y)),s},ug=function(t,e,i){var s,r;this.enable&&(pg.x=e,pg.y=i,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint()),this.value=cg(s,r,pg))},pg={},gg=function(t,e,i){if(this.enable&&t.isDown){var s,r;vg.x=t.worldX,vg.y=t.worldY,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint());var n=cg(s,r,vg);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-n)<.1?this.value=n:this.easeValueTo(n)}},vg={},fg=function(t,e){void 0===e&&(e=mg);var i=this.childrenMap.thumb,s=i.x,r=i.y;return oe(i,this.innerLeft,this.innerTop,this.innerWidth,this.innerHeight,t),e.x=i.x,e.y=i.y,i.x=s,i.y=r,e},mg={};const yg=Phaser.Display.Align.LEFT_CENTER,bg=Phaser.Display.Align.TOP_CENTER;var xg={};const Cg=Phaser.Display.Align.RIGHT_CENTER,wg=Phaser.Display.Align.BOTTOM_CENTER;var Sg={};const kg=Phaser.Math.Linear;var Og={};const Pg=Phaser.Display.Align.LEFT_CENTER,Tg=Phaser.Display.Align.TOP_CENTER,_g=Phaser.Display.Align.RIGHT_CENTER,Mg=Phaser.Display.Align.BOTTOM_CENTER,Eg=Phaser.Utils.Objects.GetValue,Rg=Phaser.Utils.Objects.IsPlainObject,Lg=Phaser.Math.Clamp,Dg=Phaser.Math.Snap.To;class Ag extends(Ad(La)){constructor(t,e){super(t,e),this.type="rexSlider",this.bootProgressBase(e),this.reverseAxis=Eg(e,"reverseAxis",!1);var i=Eg(e,"background",void 0),s=Eg(e,"track",void 0),r=Eg(e,"indicator",void 0),n=Eg(e,"thumb",void 0);if(i&&(Rg(i)&&(i=Zc(t,i)),this.addBackground(i)),s&&(Rg(s)&&(s=Zc(t,s)),this.add(s,{proportion:1,expand:!0,minWidth:0===this.orientation?0:void 0,minHeight:1===this.orientation?0:void 0})),r&&(Rg(r)&&(r=Zc(t,r)),this.pin(r)),n){Rg(n)&&(n=Zc(t,n)),this.pin(n);var a=Eg(e,"thumbOffsetX",0),h=Eg(e,"thumbOffsetY",0);this.setThumbOffset(a,h)}var o=Eg(e,"input",0);switch("string"==typeof o&&(o=Bg[o]),o){case 0:n&&(n.setInteractive(),this.scene.input.setDraggable(n),n.on("drag",ug,this).on("dragstart",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("dragend",(function(t){this.eventEmitter.emit("inputend",t)}),this));break;case 1:this.on("pointerdown",gg,this).on("pointermove",gg,this).on("pointerdown",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("pointerup",(function(t){this.eventEmitter.emit("inputend",t)}),this).on("pointerover",(function(t){t.isDown&&this.eventEmitter.emit("inputstart",t)}),this).on("pointerout",(function(t){t.isDown&&this.eventEmitter.emit("inputend",t)}),this).setInteractive()}this.addChildrenMap("background",i),this.addChildrenMap("track",s),this.addChildrenMap("indicator",r),this.addChildrenMap("thumb",n),this.setEnable(Eg(e,"enable",void 0));var l=Eg(e,"tick",void 0);void 0===l&&(l=Eg(e,"gap",void 0)),this.setGap(l),this.setValue(Eg(e,"value",0),Eg(e,"min",void 0),Eg(e,"max",void 0))}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setGap(t,e,i){return t&&void 0!==e&&(t/=i-e),this.gap=t,this}setTick(t,e,i){return this.setGap(t,e,i),this}get tick(){return this.gap}set tick(t){this.gap=t}setThumbOffset(t,e){return this.thumbOffsetX=t,this.thumbOffsetY=e,this}get value(){return this._value}set value(t){void 0!==this.gap&&(t=Dg(t,this.gap));var e=this._value;this._value=Lg(t,0,1),e!==this._value&&(this.updateThumb(this._value),this.updateIndicator(this._value),this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter))}postLayout(t,e,i){return this.updateThumb(),this.updateIndicator(),super.postLayout(t,e,i),this}}const Bg={pan:0,drag:0,click:1,none:-1};var Wg={getStartPoint:function(t){if(void 0===t&&(t=xg),this.childrenMap.thumb){var e=0===this.orientation?yg:bg;fg.call(this,e,t)}else 0===this.orientation?(t.x=this.innerLeft+1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerTop+1);return t},getEndPoint:function(t){if(void 0===t&&(t=Sg),this.childrenMap.thumb){var e=0===this.orientation?Cg:wg;fg.call(this,e,t)}else 0===this.orientation?(t.x=this.innerRight-1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerBottom-1);return t},updateThumb:function(t){var e,i,s=this.childrenMap.thumb;return void 0===s||(void 0===t&&(t=this.value),this.reverseAxis?(e=this.getEndPoint(),i=this.getStartPoint()):(e=this.getStartPoint(),i=this.getEndPoint()),function(t,e,i,s){void 0===s&&(s=Og),s.x=kg(e.x,i.x,t),s.y=kg(e.y,i.y,t)}(t,e,i,s),s.x+=this.thumbOffsetX,s.y+=this.thumbOffsetY,this.resetChildPositionState(s)),this},updateIndicator:function(t){var e=this.childrenMap.indicator;if(void 0===e)return this;void 0===t&&(t=this.value);var i,s,r,n=this.reverseAxis,a=this.childrenMap.thumb;if(a)if(0===this.orientation){var h,o=Q(a);if(n)h=a.x-o*a.originX,i=this.right-h;else i=(h=a.x-o*a.originX)+o-this.left}else{var l,d=tt(a);if(n)l=a.y-d*a.originY,s=this.bottom-l;else s=(l=a.y-d*a.originY)+d-this.top}else 0===this.orientation?i=this.width*t:s=this.height*t;Ge(e,i,s),r=n?0===this.orientation?_g:Mg:0===this.orientation?Pg:Tg,he(e,this,r),this.resetChildPositionState(e)}};Object.assign(Ag.prototype,Wg);const zg=Phaser.Utils.Objects.GetValue;class Ig extends La{constructor(t,e){super(t,e),this.type="rexScrollBar";var i,s,r=zg(e,"background",void 0),n=zg(e,"buttons",void 0),a=zg(n,"top",zg(n,"left",void 0)),h=zg(n,"bottom",zg(n,"right",void 0)),o=zg(e,"slider",void 0);(r&&this.addBackground(r),a&&(this.add(a),new Br(a).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?this.scrollStep:-this.scrollStep;this.value+=t}}),this)),o)&&(o.orientation=this.orientation,o.eventEmitter=this,o.value=null,s=0===this.orientation?void 0===zg(o,"width",void 0)?1:0:void 0===zg(o,"height",void 0)?1:0,i=new Ag(t,o),t.add.existing(i),this.add(i,{proportion:s}));h&&(this.add(h),new Br(h).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?-this.scrollStep:this.scrollStep;this.value+=t}}),this));var l=[a,h];this.addChildrenMap("background",r),this.addChildrenMap("slider",i),this.addChildrenMap("buttons",l);var d=zg(e,"valuechangeCallback",null);if(null!==d){var c=zg(e,"valuechangeCallbackScope",void 0);this.on("valuechange",d,c)}this.setEnable(zg(e,"enable",void 0)),this.setValue(zg(e,"value",0)),this.setScrollStep(zg(n,"step",.01))}setScrollStep(t){return this.scrollStep=t,this}get enable(){return!!this.childrenMap.slider&&this.childrenMap.slider.enable}set enable(t){this.childrenMap.slider&&this.childrenMap.slider.setEnable(t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get value(){return this.childrenMap.slider?this.childrenMap.slider.value:0}set value(t){this.childrenMap.slider&&(this.childrenMap.slider.value=t)}setValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setValue(t,e,i),this}addValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.addValue(t,e,i),this}getValue(t,e){return this.childrenMap.slider?this.childrenMap.slider.getValue(t,e):0}easeValueTo(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.easeValueTo(t,e,i),this}stopEaseValue(){return this.childrenMap.slider&&this.childrenMap.slider.stopEaseValue(),this}setEaseValueDuration(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueDuration(t),this}setEaseValueFunction(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueFunction(t),this}setGap(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setGap(t,e,i),this}get gap(){if(this.childrenMap.slider)return this.childrenMap.slider.gap}set gap(t){this.childrenMap.slider&&(this.childrenMap.slider.gap=t)}setTick(t,e,i){return this.setGap(t,e,i),this}get tick(){if(this.childrenMap.slider)return this.childrenMap.slider.tick}set tick(t){this.childrenMap.slider&&(this.childrenMap.slider.tick=t)}}class Yg extends Bs{constructor(t,e){super(e),this.parent=t,this.init()}init(){this.start("IDLE")}next_IDLE(){var t,e=this.parent;return e.dragState.isDown&&(t=0===e.dragThreshold?"DRAG":"DRAGBEGIN"),t}update_IDLE(t,e){this.next()}next_DRAGBEGIN(){var t=this.parent,e=t.dragState;return e.isDown?e.pointer.getDistance()>=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const jg=Phaser.Utils.Objects.GetValue,Xg=Phaser.Math.Distance.Between;class Fg extends si{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=jg(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(jg(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(jg(t,"enable",!0)),this.holdThreshold=jg(t,"holdThreshold",50),this.pointerOutReleaseEnable=jg(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return vn(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:Xg(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!ur(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!ur(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const Hg=Phaser.Utils.Objects.GetValue;class Vg{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(Hg(t,"value",0)),this.setSpeed(Hg(t,"speed",0)),this.setAcceleration(Hg(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class Gg{constructor(){this.value,this.dir,this.movement=new Vg}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const Kg={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},Jg=Phaser.Utils.Objects.GetValue;class qg extends si{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=Jg(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(Jg(e,"speed",.1)),this.setEnable(Jg(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(Jg(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||ur(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const Zg=Phaser.Utils.Objects.GetValue;var Qg=function(t,e,i,s){var r,n,a="Y"===(i=i.toUpperCase()),h=2===t.scrollMode,o=t.childrenMap.child,l=`slider${i}`;if(r=h||s.hasOwnProperty(l)?Zg(s,l,void 0):Zg(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=a?1:0,n=function(t,e){void 0===e&&(e={});var i=yt(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new Ig(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r),n.tickLength=Zg(r,"tickLength",void 0);var p=Zg(r,"position",0);"string"==typeof p&&(p=tv[p]);var g,v,f=Zg(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=Zg(s,"space.slider",void 0))&&(h?f=0:g=Zg(s,"space.child",0)),v=void 0===g?"number"==typeof f:"number"==typeof g,a?0===p?(d=2,c=1,u=void 0===g?v?{left:f}:f:{left:Zg(g,"right",g)}):(d=0,c=1,u=void 0===g?v?{right:f}:f:{right:Zg(g,"left",g)}):0===p?(d=1,c=2,u=void 0===g?v?{top:f}:f:{top:Zg(g,"bottom",g)}):(d=1,c=0,u=void 0===g?v?{bottom:f}:f:{bottom:Zg(g,"top",g)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=Zg(r,"hideUnscrollableSlider",!1),t[`disableUnscrollableDrag${i}`]=Zg(r,"disableUnscrollableDrag",!1),t[`adaptThumb${i}SizeMode`]=Zg(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=Zg(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`disableUnscrollableDrag${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=Zg(s,"scrollDetectionMode");"string"==typeof b&&(b=ev[b]);var x=`scroller${i}`;(m=h||s.hasOwnProperty(x)?Zg(s,x,!0):Zg(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=a?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new $g(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var C,w,S,k,O,P=Zg(s,h?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);P&&o&&(void 0!==b&&(P.focus=1===b?2:0),C=new qg(o,P)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,C),h&&!a||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.disableUnscrollableDrag=t[`disableUnscrollableDrag${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",C)),n&&(h?(w=a?"t":"s",k=`scroll${i}`):(w="t",k="scroll"),n.on("valuechange",(function(e){t[w]=e,t.emit(k,t)}))),y&&(h?(S=`childO${i}`,k=`scroll${i}`):(S="childOY",k="scroll"),y.on("valuechange",(function(e){t[S]=e,t.emit(k,t)}))),C&&(O=h?`addChildO${i}`:"addChildOY",C.on("scroll",(function(e){t[O](-e,!0)})))};const tv={right:0,left:1,bottom:0,top:1},ev={gameObject:0,rectBounds:1},iv=Phaser.Utils.Objects.GetValue;var sv=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=iv(e,"width"),a=iv(e,"height");n||iv(e,"child.expandWidth",!0)||(s[1]=0),a||iv(e,"child.expandHeight",!0)||(r[1]=0);var h=new og(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=lg(i,"child"),r=lg(s,"gameObject",void 0);if(r){var n=lg(i,"space.child",0);t.childMargin={};var a=t.childMargin,h={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:a.top=0,a.bottom=0,a.left=0,a.right=0;break;default:a.top=n,a.bottom=n,a.left=n,a.right=n}else switch(t.scrollMode){case 0:a.top=lg(n,"top",0),a.bottom=lg(n,"bottom",0),h.left=lg(n,"left",0),h.right=lg(n,"right",0);break;case 1:a.top=lg(n,"left",0),a.bottom=lg(n,"right",0),h.top=lg(n,"top",0),h.bottom=lg(n,"bottom",0);break;default:a.top=lg(n,"top",0),a.bottom=lg(n,"bottom",0),a.left=lg(n,"left",0),a.right=lg(n,"right",0)}e.add(r,{column:1,row:1,align:lg(s,"align","center"),padding:h,expand:{width:lg(s,"expandWidth",!0),height:lg(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,h,e),t.scrollMode){case 0:Qg(t,h,"y",e);break;case 1:Qg(t,h,"x",e);break;default:Qg(t,h,"y",e),Qg(t,h,"x",e)}return h},rv=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}i*="Y"===t?this.scaleY:this.scaleX,s&&s.setBounds(e,i),r&&(r.setEnable(e!==i),r.tickLength&&r.setTick(r.tickLength,e,i))},nv=function(t){switch(this.scrollMode){case 0:case 1:(i=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(i,this.isOverflow),(r=this.childrenMap.scroller)&&this.disableUnscrollableDrag&&r.setEnable(this.isOverflow);break;default:var e=this[`isOverflow${t=t.toUpperCase()}`],i=this.childrenMap[`slider${t}`],s=this[`hideUnscrollableSlider${t}`];i&&s&&this.setChildVisible(i,e);var r=this.childrenMap.scroller,n=this[`disableUnscrollableDrag${t}`];r&&n&&r.setEnable(e)}},av=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(h=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=h.childrenMap.track,s=h.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&n0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n")}return i}(this.textObject,this.text,this.lines),this.linesCount=this.lines.length,this._textHeight=void 0,this._textVisibleHeight=void 0,this.updateTextObject(),this},updateTextObject:function(){var t=Math.max(Math.floor(uv.call(this,-this.textOY)),0),e=pv.call(this,t)+this.textOY,i=gv.call(this,t);return function(t,e){switch(mh(t)){case 0:var i=(r=t.style).wordWrapWidth,s=r.wordWrapCallback;r.wordWrapWidth=0,r.wordWrapCallback=void 0,t.setText(e),r.wordWrapWidth=i,r.wordWrapCallback=s;break;case 1:var r,n=(r=t.style).wrapMode;r.wrapMode=0,t.setText(e),r.wrapMode=n;break;case 2:var a=t._maxWidth;t._maxWidth=0,t.setText(e),t._maxWidth=a}}(this.textObject,i),this.textObject.rexSizer.offsetY=e,vv.call(this),this},preLayout:function(){return this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,Fe.call(this),this},layoutChildren:function(){var t,e,i,s,r,n,a,h=this.left,o=this.top;(t=this.textObject).rexSizer.hidden||(s=h+(i=(e=t.rexSizer).padding).left*this.scaleX,r=o+i.top*this.scaleY,n=this.width*this.scaleX-(i.left+i.right)*this.scaleX,a=this.height*this.scaleY-(i.top+i.bottom)*this.scaleY,mv.call(this,t,n,a),oe(t,s,r,n,a,e.align),e.preOffsetY=0,vv.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const bv=Phaser.Utils.Objects.IsPlainObject,xv=Phaser.Utils.Objects.GetValue,Cv=Phaser.Display.Align.TOP_LEFT;class wv extends na{constructor(t,e,i,s,r,n){bv(e)?(e=xv(n=e,"x",0),i=xv(n,"y",0),s=xv(n,"width",void 0),r=xv(n,"height",void 0)):bv(s)&&(s=xv(n=s,"width",void 0),r=xv(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexTextBlock",this.textObject=void 0,this.linesCount=0,this.textMask=void 0,this.textObjectType=void 0,this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,this._textObjectRealHeight=0,this.lines=void 0,this.text=xv(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode(xv(n,"clampTextOY",!0)),this.alwaysScrollable=xv(n,"alwaysScrollable",!1);var a=xv(n,"background",void 0),h=xv(n,"text",void 0);void 0===h&&(h=Sv(t)),this.textCropEnable=xv(n,"textCrop",!!h.setCrop);var o=xv(n,"textMask",!this.textCropEnable);a&&this.addBackground(a),this.add(h),this.sizerChildren=[h];var l=this.getSizerConfig(h);l.align=Cv,l.padding=fe(0),l.expand=!0,this.textObject=h,this.textObjectType=mh(h),l.preOffsetY=0,l.offsetY=0,o&&(this.textMask=uh.call(this,this.textObject,this)),this.addChildrenMap("background",a),this.addChildrenMap("text",h)}destroy(t){if(this.scene&&!this.ignoreDestroy){if(this.textObject=void 0,this.textMask=void 0,this.lines){switch(this.textObjectType){case 0:case 2:this.lines.length=0;break;case 1:this.lines.destroy()}this.lines=void 0}super.destroy(t)}}setClampMode(t){return void 0===t&&(t=!0),this.clampTextOY=t,this}get textLineHeight(){if(void 0===this._textLineHeight){var t;switch(this.textObjectType){case 0:case 1:var e=this.textObject.style;t=e.metrics.fontSize+e.strokeThickness;break;case 2:var i=this.textObject.fontSize/this.textObject.fontData.size;t=this.textObject.fontData.lineHeight*i}this._textLineHeight=t}return this._textLineHeight}get textLineSpacing(){if(void 0===this._textLineSpacing){var t;switch(this.textObjectType){case 0:case 1:t=this.textObject.lineSpacing;break;case 2:t=0}this._textLineSpacing=t}return this._textLineSpacing}get visibleLinesCount(){return void 0===this._visibleLinesCount&&(this._visibleLinesCount=Math.floor(uv.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=pv.call(this,this.linesCount)),this._textHeight}get textObjectHeight(){return this._textObjectRealHeight-(this.textLineHeight+this.textLineSpacing)}get textVisibleHeight(){if(void 0===this._textVisibleHeight){var t=this.textHeight-this.textObjectHeight;!this.alwaysScrollable&&t<0&&(t=0),this._textVisibleHeight=t}return this._textVisibleHeight}textOYExceedTop(t){return void 0===t&&(t=this.textOY),t>this.topTextOY}textOYExeceedBottom(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:s?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}setTextOY(t){return this.textOY=t,this}set t(t){this.textOY=-this.textVisibleHeight*t}get t(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t}setTextOYByPercentage(t){return this.t=t,this}}var Sv=function(t){return t.add.text(0,0,"")};Object.assign(wv.prototype,yv);var kv={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},Ov={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const Pv=Phaser.Utils.Objects.GetValue;class Tv extends dv{constructor(t,e){void 0===e&&(e={});var i=Pv(e,"text",void 0),s=Pv(e,"textWidth",void 0),r=Pv(e,"textHeight",void 0),n=Pv(e,"textCrop",!!i.setCrop),a=Pv(e,"textMask",!n),h=Pv(e,"content",""),o=new wv(t,{width:s,height:r,text:i,textMask:a,textCrop:n&&!a,content:h,clampTextOY:Pv(e,"clampChildOY",!1),alwaysScrollable:Pv(e,"alwaysScrollable",!1)});t.add.existing(o),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textObjectHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.textHeight}})}(o),e.scrollMode=0,e.type="rexTextArea",e.child={gameObject:o,expandWidth:void 0===s,expandHeight:void 0===r};var l=Pv(e,"space",void 0);l&&(l.child=Pv(l,"text",0)),super(t,e),this.addChildrenMap("text",i)}get text(){return this.childrenMap.child.text}get lineHeight(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.textHeight}}Object.assign(Tv.prototype,kv,Ov);const _v=Phaser.Utils.Objects.GetValue;var Mv=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("key")&&(i="bitmaptext",e.font=e.key)),i){case"bitmaptext":case"bitmap":s=new Ip(t,e);break;case"bbcodetext":case"bbcode":s=new Ap(t,0,0,"",e);break;case"label":s=new Yp(t,e);break;case"textarea":s=function(t,e,i){e=e?$o(e):{};var s=_v(i,"background",Zc),r=_v(i,"text",Mv),n=_v(i,"track",Zc),a=_v(i,"thumb",Zc);s?e.background=s(t,e.background):delete e.background,r?e.text=r(t,e.text):delete e.text;var h=e.slider;!1!==h&&null!==h&&(void 0===h&&(h={}),n?h.track=n(t,h.track):delete h.track,a?h.thumb=a(t,h.thumb):delete h.thumb,e.slider=h);var o=new Tv(t,e);return t.add.existing(o),o}(t,e);break;default:s=new eu(t,e)}return qc(s,e),t.add.existing(s),s},Ev=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("leftWidth")?i="nineSlice":(e.hasOwnProperty("color")||e.hasOwnProperty("strokeColor"))&&(i="roundRectangle")),i){case"nineSlice":s=e.hasOwnProperty("stretchMode")?new Kc(t,e):new Tc(t,e);break;case"roundRectangle":s=new bd(t,e);break;default:s=new Rc(t,e)}return qc(s,e),t.add.existing(s),s};const Rv=Phaser.Utils.Objects.GetValue;var Lv=function(t,e,i){e=e?$o(e):{};var s=Rv(i,"background",Zc),r=Rv(i,"text",Mv),n=Rv(i,"icon",Ev),a=Rv(i,"action",Ev);return null!==e.background&&s?e.background=s(t,e.background):delete e.background,null!==e.text&&r?e.text=r(t,e.text):delete e.text,null!==e.icon&&n?e.icon=n(t,e.icon):delete e.icon,null!==e.action&&a?e.action=a(t,e.action):delete e.action,e};class Dv extends Gl{constructor(t,e){super(t,e=Lv(t,e)),this.type="rexTweaker.Title"}setTitle(t){return(t=t?$o(t):{}).hasOwnProperty("text")||(t.hasOwnProperty("title")?t.text=t.title:t.text=""),this.resetDisplayContent(t),this}}Phaser.Math.Wrap;const Av=Phaser.Math.Linear;var Bv=function(){var t,e,i,s,r,n,a=this.getShape("triangle"),h=this.padding,o=this.width-h.right,l=0+h.left,d=this.height-h.bottom,c=0+h.top,u=(l+o)/2,p=(c+d)/2,g={0:{a:{x:l,y:c},b:{x:o,y:p},c:{x:l,y:d}},1:{a:{x:l,y:c},b:{x:u,y:d},c:{x:o,y:c}},2:{a:{x:o,y:c},b:{x:l,y:p},c:{x:o,y:d}},3:{a:{x:l,y:d},b:{x:u,y:c},c:{x:o,y:d}}};if(void 0===this.previousDirection){var v=g[this.direction],f=v.a,m=v.b,y=v.c;t=f.x,e=f.y,i=m.x,s=m.y,r=y.x,n=y.y}else{var b=g[this.previousDirection],x=g[this.direction],C=this.easeDirectionProgress;t=Av(b.a.x,x.a.x,C),e=Av(b.a.y,x.a.y,C),i=Av(b.b.x,x.b.x,C),s=Av(b.b.y,x.b.y,C),r=Av(b.c.x,x.c.x,C),n=Av(b.c.y,x.c.y,C)}a.startAt(t,e).lineTo(i,s).lineTo(r,n),this.arrowOnly?a.end():a.close()};const Wv=(0,Phaser.Math.DegToRad)(120);var zv=function(t){t=this.getShape("triangle");var e=this.width/2,i=this.height/2,s=Math.min(e,i)*this.radius,r=this.verticeRotation;t.startAt(e+s*Math.cos(r+Wv),i+s*Math.sin(r+Wv)).lineTo(e+s*Math.cos(r),i+s*Math.sin(r)).lineTo(e+s*Math.cos(r-Wv),i+s*Math.sin(r-Wv)),this.arrowOnly?t.end():t.close()},Iv={buildShapes(){this.addShape((new ac).setName("triangle"))},updateShapes(){var t=this.getShape("triangle");this.arrowOnly?t.fillStyle().lineStyle(this.lineWidth,this.strokeColor,this.strokeAlpha):t.fillStyle(this.fillColor,this.fillAlpha).lineStyle(this.lineWidth,this.strokeColor,this.strokeAlpha),0===this.shapeMode?Bv.call(this):zv.call(this)}},Yv={setEaseDuration(t){return void 0===t&&(t=0),this.easeDuration=t,this},playEaseDirectionation(){return void 0===this.easeDirectionProgressTask&&(this.easeDirectionProgressTask=new gs(this,{eventEmitter:null})),this.easeDirectionProgressTask.restart({key:"easeDirectionProgress",from:0,to:1,duration:this.easeDuration}),this},stopEaseDirection(){return void 0===this.easeDirectionProgressTask||this.easeDirectionProgressTask.stop(),this}};const jv=Phaser.Utils.Objects.GetValue,Xv=Phaser.Utils.Objects.IsPlainObject,Fv=Phaser.Math.DegToRad,Hv=Phaser.Math.RadToDeg;class Vv extends Pd{constructor(t,e,i,s,r,n,a){var h,o,l,d,c,u,p,g;if(Xv(e)){var v=e;e=v.x,i=v.y,s=v.width,r=v.height,n=v.color,a=v.alpha,h=v.strokeColor,o=v.strokeAlpha,l=v.strokeWidth,d=v.arrowOnly,c=v.direction,u=v.easeDuration,p=v.padding,g=v.radius}void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=s),void 0===d&&(d=!1),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),void 0===g&&(g=void 0),super(t,e,i,s,r),this.type="rexTriangle",this.setFillStyle(n,a),void 0!==h&&void 0===l&&(l=2),this.setStrokeStyle(l,h,o),this.setArrowOnly(d),this.setDirection(c,u),this.setPadding(p),this.setRadius(g),this.buildShapes()}get arrowOnly(){return this._arrowOnly}set arrowOnly(t){this.dirty=this.dirty||this._arrowOnly!=t,this._arrowOnly=t}setArrowOnly(t){return void 0===t&&(t=!0),this.arrowOnly=t,this}get direction(){return this._direction}set direction(t){t=Uv(t),this._direction!==t&&(this.easeDuration>0&&void 0!==this._direction?this.previousDirection=this._direction:this.previousDirection=void 0,this._direction=t,this.verticeAngle=90*t,this.dirty=!0,void 0!==this.previousDirection?this.playEaseDirectionation():this.stopEaseDirection())}setDirection(t,e){return void 0!==e&&this.setEaseDuration(e),this.direction=t,this}toggleDirection(t){return this.setDirection(this.direction+2,t),this}get easeDirectionProgress(){return this._easeDirectionProgress}set easeDirectionProgress(t){this._easeDirectionProgress!==t&&(this._easeDirectionProgress=t,this.dirty=!0)}setPadding(t,e,i,s){if("object"==typeof t){var r=t,n=jv(r,"x",null);null!==n?(t=n,i=n):(t=jv(r,"left",0),i=jv(r,"right",t));var a=jv(r,"y",null);null!==a?(e=a,s=a):(e=jv(r,"top",0),s=jv(r,"bottom",e))}else void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=t),void 0===s&&(s=e);return void 0===this.padding&&(this.padding={}),this.dirty=this.dirty||this.padding.left!=t||this.padding.top!=e||this.padding.right!=i||this.padding.bottom!=s,this.padding.left=t,this.padding.top=e,this.padding.right=i,this.padding.bottom=s,this.setRadius(),this}get radius(){return this._radius}set radius(t){this.dirty=this.dirty||this._radius!=t,this._radius=t}setRadius(t){return this.radius=t,this.shapeMode=null==t?0:1,this}get verticeRotation(){return this._verticeRotation}set verticeRotation(t){this.dirty=this.dirty||this._verticeRotation!=t,this._verticeRotation=t}setVerticeRotation(t){return this.verticeRotation=t,this}get verticeAngle(){return Hv(this.verticeRotation)}set verticeAngle(t){this.verticeRotation=Fv(t)}setVerticeAngle(t){return this.verticeAngle=t,this}}const Gv={right:0,down:1,left:2,up:3};var Uv=function(t){return"string"==typeof t&&(t=Gv[t]),t%=4};Object.assign(Vv.prototype,Iv,Yv);class Nv extends Dv{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexTweaker.FolderTitle";var i=new Vv(t,e.expandedIcon);t.add.existing(i),this.addSpace().add(i,{proportion:0,expand:!1,padding:1,fitRatio:1}),this.addChildrenMap("expandedIcon",i)}setExpandedState(t){void 0===t&&(t=!0);var e=t?"down":"right";return this.childrenMap.expandedIcon.setDirection(e),this}} /** * @author Richard Davey * @copyright 2019 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */var Nv=function(t,e){var i=yt(t);for(var s in e)i.hasOwnProperty(s)||(i[s]=e[s]);return i},$v=function(t,e,i){return qc(t,Nv(e,i))};class Kv extends Hs{constructor(t,e){void 0===e&&(e={}),e.destroy=!1,super(t,e)}onOpen(){this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.parent,this),super.onClose()}}var Jv={expand(t){if(!0===this.expanded)return this;void 0===t&&(t=this.transitionDuration),this.expanded=!0;var e=this.childrenMap.title,i=this.childrenMap.child;return this.show(i),this.reLayoutEnable&&(this.reLayoutTarget?this.reLayoutTarget:this.getTopmostSizer()).layout(),e.emit("folder.expand",t,this),i.emit("folder.expand",t,this),this.emit("expand.start",this),this.childTransition.once("open",(function(){this.emit("expand.complete",this)}),this).requestOpen(null,t),this},collapse(t){if(!1===this.expanded)return this;void 0===t&&(t=this.transitionDuration),this.expanded=!1;var e=this.childrenMap.title,i=this.childrenMap.child;return e.emit("folder.collapse",t,this),i.emit("folder.collapse",t,this),this.emit("collapse.start",this),this.childTransition.once("close",(function(){this.setChildScale(i,1,1).hide(i),this.reLayoutEnable&&(this.reLayoutTarget?this.reLayoutTarget:this.getTopmostSizer()).layout(),this.emit("collapse.complete",this)}),this).requestClose(null,t),this},toggle(t){return this.expanded?this.collapse(t):this.expand(t),this},setExpandedState(t){return this.reLayoutEnable=!1,void 0===t?this.expanded=void 0:t?this.expand(0):this.collapse(0),this.reLayoutEnable=!0,this}},qv=function(t,e){zi.popUp.call(t,e,this.expandDirection)},Zv=function(t,e){zi.scaleDown.call(t,e,this.expandDirection)},Qv={setTransitionDuration(t){return this.transitionDuration=t,this.childTransition.setTransitInTime(t).setTransitOutTime(t),this},setExpandCallback(t){return void 0===t&&(t=qv.bind(this)),this.childTransition.setTransitInCallback(t),this},setCollapseCallback(t){return void 0===t&&(t=Zv.bind(this)),this.childTransition.setTransitOutCallback(t),this}};const tf=Phaser.Utils.Objects.GetValue;let ef=class extends La{constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("orientation")||(e.orientation=1),super(t,e),this.type="rexFolder",this.reLayoutEnable=!0,this.expanded=void 0,this.expandDirection=1===this.orientation?"y":"x";var i=e.background,s=e.title,r=e.child;i&&this.addBackground(i);var n=tf(e,"space"),a=1===this.orientation?"left":"top",h=tf(e,"align.title",a),o=tf(e,"expand.title",!0);this.add(s,{proportion:0,align:h,expand:o,padding:{left:tf(n,"titleLeft",0),right:tf(n,"titleRight",0),top:tf(n,"titleTop",0),bottom:tf(n,"titleBottom",0)}});var l=tf(e,"toggleByTarget",void 0),d=tf(e,"toggleClickConfig");if(void 0===l&&(l=s),l&&Or.onClick.call(l,(function(){this.toggle()}),this,d),this.childTransition=new Kv(r),!tf(e,"customChildOrigin",!1)){var c=this.rtl?1:0;r.setOrigin(c)}h=tf(e,"align.child","left");var u=(o=tf(e,"expand.child",!0))?1:0;this.add(r,{proportion:u,align:h,expand:o,padding:{left:tf(n,"childLeft",0),right:tf(n,"childRight",0),top:tf(n,"childTop",0),bottom:tf(n,"childBottom",0)}}),this.addChildrenMap("title",s),this.addChildrenMap("child",r),this.addChildrenMap("background",i);var p=e.transition;this.setTransitionDuration(tf(p,"duration",200)),this.setExpandCallback(tf(p,"expandCallback",void 0)),this.setCollapseCallback(tf(p,"collapseCallback",void 0)),this.reLayoutTarget=tf(e,"reLayoutTarget",void 0);var g=e.onExpandStart;g&&this.on("expand.start",g);var v=e.onExpandComplete;v&&this.on("expand.complete",v);var f=e.onCollapseStart;f&&this.on("collapse.start",f);var m=e.onCollapseComplete;m&&this.on("collapse.complete",m);var y=tf(e,"expanded",void 0);void 0!==y&&this.setExpandedState(y)}};Object.assign(ef.prototype,Jv,Qv);var sf={setBindingTarget(t){return this.childrenMap.child.setBindingTarget(t),this}},rf={getMaxInputRowTitleWidth(){return this.childrenMap.child.getMaxInputRowTitleWidth()+this.getInnerPadding("left")},setInputRowTitleWidth(t){return t-=this.getInnerPadding("left"),this.childrenMap.child.setInputRowTitleWidth(t),this}};class nf extends ef{constructor(t,e){void 0===e&&(e={}),e.orientation=1,super(t,e),this.type="rexTweaker.Folder"}setTitle(t){return this.childrenMap.title.setTitle(t),this}}Object.assign(nf.prototype,sf,rf);const af=Phaser.Utils.Objects.GetValue,hf=Phaser.Utils.Objects.GetValue,of=La.prototype.add,lf=La.prototype.addSpace;var df=function(t){var e=!t.isRexSpace,i=!e||this.buttonsExpand?1:0;if(0===this.sizerChildren.length)if(e){!this.buttonsExpand&&("right"===this.buttonsAlign||"center"===this.buttonsAlign||"bottom"===this.buttonsAlign)&&lf.call(this),of.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&lf.call(this),this.hasTailSpace=s}else of.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;of.call(this,t,{index:r,proportion:i,expand:!0})}else of.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},cf={addButton(t){if(pr(t))for(var e=t,i=0,s=e.length;i=0;i--)gf.call(this,e[i],t);return this}},ff=function(t,e,i){if(t){var s=this.setValueCallback,r=this.setValueCallbackScope;s&&(r?s.call(r,t,e,i):s(t,e,i)),this.fireEvent("button.statechange",t,e,i)}},mf=function(t){var e=this;t._selected=void 0,Object.defineProperty(t,"selected",{get:function(){return t._selected},set:function(i){if(t._selected!==i){var s=t._selected;t._selected=i,ff.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},yf={add(t){return this.buttons.push(t),t._click||(t._click=new Sr(t,this.clickConfig),t._click.on("click",(function(t,e,i,s){this.fireEvent("button.click",e,i,s)}),this).on("enable",(function(t,e){this.fireEvent("button.enable",e)}),this).on("disable",(function(t,e){this.fireEvent("button.disable",e)}),this).on("over",(function(t,e,i,s){this.fireEvent("button.over",e,i,s)}),this).on("out",(function(t,e,i,s){this.fireEvent("button.out",e,i,s)}),this).on("down",(function(t,e,i,s){this.fireEvent("button.down",e,i,s)}),this).on("up",(function(t,e,i,s){this.fireEvent("button.up",e,i,s)}),this),t.isRexContainerLite&&t.sendChildToBack(t)),this.buttonsType&&(void 0===t.name&&console.error(`${this.parent.constructor.name}: Option button miss value`),mf.call(this,t)),this},addMultiple(t){for(var e=0,i=t.length;e0},setButtonEnable(t,e){var i=this.buttons;if(void 0===t||"boolean"==typeof t){e=t;for(var s=0,r=i.length;sr&&Ef.addNewLine(this)}else for(n=0,a=t.length;n=0;i--)Bf.call(this,e[i],t);return this}};const zf=Phaser.Utils.Objects.GetValue;class If extends Ka{constructor(t,e){void 0===e&&(e={});var i=e.space;"number"==typeof i&&(e.space={item:i,line:i}),super(t,e),this.type="rexFixWidthButtons",this.buttonGroup=new Of({parent:this,eventEmitter:zf(e,"eventEmitter",this),groupName:zf(e,"groupName",void 0),clickConfig:zf(e,"click",void 0)}).setButtonsType(e);var s=zf(e,"background",void 0),r=zf(e,"buttons",void 0);this.buttonsAlign=zf(e,"align",void 0),s&&this.addBackground(s),r&&this.addButtons(r),this.addChildrenMap("background",s),this.addChildrenMap("buttons",this.buttonGroup.buttons)}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.buttonGroup.destroy(),this.buttonGroup=void 0)}get buttons(){return this.buttonGroup.buttons}get groupName(){return this.buttonGroup.groupName}set groupName(t){this.buttonGroup.groupName=t}get eventEmitter(){return this.buttonGroup.eventEmitter}}Object.assign(If.prototype,Lf,Wf,kf,Tf);var Yf=function(t,e,i,s){if(void 0===i)i=0;else{var r=typeof i;"boolean"===r?(s=i,i=0):"string"===r&&(i=jf[i])}void 0===s?s={}:!0===s&&(s=Xf);var n=e.width/t.width,a=e.height/t.height,h=i?Math.max(n,a):Math.min(n,a);return s.width=t.width*h,s.height=t.height*h,s};const jf={fit:0,FIT:0,envelop:1,ENVELOP:1};var Xf={},Ff={},Hf={};const Vf=Phaser.Utils.Objects.IsPlainObject,Gf=Phaser.Utils.Objects.GetValue,Uf=Phaser.Display.Align.CENTER,Nf=Phaser.Utils.String.UUID;var $f={add:function(t,e,i,s,r,n,a,h,o,l){var d,c;ye.call(this,t),Vf(e)&&(e=Gf(u=e,"key",void 0),i=Gf(u,"align",Uf),s=Gf(u,"padding",0),r=Gf(u,"expand",!0),t.isRexSizer||(n=Gf(u,"minWidth",t._minWidth),a=Gf(u,"minHeight",t._minHeighted)),h=Gf(u,"offsetX",0),o=Gf(u,"offsetY",0),d=Gf(u,"offsetOriginX",0),c=Gf(u,"offsetOriginY",0),l=Gf(u,"aspectRatio",0));var u,p=void 0!==e;return p||(e=Nf()),"string"==typeof i&&(i=zt[i]),void 0===i&&(i=Uf),void 0===s&&(s=0),void 0===r&&(r=!0),t.isRexSizer||(void 0===n&&(n=t._minWidth),void 0===a&&(a=t._minHeight)),void 0===h&&(h=0),void 0===o&&(o=0),void 0===d&&(d=0),void 0===c&&(c=0),void 0===l?l=0:!0===l&&(l=Q(t)/tt(t)),l>0&&(r=!0,void 0===n&&(n=0),void 0===a&&(a=0)),(u=this.getSizerConfig(t)).align=i,u.padding=fe(s),Vf(r)?(u.expandWidth=Gf(r,"width",!1),u.expandHeight=Gf(r,"height",!1)):(u.expandWidth=r,u.expandHeight=r),t.isRexSizer||(u.expandWidth&&(t.minWidth=void 0===n?Q(t):n),u.expandHeight&&(t.minHeight=void 0===a?tt(t):a)),u.alignOffsetX=h,u.alignOffsetY=o,u.alignOffsetOriginX=d,u.alignOffsetOriginY=c,u.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,p&&this.addChildrenMap(e,t),this}},Kf={remove(t,e){var i;if("string"==typeof t){if(i=t,!(t=this.sizerChildren[i]))return this}else{if(this.getParentSizer(t)!==this)return this;i=this.childToKey(t)}return i&&(delete this.sizerChildren[i],this.childrenMap.hasOwnProperty(i)&&delete this.childrenMap[i]),Oe.call(this,t,e),this},removeAll(t){for(var e in this.sizerChildren)this.remove(e,t);return this},clear(t){for(var e in this.sizerChildren)delete this.sizerChildren[e],this.childrenMap.hasOwnProperty(e)&&delete this.childrenMap[e];return ba.call(this,t),this}},Jf={getChildrenWidth:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var a in r)t=r[a],void 0===(i=this.getChildWidth(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).left+e.right)*this.scaleX,s=Math.max(i,s));return n?void 0:s+(this.space.left+this.space.right)*this.scaleX},getChildrenHeight:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var a in r)t=r[a],void 0===(i=this.getChildHeight(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).top+e.bottom)*this.scaleY,s=Math.max(i,s));return n?void 0:s+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(s.expandWidth){var r=e-(this.space.left+this.space.right)*this.scaleX,n=s.padding;i=r-(n.left+n.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(s.expandHeight){var r=e-(this.space.top+this.space.bottom)*this.scaleY,n=s.padding;i=r-(n.top+n.bottom)*this.scaleY}return i},getChildrenSizers:function(t){void 0===t&&(t=[]);var e,i=this.sizerChildren;for(var s in i)(e=i[s]).isRexSizer&&t.push(e);return t},layoutChildren:function(){var t,e,i,s,r,n,a,h,o,l,d,c,u=this.innerLeft,p=this.innerTop,g=this.innerWidth,v=this.innerHeight,f=this.sizerChildren;for(var m in f)(t=f[m]).rexSizer.hidden||(i=(e=t.rexSizer).padding,yr.call(this,t),l=this.getExpandedChildWidth(t),d=this.getExpandedChildHeight(t),e.aspectRatio>0&&(Ff.width=e.aspectRatio,Ff.height=1,Hf.width=l,Hf.height=d,l=(c=Yf(Ff,Hf,"FIT",!0)).width,d=c.height),t.isRexSizer?(t.runLayout(this,l,d),aa(t,this)):Ge(t,l,d),s=u+i.left*this.scaleX,n=g-(i.left+i.right)*this.scaleX,r=p+i.top*this.scaleY,a=v-(i.top+i.bottom)*this.scaleY,void 0===l&&(l=Q(t)),void 0===d&&(d=tt(t)),h=(e.alignOffsetX+e.alignOffsetOriginX*l)*this.scaleX,o=(e.alignOffsetY+e.alignOffsetOriginY*d)*this.scaleY,br.call(this,t,s,r,n,a,e.align,h,o))}};Object.assign(Jf,$f,Kf);const qf=Phaser.Utils.Objects.IsPlainObject,Zf=Phaser.Utils.Objects.GetValue;class Qf extends na{constructor(t,e,i,s,r,n){qf(e)?(e=Zf(n=e,"x",0),i=Zf(n,"y",0),s=Zf(n,"width",void 0),r=Zf(n,"height",void 0)):qf(s)&&(s=Zf(n=s,"width",void 0),r=Zf(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexOverlapSizer",this.sizerChildren={},this.addChildrenMap("items",this.sizerChildren)}childToKey(t){if("string"!=typeof t)return function(t,e){if(Array.isArray(t))return t.indexOf(e);for(var i in t)if(t[i]===e)return i;return null}(this.sizerChildren,t);var e=t;return this.sizerChildren.hasOwnPropery(e)?e:null}}Object.assign(Qf.prototype,Jf);const tm=Qf.prototype.add;var em=function(t,e,i,s,r,n,a,h,o){return t.setVisible(!1),tm.call(this,t,e,i,s,r,n,a,h,o),this},im={add:em,addPage:em};const sm=Et.prototype.setChildVisible;var rm={getPage:function(t){return void 0===t?null:this.sizerChildren.hasOwnProperty(t)?this.sizerChildren[t]:null},swapPage:function(t,e){this._previousKey=this._currentKey;var i=this.previousPage;i&&(0===this.swapMode?(sm.call(this,i,!1),this.emit("pageinvisible",i,this._previousKey,this)):i.destroy()),t&&!this.sizerChildren.hasOwnProperty(t)&&this.emit("createpage",t,this),this._currentKey=t;var s=this.currentPage;return s&&(sm.call(this,s,!0),this.emit("pagevisible",s,this._currentKey,this),void 0===e&&(e=this.fadeInDuration),e>0&&s.setAlpha(0).fadeIn(e,1)),this},hasPage:function(t){return this.sizerChildren.hasOwnProperty(t)}};Object.assign(rm,im);const nm=Phaser.Utils.Objects.GetValue;class am extends Qf{constructor(t,e){super(t,e),this.type="rexPages",this.childrenMap=this.sizerChildren,this._previousKey=void 0,this._currentKey=void 0,this.setSwapMode(nm(e,"swapMode",0)),this.setFadeInDuration(nm(e,"fadeIn",0))}setSwapMode(t){return"string"==typeof t&&(t=hm[t]),this.swapMode=t,this}setFadeInDuration(t){return this.fadeInDuration=t,this}get previousKey(){return this._previousKey}get currentKey(){return this._currentKey}set currentKey(t){this.swapPage(t)}get currentPage(){return this.getPage(this.currentKey)}get previousPage(){return this.getPage(this.previousKey)}get keys(){return Object.keys(this.sizerChildren)}}Object.assign(am.prototype,rm);const hm={invisible:0,destroy:1},om=Phaser.Utils.Objects.IsPlainObject,lm=Phaser.Utils.Objects.GetValue,dm=Phaser.Utils.String.UUID;var cm={swapPage:function(t,e){var i,s;return null!=(i="number"==typeof t?t:this.getPageIndex(t))&&(void 0!==e&&(s=this.childrenMap.pages.fadeInDuration,this.childrenMap.pages.fadeInDuration=e),this.childrenMap.tabs.emitButtonClick(i),void 0!==s&&(this.childrenMap.pages.fadeInDuration=s)),this},swapFirstPage:function(t){return this.swapPage(0,t),this},swapLastPage:function(t){var e=this.getElement("tabs.buttons").length-1;return this.swapPage(e,t),this}},um={removePage(t,e){"number"==typeof t&&(t=this.getPageKey(t));var i=this.childrenMap.tabs,s=i.getByName(t),r=this.childrenMap.pages,n=r.getElement(t);return s&&n?(r.removeChildrenMap(t),i.removeButton(s,e),r.remove(n,e),this):this},removeAllPages(t){for(var e=this.getElement("tabs.buttons"),i=e.length-1;i>=0;i--)this.removePage(e[i].name,t);return this}},pm={top:1,left:3,right:5,bottom:7},gm={top:"bottom",left:"right",right:"left",bottom:"top"},vm={setTabsPadding(t,e){return this.childrenMap.tabs.setOuterPadding(t,e),this},getTabsPadding(t){return this.childrenMap.tabs.getOuterPadding(t)}},fm={getPageKey:function(t){var e=this.getElement("tabs.buttons");if(!(t>=e.length))return e[t].name},getPageIndex:function(t){for(var e=this.getElement("tabs.buttons"),i=0,s=e.length;i0,setInputRowTitleWidth(t){return this}};const Am=Phaser.Utils.Objects.GetValue;class Bm extends La{constructor(t,e){void 0===e&&(e={}),e.orientation="y",super(t,e),this.type="rexTweaker.Wrap";var i=Am(e,"background",void 0),s=Am(e,"title",void 0);i&&this.addBackground(i),s&&this.add(s,{expand:!0,space:{bottom:Am(e,"space.title",0)}});var r=Am(e,"child",void 0);this.add(r,{expand:!0}),this.addChildrenMap("title",s),this.addChildrenMap("child",r)}setTitle(t){var e=this.childrenMap.title;return t.title||t.icon?e.show().setTitle(t):e.hide(),this}}Object.assign(Bm.prototype,Lm,Dm);const Wm=Phaser.Utils.Objects.GetValue,zm=Phaser.Utils.Objects.GetValue;var Im=function(t){return t.hasOwnProperty("geometryMask")?t.geometryMask:t.bitmapMask};const Ym=Phaser.Geom.Intersects.RectangleToRectangle,jm=Phaser.Geom.Rectangle.Overlaps;var Xm=function(t){if(!t.displayList)return!1;for(;;){var e=t.rexContainer;if(e){if(e.visible){var i=e.parent;if(i){t=i;continue}return!0}return!1}return t.visible}},Fm=function(t,e){var i=e.top,s=e.bottom,r=e.left,n=e.right,a=0;return a+=t.contains(r,i)?1:0,a+=t.contains(r,s)?1:0,a+=t.contains(n,i)?1:0,a+=t.contains(n,s)?1:0},Hm=function(t,e,i){e.hasOwnProperty("isRexContainerLite")?(e.syncChildrenEnable=!1,t.setChildMaskVisible(e,!0),e.syncChildrenEnable=!0):(e.clearMask&&e.clearMask(),t.setChildMaskVisible(e,!0))},Vm=function(t,e,i){e.hasOwnProperty("isRexContainerLite")?(e.syncChildrenEnable=!1,t.setChildMaskVisible(e,!0),e.syncChildrenEnable=!0):(e.setMask&&e.setMask(i),t.setChildMaskVisible(e,!0))},Gm=function(t,e,i){e.hasOwnProperty("isRexContainerLite")?(e.syncChildrenEnable=!1,t.setChildMaskVisible(e,!1),e.syncChildrenEnable=!0):(e.clearMask&&e.clearMask(),t.setChildMaskVisible(e,!1))};const Um=Phaser.Utils.Objects.GetValue,Nm={update:0,everyTick:1};var $m={setupChildrenMask(t){return!1===t||(this.setMaskUpdateMode(Um(t,"updateMode",0)),this.enableChildrenMask(Um(t,"padding",0)),this.setMaskLayer(Um(t,"layer",void 0)),this.onMaskGameObjectVisible=Um(t,"onVisible"),this.onMaskGameObjectInvisible=Um(t,"onInvisible"),this.maskGameObjectCallbackScope=Um(t,"scope"),this.startMaskUpdate()),this},destroyChildrenMask(){return this.childrenMask?(this.stopMaskUpdate(),this.childrenMask.destroy(),this.childrenMask=void 0,this.onMaskGameObjectVisible=null,this.onMaskGameObjectInvisible=null,this.maskGameObjectCallbackScope=null,this):this},setMaskUpdateMode(t){return"string"==typeof t&&(t=Nm[t]),this.maskUpdateMode=t,this},startMaskUpdate(){this.scene.game.events.on("poststep",this.maskChildren,this)},stopMaskUpdate(){this.scene.game.events.off("poststep",this.maskChildren,this)},enableChildrenMask(t){var e=uh.call(this,null,this,0,t);return this.childrenMask=e.createGeometryMask(),this},setMaskChildrenFlag(t){return void 0===t&&(t=!0),this.maskChildrenFlag=t,this},setMaskLayer(t){return this.maskLayer=t,this},maskChildren(){return this.childrenMask&&this.maskChildrenFlag&&0!==this.alpha&&this.visible?(this.privateRenderLayer?this.privateRenderLayer.setMask(this.childrenMask):this.maskLayer?(this.addToLayer(this.maskLayer),this.maskLayer.setMask(this.childrenMask)):function({parent:t,mask:e,children:i,onVisible:s,onInvisible:r,scope:n}){if(e){void 0===i&&(i=t.getAllChildren());for(var a,h,o,l=!!s||!!r,d=t.getBounds(),c=Im(e),u=0,p=i.length;uthis.topChildOY}childOYExeceedBottom(t){return void 0===t&&(t=this.childOY),tthis.leftChildOX}childOXExeceedRight(t){return void 0===t&&(t=this.childOX),tthis.childHeight?t=0:s?t=e:r&&(t=i)),this._childOY!==t&&(this._childOY=t,this.resetChildPosition()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}get childOX(){return this._childOX}set childOX(t){var e=this.leftChildOX,i=this.rightChildOX,s=this.childOXExceedLeft(t),r=this.childOXExeceedRight(t);this.clampChildOX&&(this.childVisibleWidth>this.childWidth?t=0:s?t=e:r&&(t=i)),this._childOX!==t&&(this._childOX=t,this.resetChildPosition()),s&&(this.execeedLeftState||this.emit("execeedleft",this,t,e)),this.execeedLeftState=s,r&&(this.execeedRightState||this.emit("execeedright",this,t,i)),this.execeedRightState=r}setChildOY(t){return this.childOY=t,this}setChildOX(t){return this.childOX=t,this}set t(t){this.childOY=-this.visibleHeight*t}get t(){var t=this.visibleHeight;return 0===t?0:this.childOY/-t}set s(t){this.childOX=-this.visibleWidth*t}get s(){var t=this.visibleWidth;return 0===t?0:this.childOX/-t}setChildOYByPercentage(t){return this.t=t,this}setChildOXByPercentage(t){return this.s=t,this}}Object.assign(Qm.prototype,Km);const ty=["top","bottom","centerY","center"],ey=["left","right","centerX","center"];var iy=function(t,e,i){var s,r="Y"===(e=e.toUpperCase()),n=this.childrenMap.child;if(r){if(i)for(var a=0,h=ty.length;a=0?0:Math.abs(l)<=Math.abs(d)?l:d}}else{if(i)for(a=0,h=ey.length;a=0?0:Math.abs(c)<=Math.abs(u)?c:u}}switch(this.scrollMode){case 0:case 1:this.childOY+=s;break;default:this[`childO${e}`]+=s}};const sy=Phaser.Utils.Objects.GetValue;class ry extends lv{constructor(t,e){void 0===e&&(e={});var i=Xp(e),s=sy(e,"panel",void 0);void 0===s&&(s={}),s.scrollMode=i,s.clampChildOY=sy(e,"clampChildOY",!1),s.clampChildOX=sy(e,"clampChildOX",!1);var r,n,a=new Qm(t,s);switch(t.add.existing(a),i){case 0:r=sy(e,"expand.panel",!0),n=!0;break;case 1:r=!0,n=sy(e,"expand.panel",!0);break;default:r=!0,n=!0}e.type="rexScrollablePanel",e.child={gameObject:a,expandWidth:r,expandHeight:n,align:sy(e,"align.panel","center")};var h=sy(e,"space",void 0);h&&(h.child=sy(h,"panel",0)),super(t,e),this.addChildrenMap("panel",a.child),this.addChildrenMap("panelLayer",a.maskLayer),this.addChildrenMap("mask",a.maskGameObject),this.addChildrenMap("scrollableBlock",a)}setChildrenInteractive(t){return void 0===t&&(t={}),t.hasOwnProperty("eventEmitter")||(t.eventEmitter=this),t.hasOwnProperty("targets")||(t.targets=[this.childrenMap.panel]),ia(this.childrenMap.child,t),this}}var ny={scrollToChild:function(t,e){if(!this.hasChild(t))return this;switch(this.scrollMode){case 0:iy.call(this,t,"y",e);break;case 1:iy.call(this,t,"x",e);break;default:iy.call(this,t,"y",e),iy.call(this,t,"x",e)}return this}};Object.assign(ry.prototype,ny);var ay={setBindingTarget(t){return this.childrenMap.panel.setBindingTarget(t),this}},hy={getMaxInputRowTitleWidth(){return this.childrenMap.panel.getMaxInputRowTitleWidth()+this.getInnerPadding("left")},setInputRowTitleWidth(t){return t-=this.getInnerPadding("left"),this.childrenMap.panel.setInputRowTitleWidth(t),this}};class oy extends ry{constructor(t,e){super(t,e),this.type="rexTweaker.Scrollable"}setTitle(t){var e=this.childrenMap.header;return t.title||t.icon?e.show().setTitle(t):e.hide(),this}}Object.assign(oy.prototype,ay,hy);const ly=Phaser.Utils.Objects.GetValue,dy=Phaser.Utils.Objects.GetValue,cy=Phaser.Utils.Objects.GetValue;var uy={setupBinding(){return this.childrenMap.inputField.on("valuechange",(function(t){this.autoUpdateEnable&&this.setTargetValue(t)}),this),this},setAutoUpdateEnable(t){return void 0===t&&(t=!0),this.autoUpdateEnable=t,this},setBindingTarget(t,e){this.bindingTarget=t,void 0!==e&&this.setBindingTargetKey(e),this.syncTargetValue();var i=this.childrenMap.inputField;return i.onBindTarget&&i.onBindTarget(t,e),this},setBindingTargetKey(t){return this.bindTargetKey=t,this},setValueCallbacks(t){return this.onGetValue=cy(t,"onGetValue"),this.onSetValue=cy(t,"onSetValue"),this},getTargetValue(){if(this.bindingTarget)return null!=this.bindTargetKey?this.bindingTarget[this.bindTargetKey]:this.onGetValue?this.onGetValue(this.bindingTarget):void 0},setTargetValue(t){return this.bindingTarget?null!=this.bindTargetKey?(this.bindingTarget[this.bindTargetKey]=t,this):(this.onSetValue&&this.onSetValue(this.bindingTarget,t),this):this},syncTargetValue(){if(!this.bindingTarget)return this;var t=this.childrenMap.inputField;return t.syncValue&&t.syncValue(this.getTargetValue()),this}},py={startMonitorTarget(){return this.isMonitoring||(this.isMonitoring=!0,this.scene.events.on("postupdate",this.onMonitorTarget,this)),this},stopMonitorTarget(){return this.isMonitoring?(this.isMonitoring=!1,this.scene.events.off("postupdate",this.onMonitorTarget,this),this):this},onMonitorTarget(){if(this.bindingTarget){var t=this.getTargetValue(),e=this.childrenMap.inputField;e.value!==t&&e.syncValue(t)}}},gy={getMinTitleWidth(){var t=this.childrenMap.title;if(!t||0!==t.orientation)return 0;var e=t.rexSizer.padding;return this.getChildWidth(this.childrenMap.title)+(e.left+e.right)*t.scaleX+this.getInnerPadding("left")},setMinTitleWidth(t){var e=this.childrenMap.title;if(!e||0!==e.orientation)return this;var i=e.rexSizer.padding;return t-=(i.left+i.right)*e.scaleX,e.minWidth=t,this}};const vy=Phaser.Utils.Objects.GetValue;class fy extends La{constructor(t,e){super(t,e),this.type="rexTweaker.InputRow",this.bindingTarget=void 0,this.bindTargetKey=void 0,this.autoUpdateEnable=!0;var i,s=e.inputTitle,r=e.inputField,n=e.background,a=vy(e,"proportion.title",0),h=vy(e,"space.title",0);i=0===this.orientation?{right:h}:{bottom:h},this.add(s,{proportion:a,expand:!0,padding:i});var o=r.defaultProportion;void 0===o&&(o=e.defaultExpandWidth?1:0),a=vy(e,"proportion.inputField",o),this.add(r,{proportion:a,expand:!0}),n&&this.addBackground(n),this.addChildrenMap("title",s),this.addChildrenMap("inputField",r),this.addChildrenMap("background",n),this.setupBinding()}destroy(t){this.scene&&!this.ignoreDestroy&&(this.stopMonitorTarget(),super.destroy(t))}setTitle(t){return this.childrenMap.title.setTitle(t),this}preLayout(){var t=this.childrenMap.title;t&&(t.minWidth=0),super.preLayout()}}Object.assign(fy.prototype,uy,py,gy);var my=function(t,e,i){var s=new Lv(t,i);return t.add.existing(s),s},yy=function(t){return void 0===t&&(t=La),class extends t{get bindingTarget(){return this.getParentSizer().bindingTarget}get bindingKey(){return this.getParentSizer().bindTargetKey}get value(){return this._value}get root(){return this.getParentSizer().getParentSizer().root}onBindTarget(t,e){this.onBindTargetCallback&&this.onBindTargetCallback(this,t,e)}validate(t){return!(!this.syncValueFlag&&this.validateCallback)||this.validateCallback(t,this._value,this.bindingTarget,this.bindingKey)}getFotmatText(t){return t=this.textFormatCallback?this.textFormatCallback(t):t.toString()}set value(t){if(this._value!==t&&(this.validate(t)||(t=this._value),this.filterValueCallback&&(t=this.filterValueCallback(this,t)),this.displayValueCallback&&this.displayValueCallback(this,t),this._value!==t)){var e=this._value;if(this._value=t,!this.syncValueFlag){var i=this.bindingTarget,s=this.bindingKey;this.emit("valuechange",t,e,i,s),this.root.emit("valuechange",t,e,i,s)}}}getValue(){return this.value}setValue(t){return this.value=t,this}syncValue(t){return this.syncValueFlag=!0,this.value=t,this.syncValueFlag=!1,this}setup(t,e){return void 0===e&&(e=!1),(e||t.hasOwnProperty("format"))&&this.setTextFormatCallback(t.format),(e||t.hasOwnProperty("onValidate"))&&this.setValidateCallback(t.onValidate),this.setupCallback&&this.setupCallback(this,t,e),this}setSetupCallback(t){return this.setupCallback=t,this}setFilterValueCallback(t){return this.filterValueCallback=t,this}setDisplayValueCallback(t){return this.displayValueCallback=t,this}setOnBindTargetCallback(t){return this.onBindTargetCallback=t,this}setTextFormatCallback(t){return this.textFormatCallback=t,this}setValidateCallback(t){return this.validateCallback=t,this}}},by=function(t,e,i){for(var s,r=this.inputHandlers,n=0,a=r.length;n0?0:1,0===n.minWidth&&n.setMinWidth(this.itemWidth)),0===n.minHeight&&n.setMinHeight(this.itemHeight),this.add(n,{proportion:r,expand:!0})),i.onValueChange&&n.childrenMap.inputField.on("valuechange",i.onValueChange),n.setAutoUpdateEnable(i.autoUpdate),n.setBindingTarget(t,e),i.monitor&&n.startMonitorTarget(),i.key&&this.root.addChildrenMap(i.key,n),this):(console.error(`[Tweaker] Can't add Input\n title: ${i.title}\n view: ${i.view}\n`),this)},addButtons:function(t){void 0===t&&(t={});var e=this.scene,i=t.bindingTarget;delete t.bindingTarget;var s=Oy(this.styles,"inputRow")||{},r=ky(e,t,s);return this.add(r,{expand:!0}),i&&r.setBindingTarget(i),t.key&&this.root.addChildrenMap(t.key,r),this},addButton:function(t){return void 0===t&&(t={}),t.buttons=[{label:t.label,callback:t.callback}],delete t.label,delete t.callback,this.addButtons(t),this},addSeparator:function(t){void 0===t&&(t={});var e=function(t,e,i){return qc(t,Nv(e,i))}(this.scene,t,Py(this.styles,"separator"));return this.add(e,{expand:!0}),this},addRows:function(t,e,i){return"boolean"==typeof e&&(i=e,e=void 0),void 0===i&&(i=!0),Ty(this,$o(t),e,i),this},setBindingTarget:function(t){for(var e=this.sizerChildren,i=0,s=e.length;i=r&&o=i&&oi.length&&(t.prevCursorPosition=null),null!==t.prevCursorPosition&&(s=e.getCharChild(t.prevCursorPosition))&&("\n"===s.text&&s.clearTextSize(),e.emit("cursorout",s,t.prevCursorPosition,e)),null!=r&&(s=e.getCharChild(r))&&("\n"===s.text&&s.copyTextSize(e.lastInsertCursor),function(t){var e,i,s=t.parent,r=s.width,n=s.height,a=t.drawX,h=t.drawY,o=a+t.drawTLX,l=a+t.drawTRX,d=h+t.drawTLY,c=h+t.drawBLY;e=o<0?0-o:l>r?r-l:0,i=d<0?0-d:c>n?n-c:0,s._textOX+=e,s._textOY+=i}(s),e.emit("cursorin",s,r,e)),e.emit("movecursor",r,t.prevCursorPosition,e),t.prevCursorPosition=r)}(this)):(Jy(this),qy(this)),this}setNumberInput(){return this.onUpdateCallback=Ky,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}}const tb=Phaser.Utils.Objects.GetValue,eb=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var ib=function(t,e){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return!0;if(-1!==e.indexOf(".")){for(var i=e.split("."),s=t,r=0;rt.length?i:t})),a.value=t.join(e)}else a.value=t.join(i.slice(h,h+a.count));h+=a.count,a.added||(o+=a.count)}}let l=e[a-1];return a>1&&"string"==typeof l.value&&(l.added||l.removed)&&t.equals("",l.value)&&(e[a-2].value+=l.value,e.pop()),e}db.prototype={diff(t,e,i={}){let s=i.callback;"function"==typeof i&&(s=i,i={}),this.options=i;let r=this;function n(t){return s?(setTimeout((function(){s(void 0,t)}),0),!0):t}t=this.castInput(t),e=this.castInput(e),t=this.removeEmpty(this.tokenize(t));let a=(e=this.removeEmpty(this.tokenize(e))).length,h=t.length,o=1,l=a+h;i.maxEditLength&&(l=Math.min(l,i.maxEditLength));let d=[{newPos:-1,components:[]}],c=this.extractCommon(d[0],e,t,0);if(d[0].newPos+1>=a&&c+1>=h)return n([{value:this.join(e),count:e.length}]);function u(){for(let s=-1*o;s<=o;s+=2){let o,l=d[s-1],c=d[s+1],u=(c?c.newPos:0)-s;l&&(d[s-1]=void 0);let p=l&&l.newPos+1=a&&u+1>=h)return n(cb(r,o.components,e,t,r.useLongestToken));d[s]=o}else d[s]=void 0}var i;o++}if(s)!function t(){setTimeout((function(){if(o>l)return s();u()||t()}),0)}();else for(;o<=l;){let t=u();if(t)return t}},pushComponent(t,e,i){let s=t[t.length-1];s&&s.added===e&&s.removed===i?t[t.length-1]={count:s.count+1,added:e,removed:i}:t.push({count:1,added:e,removed:i})},extractCommon(t,e,i,s){let r=e.length,n=i.length,a=t.newPos,h=a-s,o=0;for(;a+1t,tokenize:t=>t.split(""),join:t=>t.join("")};const ub=new db,pb=/^[a-zA-Z\u{C0}-\u{FF}\u{D8}-\u{F6}\u{F8}-\u{2C6}\u{2C8}-\u{2D7}\u{2DE}-\u{2FF}\u{1E00}-\u{1EFF}]+$/u,gb=/\S/,vb=new db;vb.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!gb.test(t)&&!gb.test(e)},vb.tokenize=function(t){let e=t.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/);for(let t=0;tvoid 0===i?e:i}=this.options;return"string"==typeof t?t:JSON.stringify(bb(t,null,null,i),i," ")},yb.equals=function(t,e){return db.prototype.equals.call(yb,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const xb=new db;xb.tokenize=function(t){return t.slice()},xb.join=xb.removeEmpty=function(t){return t};const Cb=Phaser.Utils.Array.Remove;var wb=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),Cb(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(o=i,l=e,ub.diff(o,l,d)),r=0,n=0,a=s.length;nr)i+=a;else{if(s!==r)break;i+=Math.min(e.position,a)}}return i},Tb={cursorMoveLeft(){if(!this.isOpened)return this;var t=kb(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=kb(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=Ob(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=kb(Pb(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=Ob(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=kb(Pb(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const _b=Phaser.Utils.Objects.IsPlainObject;class Mb extends Wl{constructor(t,e,i,s,r,n){_b(e)?n=e:_b(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(ib(e,"wrap.vAlign")||gc(e,"wrap.vAlign",s=i?"center":"top"),ib(e,"wrap.wrapMode")||gc(e,"wrap.wrapMode","char"),ib(e,"wrap.maxLines")||gc(e,"wrap.maxLines",s=i?1:void 0),i&&gc(e,"wrap.wrapWidth",1/0),ib(e,"wrap.useDefaultTextHeight")||gc(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!ib(e.edit,"inputType")){var s=i?"text":"textarea";gc(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new rb(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var a=n.text;a&&delete n.text;var h=ud(n.background,"focus"),o=ud(n.style,"cursor"),l=ud(n.style,"range");super(t,e,i,s,r,n),this.type="rexCanvasInput",this.contentWidth=void 0,this.contentHeight=void 0,this.lineHeight=void 0,this.linesCount=void 0,this.characterCountOfLines=[],this._text,this.textEdit=function(t,e){var i=tb(e,"edit");return void 0===i&&(i={}),Dy(e,i,eb),new Qy(t,i)}(this,n),nb.call(this),n.focusStyle&&Object.assign(h,n.focusStyle),lb.call(this,h),n.cursorStyle&&Object.assign(o,n.cursorStyle),hb.call(this,o),n.rangeStyle&&Object.assign(l,n.rangeStyle),ab(l)&&Object.assign(l,o),ob.call(this,l);var d=n.onAddChar;d&&this.on("addchar",d);var c=n.onCursorIn;c&&this.on("cursorin",c);var u=n.onCursorOut;u&&this.on("cursorout",u);var p=!n.onRangeIn&&!n.onRangeOut,g=p?n.onCursorIn:n.onRangeIn;g&&this.on("rangein",g);var v=p?n.onCursorOut:n.onRangeOut;v&&this.on("rangeout",v);var f,m=n.onMoveCursor;m&&this.on("movecursor",m),this.setParseTextCallback(n.parseTextCallback),this.lastInsertCursor=((f=this.createCharChild("|")).text="",f),a||(a=""),this.setText(a)}addChild(t,e){if(super.addChild(t,e),Array.isArray(t))for(var i=t,s=0,r=i.length;st.hasOwnProperty("view")?"string"===t.view:"string"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.TextInput";var s=e.inputText,r=Rb(i,s);t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))}},Db={setText(t){return this.childrenMap.child.setText(t),this},appendText(t){return this.setText(this.text+t),this}},Ab={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const Bb=Phaser.Utils.Objects.GetValue;class Wb extends lv{constructor(t,e){void 0===e&&(e={});var i,s=Bb(e,"text");xt(s)?i=s:(void 0===s&&(s={}),s.textArea=!0,i=new Mb(t,s),t.add.existing(i)),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textVisibleHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.contentHeight}})}(i);var r=void 0===s.width,n=void 0===s.height;r&&(i.minWidth=0),n&&(i.minHeight=0),e.scrollMode=0,e.type="rexTextAreaInput",e.child={gameObject:i,expandWidth:r,expandHeight:n};var a,h,o=Bb(e,"space",void 0);o&&(o.child=Bb(o,"text",0)),e.scroller=!1,super(t,e),this.addChildrenMap("text",i),i.on("cursorin",(function(){var t=i.textOY,e=i.contentHeight,s=a!==t,r=h!==e;a=t,h=e,r&&this.resizeController(),(s||r)&&(this.t=i.t)}),this),i.on("textchange",(function(t){this.emit("textchange",t,this)}),this).on("close",(function(){this.emit("close",this.text,this)}),this);var l=Bb(e,"content",void 0);l&&this.setText(l)}get text(){return this.childrenMap.child.text}set text(t){t=null==t?"":t.toString(),this.childrenMap.child.text!==t&&this.setText(t)}get lineHeight(){return this.childrenMap.child.lineHeight}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.contentHeight}get readOnly(){return this.childrenMap.child.readOnly}set readOnly(t){this.childrenMap.child.readOnly=t}setReadOnly(t){return this.childrenMap.child.setReadOnly(t),this}get value(){return this.text}set value(t){this.text=t}}Object.assign(Wb.prototype,Db,Ab);var zb={name:"TextAreaInput",accept:t=>!!t.hasOwnProperty("view")&&"textarea"===t.view,build(t,e){var i=t.scene;this.type="rexTweaker.TextAreaInput";var s=e.inputTextArea;void 0===s&&(s={}),s.hasOwnProperty("text")||(s.text=e.inputText),s.hasOwnProperty("slider")||(s.slider=e.slider);var r=function(t,e,i){void 0===i&&(i=!0),i?e=e?$o(e):{}:e||(e={});var s=new Wb(t,e);return t.add.existing(s),s}(i,s);t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))},onBindTarget(t){t.childrenMap.inputText.scrollToTop()}},Ib={name:"NumberInput",accept:t=>t.hasOwnProperty("view")?"number"===t.view:"number"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.NumberInput";var s=e.inputNumber||e.inputText,r=Rb(i,s).setNumberInput();t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly),t.isFloatType=!e.int},filterValue:(t,e)=>t.isFloatType?e:Math.floor(e),displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))}};const Yb=Phaser.Utils.Objects.GetValue,jb=Phaser.Math.Linear,Xb=Phaser.Math.Snap.Floor;var Fb={name:"RangeInput",accept:t=>t.hasOwnProperty("view")?"range"===t.view:"number"==typeof t.value&&t.hasOwnProperty("min")&&t.hasOwnProperty("max"),build(t,e){var i=t.scene;t.type="rexTweaker.RangeInput";var s=e.slider,r=0===t.orientation?"track.height":"track.width",n=Yb(s,r),a=function(t,e){var i=new Dg(t,e);return t.add.existing(i),i}(i,s),h=e.defaultExpandWidth?2:0,o=Yb(e,"proportion.range.slider",h),l=void 0===n;t.add(a,{proportion:o,expand:l,key:"slider"});var d=e.inputNumber||e.inputText,c=Rb(i,d).setNumberInput();h=e.defaultExpandWidth?1:0,o=Yb(e,"proportion.range.inputText",h),t.add(c,{proportion:o,expand:!0,key:"inputText"}),c.on("close",(function(){t.setValue(c.value)})),a.on("valuechange",(function(){var e=jb(t.minValue,t.maxValue,a.value);t.step&&(e=Xb(e,t.step,t.minValue)),t.setValue(e)}))},setup(t,e,i){(i||e.hasOwnProperty("max"))&&function(t,e,i,s){t.minValue=e,t.maxValue=i,t.step=s,t.childrenMap.slider.setGap(s,e,i)}(t,e.min,e.max,e.step),(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.slider.setValue(e,t.minValue,t.maxValue),t.childrenMap.inputText.setText("").setText(t.getFotmatText(e))}},Hb=function(t,e){var i=new Mf(t,e);return t.add.existing(i),i};const Vb=Phaser.Utils.Objects.GetValue;var Gb={name:"RangeInput",accept:t=>!!t.hasOwnProperty("view")&&"incdec"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.IncDecInput";var s=Vb(e,"incDec")||{},r={text:null,action:null},n=Hb(i,{expand:!1}),a=e.defaultExpandWidth?1:0;t.add(n,{proportion:a,expand:!0});var h=e.inputNumber||e.inputText,o=Rb(i,h).setNumberInput();o.on("close",(function(){t.setValue(o.value)}));var l=Object.assign($o(r),s.incButton||{}),d=Sm(i,l),c=Object.assign($o(r),s.decButton||{}),u=Sm(i,c);n.addButton(d),n.addButton(u);var p=s.inputTextIndex||0;n.insert(p,o,{proportion:1,expand:!0}),t.step=1,t.minValue=void 0,t.maxValue=void 0,n.on("button.click",(function(e,i,s,r){var n=t.value;0===i?n+=t.step:n-=t.step,void 0!==t.maxValue&&n>t.maxValue&&(n=t.maxValue),void 0!==t.minValue&&n0&&{height:this.colorComponentsHeight,formatLabel:this.colorComponentsFormatLabelConfig,inputText:this.colorComponentsInputTextConfig,space:this.colorComponentsSpace};var a=new Ix(t,{width:s,height:n,background:e,space:this.colorPickerSpace,hPalette:{position:this.colorPickerHPalettePosition},colorComponents:r,value:this.value});return t.add.existing(a),a};const jx=Phaser.Utils.Objects.GetValue;var Xx=function(t,e){var i=jx(e,"expandDirection",void 0);"string"==typeof i&&(i=Fx[i]);var s,r,n,a,h,o,l,d=(n="alignTargetX",ib(s=e,r="alignTarget")?Es(s,r):n&&ib(s,n)?Es(s,n):a&&ib(s,a)?Es(s,a):h),c=jx(e,"alignTargetY",d),u=jx(e,"alignOffsetX",0),p=jx(e,"alignOffsetY",0),g=jx(e,"alignSide","").includes("right"),v=jx(e,"bounds"),f=0===i,m=!(f||1===i),y=g?1:0,b=f||m?0:1;t.setOrigin(y,b),o=g?d.getTopRight().x:d.getTopLeft().x,l=c.getBottomLeft().y,t.setPosition(o+u,l+p);var x=v;x||(x=At(t.scene)),m&&t.getBottomLeft().y>x.bottom&&(l=c.getTopLeft().y,t.setOrigin(0,1).setPosition(o+u,l+p))};const Fx={down:0,up:1},Hx=Phaser.Utils.Objects.GetValue;class Vx extends Hs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=function(t,e){Ri(t,e,"y","Cubic")}),null==e.transitOut&&(e.transitOut=function(t,e){!function(t,e,i,s,r){void 0===s&&(s="Linear");var n={mode:0};switch(i){case 0:case"x":n.end={x:0};break;case 1:case"y":n.end={y:0};break;default:n.end=0}n.duration=e,n.ease=s,void 0===r?r=new Mi(t,n):r.resetFromJSON(n),r.restart()}(t,e,"y","Linear")}),e.manualClose=!0,e.clickOutsideClose=!0,e.destroy=!0,super(t,e),Xx(t,e),t.isRexSizer&&t.layout();var i=Hx(e,"touchOutsideClose",!1),s=Hx(e,"anyTouchClose",!1);s&&(i=!1),s?this.once("open",this.anyTouchClose,this):i&&this.once("open",this.touchOutsideClose,this),this.requestOpen()}shutdown(t){this.isShutdown||(this.scene.input.off("pointerup",this.touchCloseCallback,this),super.shutdown(t))}touchOutsideClose(){return this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&ir(this.parent,t.worldX,t.worldY)||this.requestClose()}onOpen(){this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.parent,this),super.onClose()}}var Gx={openColorPicker:function(){if(!this.colorPicker){var t=Yx.call(this).layout(),e=new Vx(t,{duration:{in:this.colorPickerEaseInDuration,out:this.colorPickerEaseOutDuration},transitIn:this.colorPickerTransitInCallback,transitOut:this.colorPickerTransitOutCallback,expandDirection:this.colorPickerExpandDirection,alignTargetX:this,alignTargetY:this,bounds:this.colorPickerBounds,touchOutsideClose:!0}).on("open",(function(){t.on("valuechange",(function(t){this.setValue(t)}),this)}),this).on("close",(function(){this.colorPicker=void 0,this.dropDownBehavior=void 0}),this);return this.colorPicker=t,this.dropDownBehavior=e,this.pin(t),this}}};Object.assign(Gx,nx);const Ux=Phaser.Utils.Objects.GetValue;class Nx extends rx{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexColorInput",e.hasOwnProperty("colorPicker")||(e.colorPicker={background:{color:0}});var i=e.colorPicker,s=!1!==i&&null!==i;if(s){var r;this.setColorPickerSize(Ux(i,"width",160),Ux(i,"height",170));var n=Ux(i,"background");r=n?function(t){return qc(t,n)}:Ux(i,"createBackgroundCallback"),this.setCreateColorPickerBackgroundCallback(r),this.setColorPickerHPalettePosition(Ux(i,"hPalettePosition",0)),this.setColorPickerExpandDirection(Ux(i,"expandDirection")),this.setColorPickerEaseInDuration(Ux(i,"easeIn",200)),this.setColorPickerEaseOutDuration(Ux(i,"easeOut",200)),this.setColorPickerTransitInCallback(Ux(i,"transitIn")),this.setColorPickerTransitOutCallback(Ux(i,"transitOut")),this.setColorPickerBounds(Ux(i,"bounds"));var a=Ux(i,"space");void 0===a&&(a={left:10,right:10,top:10,bottom:10,item:8}),this.setColorPickerSpace(a)}var h=e.colorComponents;if(s&&!1!==h&&null!==h){this.setColorComponentsHeight(Ux(h,"height",30)),this.setColorComponentsFormatLabelConfig(Ux(h,"formatLabel"));var o=Ux(h,"inputText");o||(o=Ux(e,"inputText")),this.setColorComponentsInputTextConfig(o);var l=Ux(h,"space");void 0===l&&(l={item:8}),this.setColorComponentsSpace(l)}var d=this.childrenMap.swatch;d&&s&&this.onClick(d,this.openColorPicker,this)}}Object.assign(Nx.prototype,Gx);var $x={name:"ColorInput",accept:t=>!!t.hasOwnProperty("view")&&"color"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.ColorInput";var s=e.colorInput;void 0===s&&(s={}),s.hasOwnProperty("inputText")||(s.inputText=e.inputText);var r=function(t,e,i){void 0===i&&(i=!0),i?e=e?$o(e):{}:e||(e={});var s=new Nx(t,e);return t.add.existing(s),s}(i,s);t.add(r,{proportion:1,expand:!0,key:"colorInput"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.colorInput.setValue(e)}},Kx={setBoxFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.boxFillColor!==t||this.boxFillAlpha!==e,this.boxFillColor=t,this.boxFillAlpha=e,this},setUncheckedBoxFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.uncheckedBoxFillColor!==t||this.uncheckedBoxFillAlpha!==e,this.uncheckedBoxFillColor=t,this.uncheckedBoxFillAlpha=e,this},setBoxStrokeStyle(t,e,i){return void 0===i&&(i=1),this.dirty=this.dirty||this.boxLineWidth!==t||this.boxStrokeColor!==e||this.boxStrokeAlpha!==i,this.boxLineWidth=t,this.boxStrokeColor=e,this.boxStrokeAlpha=i,this},setUncheckedBoxStrokeStyle(t,e,i){return void 0===i&&(i=1),this.dirty=this.dirty||this.uncheckedBoxLineWidth!==t||this.uncheckedBoxStrokeColor!==e||this.uncheckedBoxStrokeAlpha!==i,this.uncheckedBoxLineWidth=t,this.uncheckedBoxStrokeColor=e,this.uncheckedBoxStrokeAlpha=i,this},setCheckerStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.checkerColor!==t||this.checkAlpha!==e,this.checkerColor=t,this.checkAlpha=e,this},setBoxShape(t){return void 0===t&&(t=!1),this.isCircleShape===t||(this.isCircleShape=t,this.isSizeChanged=!0,this.dirty=!0),this}},Jx={setBoxSize(t){return this.dirty=this.dirty||this.boxSize!==t,this.boxSize=t,this},setCheckerSize(t){return this.dirty=this.dirty||this.checkerSize!==t,this.checkerSize=t,this}},qx={buildShapes(){this.addShape((new hc).setName("box")).addShape((new nc).setName("checker"))},updateShapes(){var t=this.width/2,e=this.height/2,i=Math.min(t,e),s=2*i,r=t-i,n=e-i,a=this.boxLineWidth,h=Math.max(s/10,2),o=this.getShape("box"),l=this.getShape("checker");if(this.isSizeChanged){var d=s*(1-this.boxSize)/2,c=a/2,u=s*this.boxSize-a;o.setTopLeftPosition(r+c+d,n+c+d).setSize(u,u),this.isCircleShape?o.setRadius(u/2):o.setRadius(0),d=s*(1-this.checkerSize)/2;var p=s*this.checkerSize/4,g=1*p,v=2*p,f=3*p;l.startAt(g,v).lineTo(v,f).lineTo(f,g).offset(r+d,n+d).end()}this.checked?(o.fillStyle(this.boxFillColor,this.boxFillAlpha).lineStyle(a,this.boxStrokeColor,this.boxStrokeAlpha),l.lineStyle(h,this.checkerColor)):(o.fillStyle(this.uncheckedBoxFillColor,this.uncheckedBoxFillAlpha).lineStyle(a,this.uncheckedBoxStrokeColor,this.uncheckedBoxStrokeAlpha),l.lineStyle()),this.checked&&l.setDisplayPathSegment(this.checkerAnimProgress)}},Zx={setCheckerAnimationDuration(t){return void 0===t&&(t=0),this.checkerAnimDuration=t,this},playCheckerAnimation(){return void 0===this.checkerAnimProgressTask&&(this.checkerAnimProgressTask=new gs(this,{eventEmitter:null})),this.checkerAnimProgressTask.restart({key:"checkerAnimProgress",from:0,to:1,duration:this.checkerAnimDuration}),this},stopCheckerAnimation(){return void 0===this.checkerAnimProgressTask||this.checkerAnimProgressTask.stop(),this}},Qx={};Object.assign(Qx,Kx,Jx,qx,Zx);const tC=23730,eC=Phaser.Utils.Objects.GetValue,iC=Phaser.Utils.Objects.IsPlainObject;class sC extends Pd{constructor(t,e,i,s,r,n,a){iC(e)?(e=eC(a=e,"x",0),i=eC(a,"y",0),s=eC(a,"width",2),r=eC(a,"height",2),n=eC(a,"color",tC)):iC(n)&&(n=eC(a=n,"color",tC)),super(t,e,i,s,r),this.type="rexCheckbox",void 0===n&&(n=tC),this.setBoxShape(eC(a,"circleBox",!1)),this.setBoxFillStyle(n,eC(a,"boxFillAlpha",1)),this.setUncheckedBoxFillStyle(eC(a,"uncheckedColor",null),eC(a,"uncheckedBoxFillAlpha",1)),this.setBoxStrokeStyle(eC(a,"boxLineWidth",4),eC(a,"boxStrokeColor",n),eC(a,"boxStrokeAlpha",1)),this.setUncheckedBoxStrokeStyle(this.boxLineWidth,eC(a,"uncheckedBoxStrokeColor",this.boxStrokeColor),eC(a,"uncheckedBoxStrokeAlpha",this.boxStrokeAlpha)),this.setCheckerStyle(eC(a,"checkerColor",16777215),eC(a,"checkerAlpha",1)),this.setBoxSize(eC(a,"boxSize",1)),this.setCheckerSize(eC(a,"checkerSize",1)),this.setCheckerAnimationDuration(eC(a,"animationDuration",150)),this.buildShapes();var h=eC(a,"checked");void 0===h&&(h=eC(a,"value",!1)),this.setValue(h)}get value(){return this._value}set value(t){t=!!t,this._value!==t&&(this.dirty=!0,this._value=t,t?this.playCheckerAnimation():this.stopCheckerAnimation(),this.emit("valuechange",t))}setValue(t){return this.value=t,this}toggleValue(){return this.setValue(!this.value),this}get checked(){return this.value}set checked(t){this.value=t}setChecked(t){return void 0===t&&(t=!0),this.setValue(t),this}toggleChecked(){return this.toggleValue(),this}get checkerAnimProgress(){return this._checkerAnimProgress}set checkerAnimProgress(t){this._checkerAnimProgress!==t&&(this._checkerAnimProgress=t,this.dirty=!0)}}Object.assign(sC.prototype,Qx);const rC=Phaser.Utils.Objects.GetValue,nC=Phaser.Utils.Objects.IsPlainObject;class aC extends sC{constructor(t,e,i,s,r,n,a){nC(e)?(e=rC(a=e,"x",0),i=rC(a,"y",0),s=rC(a,"width",2),r=rC(a,"height",2),n=rC(a,"color",tC)):nC(n)&&(n=rC(a=n,"color",tC)),super(t,e,i,s,r,n,a),this._click=new Sr(this,rC(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(rC(a,"readOnly",!1))}get readOnly(){return!this._click.enable}set readOnly(t){this._click.enable=!t}setReadOnly(t){return void 0===t&&(t=!0),this.readOnly=t,this}}var hC={name:"CheckboxInput",accept:t=>t.hasOwnProperty("view")?"boolean"===t.view:"boolean"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.CheckboxInput";var s=e.checkbox,r=function(t,e){var i=new aC(t,e);return t.add.existing(i),i}(i,s),n=s.size;void 0!==n&&r.setSize(n,n);var a=void 0!==n?0:1;t.add(r,{proportion:0,expand:!1,fitRatio:a,key:"checkbox"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.checkbox.setValue(e)}},oC={setTrackFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.trackFillColor!==t||this.trackFillAlpha!==e,this.trackFillColor=t,this.trackFillAlpha=e,this},setFalseValueTrackFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.falseValueTrackColor!==t||this.uncheckedTrackFillAlpha!==e,this.falseValueTrackColor=t,this.falseValueTrackFillAlpha=e,this},setThumbStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.thumbColor!==t||this.checkAlpha!==e,this.thumbColor=t,this.thumbAlpha=e,this}},lC={setTrackSize(t,e){return this.dirty=this.dirty||this.trackWidth!==t||this.trackHeight!==e,this.trackWidth=t,this.trackHeight=e,this},setTrackRadius(t){return this.dirty=this.dirty||this.trackRadius!==t,this.trackRadius=t,this},setThumbSize(t,e){return void 0===e&&(e=t),this.dirty=this.dirty||this.thumbWidth!==t||this.thumbHeight!==e,this.thumbWidth=t,this.thumbHeight=e,this},setThumbRadius(t){return this.dirty=this.dirty||this.thumbRadius!==t,this.thumbRadius=t,this}},dC={setThumbPosition(t,e){return void 0===e&&(e=1-t),this.thumbLeftX=t,this.thumbRightX=e,this},setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}},cC=function(t,e,i){return(e-t)*i+t},uC=function(t){return t>>16&255},pC=function(t){return t>>8&255},gC=function(t){return 255&t};const vC=Phaser.Math.Linear;var fC={buildShapes(){this.addShape((new hc).setName("track")).addShape((new hc).setName("thumb"))},updateShapes(){var t=this.width,e=this.height,i=this.value?this.toggleAnimProgress:1-this.toggleAnimProgress,s=this.getShape("track");if(this.isSizeChanged){var r=t*this.trackWidth,n=e*this.trackHeight,a=(t-r)/2,h=(e-n)/2,o=e*this.trackRadius;s.setTopLeftPosition(a,h).setSize(r,n).setRadius(o)}var l,d,c,u=(l=this.falseValueTrackColor,d=this.trackFillColor,c=i,(255&cC(uC(l),uC(d),c))<<16|(255&cC(pC(l),pC(d),c))<<8|255&cC(gC(l),gC(d),c)),p=vC(this.falseValueTrackFillAlpha,this.trackFillAlpha,i);s.fillStyle(u,p);var g=this.getShape("thumb");if(this.isSizeChanged){var v=t*this.thumbWidth,f=e*this.thumbHeight,m=e*this.thumbRadius;g.setSize(v,f).setRadius(m)}var y=vC(this.thumbLeftX,this.thumbRightX,i)*t;this.rtl&&(y=t-y);var b=e/2;g.setCenterPosition(y,b),g.fillStyle(this.thumbColor,this.thumbAlpha)}},mC={setToggleAnimationDuration(t){return void 0===t&&(t=0),this.toggleAnimDuration=t,this},playToggleAnimation(){return void 0===this.toggleAnimProgressTask&&(this.toggleAnimProgressTask=new gs(this,{eventEmitter:null})),this.toggleAnimProgressTask.restart({key:"toggleAnimProgress",from:0,to:1,duration:this.toggleAnimDuration}),this},stopToggleAnimation(){return void 0===this.toggleAnimProgressTask||this.toggleAnimProgressTask.stop(),this}},yC={};Object.assign(yC,oC,lC,dC,fC,mC);const bC=Phaser.Utils.Objects.GetValue,xC=Phaser.Utils.Objects.IsPlainObject,CC=23730;class wC extends Pd{constructor(t,e,i,s,r,n,a){xC(e)?(e=bC(a=e,"x",0),i=bC(a,"y",0),s=bC(a,"width",2),r=bC(a,"height",2),n=bC(a,"color",CC)):xC(n)&&(n=bC(a=n,"color",CC)),super(t,e,i,s,r),this.type="rexToggleSwitch",void 0===n&&(n=CC),this.setTrackFillStyle(n,bC(a,"trackFillAlpha",1)),this.setFalseValueTrackFillStyle(bC(a,"falseValueTrackColor",function(t){var e=.3*uC(t)+.59*pC(t)+.11*gC(t);return(255&e)<<16|(255&e)<<8|255&e}(n)),bC(a,"falseValueTrackFillAlpha",1)),this.setThumbStyle(bC(a,"thumbColor",16777215),bC(a,"thumbAlpha",1)),this.setTrackSize(bC(a,"trackWidth",.9),bC(a,"trackHeight",.5)),this.setTrackRadius(bC(a,"trackRadius",.5*this.trackHeight));var h=bC(a,"thumbHeight",void 0),o=bC(a,"thumbWidth",h);void 0===o&&(o=.9*this.trackHeight),this.setThumbSize(o,h),this.setThumbRadius(bC(a,"thumbRadius",.5*this.thumbHeight)),this.setThumbPosition(bC(a,"thumbLeft",.3),bC(a,"thumbRight",void 0)),this.setRTL(bC(a,"rtl",!1)),this.setToggleAnimationDuration(bC(a,"animationDuration",150)),this.buildShapes(),this.setValue(bC(a,"value",!1),0)}get value(){return this._value}set value(t){t=!!t,this._value!==t&&(this.dirty=!0,this._value=t,this.playToggleAnimation(),this.emit("valuechange",t))}setValue(t,e){void 0===e&&(e=this.toggleAnimDuration);var i=this.toggleAnimDuration;return this.toggleAnimDuration=e,this.value=t,this.toggleAnimDuration=i,this}toggleValue(t){return this.setValue(!this.value,t),this}get toggleAnimProgress(){return this._toggleAnimProgress}set toggleAnimProgress(t){this._toggleAnimProgress!==t&&(this._toggleAnimProgress=t,this.dirty=!0)}}Object.assign(wC.prototype,yC);const SC=Phaser.Utils.Objects.GetValue;class kC extends wC{constructor(t,e,i,s,r,n,a){super(t,e,i,s,r,n,a),this._click=new Sr(this,SC(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(SC(a,"readOnly",!1))}get readOnly(){return!this._click.enable}set readOnly(t){this._click.enable=!t}setReadOnly(t){return void 0===t&&(t=!0),this.readOnly=t,this}}var OC={name:"ToggleSwitchInput",accept:t=>!!t.hasOwnProperty("view")&&"toggleSwitch"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.ToggleSwitchInput";var s=e.toggleSwitch,r=function(t,e){var i=new kC(t,e);return t.add.existing(i),i}(i,s),n=s.size;void 0!==n&&r.setSize(n,n);var a=void 0!==n?0:1;t.addSpace().add(r,{proportion:0,expand:!1,fitRatio:a,key:"toggleSwitch"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.toggleSwitch.setValue(e)}},PC={setWrapEnable(t){return void 0===t&&(t=!0),this.listWrapEnable=t,this},setCreateButtonCallback(t){return this.listCreateButtonCallback=t,this},setCreateListBackgroundCallback(t){return this.listCreateBackgroundCallback=t,this},setCreateListSliderTrackCallback(t){return this.listCreateSliderTrackCallback=t,this},setCreateListSliderThumbCallback(t){return this.listCreateSliderThumbCallback=t,this},setListSliderAdaptThumbSizeEnable(t){return void 0===t&&(t=!0),this.listSliderAdaptThumbSizeEnable=t,this},setListScrollerConfig(t){return void 0===t&&(t={}),this.listScrollerConfig=t,this},setListMouseWheelScrollerConfig(t){return this.listMouseWheelScrollerConfig=t,this},setButtonClickCallback(t){return this.listOnButtonClick=t,this},setButtonOverCallback(t){return this.listOnButtonOver=t,this},setButtonOutCallback(t){return this.listOnButtonOut=t,this},setListExpandDirection(t){return"string"==typeof t&&(t=TC[t]),this.listExpandDirection=t,this},setListEaseInDuration(t){return void 0===t&&(t=0),this.listEaseInDuration=t,this},setListEaseOutDuration(t){return void 0===t&&(t=0),this.listEaseOutDuration=t,this},setListTransitInCallback(t){return this.listTransitInCallback=t,this},settListTransitOutCallback(t){return this.listTransitOutCallback=t,this},setListBounds(t){return this.listBounds=t,this},setListWidth(t){return this.listWidth=t,this},setListHeight(t){return this.listHeight=t,this},setListSize(t,e){return this.setListWidth(t).setListHeight(e),this},setListMaxHeight(t){return this.listMaxHeight=t,this},setListAlignmentMode(t){return this.listAlignMode=t,this},setListAlignmentSide(t){return void 0===t&&(t=""),this.listAlignSide=t,this},setListSpace(t){return void 0===t&&(t={}),this.listSpace=t,this},setListDraggable(t){return void 0===t&&(t=!0),this.listDraggable=t,this}};const TC={down:0,up:1},_C=Phaser.Utils.Objects.GetValue;var MC=function(){var t,e=this.scene,i=this.listCreateBackgroundCallback;i&&(t=i.call(this,e),e.add.existing(t));var s=[],r=this.listCreateButtonCallback;if(r)for(var n=this.options,a=0,h=n.length;a0||this.listMaxHeight>0)){if(s=EC(e,u,this.listWrapEnable),this.listMaxHeight>0&&(s.layout(),s.height<=this.listMaxHeight&&(d=s)),!d){0===c&&(c=this.listMaxHeight);var p=RC(e,this.listCreateSliderTrackCallback),g=RC(e,this.listCreateSliderThumbCallback);d=new ry(e,{height:c,scrollMode:0,panel:{child:s,mask:{padding:1}},slider:{track:p,thumb:g,adaptThumbSize:this.listSliderAdaptThumbSizeEnable},scrollDetectionMode:1,scroller:this.listScrollerConfig,mouseWheelScroller:this.listMouseWheelScrollerConfig,space:{panel:_C(this.listSpace,"panel",0)}}),e.add.existing(d)}}else u.height=c,s=EC(e,u,this.listWrapEnable),d=s;return t&&d.addBackground(t,"background"),this.listDraggable&&d.setDraggable(!0),d!==s&&s.on("button.over",(function(t,e,i,s){d.emit("button.over",t,e,i,s)})).on("button.out",(function(t,e,i,s){d.emit("button.out",t,e,i,s)})).on("button.click",(function(t,e,i,s){d.emit("button.click",t,e,i,s)})),d},EC=function(t,e,i){var s;return i?(e.orientation="x",s=new If(t,e)):(e.orientation="y",s=new Mf(t,e)),t.add.existing(s),s},RC=function(t,e,i){var s;return e&&(s=e.call(i,t),t.add.existing(s)),s},LC={focusNextButton(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;return t=void 0===e?0:(e+1)%this.listPanel.getButtons().length,this.emitButtonOver(t),this},focusPrevButton(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;if(void 0===e)t=0;else{var i=this.listPanel.getButtons().length;t=(e-1+i)%i}return this.emitButtonOver(t),this}},DC={openListPanel:function(){if(this.listPanel)return this;if(0===this.options.length)return this;var t,e=MC.call(this);e.on("button.over",(function(t,i,s,r){this.currentOverIndex=i,this.listOnButtonOver&&this.listOnButtonOver.call(this,t,i,s,r),this.emit("button.over",this,e,t,i,s,r)}),this).on("button.out",(function(t,i,s,r){this.currentOverIndex===i&&(this.currentOverIndex=void 0),this.listOnButtonOut&&this.listOnButtonOut.call(this,t,i,s,r),this.emit("button.out",this,e,t,i,s,r)}),this),t=this.listAlignMode&&"label"!==this.listAlignMode?this.getElement(this.listAlignMode):this;var i=new Vx(e,{duration:{in:this.listEaseInDuration,out:this.listEaseOutDuration},transitIn:this.listTransitInCallback,transitOut:this.listTransitOutCallback,expandDirection:this.listExpandDirection,alignTargetX:t,alignTargetY:this,alignSide:this.listAlignSide,bounds:this.listBounds}).on("open",(function(){e.on("button.click",(function(t,i,s,r){this.listOnButtonClick&&this.listOnButtonClick.call(this,t,i,s,r),this.emit("button.click",this,e,t,i,s,r),this.dropDownBehavior.requestClose()}),this),this.emit("list.open",this,e)}),this).on("close",(function(){this.listPanel=void 0,this.dropDownBehavior=void 0,this.emit("list.close",this)}),this);return e.onClickOutside((function(){i.requestClose()})),this.listPanel=e,this.dropDownBehavior=i,this.pin(e),this},closeListPanel:function(){return this.dropDownBehavior?(this.dropDownBehavior.requestClose(),this.currentOverIndex=void 0,this):this},toggleListPanel:function(){return this.listPanel?this.closeListPanel():this.openListPanel(),this},emitButtonClick:function(t){if(void 0===t&&(t=this.currentOverIndex),void 0===t)return this;var e=this.listPanel,i=e?e.getButton(t):this.options[t];return this.listOnButtonClick&&this.listOnButtonClick.call(this,i,t),this.emit("button.click",this,e,i,t),this},emitButtonOver:function(t){var e=this.listPanel;return e?(e.emitButtonOver(t),this):this}};Object.assign(DC,PC,LC);const AC=Phaser.Utils.Objects.GetValue;class BC extends Gl{constructor(t,e){super(t,e),this.type="rexDropDownList",this.timer=void 0,this.listPanel=void 0,this.currentOverIndex=void 0,this.setOptions(AC(e,"options"));var i=AC(e,"list");this.setWrapEnable(AC(i,"wrap",!1)),this.setCreateButtonCallback(AC(i,"createButtonCallback")),this.setCreateListBackgroundCallback(AC(i,"createBackgroundCallback")),this.setCreateListSliderTrackCallback(AC(i,"createTrackCallback")),this.setCreateListSliderThumbCallback(AC(i,"createThumbCallback")),this.setListSliderAdaptThumbSizeEnable(AC(i,"sliderAdaptThumbSize",!1)),this.setListScrollerConfig(AC(i,"scroller")),this.setListMouseWheelScrollerConfig(AC(i,"mouseWheelScroller")),this.setButtonClickCallback(AC(i,"onButtonClick")),this.setButtonOverCallback(AC(i,"onButtonOver")),this.setButtonOutCallback(AC(i,"onButtonOut")),this.setListExpandDirection(AC(i,"expandDirection")),this.setListEaseInDuration(AC(i,"easeIn",500)),this.setListEaseOutDuration(AC(i,"easeOut",100)),this.setListTransitInCallback(AC(i,"transitIn")),this.settListTransitOutCallback(AC(i,"transitOut")),this.setListMaxHeight(AC(i,"maxHeight",0)),this.setListSize(AC(i,"width"),AC(i,"height",0)),this.setListAlignmentMode(AC(i,"alignParent","text")),this.setListAlignmentSide(AC(i,"alignSide","")),this.setListBounds(AC(i,"bounds")),this.setListSpace(AC(i,"space")),this.setListDraggable(AC(i,"draggable",!1)),this.setValueChangeCallback(AC(e,"setValueCallback"),AC(e,"setValueCallbackScope")),this.setValue(AC(e,"value")),this.onClick(this.toggleListPanel,this)}destroy(t){this.scene&&!this.ignoreDestroy&&(this.listPanel&&(this.listPanel.destroy(t),this.listPanel=void 0),super.destroy(t))}get isOpened(){return!!this.listPanel}setOptions(t){return void 0===t&&(t=[]),this.options=t,this}setValueChangeCallback(t,e){return this.valueChangeCallback=t,this.valueChangeCallbackScope=e,this}setValue(t){return this.value=t,this}get value(){return this._value}set value(t){if(this._value!==t){var e=this._value;this._value=t;var i=this.valueChangeCallback,s=this.valueChangeCallbackScope;i&&(s?i.call(s,this,t,e):i(this,t,e)),this.emit("valuechange",this,t,e)}}}Object.assign(BC.prototype,DC);var WC=function(t,e){e=function(t,e,i){void 0===i&&(i={});var s=(e=e?$o(e):{}).label||e.button,r=e.button||e.label;delete e.label,delete e.button;var n=i.label||i.button||i,a=i.button||i.label||i,h=Rv(t,s,n);h.list=e.list||{},h.list.createButtonCallback=function(t,e){var i=Sm(t,r,a).resetDisplayContent(e);return e.hasOwnProperty("value")&&(i.value=e.value),i};var o=e.track;o&&(h.list.createTrackCallback=function(t){return qc(t,o)},delete e.track);var l=e.thumb;return l&&(h.list.createThumbCallback=function(t){return qc(t,l)},delete e.thumb),h.list.onButtonOver=function(t,e,i,s){t.setHoverState&&t.setHoverState(!0)},h.list.onButtonOut=function(t,e,i,s){t.setHoverState&&t.setHoverState(!1)},h}(t,e);var i=new BC(t,e);return t.add.existing(i),i},zC=function(t,e){for(var i=0,s=t.length;it.hasOwnProperty("view")?"list"===t.view:t.hasOwnProperty("options"),build(t,e){var i=t.scene;t.type="rexTweaker.ListInput";var s=WC(i,e.list);t.add(s,{proportion:1,expand:!0,key:"list"}),s.on("button.click",(function(e,i,s,r,n,a){t.setValue(s.value)}))},setup(t,e,i){(i||e.hasOwnProperty("options"))&&function(t,e){t.childrenMap.list.setOptions(e)}(t,e.options)},displayValue(t,e){var i=t.childrenMap.list,s=function(t,e){var i=zC(t,e);if(null!=i)return t[i]}(i.options,e);i.resetDisplayContent(s).setMinSize(i.width,i.height).layout().setMinSize(0,0)}};const YC=Phaser.Utils.Objects.GetValue;var jC={name:"ButtonsInput",accept:t=>!!t.hasOwnProperty("view")&&"buttons"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.ButtonsInput";var s=e.button?$o(e.button):{},r=YC(s,"expand",!0);r&&(s.align="center"),delete s.expand;var n=Hb(i,{expand:r});n.buttonConfig=s,t.add(n,{proportion:1,expand:!0,key:"list"}),n.on("button.click",(function(e,i,s,r){var a=n.options[i];a&&(t._selectedIndex=i,t.setValue(a.value),t._selectedIndex=void 0)}))},setup(t,e,i){(i||e.hasOwnProperty("options"))&&function(t,e){var i=t.childrenMap.list;i.options=e;var s=t.scene,r=i.buttonConfig;i.clearButtons(!0);for(var n=0,a=e.length;n=0;i--)vf.call(this,e[i],t);return this}},mf=function(t,e,i){if(t){var s=this.setValueCallback,r=this.setValueCallbackScope;s&&(r?s.call(r,t,e,i):s(t,e,i)),this.fireEvent("button.statechange",t,e,i)}},yf=function(t){var e=this;t._selected=void 0,Object.defineProperty(t,"selected",{get:function(){return t._selected},set:function(i){if(t._selected!==i){var s=t._selected;t._selected=i,mf.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},bf={add(t){return this.buttons.push(t),t._click||(t._click=new Sr(t,this.clickConfig),t._click.on("click",(function(t,e,i,s){this.fireEvent("button.click",e,i,s)}),this).on("enable",(function(t,e){this.fireEvent("button.enable",e)}),this).on("disable",(function(t,e){this.fireEvent("button.disable",e)}),this).on("over",(function(t,e,i,s){this.fireEvent("button.over",e,i,s)}),this).on("out",(function(t,e,i,s){this.fireEvent("button.out",e,i,s)}),this).on("down",(function(t,e,i,s){this.fireEvent("button.down",e,i,s)}),this).on("up",(function(t,e,i,s){this.fireEvent("button.up",e,i,s)}),this),t.isRexContainerLite&&t.sendChildToBack(t)),this.buttonsType&&(void 0===t.name&&console.error(`${this.parent.constructor.name}: Option button miss value`),yf.call(this,t)),this},addMultiple(t){for(var e=0,i=t.length;e0},setButtonEnable(t,e){var i=this.buttons;if(void 0===t||"boolean"==typeof t){e=t;for(var s=0,r=i.length;sr&&Rf.addNewLine(this)}else for(n=0,a=t.length;n=0;i--)Wf.call(this,e[i],t);return this}};const If=Phaser.Utils.Objects.GetValue;class Yf extends Ka{constructor(t,e){void 0===e&&(e={});var i=e.space;"number"==typeof i&&(e.space={item:i,line:i}),super(t,e),this.type="rexFixWidthButtons",this.buttonGroup=new Pf({parent:this,eventEmitter:If(e,"eventEmitter",this),groupName:If(e,"groupName",void 0),clickConfig:If(e,"click",void 0)}).setButtonsType(e);var s=If(e,"background",void 0),r=If(e,"buttons",void 0);this.buttonsAlign=If(e,"align",void 0),s&&this.addBackground(s),r&&this.addButtons(r),this.addChildrenMap("background",s),this.addChildrenMap("buttons",this.buttonGroup.buttons)}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.buttonGroup.destroy(),this.buttonGroup=void 0)}get buttons(){return this.buttonGroup.buttons}get groupName(){return this.buttonGroup.groupName}set groupName(t){this.buttonGroup.groupName=t}get eventEmitter(){return this.buttonGroup.eventEmitter}}Object.assign(Yf.prototype,Df,zf,Of,_f);var jf=function(t,e,i,s){if(void 0===i)i=0;else{var r=typeof i;"boolean"===r?(s=i,i=0):"string"===r&&(i=Xf[i])}void 0===s?s={}:!0===s&&(s=Ff);var n=e.width/t.width,a=e.height/t.height,h=i?Math.max(n,a):Math.min(n,a);return s.width=t.width*h,s.height=t.height*h,s};const Xf={fit:0,FIT:0,envelop:1,ENVELOP:1};var Ff={},Hf={},Vf={};const Gf=Phaser.Utils.Objects.IsPlainObject,Uf=Phaser.Utils.Objects.GetValue,Nf=Phaser.Display.Align.CENTER,$f=Phaser.Utils.String.UUID;var Kf={add:function(t,e,i,s,r,n,a,h,o,l){var d,c;ye.call(this,t),Gf(e)&&(e=Uf(u=e,"key",void 0),i=Uf(u,"align",Nf),s=Uf(u,"padding",0),r=Uf(u,"expand",!0),t.isRexSizer||(n=Uf(u,"minWidth",t._minWidth),a=Uf(u,"minHeight",t._minHeighted)),h=Uf(u,"offsetX",0),o=Uf(u,"offsetY",0),d=Uf(u,"offsetOriginX",0),c=Uf(u,"offsetOriginY",0),l=Uf(u,"aspectRatio",0));var u,p=void 0!==e;return p||(e=$f()),"string"==typeof i&&(i=zt[i]),void 0===i&&(i=Nf),void 0===s&&(s=0),void 0===r&&(r=!0),t.isRexSizer||(void 0===n&&(n=t._minWidth),void 0===a&&(a=t._minHeight)),void 0===h&&(h=0),void 0===o&&(o=0),void 0===d&&(d=0),void 0===c&&(c=0),void 0===l?l=0:!0===l&&(l=Q(t)/tt(t)),l>0&&(r=!0,void 0===n&&(n=0),void 0===a&&(a=0)),(u=this.getSizerConfig(t)).align=i,u.padding=fe(s),Gf(r)?(u.expandWidth=Uf(r,"width",!1),u.expandHeight=Uf(r,"height",!1)):(u.expandWidth=r,u.expandHeight=r),t.isRexSizer||(u.expandWidth&&(t.minWidth=void 0===n?Q(t):n),u.expandHeight&&(t.minHeight=void 0===a?tt(t):a)),u.alignOffsetX=h,u.alignOffsetY=o,u.alignOffsetOriginX=d,u.alignOffsetOriginY=c,u.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,p&&this.addChildrenMap(e,t),this}},Jf={remove(t,e){var i;if("string"==typeof t){if(i=t,!(t=this.sizerChildren[i]))return this}else{if(this.getParentSizer(t)!==this)return this;i=this.childToKey(t)}return i&&(delete this.sizerChildren[i],this.childrenMap.hasOwnProperty(i)&&delete this.childrenMap[i]),Oe.call(this,t,e),this},removeAll(t){for(var e in this.sizerChildren)this.remove(e,t);return this},clear(t){for(var e in this.sizerChildren)delete this.sizerChildren[e],this.childrenMap.hasOwnProperty(e)&&delete this.childrenMap[e];return ba.call(this,t),this}},qf={getChildrenWidth:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var a in r)t=r[a],void 0===(i=this.getChildWidth(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).left+e.right)*this.scaleX,s=Math.max(i,s));return n?void 0:s+(this.space.left+this.space.right)*this.scaleX},getChildrenHeight:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var a in r)t=r[a],void 0===(i=this.getChildHeight(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).top+e.bottom)*this.scaleY,s=Math.max(i,s));return n?void 0:s+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(s.expandWidth){var r=e-(this.space.left+this.space.right)*this.scaleX,n=s.padding;i=r-(n.left+n.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(s.expandHeight){var r=e-(this.space.top+this.space.bottom)*this.scaleY,n=s.padding;i=r-(n.top+n.bottom)*this.scaleY}return i},getChildrenSizers:function(t){void 0===t&&(t=[]);var e,i=this.sizerChildren;for(var s in i)(e=i[s]).isRexSizer&&t.push(e);return t},layoutChildren:function(){var t,e,i,s,r,n,a,h,o,l,d,c,u=this.innerLeft,p=this.innerTop,g=this.innerWidth,v=this.innerHeight,f=this.sizerChildren;for(var m in f)(t=f[m]).rexSizer.hidden||(i=(e=t.rexSizer).padding,yr.call(this,t),l=this.getExpandedChildWidth(t),d=this.getExpandedChildHeight(t),e.aspectRatio>0&&(Hf.width=e.aspectRatio,Hf.height=1,Vf.width=l,Vf.height=d,l=(c=jf(Hf,Vf,"FIT",!0)).width,d=c.height),t.isRexSizer?(t.runLayout(this,l,d),aa(t,this)):Ge(t,l,d),s=u+i.left*this.scaleX,n=g-(i.left+i.right)*this.scaleX,r=p+i.top*this.scaleY,a=v-(i.top+i.bottom)*this.scaleY,void 0===l&&(l=Q(t)),void 0===d&&(d=tt(t)),h=(e.alignOffsetX+e.alignOffsetOriginX*l)*this.scaleX,o=(e.alignOffsetY+e.alignOffsetOriginY*d)*this.scaleY,br.call(this,t,s,r,n,a,e.align,h,o))}};Object.assign(qf,Kf,Jf);const Zf=Phaser.Utils.Objects.IsPlainObject,Qf=Phaser.Utils.Objects.GetValue;class tm extends na{constructor(t,e,i,s,r,n){Zf(e)?(e=Qf(n=e,"x",0),i=Qf(n,"y",0),s=Qf(n,"width",void 0),r=Qf(n,"height",void 0)):Zf(s)&&(s=Qf(n=s,"width",void 0),r=Qf(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexOverlapSizer",this.sizerChildren={},this.addChildrenMap("items",this.sizerChildren)}childToKey(t){if("string"!=typeof t)return function(t,e){if(Array.isArray(t))return t.indexOf(e);for(var i in t)if(t[i]===e)return i;return null}(this.sizerChildren,t);var e=t;return this.sizerChildren.hasOwnPropery(e)?e:null}}Object.assign(tm.prototype,qf);const em=tm.prototype.add;var im=function(t,e,i,s,r,n,a,h,o){return t.setVisible(!1),em.call(this,t,e,i,s,r,n,a,h,o),this},sm={add:im,addPage:im};const rm=Et.prototype.setChildVisible;var nm={getPage:function(t){return void 0===t?null:this.sizerChildren.hasOwnProperty(t)?this.sizerChildren[t]:null},swapPage:function(t,e){this._previousKey=this._currentKey;var i=this.previousPage;i&&(0===this.swapMode?(rm.call(this,i,!1),this.emit("pageinvisible",i,this._previousKey,this)):i.destroy()),t&&!this.sizerChildren.hasOwnProperty(t)&&this.emit("createpage",t,this),this._currentKey=t;var s=this.currentPage;return s&&(rm.call(this,s,!0),this.emit("pagevisible",s,this._currentKey,this),void 0===e&&(e=this.fadeInDuration),e>0&&s.setAlpha(0).fadeIn(e,1)),this},hasPage:function(t){return this.sizerChildren.hasOwnProperty(t)}};Object.assign(nm,sm);const am=Phaser.Utils.Objects.GetValue;class hm extends tm{constructor(t,e){super(t,e),this.type="rexPages",this.childrenMap=this.sizerChildren,this._previousKey=void 0,this._currentKey=void 0,this.setSwapMode(am(e,"swapMode",0)),this.setFadeInDuration(am(e,"fadeIn",0))}setSwapMode(t){return"string"==typeof t&&(t=om[t]),this.swapMode=t,this}setFadeInDuration(t){return this.fadeInDuration=t,this}get previousKey(){return this._previousKey}get currentKey(){return this._currentKey}set currentKey(t){this.swapPage(t)}get currentPage(){return this.getPage(this.currentKey)}get previousPage(){return this.getPage(this.previousKey)}get keys(){return Object.keys(this.sizerChildren)}}Object.assign(hm.prototype,nm);const om={invisible:0,destroy:1},lm=Phaser.Utils.Objects.IsPlainObject,dm=Phaser.Utils.Objects.GetValue,cm=Phaser.Utils.String.UUID;var um={swapPage:function(t,e){var i,s;return null!=(i="number"==typeof t?t:this.getPageIndex(t))&&(void 0!==e&&(s=this.childrenMap.pages.fadeInDuration,this.childrenMap.pages.fadeInDuration=e),this.childrenMap.tabs.emitButtonClick(i),void 0!==s&&(this.childrenMap.pages.fadeInDuration=s)),this},swapFirstPage:function(t){return this.swapPage(0,t),this},swapLastPage:function(t){var e=this.getElement("tabs.buttons").length-1;return this.swapPage(e,t),this}},pm={removePage(t,e){"number"==typeof t&&(t=this.getPageKey(t));var i=this.childrenMap.tabs,s=i.getByName(t),r=this.childrenMap.pages,n=r.getElement(t);return s&&n?(r.removeChildrenMap(t),i.removeButton(s,e),r.remove(n,e),this):this},removeAllPages(t){for(var e=this.getElement("tabs.buttons"),i=e.length-1;i>=0;i--)this.removePage(e[i].name,t);return this}},gm={top:1,left:3,right:5,bottom:7},vm={top:"bottom",left:"right",right:"left",bottom:"top"},fm={setTabsPadding(t,e){return this.childrenMap.tabs.setOuterPadding(t,e),this},getTabsPadding(t){return this.childrenMap.tabs.getOuterPadding(t)}},mm={getPageKey:function(t){var e=this.getElement("tabs.buttons");if(!(t>=e.length))return e[t].name},getPageIndex:function(t){for(var e=this.getElement("tabs.buttons"),i=0,s=e.length;i0,setInputRowTitleWidth(t){return this}};const Bm=Phaser.Utils.Objects.GetValue;class Wm extends La{constructor(t,e){void 0===e&&(e={}),e.orientation="y",super(t,e),this.type="rexTweaker.Wrap";var i=Bm(e,"background",void 0),s=Bm(e,"title",void 0);i&&this.addBackground(i),s&&this.add(s,{expand:!0,space:{bottom:Bm(e,"space.title",0)}});var r=Bm(e,"child",void 0);this.add(r,{expand:!0}),this.addChildrenMap("title",s),this.addChildrenMap("child",r)}setTitle(t){var e=this.childrenMap.title;return t.title||t.icon?e.show().setTitle(t):e.hide(),this}}Object.assign(Wm.prototype,Dm,Am);const zm=Phaser.Utils.Objects.GetValue,Im=Phaser.Utils.Objects.GetValue;var Ym=function(t){return t.hasOwnProperty("geometryMask")?t.geometryMask:t.bitmapMask};const jm=Phaser.Geom.Intersects.RectangleToRectangle,Xm=Phaser.Geom.Rectangle.Overlaps;var Fm=function(t){if(!t.displayList)return!1;for(;;){var e=t.rexContainer;if(e){if(e.visible){var i=e.parent;if(i){t=i;continue}return!0}return!1}return t.visible}},Hm=function(t,e){var i=e.top,s=e.bottom,r=e.left,n=e.right,a=0;return a+=t.contains(r,i)?1:0,a+=t.contains(r,s)?1:0,a+=t.contains(n,i)?1:0,a+=t.contains(n,s)?1:0},Vm=function(t,e,i){e.hasOwnProperty("isRexContainerLite")?(e.syncChildrenEnable=!1,t.setChildMaskVisible(e,!0),e.syncChildrenEnable=!0):(e.clearMask&&e.clearMask(),t.setChildMaskVisible(e,!0))},Gm=function(t,e,i){e.hasOwnProperty("isRexContainerLite")?(e.syncChildrenEnable=!1,t.setChildMaskVisible(e,!0),e.syncChildrenEnable=!0):(e.setMask&&e.setMask(i),t.setChildMaskVisible(e,!0))},Um=function(t,e,i){e.hasOwnProperty("isRexContainerLite")?(e.syncChildrenEnable=!1,t.setChildMaskVisible(e,!1),e.syncChildrenEnable=!0):(e.clearMask&&e.clearMask(),t.setChildMaskVisible(e,!1))};const Nm=Phaser.Utils.Objects.GetValue,$m={update:0,everyTick:1};var Km={setupChildrenMask(t){return!1===t||(this.setMaskUpdateMode(Nm(t,"updateMode",0)),this.enableChildrenMask(Nm(t,"padding",0)),this.setMaskLayer(Nm(t,"layer",void 0)),this.onMaskGameObjectVisible=Nm(t,"onVisible"),this.onMaskGameObjectInvisible=Nm(t,"onInvisible"),this.maskGameObjectCallbackScope=Nm(t,"scope"),this.startMaskUpdate()),this},destroyChildrenMask(){return this.childrenMask?(this.stopMaskUpdate(),this.childrenMask.destroy(),this.childrenMask=void 0,this.onMaskGameObjectVisible=null,this.onMaskGameObjectInvisible=null,this.maskGameObjectCallbackScope=null,this):this},setMaskUpdateMode(t){return"string"==typeof t&&(t=$m[t]),this.maskUpdateMode=t,this},startMaskUpdate(){this.scene.game.events.on("poststep",this.maskChildren,this)},stopMaskUpdate(){this.scene.game.events.off("poststep",this.maskChildren,this)},enableChildrenMask(t){var e=uh.call(this,null,this,0,t);return this.childrenMask=e.createGeometryMask(),this},setMaskChildrenFlag(t){return void 0===t&&(t=!0),this.maskChildrenFlag=t,this},setMaskLayer(t){return this.maskLayer=t,this},maskChildren(){return this.childrenMask&&this.maskChildrenFlag&&0!==this.alpha&&this.visible?(this.privateRenderLayer?this.privateRenderLayer.setMask(this.childrenMask):this.maskLayer?(this.addToLayer(this.maskLayer),this.maskLayer.setMask(this.childrenMask)):function({parent:t,mask:e,children:i,onVisible:s,onInvisible:r,scope:n}){if(e){void 0===i&&(i=t.getAllChildren());for(var a,h,o,l=!!s||!!r,d=t.getBounds(),c=Ym(e),u=0,p=i.length;uthis.topChildOY}childOYExeceedBottom(t){return void 0===t&&(t=this.childOY),tthis.leftChildOX}childOXExeceedRight(t){return void 0===t&&(t=this.childOX),tthis.childHeight?t=0:s?t=e:r&&(t=i)),this._childOY!==t&&(this._childOY=t,this.resetChildPosition()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}get childOX(){return this._childOX}set childOX(t){var e=this.leftChildOX,i=this.rightChildOX,s=this.childOXExceedLeft(t),r=this.childOXExeceedRight(t);this.clampChildOX&&(this.childVisibleWidth>this.childWidth?t=0:s?t=e:r&&(t=i)),this._childOX!==t&&(this._childOX=t,this.resetChildPosition()),s&&(this.execeedLeftState||this.emit("execeedleft",this,t,e)),this.execeedLeftState=s,r&&(this.execeedRightState||this.emit("execeedright",this,t,i)),this.execeedRightState=r}setChildOY(t){return this.childOY=t,this}setChildOX(t){return this.childOX=t,this}set t(t){this.childOY=-this.visibleHeight*t}get t(){var t=this.visibleHeight;return 0===t?0:this.childOY/-t}set s(t){this.childOX=-this.visibleWidth*t}get s(){var t=this.visibleWidth;return 0===t?0:this.childOX/-t}setChildOYByPercentage(t){return this.t=t,this}setChildOXByPercentage(t){return this.s=t,this}}Object.assign(ty.prototype,Jm);const ey=["top","bottom","centerY","center"],iy=["left","right","centerX","center"];var sy=function(t,e,i){var s,r="Y"===(e=e.toUpperCase()),n=this.childrenMap.child;if(r){if(i)for(var a=0,h=ey.length;a=0?0:Math.abs(l)<=Math.abs(d)?l:d}}else{if(i)for(a=0,h=iy.length;a=0?0:Math.abs(c)<=Math.abs(u)?c:u}}switch(this.scrollMode){case 0:case 1:this.childOY+=s;break;default:this[`childO${e}`]+=s}};const ry=Phaser.Utils.Objects.GetValue;class ny extends dv{constructor(t,e){void 0===e&&(e={});var i=Fp(e),s=ry(e,"panel",void 0);void 0===s&&(s={}),s.scrollMode=i,s.clampChildOY=ry(e,"clampChildOY",!1),s.clampChildOX=ry(e,"clampChildOX",!1);var r,n,a=new ty(t,s);switch(t.add.existing(a),i){case 0:r=ry(e,"expand.panel",!0),n=!0;break;case 1:r=!0,n=ry(e,"expand.panel",!0);break;default:r=!0,n=!0}e.type="rexScrollablePanel",e.child={gameObject:a,expandWidth:r,expandHeight:n,align:ry(e,"align.panel","center")};var h=ry(e,"space",void 0);h&&(h.child=ry(h,"panel",0)),super(t,e),this.addChildrenMap("panel",a.child),this.addChildrenMap("panelLayer",a.maskLayer),this.addChildrenMap("mask",a.maskGameObject),this.addChildrenMap("scrollableBlock",a)}setChildrenInteractive(t){return void 0===t&&(t={}),t.hasOwnProperty("eventEmitter")||(t.eventEmitter=this),t.hasOwnProperty("targets")||(t.targets=[this.childrenMap.panel]),ia(this.childrenMap.child,t),this}}var ay={scrollToChild:function(t,e){if(!this.hasChild(t))return this;switch(this.scrollMode){case 0:sy.call(this,t,"y",e);break;case 1:sy.call(this,t,"x",e);break;default:sy.call(this,t,"y",e),sy.call(this,t,"x",e)}return this}};Object.assign(ny.prototype,ay);var hy={setBindingTarget(t){return this.childrenMap.panel.setBindingTarget(t),this}},oy={getMaxInputRowTitleWidth(){return this.childrenMap.panel.getMaxInputRowTitleWidth()+this.getInnerPadding("left")},setInputRowTitleWidth(t){return t-=this.getInnerPadding("left"),this.childrenMap.panel.setInputRowTitleWidth(t),this}};class ly extends ny{constructor(t,e){super(t,e),this.type="rexTweaker.Scrollable"}setTitle(t){var e=this.childrenMap.header;return t.title||t.icon?e.show().setTitle(t):e.hide(),this}}Object.assign(ly.prototype,hy,oy);const dy=Phaser.Utils.Objects.GetValue,cy=Phaser.Utils.Objects.GetValue,uy=Phaser.Utils.Objects.GetValue;var py={setupBinding(){return this.childrenMap.inputField.on("valuechange",(function(t){this.autoUpdateEnable&&this.setTargetValue(t)}),this),this},setAutoUpdateEnable(t){return void 0===t&&(t=!0),this.autoUpdateEnable=t,this},setBindingTarget(t,e){this.bindingTarget=t,void 0!==e&&this.setBindingTargetKey(e),this.syncTargetValue();var i=this.childrenMap.inputField;return i.onBindTarget&&i.onBindTarget(t,e),this},setBindingTargetKey(t){return this.bindTargetKey=t,this},setValueCallbacks(t){return this.onGetValue=uy(t,"onGetValue"),this.onSetValue=uy(t,"onSetValue"),this},getTargetValue(){if(this.bindingTarget)return null!=this.bindTargetKey?this.bindingTarget[this.bindTargetKey]:this.onGetValue?this.onGetValue(this.bindingTarget):void 0},setTargetValue(t){return this.bindingTarget?null!=this.bindTargetKey?(this.bindingTarget[this.bindTargetKey]=t,this):(this.onSetValue&&this.onSetValue(this.bindingTarget,t),this):this},syncTargetValue(){if(!this.bindingTarget)return this;var t=this.childrenMap.inputField;return t.syncValue&&t.syncValue(this.getTargetValue()),this}},gy={startMonitorTarget(){return this.isMonitoring||(this.isMonitoring=!0,this.scene.events.on("postupdate",this.onMonitorTarget,this)),this},stopMonitorTarget(){return this.isMonitoring?(this.isMonitoring=!1,this.scene.events.off("postupdate",this.onMonitorTarget,this),this):this},onMonitorTarget(){if(this.bindingTarget){var t=this.getTargetValue(),e=this.childrenMap.inputField;e.value!==t&&e.syncValue(t)}}},vy={getMinTitleWidth(){var t=this.childrenMap.title;if(!t||0!==t.orientation)return 0;var e=t.rexSizer.padding;return this.getChildWidth(this.childrenMap.title)+(e.left+e.right)*t.scaleX+this.getInnerPadding("left")},setMinTitleWidth(t){var e=this.childrenMap.title;if(!e||0!==e.orientation)return this;var i=e.rexSizer.padding;return t-=(i.left+i.right)*e.scaleX,e.minWidth=t,this}};const fy=Phaser.Utils.Objects.GetValue;class my extends La{constructor(t,e){super(t,e),this.type="rexTweaker.InputRow",this.bindingTarget=void 0,this.bindTargetKey=void 0,this.autoUpdateEnable=!0;var i,s=e.inputTitle,r=e.inputField,n=e.background,a=fy(e,"proportion.title",0),h=fy(e,"space.title",0);i=0===this.orientation?{right:h}:{bottom:h},this.add(s,{proportion:a,expand:!0,padding:i});var o=r.defaultProportion;void 0===o&&(o=e.defaultExpandWidth?1:0),a=fy(e,"proportion.inputField",o),this.add(r,{proportion:a,expand:!0}),n&&this.addBackground(n),this.addChildrenMap("title",s),this.addChildrenMap("inputField",r),this.addChildrenMap("background",n),this.setupBinding()}destroy(t){this.scene&&!this.ignoreDestroy&&(this.stopMonitorTarget(),super.destroy(t))}setTitle(t){return this.childrenMap.title.setTitle(t),this}preLayout(){var t=this.childrenMap.title;t&&(t.minWidth=0),super.preLayout()}}Object.assign(my.prototype,py,gy,vy);var yy=function(t,e,i){var s=new Dv(t,i);return t.add.existing(s),s},by=function(t){return void 0===t&&(t=La),class extends t{get bindingTarget(){return this.getParentSizer().bindingTarget}get bindingKey(){return this.getParentSizer().bindTargetKey}get value(){return this._value}get root(){return this.getParentSizer().getParentSizer().root}onBindTarget(t,e){this.onBindTargetCallback&&this.onBindTargetCallback(this,t,e)}validate(t){return!(!this.syncValueFlag&&this.validateCallback)||this.validateCallback(t,this._value,this.bindingTarget,this.bindingKey)}getFotmatText(t){return t=this.textFormatCallback?this.textFormatCallback(t):t.toString()}set value(t){if(this._value!==t&&(this.validate(t)||(t=this._value),this.filterValueCallback&&(t=this.filterValueCallback(this,t)),this.displayValueCallback&&this.displayValueCallback(this,t),this._value!==t)){var e=this._value;if(this._value=t,!this.syncValueFlag){var i=this.bindingTarget,s=this.bindingKey;this.emit("valuechange",t,e,i,s),this.root.emit("valuechange",t,e,i,s)}}}getValue(){return this.value}setValue(t){return this.value=t,this}syncValue(t){return this.syncValueFlag=!0,this.value=t,this.syncValueFlag=!1,this}setup(t,e){return void 0===e&&(e=!1),(e||t.hasOwnProperty("format"))&&this.setTextFormatCallback(t.format),(e||t.hasOwnProperty("onValidate"))&&this.setValidateCallback(t.onValidate),this.setupCallback&&this.setupCallback(this,t,e),this}setSetupCallback(t){return this.setupCallback=t,this}setFilterValueCallback(t){return this.filterValueCallback=t,this}setDisplayValueCallback(t){return this.displayValueCallback=t,this}setOnBindTargetCallback(t){return this.onBindTargetCallback=t,this}setTextFormatCallback(t){return this.textFormatCallback=t,this}setValidateCallback(t){return this.validateCallback=t,this}}},xy=function(t,e,i){for(var s,r=this.inputHandlers,n=0,a=r.length;n0?0:1,0===n.minWidth&&n.setMinWidth(this.itemWidth)),0===n.minHeight&&n.setMinHeight(this.itemHeight),this.add(n,{proportion:r,expand:!0})),i.onValueChange&&n.childrenMap.inputField.on("valuechange",i.onValueChange),n.setAutoUpdateEnable(i.autoUpdate),n.setBindingTarget(t,e),i.monitor&&n.startMonitorTarget(),i.key&&this.root.addChildrenMap(i.key,n),this):(console.error(`[Tweaker] Can't add Input\n title: ${i.title}\n view: ${i.view}\n`),this)},addButtons:function(t){void 0===t&&(t={});var e=this.scene,i=t.bindingTarget;delete t.bindingTarget;var s=Py(this.styles,"inputRow")||{},r=Oy(e,t,s);return this.add(r,{expand:!0}),i&&r.setBindingTarget(i),t.key&&this.root.addChildrenMap(t.key,r),this},addButton:function(t){return void 0===t&&(t={}),t.buttons=[{label:t.label,callback:t.callback}],delete t.label,delete t.callback,this.addButtons(t),this},addSeparator:function(t){void 0===t&&(t={});var e=function(t,e,i){return Zc(t,$v(e,i))}(this.scene,t,Ty(this.styles,"separator"));return this.add(e,{expand:!0}),this},addRows:function(t,e,i){return"boolean"==typeof e&&(i=e,e=void 0),void 0===i&&(i=!0),_y(this,$o(t),e,i),this},setBindingTarget:function(t){for(var e=this.sizerChildren,i=0,s=e.length;i=r&&o=i&&oi.length&&(t.prevCursorPosition=null),null!==t.prevCursorPosition&&(s=e.getCharChild(t.prevCursorPosition))&&("\n"===s.text&&s.clearTextSize(),e.emit("cursorout",s,t.prevCursorPosition,e)),null!=r&&(s=e.getCharChild(r))&&("\n"===s.text&&s.copyTextSize(e.lastInsertCursor),function(t){var e,i,s=t.parent,r=s.width,n=s.height,a=t.drawX,h=t.drawY,o=a+t.drawTLX,l=a+t.drawTRX,d=h+t.drawTLY,c=h+t.drawBLY;e=o<0?0-o:l>r?r-l:0,i=d<0?0-d:c>n?n-c:0,s._textOX+=e,s._textOY+=i}(s),e.emit("cursorin",s,r,e)),e.emit("movecursor",r,t.prevCursorPosition,e),t.prevCursorPosition=r)}(this)):(qy(this),Zy(this)),this}setNumberInput(){return this.onUpdateCallback=Jy,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}}const eb=Phaser.Utils.Objects.GetValue,ib=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var sb=function(t,e){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return!0;if(-1!==e.indexOf(".")){for(var i=e.split("."),s=t,r=0;rt.length?i:t})),a.value=t.join(e)}else a.value=t.join(i.slice(h,h+a.count));h+=a.count,a.added||(o+=a.count)}}let l=e[a-1];return a>1&&"string"==typeof l.value&&(l.added||l.removed)&&t.equals("",l.value)&&(e[a-2].value+=l.value,e.pop()),e}cb.prototype={diff(t,e,i={}){let s=i.callback;"function"==typeof i&&(s=i,i={}),this.options=i;let r=this;function n(t){return s?(setTimeout((function(){s(void 0,t)}),0),!0):t}t=this.castInput(t),e=this.castInput(e),t=this.removeEmpty(this.tokenize(t));let a=(e=this.removeEmpty(this.tokenize(e))).length,h=t.length,o=1,l=a+h;i.maxEditLength&&(l=Math.min(l,i.maxEditLength));let d=[{newPos:-1,components:[]}],c=this.extractCommon(d[0],e,t,0);if(d[0].newPos+1>=a&&c+1>=h)return n([{value:this.join(e),count:e.length}]);function u(){for(let s=-1*o;s<=o;s+=2){let o,l=d[s-1],c=d[s+1],u=(c?c.newPos:0)-s;l&&(d[s-1]=void 0);let p=l&&l.newPos+1=a&&u+1>=h)return n(ub(r,o.components,e,t,r.useLongestToken));d[s]=o}else d[s]=void 0}var i;o++}if(s)!function t(){setTimeout((function(){if(o>l)return s();u()||t()}),0)}();else for(;o<=l;){let t=u();if(t)return t}},pushComponent(t,e,i){let s=t[t.length-1];s&&s.added===e&&s.removed===i?t[t.length-1]={count:s.count+1,added:e,removed:i}:t.push({count:1,added:e,removed:i})},extractCommon(t,e,i,s){let r=e.length,n=i.length,a=t.newPos,h=a-s,o=0;for(;a+1t,tokenize:t=>t.split(""),join:t=>t.join("")};const pb=new cb,gb=/^[a-zA-Z\u{C0}-\u{FF}\u{D8}-\u{F6}\u{F8}-\u{2C6}\u{2C8}-\u{2D7}\u{2DE}-\u{2FF}\u{1E00}-\u{1EFF}]+$/u,vb=/\S/,fb=new cb;fb.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!vb.test(t)&&!vb.test(e)},fb.tokenize=function(t){let e=t.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/);for(let t=0;tvoid 0===i?e:i}=this.options;return"string"==typeof t?t:JSON.stringify(xb(t,null,null,i),i," ")},bb.equals=function(t,e){return cb.prototype.equals.call(bb,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const Cb=new cb;Cb.tokenize=function(t){return t.slice()},Cb.join=Cb.removeEmpty=function(t){return t};const wb=Phaser.Utils.Array.Remove;var Sb=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),wb(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(o=i,l=e,pb.diff(o,l,d)),r=0,n=0,a=s.length;nr)i+=a;else{if(s!==r)break;i+=Math.min(e.position,a)}}return i},_b={cursorMoveLeft(){if(!this.isOpened)return this;var t=Ob(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=Ob(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=Pb(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=Ob(Tb(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=Pb(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=Ob(Tb(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const Mb=Phaser.Utils.Objects.IsPlainObject;class Eb extends Wl{constructor(t,e,i,s,r,n){Mb(e)?n=e:Mb(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(sb(e,"wrap.vAlign")||vc(e,"wrap.vAlign",s=i?"center":"top"),sb(e,"wrap.wrapMode")||vc(e,"wrap.wrapMode","char"),sb(e,"wrap.maxLines")||vc(e,"wrap.maxLines",s=i?1:void 0),i&&vc(e,"wrap.wrapWidth",1/0),sb(e,"wrap.useDefaultTextHeight")||vc(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!sb(e.edit,"inputType")){var s=i?"text":"textarea";vc(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new nb(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var a=n.text;a&&delete n.text;var h=ud(n.background,"focus"),o=ud(n.style,"cursor"),l=ud(n.style,"range");super(t,e,i,s,r,n),this.type="rexCanvasInput",this.contentWidth=void 0,this.contentHeight=void 0,this.lineHeight=void 0,this.linesCount=void 0,this.characterCountOfLines=[],this._text,this.textEdit=function(t,e){var i=eb(e,"edit");return void 0===i&&(i={}),Ay(e,i,ib),new tb(t,i)}(this,n),ab.call(this),n.focusStyle&&Object.assign(h,n.focusStyle),db.call(this,h),n.cursorStyle&&Object.assign(o,n.cursorStyle),ob.call(this,o),n.rangeStyle&&Object.assign(l,n.rangeStyle),hb(l)&&Object.assign(l,o),lb.call(this,l);var d=n.onAddChar;d&&this.on("addchar",d);var c=n.onCursorIn;c&&this.on("cursorin",c);var u=n.onCursorOut;u&&this.on("cursorout",u);var p=!n.onRangeIn&&!n.onRangeOut,g=p?n.onCursorIn:n.onRangeIn;g&&this.on("rangein",g);var v=p?n.onCursorOut:n.onRangeOut;v&&this.on("rangeout",v);var f,m=n.onMoveCursor;m&&this.on("movecursor",m),this.setParseTextCallback(n.parseTextCallback),this.lastInsertCursor=((f=this.createCharChild("|")).text="",f),a||(a=""),this.setText(a)}addChild(t,e){if(super.addChild(t,e),Array.isArray(t))for(var i=t,s=0,r=i.length;st.hasOwnProperty("view")?"string"===t.view:"string"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.TextInput";var s=e.inputText,r=Lb(i,s);t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))}},Ab={setText(t){return this.childrenMap.child.setText(t),this},appendText(t){return this.setText(this.text+t),this}},Bb={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const Wb=Phaser.Utils.Objects.GetValue;class zb extends dv{constructor(t,e){void 0===e&&(e={});var i,s=Wb(e,"text");xt(s)?i=s:(void 0===s&&(s={}),s.textArea=!0,i=new Eb(t,s),t.add.existing(i)),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textVisibleHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.contentHeight}})}(i);var r=void 0===s.width,n=void 0===s.height;r&&(i.minWidth=0),n&&(i.minHeight=0),e.scrollMode=0,e.type="rexTextAreaInput",e.child={gameObject:i,expandWidth:r,expandHeight:n};var a,h,o=Wb(e,"space",void 0);o&&(o.child=Wb(o,"text",0)),e.scroller=!1,super(t,e),this.addChildrenMap("text",i),i.on("cursorin",(function(){var t=i.textOY,e=i.contentHeight,s=a!==t,r=h!==e;a=t,h=e,r&&this.resizeController(),(s||r)&&(this.t=i.t)}),this),i.on("textchange",(function(t){this.emit("textchange",t,this)}),this).on("close",(function(){this.emit("close",this.text,this)}),this);var l=Wb(e,"content",void 0);l&&this.setText(l)}get text(){return this.childrenMap.child.text}set text(t){t=null==t?"":t.toString(),this.childrenMap.child.text!==t&&this.setText(t)}get lineHeight(){return this.childrenMap.child.lineHeight}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.contentHeight}get readOnly(){return this.childrenMap.child.readOnly}set readOnly(t){this.childrenMap.child.readOnly=t}setReadOnly(t){return this.childrenMap.child.setReadOnly(t),this}get value(){return this.text}set value(t){this.text=t}}Object.assign(zb.prototype,Ab,Bb);var Ib={name:"TextAreaInput",accept:t=>!!t.hasOwnProperty("view")&&"textarea"===t.view,build(t,e){var i=t.scene;this.type="rexTweaker.TextAreaInput";var s=e.inputTextArea;void 0===s&&(s={}),s.hasOwnProperty("text")||(s.text=e.inputText),s.hasOwnProperty("slider")||(s.slider=e.slider);var r=function(t,e,i){void 0===i&&(i=!0),i?e=e?$o(e):{}:e||(e={});var s=new zb(t,e);return t.add.existing(s),s}(i,s);t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))},onBindTarget(t){t.childrenMap.inputText.scrollToTop()}},Yb={name:"NumberInput",accept:t=>t.hasOwnProperty("view")?"number"===t.view:"number"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.NumberInput";var s=e.inputNumber||e.inputText,r=Lb(i,s).setNumberInput();t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly),t.isFloatType=!e.int},filterValue:(t,e)=>t.isFloatType?e:Math.floor(e),displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))}};const jb=Phaser.Utils.Objects.GetValue,Xb=Phaser.Math.Linear,Fb=Phaser.Math.Snap.Floor;var Hb={name:"RangeInput",accept:t=>t.hasOwnProperty("view")?"range"===t.view:"number"==typeof t.value&&t.hasOwnProperty("min")&&t.hasOwnProperty("max"),build(t,e){var i=t.scene;t.type="rexTweaker.RangeInput";var s=e.slider,r=0===t.orientation?"track.height":"track.width",n=jb(s,r),a=function(t,e){var i=new Ag(t,e);return t.add.existing(i),i}(i,s),h=e.defaultExpandWidth?2:0,o=jb(e,"proportion.range.slider",h),l=void 0===n;t.add(a,{proportion:o,expand:l,key:"slider"});var d=e.inputNumber||e.inputText,c=Lb(i,d).setNumberInput();h=e.defaultExpandWidth?1:0,o=jb(e,"proportion.range.inputText",h),t.add(c,{proportion:o,expand:!0,key:"inputText"}),c.on("close",(function(){t.setValue(c.value)})),a.on("valuechange",(function(){var e=Xb(t.minValue,t.maxValue,a.value);t.step&&(e=Fb(e,t.step,t.minValue)),t.setValue(e)}))},setup(t,e,i){(i||e.hasOwnProperty("max"))&&function(t,e,i,s){t.minValue=e,t.maxValue=i,t.step=s,t.childrenMap.slider.setGap(s,e,i)}(t,e.min,e.max,e.step),(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.slider.setValue(e,t.minValue,t.maxValue),t.childrenMap.inputText.setText("").setText(t.getFotmatText(e))}},Vb=function(t,e){var i=new Ef(t,e);return t.add.existing(i),i};const Gb=Phaser.Utils.Objects.GetValue;var Ub={name:"RangeInput",accept:t=>!!t.hasOwnProperty("view")&&"incdec"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.IncDecInput";var s=Gb(e,"incDec")||{},r={text:null,action:null},n=Vb(i,{expand:!1}),a=e.defaultExpandWidth?1:0;t.add(n,{proportion:a,expand:!0});var h=e.inputNumber||e.inputText,o=Lb(i,h).setNumberInput();o.on("close",(function(){t.setValue(o.value)}));var l=Object.assign($o(r),s.incButton||{}),d=km(i,l),c=Object.assign($o(r),s.decButton||{}),u=km(i,c);n.addButton(d),n.addButton(u);var p=s.inputTextIndex||0;n.insert(p,o,{proportion:1,expand:!0}),t.step=1,t.minValue=void 0,t.maxValue=void 0,n.on("button.click",(function(e,i,s,r){var n=t.value;0===i?n+=t.step:n-=t.step,void 0!==t.maxValue&&n>t.maxValue&&(n=t.maxValue),void 0!==t.minValue&&n0&&{height:this.colorComponentsHeight,formatLabel:this.colorComponentsFormatLabelConfig,inputText:this.colorComponentsInputTextConfig,space:this.colorComponentsSpace};var a=new Yx(t,{width:s,height:n,background:e,space:this.colorPickerSpace,hPalette:{position:this.colorPickerHPalettePosition},colorComponents:r,value:this.value});return t.add.existing(a),a};const Xx=Phaser.Utils.Objects.GetValue;var Fx=function(t,e){var i=Xx(e,"expandDirection",void 0);"string"==typeof i&&(i=Hx[i]);var s,r,n,a,h,o,l,d=(n="alignTargetX",sb(s=e,r="alignTarget")?Es(s,r):n&&sb(s,n)?Es(s,n):a&&sb(s,a)?Es(s,a):h),c=Xx(e,"alignTargetY",d),u=Xx(e,"alignOffsetX",0),p=Xx(e,"alignOffsetY",0),g=Xx(e,"alignSide","").includes("right"),v=Xx(e,"bounds"),f=0===i,m=!(f||1===i),y=g?1:0,b=f||m?0:1;t.setOrigin(y,b),o=g?d.getTopRight().x:d.getTopLeft().x,l=c.getBottomLeft().y,t.setPosition(o+u,l+p);var x=v;x||(x=At(t.scene)),m&&t.getBottomLeft().y>x.bottom&&(l=c.getTopLeft().y,t.setOrigin(0,1).setPosition(o+u,l+p))};const Hx={down:0,up:1},Vx=Phaser.Utils.Objects.GetValue;class Gx extends Hs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=function(t,e){Ri(t,e,"y","Cubic")}),null==e.transitOut&&(e.transitOut=function(t,e){!function(t,e,i,s,r){void 0===s&&(s="Linear");var n={mode:0};switch(i){case 0:case"x":n.end={x:0};break;case 1:case"y":n.end={y:0};break;default:n.end=0}n.duration=e,n.ease=s,void 0===r?r=new Mi(t,n):r.resetFromJSON(n),r.restart()}(t,e,"y","Linear")}),e.manualClose=!0,e.clickOutsideClose=!0,e.destroy=!0,super(t,e),Fx(t,e),t.isRexSizer&&t.layout();var i=Vx(e,"touchOutsideClose",!1),s=Vx(e,"anyTouchClose",!1);s&&(i=!1),s?this.once("open",this.anyTouchClose,this):i&&this.once("open",this.touchOutsideClose,this),this.requestOpen()}shutdown(t){this.isShutdown||(this.scene.input.off("pointerup",this.touchCloseCallback,this),super.shutdown(t))}touchOutsideClose(){return this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&ir(this.parent,t.worldX,t.worldY)||this.requestClose()}onOpen(){this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.parent,this),super.onClose()}}var Ux={openColorPicker:function(){if(!this.colorPicker){var t=jx.call(this).layout(),e=new Gx(t,{duration:{in:this.colorPickerEaseInDuration,out:this.colorPickerEaseOutDuration},transitIn:this.colorPickerTransitInCallback,transitOut:this.colorPickerTransitOutCallback,expandDirection:this.colorPickerExpandDirection,alignTargetX:this,alignTargetY:this,bounds:this.colorPickerBounds,touchOutsideClose:!0}).on("open",(function(){t.on("valuechange",(function(t){this.setValue(t)}),this)}),this).on("close",(function(){this.colorPicker=void 0,this.dropDownBehavior=void 0}),this);return this.colorPicker=t,this.dropDownBehavior=e,this.pin(t),this}}};Object.assign(Ux,ax);const Nx=Phaser.Utils.Objects.GetValue;class $x extends nx{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexColorInput",e.hasOwnProperty("colorPicker")||(e.colorPicker={background:{color:0}});var i=e.colorPicker,s=!1!==i&&null!==i;if(s){var r;this.setColorPickerSize(Nx(i,"width",160),Nx(i,"height",170));var n=Nx(i,"background");r=n?function(t){return Zc(t,n)}:Nx(i,"createBackgroundCallback"),this.setCreateColorPickerBackgroundCallback(r),this.setColorPickerHPalettePosition(Nx(i,"hPalettePosition",0)),this.setColorPickerExpandDirection(Nx(i,"expandDirection")),this.setColorPickerEaseInDuration(Nx(i,"easeIn",200)),this.setColorPickerEaseOutDuration(Nx(i,"easeOut",200)),this.setColorPickerTransitInCallback(Nx(i,"transitIn")),this.setColorPickerTransitOutCallback(Nx(i,"transitOut")),this.setColorPickerBounds(Nx(i,"bounds"));var a=Nx(i,"space");void 0===a&&(a={left:10,right:10,top:10,bottom:10,item:8}),this.setColorPickerSpace(a)}var h=e.colorComponents;if(s&&!1!==h&&null!==h){this.setColorComponentsHeight(Nx(h,"height",30)),this.setColorComponentsFormatLabelConfig(Nx(h,"formatLabel"));var o=Nx(h,"inputText");o||(o=Nx(e,"inputText")),this.setColorComponentsInputTextConfig(o);var l=Nx(h,"space");void 0===l&&(l={item:8}),this.setColorComponentsSpace(l)}var d=this.childrenMap.swatch;d&&s&&this.onClick(d,this.openColorPicker,this)}}Object.assign($x.prototype,Ux);var Kx={name:"ColorInput",accept:t=>!!t.hasOwnProperty("view")&&"color"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.ColorInput";var s=e.colorInput;void 0===s&&(s={}),s.hasOwnProperty("inputText")||(s.inputText=e.inputText);var r=function(t,e,i){void 0===i&&(i=!0),i?e=e?$o(e):{}:e||(e={});var s=new $x(t,e);return t.add.existing(s),s}(i,s);t.add(r,{proportion:1,expand:!0,key:"colorInput"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.colorInput.setValue(e)}},Jx={setBoxFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.boxFillColor!==t||this.boxFillAlpha!==e,this.boxFillColor=t,this.boxFillAlpha=e,this},setUncheckedBoxFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.uncheckedBoxFillColor!==t||this.uncheckedBoxFillAlpha!==e,this.uncheckedBoxFillColor=t,this.uncheckedBoxFillAlpha=e,this},setBoxStrokeStyle(t,e,i){return void 0===i&&(i=1),this.dirty=this.dirty||this.boxLineWidth!==t||this.boxStrokeColor!==e||this.boxStrokeAlpha!==i,this.boxLineWidth=t,this.boxStrokeColor=e,this.boxStrokeAlpha=i,this},setUncheckedBoxStrokeStyle(t,e,i){return void 0===i&&(i=1),this.dirty=this.dirty||this.uncheckedBoxLineWidth!==t||this.uncheckedBoxStrokeColor!==e||this.uncheckedBoxStrokeAlpha!==i,this.uncheckedBoxLineWidth=t,this.uncheckedBoxStrokeColor=e,this.uncheckedBoxStrokeAlpha=i,this},setCheckerStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.checkerColor!==t||this.checkAlpha!==e,this.checkerColor=t,this.checkAlpha=e,this},setBoxShape(t){return void 0===t&&(t=!1),this.isCircleShape===t||(this.isCircleShape=t,this.isSizeChanged=!0,this.dirty=!0),this}},qx={setBoxSize(t){return this.dirty=this.dirty||this.boxSize!==t,this.boxSize=t,this},setCheckerSize(t){return this.dirty=this.dirty||this.checkerSize!==t,this.checkerSize=t,this}},Zx={buildShapes(){this.addShape((new oc).setName("box")).addShape((new ac).setName("checker"))},updateShapes(){var t=this.width/2,e=this.height/2,i=Math.min(t,e),s=2*i,r=t-i,n=e-i,a=this.boxLineWidth,h=Math.max(s/10,2),o=this.getShape("box"),l=this.getShape("checker");if(this.isSizeChanged){var d=s*(1-this.boxSize)/2,c=a/2,u=s*this.boxSize-a;o.setTopLeftPosition(r+c+d,n+c+d).setSize(u,u),this.isCircleShape?o.setRadius(u/2):o.setRadius(0),d=s*(1-this.checkerSize)/2;var p=s*this.checkerSize/4,g=1*p,v=2*p,f=3*p;l.startAt(g,v).lineTo(v,f).lineTo(f,g).offset(r+d,n+d).end()}this.checked?(o.fillStyle(this.boxFillColor,this.boxFillAlpha).lineStyle(a,this.boxStrokeColor,this.boxStrokeAlpha),l.lineStyle(h,this.checkerColor)):(o.fillStyle(this.uncheckedBoxFillColor,this.uncheckedBoxFillAlpha).lineStyle(a,this.uncheckedBoxStrokeColor,this.uncheckedBoxStrokeAlpha),l.lineStyle()),this.checked&&l.setDisplayPathSegment(this.checkerAnimProgress)}},Qx={setCheckerAnimationDuration(t){return void 0===t&&(t=0),this.checkerAnimDuration=t,this},playCheckerAnimation(){return void 0===this.checkerAnimProgressTask&&(this.checkerAnimProgressTask=new gs(this,{eventEmitter:null})),this.checkerAnimProgressTask.restart({key:"checkerAnimProgress",from:0,to:1,duration:this.checkerAnimDuration}),this},stopCheckerAnimation(){return void 0===this.checkerAnimProgressTask||this.checkerAnimProgressTask.stop(),this}},tC={};Object.assign(tC,Jx,qx,Zx,Qx);const eC=23730,iC=Phaser.Utils.Objects.GetValue,sC=Phaser.Utils.Objects.IsPlainObject;class rC extends Pd{constructor(t,e,i,s,r,n,a){sC(e)?(e=iC(a=e,"x",0),i=iC(a,"y",0),s=iC(a,"width",2),r=iC(a,"height",2),n=iC(a,"color",eC)):sC(n)&&(n=iC(a=n,"color",eC)),super(t,e,i,s,r),this.type="rexCheckbox",void 0===n&&(n=eC),this.setBoxShape(iC(a,"circleBox",!1)),this.setBoxFillStyle(n,iC(a,"boxFillAlpha",1)),this.setUncheckedBoxFillStyle(iC(a,"uncheckedColor",null),iC(a,"uncheckedBoxFillAlpha",1)),this.setBoxStrokeStyle(iC(a,"boxLineWidth",4),iC(a,"boxStrokeColor",n),iC(a,"boxStrokeAlpha",1)),this.setUncheckedBoxStrokeStyle(this.boxLineWidth,iC(a,"uncheckedBoxStrokeColor",this.boxStrokeColor),iC(a,"uncheckedBoxStrokeAlpha",this.boxStrokeAlpha)),this.setCheckerStyle(iC(a,"checkerColor",16777215),iC(a,"checkerAlpha",1)),this.setBoxSize(iC(a,"boxSize",1)),this.setCheckerSize(iC(a,"checkerSize",1)),this.setCheckerAnimationDuration(iC(a,"animationDuration",150)),this.buildShapes();var h=iC(a,"checked");void 0===h&&(h=iC(a,"value",!1)),this.setValue(h)}get value(){return this._value}set value(t){t=!!t,this._value!==t&&(this.dirty=!0,this._value=t,t?this.playCheckerAnimation():this.stopCheckerAnimation(),this.emit("valuechange",t))}setValue(t){return this.value=t,this}toggleValue(){return this.setValue(!this.value),this}get checked(){return this.value}set checked(t){this.value=t}setChecked(t){return void 0===t&&(t=!0),this.setValue(t),this}toggleChecked(){return this.toggleValue(),this}get checkerAnimProgress(){return this._checkerAnimProgress}set checkerAnimProgress(t){this._checkerAnimProgress!==t&&(this._checkerAnimProgress=t,this.dirty=!0)}}Object.assign(rC.prototype,tC);const nC=Phaser.Utils.Objects.GetValue,aC=Phaser.Utils.Objects.IsPlainObject;class hC extends rC{constructor(t,e,i,s,r,n,a){aC(e)?(e=nC(a=e,"x",0),i=nC(a,"y",0),s=nC(a,"width",2),r=nC(a,"height",2),n=nC(a,"color",eC)):aC(n)&&(n=nC(a=n,"color",eC)),super(t,e,i,s,r,n,a),this._click=new Sr(this,nC(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(nC(a,"readOnly",!1))}get readOnly(){return!this._click.enable}set readOnly(t){this._click.enable=!t}setReadOnly(t){return void 0===t&&(t=!0),this.readOnly=t,this}}var oC={name:"CheckboxInput",accept:t=>t.hasOwnProperty("view")?"boolean"===t.view:"boolean"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.CheckboxInput";var s=e.checkbox,r=function(t,e){var i=new hC(t,e);return t.add.existing(i),i}(i,s),n=s.size;void 0!==n&&r.setSize(n,n);var a=void 0!==n?0:1;t.add(r,{proportion:0,expand:!1,fitRatio:a,key:"checkbox"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.checkbox.setValue(e)}},lC={setTrackFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.trackFillColor!==t||this.trackFillAlpha!==e,this.trackFillColor=t,this.trackFillAlpha=e,this},setFalseValueTrackFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.falseValueTrackColor!==t||this.uncheckedTrackFillAlpha!==e,this.falseValueTrackColor=t,this.falseValueTrackFillAlpha=e,this},setThumbStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.thumbColor!==t||this.checkAlpha!==e,this.thumbColor=t,this.thumbAlpha=e,this}},dC={setTrackSize(t,e){return this.dirty=this.dirty||this.trackWidth!==t||this.trackHeight!==e,this.trackWidth=t,this.trackHeight=e,this},setTrackRadius(t){return this.dirty=this.dirty||this.trackRadius!==t,this.trackRadius=t,this},setThumbSize(t,e){return void 0===e&&(e=t),this.dirty=this.dirty||this.thumbWidth!==t||this.thumbHeight!==e,this.thumbWidth=t,this.thumbHeight=e,this},setThumbRadius(t){return this.dirty=this.dirty||this.thumbRadius!==t,this.thumbRadius=t,this}},cC={setThumbPosition(t,e){return void 0===e&&(e=1-t),this.thumbLeftX=t,this.thumbRightX=e,this},setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}},uC=function(t,e,i){return(e-t)*i+t},pC=function(t){return t>>16&255},gC=function(t){return t>>8&255},vC=function(t){return 255&t};const fC=Phaser.Math.Linear;var mC={buildShapes(){this.addShape((new oc).setName("track")).addShape((new oc).setName("thumb"))},updateShapes(){var t=this.width,e=this.height,i=this.value?this.toggleAnimProgress:1-this.toggleAnimProgress,s=this.getShape("track");if(this.isSizeChanged){var r=t*this.trackWidth,n=e*this.trackHeight,a=(t-r)/2,h=(e-n)/2,o=e*this.trackRadius;s.setTopLeftPosition(a,h).setSize(r,n).setRadius(o)}var l,d,c,u=(l=this.falseValueTrackColor,d=this.trackFillColor,c=i,(255&uC(pC(l),pC(d),c))<<16|(255&uC(gC(l),gC(d),c))<<8|255&uC(vC(l),vC(d),c)),p=fC(this.falseValueTrackFillAlpha,this.trackFillAlpha,i);s.fillStyle(u,p);var g=this.getShape("thumb");if(this.isSizeChanged){var v=t*this.thumbWidth,f=e*this.thumbHeight,m=e*this.thumbRadius;g.setSize(v,f).setRadius(m)}var y=fC(this.thumbLeftX,this.thumbRightX,i)*t;this.rtl&&(y=t-y);var b=e/2;g.setCenterPosition(y,b),g.fillStyle(this.thumbColor,this.thumbAlpha)}},yC={setToggleAnimationDuration(t){return void 0===t&&(t=0),this.toggleAnimDuration=t,this},playToggleAnimation(){return void 0===this.toggleAnimProgressTask&&(this.toggleAnimProgressTask=new gs(this,{eventEmitter:null})),this.toggleAnimProgressTask.restart({key:"toggleAnimProgress",from:0,to:1,duration:this.toggleAnimDuration}),this},stopToggleAnimation(){return void 0===this.toggleAnimProgressTask||this.toggleAnimProgressTask.stop(),this}},bC={};Object.assign(bC,lC,dC,cC,mC,yC);const xC=Phaser.Utils.Objects.GetValue,CC=Phaser.Utils.Objects.IsPlainObject,wC=23730;class SC extends Pd{constructor(t,e,i,s,r,n,a){CC(e)?(e=xC(a=e,"x",0),i=xC(a,"y",0),s=xC(a,"width",2),r=xC(a,"height",2),n=xC(a,"color",wC)):CC(n)&&(n=xC(a=n,"color",wC)),super(t,e,i,s,r),this.type="rexToggleSwitch",void 0===n&&(n=wC),this.setTrackFillStyle(n,xC(a,"trackFillAlpha",1)),this.setFalseValueTrackFillStyle(xC(a,"falseValueTrackColor",function(t){var e=.3*pC(t)+.59*gC(t)+.11*vC(t);return(255&e)<<16|(255&e)<<8|255&e}(n)),xC(a,"falseValueTrackFillAlpha",1)),this.setThumbStyle(xC(a,"thumbColor",16777215),xC(a,"thumbAlpha",1)),this.setTrackSize(xC(a,"trackWidth",.9),xC(a,"trackHeight",.5)),this.setTrackRadius(xC(a,"trackRadius",.5*this.trackHeight));var h=xC(a,"thumbHeight",void 0),o=xC(a,"thumbWidth",h);void 0===o&&(o=.9*this.trackHeight),this.setThumbSize(o,h),this.setThumbRadius(xC(a,"thumbRadius",.5*this.thumbHeight)),this.setThumbPosition(xC(a,"thumbLeft",.3),xC(a,"thumbRight",void 0)),this.setRTL(xC(a,"rtl",!1)),this.setToggleAnimationDuration(xC(a,"animationDuration",150)),this.buildShapes(),this.setValue(xC(a,"value",!1),0)}get value(){return this._value}set value(t){t=!!t,this._value!==t&&(this.dirty=!0,this._value=t,this.playToggleAnimation(),this.emit("valuechange",t))}setValue(t,e){void 0===e&&(e=this.toggleAnimDuration);var i=this.toggleAnimDuration;return this.toggleAnimDuration=e,this.value=t,this.toggleAnimDuration=i,this}toggleValue(t){return this.setValue(!this.value,t),this}get toggleAnimProgress(){return this._toggleAnimProgress}set toggleAnimProgress(t){this._toggleAnimProgress!==t&&(this._toggleAnimProgress=t,this.dirty=!0)}}Object.assign(SC.prototype,bC);const kC=Phaser.Utils.Objects.GetValue;class OC extends SC{constructor(t,e,i,s,r,n,a){super(t,e,i,s,r,n,a),this._click=new Sr(this,kC(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(kC(a,"readOnly",!1))}get readOnly(){return!this._click.enable}set readOnly(t){this._click.enable=!t}setReadOnly(t){return void 0===t&&(t=!0),this.readOnly=t,this}}var PC={name:"ToggleSwitchInput",accept:t=>!!t.hasOwnProperty("view")&&"toggleSwitch"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.ToggleSwitchInput";var s=e.toggleSwitch,r=function(t,e){var i=new OC(t,e);return t.add.existing(i),i}(i,s),n=s.size;void 0!==n&&r.setSize(n,n);var a=void 0!==n?0:1;t.addSpace().add(r,{proportion:0,expand:!1,fitRatio:a,key:"toggleSwitch"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.toggleSwitch.setValue(e)}},TC={setWrapEnable(t){return void 0===t&&(t=!0),this.listWrapEnable=t,this},setCreateButtonCallback(t){return this.listCreateButtonCallback=t,this},setCreateListBackgroundCallback(t){return this.listCreateBackgroundCallback=t,this},setCreateListSliderTrackCallback(t){return this.listCreateSliderTrackCallback=t,this},setCreateListSliderThumbCallback(t){return this.listCreateSliderThumbCallback=t,this},setListSliderAdaptThumbSizeEnable(t){return void 0===t&&(t=!0),this.listSliderAdaptThumbSizeEnable=t,this},setListScrollerConfig(t){return void 0===t&&(t={}),this.listScrollerConfig=t,this},setListMouseWheelScrollerConfig(t){return this.listMouseWheelScrollerConfig=t,this},setButtonClickCallback(t){return this.listOnButtonClick=t,this},setButtonOverCallback(t){return this.listOnButtonOver=t,this},setButtonOutCallback(t){return this.listOnButtonOut=t,this},setListExpandDirection(t){return"string"==typeof t&&(t=_C[t]),this.listExpandDirection=t,this},setListEaseInDuration(t){return void 0===t&&(t=0),this.listEaseInDuration=t,this},setListEaseOutDuration(t){return void 0===t&&(t=0),this.listEaseOutDuration=t,this},setListTransitInCallback(t){return this.listTransitInCallback=t,this},settListTransitOutCallback(t){return this.listTransitOutCallback=t,this},setListBounds(t){return this.listBounds=t,this},setListWidth(t){return this.listWidth=t,this},setListHeight(t){return this.listHeight=t,this},setListSize(t,e){return this.setListWidth(t).setListHeight(e),this},setListMaxHeight(t){return this.listMaxHeight=t,this},setListAlignmentMode(t){return this.listAlignMode=t,this},setListAlignmentSide(t){return void 0===t&&(t=""),this.listAlignSide=t,this},setListSpace(t){return void 0===t&&(t={}),this.listSpace=t,this},setListDraggable(t){return void 0===t&&(t=!0),this.listDraggable=t,this}};const _C={down:0,up:1},MC=Phaser.Utils.Objects.GetValue;var EC=function(){var t,e=this.scene,i=this.listCreateBackgroundCallback;i&&(t=i.call(this,e),e.add.existing(t));var s=[],r=this.listCreateButtonCallback;if(r)for(var n=this.options,a=0,h=n.length;a0||this.listMaxHeight>0)){if(s=RC(e,u,this.listWrapEnable),this.listMaxHeight>0&&(s.layout(),s.height<=this.listMaxHeight&&(d=s)),!d){0===c&&(c=this.listMaxHeight);var p=LC(e,this.listCreateSliderTrackCallback),g=LC(e,this.listCreateSliderThumbCallback);d=new ny(e,{height:c,scrollMode:0,panel:{child:s,mask:{padding:1}},slider:{track:p,thumb:g,adaptThumbSize:this.listSliderAdaptThumbSizeEnable},scrollDetectionMode:1,scroller:this.listScrollerConfig,mouseWheelScroller:this.listMouseWheelScrollerConfig,space:{panel:MC(this.listSpace,"panel",0)}}),e.add.existing(d)}}else u.height=c,s=RC(e,u,this.listWrapEnable),d=s;return t&&d.addBackground(t,"background"),this.listDraggable&&d.setDraggable(!0),d!==s&&s.on("button.over",(function(t,e,i,s){d.emit("button.over",t,e,i,s)})).on("button.out",(function(t,e,i,s){d.emit("button.out",t,e,i,s)})).on("button.click",(function(t,e,i,s){d.emit("button.click",t,e,i,s)})),d},RC=function(t,e,i){var s;return i?(e.orientation="x",s=new Yf(t,e)):(e.orientation="y",s=new Ef(t,e)),t.add.existing(s),s},LC=function(t,e,i){var s;return e&&(s=e.call(i,t),t.add.existing(s)),s},DC={focusNextButton(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;return t=void 0===e?0:(e+1)%this.listPanel.getButtons().length,this.emitButtonOver(t),this},focusPrevButton(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;if(void 0===e)t=0;else{var i=this.listPanel.getButtons().length;t=(e-1+i)%i}return this.emitButtonOver(t),this}},AC={openListPanel:function(){if(this.listPanel)return this;if(0===this.options.length)return this;var t,e=EC.call(this);e.on("button.over",(function(t,i,s,r){this.currentOverIndex=i,this.listOnButtonOver&&this.listOnButtonOver.call(this,t,i,s,r),this.emit("button.over",this,e,t,i,s,r)}),this).on("button.out",(function(t,i,s,r){this.currentOverIndex===i&&(this.currentOverIndex=void 0),this.listOnButtonOut&&this.listOnButtonOut.call(this,t,i,s,r),this.emit("button.out",this,e,t,i,s,r)}),this),t=this.listAlignMode&&"label"!==this.listAlignMode?this.getElement(this.listAlignMode):this;var i=new Gx(e,{duration:{in:this.listEaseInDuration,out:this.listEaseOutDuration},transitIn:this.listTransitInCallback,transitOut:this.listTransitOutCallback,expandDirection:this.listExpandDirection,alignTargetX:t,alignTargetY:this,alignSide:this.listAlignSide,bounds:this.listBounds}).on("open",(function(){e.on("button.click",(function(t,i,s,r){this.listOnButtonClick&&this.listOnButtonClick.call(this,t,i,s,r),this.emit("button.click",this,e,t,i,s,r),this.dropDownBehavior.requestClose()}),this),this.emit("list.open",this,e)}),this).on("close",(function(){this.listPanel=void 0,this.dropDownBehavior=void 0,this.emit("list.close",this)}),this);return e.onClickOutside((function(){i.requestClose()})),this.listPanel=e,this.dropDownBehavior=i,this.pin(e),this},closeListPanel:function(){return this.dropDownBehavior?(this.dropDownBehavior.requestClose(),this.currentOverIndex=void 0,this):this},toggleListPanel:function(){return this.listPanel?this.closeListPanel():this.openListPanel(),this},emitButtonClick:function(t){if(void 0===t&&(t=this.currentOverIndex),void 0===t)return this;var e=this.listPanel,i=e?e.getButton(t):this.options[t];return this.listOnButtonClick&&this.listOnButtonClick.call(this,i,t),this.emit("button.click",this,e,i,t),this},emitButtonOver:function(t){var e=this.listPanel;return e?(e.emitButtonOver(t),this):this}};Object.assign(AC,TC,DC);const BC=Phaser.Utils.Objects.GetValue;class WC extends Gl{constructor(t,e){super(t,e),this.type="rexDropDownList",this.timer=void 0,this.listPanel=void 0,this.currentOverIndex=void 0,this.setOptions(BC(e,"options"));var i=BC(e,"list");this.setWrapEnable(BC(i,"wrap",!1)),this.setCreateButtonCallback(BC(i,"createButtonCallback")),this.setCreateListBackgroundCallback(BC(i,"createBackgroundCallback")),this.setCreateListSliderTrackCallback(BC(i,"createTrackCallback")),this.setCreateListSliderThumbCallback(BC(i,"createThumbCallback")),this.setListSliderAdaptThumbSizeEnable(BC(i,"sliderAdaptThumbSize",!1)),this.setListScrollerConfig(BC(i,"scroller")),this.setListMouseWheelScrollerConfig(BC(i,"mouseWheelScroller")),this.setButtonClickCallback(BC(i,"onButtonClick")),this.setButtonOverCallback(BC(i,"onButtonOver")),this.setButtonOutCallback(BC(i,"onButtonOut")),this.setListExpandDirection(BC(i,"expandDirection")),this.setListEaseInDuration(BC(i,"easeIn",500)),this.setListEaseOutDuration(BC(i,"easeOut",100)),this.setListTransitInCallback(BC(i,"transitIn")),this.settListTransitOutCallback(BC(i,"transitOut")),this.setListMaxHeight(BC(i,"maxHeight",0)),this.setListSize(BC(i,"width"),BC(i,"height",0)),this.setListAlignmentMode(BC(i,"alignParent","text")),this.setListAlignmentSide(BC(i,"alignSide","")),this.setListBounds(BC(i,"bounds")),this.setListSpace(BC(i,"space")),this.setListDraggable(BC(i,"draggable",!1)),this.setValueChangeCallback(BC(e,"setValueCallback"),BC(e,"setValueCallbackScope")),this.setValue(BC(e,"value")),this.onClick(this.toggleListPanel,this)}destroy(t){this.scene&&!this.ignoreDestroy&&(this.listPanel&&(this.listPanel.destroy(t),this.listPanel=void 0),super.destroy(t))}get isOpened(){return!!this.listPanel}setOptions(t){return void 0===t&&(t=[]),this.options=t,this}setValueChangeCallback(t,e){return this.valueChangeCallback=t,this.valueChangeCallbackScope=e,this}setValue(t){return this.value=t,this}get value(){return this._value}set value(t){if(this._value!==t){var e=this._value;this._value=t;var i=this.valueChangeCallback,s=this.valueChangeCallbackScope;i&&(s?i.call(s,this,t,e):i(this,t,e)),this.emit("valuechange",this,t,e)}}}Object.assign(WC.prototype,AC);var zC=function(t,e){e=function(t,e,i){void 0===i&&(i={});var s=(e=e?$o(e):{}).label||e.button,r=e.button||e.label;delete e.label,delete e.button;var n=i.label||i.button||i,a=i.button||i.label||i,h=Lv(t,s,n);h.list=e.list||{},h.list.createButtonCallback=function(t,e){var i=km(t,r,a).resetDisplayContent(e);return e.hasOwnProperty("value")&&(i.value=e.value),i};var o=e.track;o&&(h.list.createTrackCallback=function(t){return Zc(t,o)},delete e.track);var l=e.thumb;return l&&(h.list.createThumbCallback=function(t){return Zc(t,l)},delete e.thumb),h.list.onButtonOver=function(t,e,i,s){t.setHoverState&&t.setHoverState(!0)},h.list.onButtonOut=function(t,e,i,s){t.setHoverState&&t.setHoverState(!1)},h}(t,e);var i=new WC(t,e);return t.add.existing(i),i},IC=function(t,e){for(var i=0,s=t.length;it.hasOwnProperty("view")?"list"===t.view:t.hasOwnProperty("options"),build(t,e){var i=t.scene;t.type="rexTweaker.ListInput";var s=zC(i,e.list);t.add(s,{proportion:1,expand:!0,key:"list"}),s.on("button.click",(function(e,i,s,r,n,a){t.setValue(s.value)}))},setup(t,e,i){(i||e.hasOwnProperty("options"))&&function(t,e){t.childrenMap.list.setOptions(e)}(t,e.options)},displayValue(t,e){var i=t.childrenMap.list,s=function(t,e){var i=IC(t,e);if(null!=i)return t[i]}(i.options,e);i.resetDisplayContent(s).setMinSize(i.width,i.height).layout().setMinSize(0,0)}};const jC=Phaser.Utils.Objects.GetValue;var XC={name:"ButtonsInput",accept:t=>!!t.hasOwnProperty("view")&&"buttons"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.ButtonsInput";var s=e.button?$o(e.button):{},r=jC(s,"expand",!0);r&&(s.align="center"),delete s.expand;var n=Vb(i,{expand:r});n.buttonConfig=s,t.add(n,{proportion:1,expand:!0,key:"list"}),n.on("button.click",(function(e,i,s,r){var a=n.options[i];a&&(t._selectedIndex=i,t.setValue(a.value),t._selectedIndex=void 0)}))},setup(t,e,i){(i||e.hasOwnProperty("options"))&&function(t,e){var i=t.childrenMap.list;i.options=e;var s=t.scene,r=i.buttonConfig;i.clearButtons(!0);for(var n=0,a=e.length;n * @copyright 2018 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */const Pe=Phaser.Display.Canvas.CanvasPool;var Te=function(t){var e=Pe.create(this),i=e.getContext("2d",{willReadFrequently:!0});t.syncFont(e,i);var s=i.measureText(t.testString);if("actualBoundingBoxAscent"in s){var r=s.actualBoundingBoxAscent,n=s.actualBoundingBoxDescent,a={ascent:r,descent:n,fontSize:r+n};return Pe.remove(e),a}var o=Math.ceil(s.width*t.baselineX),h=o,l=2*h;if(h=h*t.baselineY|0,e.width=o,e.height=l,i.fillStyle="#f00",i.fillRect(0,0,o,l),i.font=t._font,i.textBaseline="alphabetic",i.fillStyle="#000",i.fillText(t.testString,0,h),a={ascent:0,descent:0,fontSize:0},!i.getImageData(0,0,o,l))return a.ascent=h,a.descent=h+6,a.fontSize=a.ascent+a.descent,Pe.remove(e),a;var d,c,u=i.getImageData(0,0,o,l).data,p=u.length,g=4*o,v=0,f=!1;for(d=0;dh;d--){for(c=0;c0&&this.wrapMode!==_e&&0===this.wrapWidth}setStyle(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wordWrap")){var s=t.wordWrap;s.hasOwnProperty("width")&&(t.wrap={mode:"word",width:s.width})}if(t&&t.hasOwnProperty("wrap")){var r=t.wrap;if(r.hasOwnProperty("mode")){var n=r.mode;"string"==typeof n&&(r.mode=Ie[n])}else r.hasOwnProperty("width")&&(r.mode=1)}t&&t.rtl&&i&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var a=this.propertyMap;for(var o in a){var h=a[o],l=h[0],d=i?h[1]:this[o],c=h[2];if("wrapCallback"===o||"wrapCallbackScope"===o)this[o]=je(t,l,d);else{var u=De(t,l,d);c&&(u=c(u)),this[o]=u}}var p=je(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var g=je(t,"fill",null);null!==g&&(this.color=qt(g));var v=je(t,"metrics",!1);return v?this.metrics={ascent:je(v,"ascent",0),descent:je(v,"descent",0),fontSize:je(v,"fontSize",0)}:!e&&this.metrics||(this.metrics=Te(this)),e?this.parent.updateText():this.parent}syncFont(t,e){e.font=this._font}syncStyle(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"}syncShadow(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)}update(t){return t&&(this._font=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim(),this.metrics=Te(this)),this.parent.updateText(t)}buildFont(){var t=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim();return t!==this._font&&(this._font=t),this}setFont(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=je(t,"fontFamily","Courier"),this.fontSize=je(t,"fontSize","16px"),this.fontStyle=je(t,"fontStyle","")),this.update(!0)}setFontFamily(t){return this.fontFamily=t,this.update(!0)}setFontStyle(t){return this.fontStyle=t,this.update(!0)}setFontSize(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}setTestString(t){return this.testString=t,this.update(!0)}setFixedSize(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}setResolution(t){return this.resolution=t,this.update(!1)}setXOffset(t){return this.xOffset=t,this.update(!1)}setBackgroundColor(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=qt(t,this.parent.canvas,this.parent.context),this.backgroundColor2=qt(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=qt(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}setBackgroundCornerRadius(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}setFill(t){return this.color=qt(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=qt(t,this.parent.canvas,this.parent.context),this.update(!1)}setStroke(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=qt(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}setShadow(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===n&&(n=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=qt(i,this.parent.canvas,this.parent.context),this.shadowBlur=s,this.shadowStroke=r,this.shadowFill=n,this.update(!1)}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}setShadowColor(t){return void 0===t&&(t="#000"),this.shadowColor=qt(t,this.parent.canvas,this.parent.context),this.update(!1)}setShadowBlur(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}setShadowStroke(t){return this.shadowStroke=t,this.update(!1)}setShadowFill(t){return this.shadowFill=t,this.update(!1)}setUnderline(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=qt(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}setUnderlineColor(t){return void 0===t&&(t="#000"),this.underlineColor=qt(t,this.parent.canvas,this.parent.context),this.update(!1)}setUnderlineThickness(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}setUnderlineOffset(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}setStrikethrough(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=qt(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}setStrikethroughColor(t){return void 0===t&&(t="#000"),this.strikethroughColor=qt(t,this.parent.canvas,this.parent.context),this.update(!1)}setStrikethroughThickness(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}setStrikethroughOffset(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}setWrapMode(t){return"string"==typeof t&&(t=Ie[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}setWrapWidth(t){return this.wrapWidth=t,this.update(!1)}setAlign(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}setHAlign(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}setVAlign(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}setMaxLines(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}getTextMetrics(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}setTextMetrics(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=je(e,"fontFamily",this.fontFamily),this.fontSize=je(e,"fontSize",this.fontSize),this.fontStyle=je(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}get lineHeight(){return this.metrics.fontSize+this.parent.lineSpacing}toJSON(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}destroy(){this.parent=void 0}};var ze=function(t){return null==t?t="":Array.isArray(t)?t=t.join("\n"):"number"==typeof t&&(t=t.toString()),t},Fe={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var a=this.defaultStyle;this.clear(),se(this,a.backgroundColor,a.backgroundStrokeColor,a.backgroundStrokeLineWidth,a.backgroundCornerRadius,a.backgroundColor2,a.backgroundHorizontalGradient,a.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var o,h,l,d,c,u,p=a.halign,g=a.valign,v=a.lineHeight,f=r.lines,m=f.length,y=a.maxLines;y>0&&m>y?(h=y,l="center"===g?Math.floor((m-h)/2):"bottom"===g?m-h:0):(h=m,l=0),d=l+h;var b=this.rtl,x=b?this.parent.width:void 0;u="center"===g?Math.max((s-h*v)/2,0):"bottom"===g?Math.max(s-h*v-2,0):0,u+=e;for(var C=l;C0){var o=this.defaultStyle.metrics,h=i-o.ascent,l=o.fontSize;this.drawRectangle(e,h,t.width,l,a.bgcolor,a)}if(a.underlineThickness>0&&t.width>0){var d=i+a.underlineOffset-a.underlineThickness/2;this.drawLine(e,d,t.width,a.underlineThickness,a.underlineColor,a)}if(t.isTextPen&&(a.buildFont(),a.syncFont(r,n),a.syncStyle(r,n),this.drawText(e,i,t.text,a)),t.isImagePen&&this.drawImage(e,i,t.prop.img,t.prop.color,a),a.strikethroughThickness>0&&t.width>0&&(d=i+a.strikethroughOffset-a.strikethroughThickness/2,this.drawLine(e,d,t.width,a.strikethroughThickness,a.strikethroughColor,a)),n.restore(),t.hasAreaMarker&&t.width>0){var c,u=t.prop.area;if(u)c={key:u};else{var p=t.prop.url;c={key:`url:${p}`,url:p}}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,c)}},clear(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawRectangle(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;a.fillStyle=r,a.fillRect(t,e,i,s)},drawLine(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;n.syncShadow(a,n.shadowStroke);var o=a.lineCap;a.lineCap="butt",a.strokeStyle=r,a.lineWidth=s,a.beginPath(),a.moveTo(t,e),a.lineTo(t+i,e),a.stroke(),a.lineCap=o},drawText(t,e,i,s){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;s.stroke&&"none"!==s.stroke&&s.strokeThickness>0&&(s.syncShadow(r,s.shadowStroke),r.strokeText(i,t,e)),s.color&&"none"!==s.color&&(s.syncShadow(r,s.shadowFill),r.fillText(i,t,e))},drawImage(t,e,i,s,r){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,s,this.autoRound)}};const Ye=Phaser.Utils.Objects.GetValue,Xe=Oe,We=Me;class Ve{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=Ye(t,"text",""),this.x=Ye(t,"x",0),this.y=Ye(t,"y",0),this.width=Ye(t,"width",0);var e=Ye(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=Ye(t,"newLineMode",0),this.startIndex=Ye(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===We&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==Xe&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===We&&(t+=1),t}get endIndex(){return this.startIndex+this.rawTextLength}get lastX(){return this.x+this.width}get isTextPen(){return""!==this.text}get isImagePen(){return!!this.prop.img}get hasAreaMarker(){return!!this.prop.area||!!this.prop.url}}var Ge=function(t,e){var i=Array.isArray(t);if(void 0===e?e=i?[]:{}:q(e),i){e.length=t.length;for(var s=0,r=t.length;s=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}getLineEndIndex(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,s=!1;for(e=t;e>=0&&!(s=null!=(i=this.lines[e])&&i.length>0);e--);return s?i[i.length-1].endIndex:0}getLineWidth(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}getMaxLineWidth(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,s=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}getLineWidths(){for(var t=[],e=0,i=this.lines.length;e=t&&h<=e||(a=a.substring(t-o,e-o)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,a,l,d):c+=this.tagToText(a,l,d),d=l,!(h>=e)));u++);return c}get length(){return this.lines.length}set length(t){this.clear()}}var Ke={};const Je=Phaser.Geom.Rectangle;var qe=new I;class Ze{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&gi(v)){""!==b?a.push(n.getLine(b,x,oi)):0===C&&r>0&&a.push(n.getLine("",0,oi)),a.push(...ui(v,e,di,s,0,n));var w=a.pop();b=w.text,x=w.width,n.freeLine(w)," "===b&&(b="",x=0)}else(m=x+f)>h?(a.push(n.getLine(b,x,oi)),b=v,x=f,h=s):(b+=v,x=m),C===k-1&&a.push(n.getLine(b,x,l))}return a},pi=function(t,e){var i;switch(e){case li:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==fi&&i0&&t>e&&(t=e),t}get linesWidth(){return Math.ceil(this.penManager.getMaxLineWidth())}get linesHeight(){var t=this.displayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}get imageManager(){return this.parent.imageManager}get rtl(){return this.parent.style.rtl}newPenManager(){return new $e({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}get tmpPenManager(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}getPlainText(t,e,i){var s;if(null==t)s=this.penManager.plainText;else{var r=this.parser.splitText(t,1);s="";for(var n=0,a=r.length;n${t}`:e.hasOwnProperty("_style")?`${t}`:t}destroy(){this.tags=void 0}isTextTag(t){var e=this.tags[t];return!!e&&null==e.img}};var vs=function(t){for(var e,i,s,r={},n=0,a=(t=t.split(";")).length;n=1&&(s.color=o[0]),h>=2&&(s.thickness=parseInt(o[1].replace("px","")));break;case"shadow":o=s.split(" "),s={},(h=o.length)>=1&&(s.color=o[0]),h>=2&&(s.offsetX=parseInt(o[1].replace("px",""))),h>=3&&(s.offsetY=parseInt(o[2].replace("px",""))),h>=4&&(s.blur=parseInt(o[3].replace("px","")));break;case"u":case"underline":case"s":case"strikethrough":var h;o=s.split(" "),s={},(h=o.length)>=1&&(s.color=o[0]),h>=2&&(s.thickness=parseInt(o[1].replace("px",""))),h>=3&&(s.offset=parseInt(o[2].replace("px",""))),"underline"===i?i="u":"strikethrough"===i&&(i="s");break;case"y":s=parseFloat(s)}r[i]=s}return r},fs=function(t){return 0===(t=t.replace(ks,"")).length},ms=/<\s*class=["|']([^"|']+)["|']\s*\>([\s\S]*?)<\s*\/class\s*\>|<\s*style=["|']([^"|']+)["|']\s*\>([\s\S]*?)<\s*\/style\s*\>/g,ys=/<\s*class=/i,bs=/<\s*class=["|']([^"|']+)["|']\s*\>([\s\S]*?)<\s*\/class\s*\>/,xs=/<\s*style=/i,Cs=/<\s*style=["|']([^"|']+)["|']\s*\>([\s\S]*?)<\s*\/style\s*\>/,ks=/^\s+|\s+$/;const ws=Phaser.Utils.Objects.GetValue;class Ss extends Xi{constructor(t,e,i,s,r){var n=ws(r,"tags",void 0);super(t,e,i,s,r,"rexTagText",new gs(n))}addTag(t,e){return this.parser.addTag(t,e),this.updateText(!0)}addTags(t){for(var e in t)this.parser.addTag(e,t[e]);return this.updateText(!0)}getTag(t){return this.parser.getTag(t)}preDestroy(){super.preDestroy(),this.parser.destroy(),this.parser=void 0}}t.register("tagText",(function(t,e,i,s){var r=new Ss(this.scene,t,e,i,s);return this.scene.add.existing(r),r})),P(window,"RexPlugins.UI.TagText",Ss);const Ps=Phaser.Utils.Objects.GetValue;var Ts=function(t,e){return void 0===e?t:t[e]},Os=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Ps(e,"left",0),t.right=Ps(e,"right",0),t.top=Ps(e,"top",0),t.bottom=Ps(e,"bottom",0)),t};let Ms=class{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}};Object.assign(Ms.prototype,Z);var Es={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const _s=Phaser.Math.RotateAround;var Rs;const Ls=Phaser.Geom.Rectangle;var Bs,Is=function(t){void 0===Bs&&(Bs=new Ls);var e=t.drawTLX,i=t.drawTLY;return Bs.setTo(e,i,t.drawTRX-e,t.drawBLY-i),Bs};const Ds=Phaser.Math.RotateAround;var js,As=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===js&&(js={}),s=js),s.x=e,s.y=i,0!==t.rotation&&Ds(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const zs=Phaser.GameObjects.Components.TransformMatrix;var Fs,Ys,Xs={},Ws=function(t,e,i,s,r){var n=As(e,i,s,!0),a=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=Xs);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===Fs&&(Fs=new zs,Ys=new zs),t.parentContainer?t.getWorldTransformMatrix(Fs,Ys):Fs.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),Fs.transformPoint(r,n,s),s}(t,n.x,n.y,r);return a},Vs=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,a=e.drawCenterY+s;return Ws(t,e,n,a,r)},Gs={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Rs&&(Rs={}),s=Rs),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&_s(s,0,0,-i.rotation),s}(t,e,this,!0);return Is(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return Vs(this.parent,this,t,e,i)}};Object.assign(Gs,Es);const Hs=Phaser.Math.DegToRad,Us=Phaser.Math.RadToDeg,Ns=Phaser.Utils.Objects.GetValue;class $s extends Ms{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return Us(this._rotation)}set angle(t){this.rotation=Hs(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=Ns(t,"width",void 0),i=Ns(t,"height",void 0),s=Ns(t,"scaleX",void 0),r=Ns(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign($s.prototype,Gs);var Ks=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Js=Phaser.Utils.Objects.GetValue;class qs extends $s{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(Js(e,"color",null),Js(e,"color2",null),Js(e,"horizontalGradient",!0)),this.setStroke(Js(e,"stroke",null),Js(e,"strokeThickness",2)),this.setCornerRadius(Js(e,"cornerRadius",0),Js(e,"cornerIteration",null))}set color(t){t=qt(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=qt(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=qt(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,Ks("color2",t,this),Ks("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Ks("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Ks("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){se(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Zs=Phaser.Utils.Objects.GetValue;class Qs extends $s{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(Zs(e,"color",null),Zs(e,"color2",null),Zs(e,"horizontalGradient",!0)),this.setStroke(Zs(e,"stroke",null),Zs(e,"strokeThickness",2))}set color(t){t=qt(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=qt(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=qt(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,Zs(t,"color2",null),Zs(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Zs(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,a=this.parent.height-i.top-i.bottom,o=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?o.createLinearGradient(0,0,n,0):o.createLinearGradient(0,0,0,a)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,o.fillStyle=t,o.fillRect(s,r,n,a));null!=this.stroke&&this.strokeThickness>0&&(o.strokeStyle=this.stroke,o.lineWidth=this.strokeThickness,o.strokeRect(s,r,n,a))}}const tr=Phaser.Utils.Objects.GetValue;class er{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(tr(t,"bold",!1)),this.setItalic(tr(t,"italic",!1)),this.setFontSize(tr(t,"fontSize","16px")),this.setFontFamily(tr(t,"fontFamily","Courier")),this.setColor(tr(t,"color","#fff")),this.setStrokeStyle(tr(t,"stroke",null),tr(t,"strokeThickness",0)),this.setShadow(tr(t,"shadowColor",null),tr(t,"shadowOffsetX",0),tr(t,"shadowOffsetY",0),tr(t,"shadowBlur",0)),this.setOffset(tr(t,"offsetX",0),tr(t,"offsetY",0)),this.setSpace(tr(t,"leftSpace",0),tr(t,"rightSpace",0)),this.setAlign(tr(t,"align",void 0)),this.setBackgroundColor(tr(t,"backgroundColor",null)),this.setBackgroundHeight(tr(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(tr(t,"backgroundBottomY",void 0)),this.setBackgroundLeftX(tr(t,"backgroundLeftX",0)),this.setBackgroundRightX(tr(t,"backgroundRightX",0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(Ks("stroke",t,this),Ks("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Ks("shadowOffsetX",t,this),Ks("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),t.hasOwnProperty("backgroundLeftX")&&this.setBackgroundLeftX(t.backgroundLeftX),t.hasOwnProperty("backgroundRightX")&&this.setBackgroundRightX(t.backgroundRightX),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new er(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=qt(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=qt(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=qt(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=qt(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setBackgroundLeftX(t){return this.backgroundLeftX=t,this}setBackgroundRightX(t){return this.backgroundRightX=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}}const ir=Phaser.Utils.Array.Remove,sr=Phaser.Utils.Array.Remove,rr="text",nr="image",ar="drawer",or="space",hr="command";var lr=function(t){return t.type===rr&&"\n"===t.text},dr=function(t){return t.type===rr&&"\f"===t.text},cr=function(t){return t.type===rr},ur=function(t){return t.type===hr};class pr extends $s{constructor(t,e,i){super(t,rr),this.updateTextFlag=!1,this.style=new er(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX+e.backgroundLeftX,s=i,r=this.drawTRX+e.backgroundRightX-i+1;if(r>0){var n=e.backgroundBottomY;null==n&&(n=this.drawBLY);var a=e.backgroundHeight;null==a&&(a=n-this.drawTLY);var o=n-a;t.fillRect(s,o,r,a)}}var h=e.hasFill,l=e.hasStroke;(h||l)&&(e.syncFont(t).syncStyle(t),l&&(e.syncShadow(t),t.strokeText(this.text,0,0)),h&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var gr=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};Phaser.Display.Canvas.CanvasPool;class vr extends $s{constructor(t,e,i){super(t,nr),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){Ti(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}var fr=function(t,e,i){var s=this.createImageChild(t,e,i);return this.addChild(s),this};class mr extends $s{constructor(t,e,i,s){super(t,ar),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}let yr=class extends $s{constructor(t,e){super(t,or),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}};var br=function(t){var e=this.createSpaceChild(t);return this.addChild(e),this};class xr extends Ms{constructor(t,e,i,s,r){super(t,hr),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}var Cr=function(t,e,i,s){var r=this.createCommandChild(t,e,i,s);return this.addChild(r),this},kr=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const wr={none:0,word:1,char:2,character:2,mix:3};var Sr=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,a=!r&&!n,o=t.length,h=e,l=s.word,d=0,c=!1;h0&&!o){var h=this.fixedHeight-s;i>0?n=h/i:(n=(l=Mr.call(this)).height,a=l.ascent,i=Math.floor((h-a)/n))}else{var l;n=(l=Mr.call(this)).height,a=l.ascent}}else this.fixedHeight>0?void 0===(i=_r(t,"maxLines"))&&(h=this.fixedHeight-s,i=Math.floor(h/n)):i=_r(t,"maxLines",0);void 0===a&&(a=n);var d=0===i,c=_r(t,"wrapMode");void 0===c&&(c=_r(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=wr[c]);var u=_r(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=_r(t,"letterSpacing",0),g=_r(t,"hAlign",0),v=_r(t,"vAlign",0),f=_r(t,"justifyPercentage",.25),m=kr({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:g,vAlign:v,justifyPercentage:f,ascent:a,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,b=0,x=y.length;b0&&(E.push({children:_,width:R}),L=Math.max(L,R)),m.start+=M.length,m.isLastPage=!B&&m.start===O,m.maxLineWidth=L,m.linesHeight=E.length*n;var Y=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,X=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,a=t.vAlign,o=t.justifyPercentage,h=t.lines,l=0,d=h.length;l0?(a=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=Br(t,"maxLines",void 0))){var a=this.fixedWidth-r;i=Math.floor(a/n)+1}}else i=Br(t,"maxLines",0);var o=0===i,h=Br(t,"fixedCharacterHeight",void 0);if(void 0===h){var l=Br(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;h=Math.floor(d/l)}}var c=Br(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=Br(t,"letterSpacing",0),p=Br(t,"rtl",!0),g=Br(t,"hAlign",p?2:0),v=Br(t,"vAlign",0),f=kr({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:g,vAlign:v,lineWidth:n,fixedCharacterHeight:h,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(M.push({children:E,height:_}),R=Math.max(R,_)),f.start+=O.length,f.isLastPage=f.start===T,f.maxLineHeight=R,f.linesWidth=M.length*n;var A=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,z=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,a=t.vAlign,o=t.rtl,h=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}o&&(s+=l);for(var c=0,u=h.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,a=i.bottom;return Os(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||a!=i.bottom,this},getPadding:function(t){return Ts(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),ir(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return sr(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(rr);return null===i?i=new pr(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),Vs(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r>16&255},bn=function(t){return t>>8&255},xn=function(t){return 255&t};const Cn=Phaser.Events.EventEmitter;var kn=function(t,e,i,s,r,n){return void 0===n?n={}:!0===n&&(n=wn),"number"!=typeof i&&(i=0,s=0),n.x=r.x+r.width*t+i,n.y=r.y+r.height*e+s,n},wn={},Sn=function(t,e,i,s,r,n,a){if(t.hasOwnProperty("vp"))return t;"function"==typeof i&&(a=i,i=void 0),"function"==typeof r&&(a=r,r=void 0),void 0===i&&(i=.5),void 0===s&&(s=.5),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=kn),function(t){if(t.events)return t;var e=new Cn,i=t.x;Object.defineProperty(t,"x",{get:function(){return i},set:function(s){i!==s&&(i=s,e.emit("update",t))}});var s=t.y;Object.defineProperty(t,"y",{get:function(){return s},set:function(i){s!==i&&(s=i,e.emit("update",t))}});var r=t.width;Object.defineProperty(t,"width",{get:function(){return r},set:function(i){r!==i&&(r=i,e.emit("update",t))}});var n=t.height;Object.defineProperty(t,"height",{get:function(){return n},set:function(i){n!==i&&(n=i,e.emit("update",t))}}),t.events=e}(e);var o=e.events;t.vp=e;var h=function(){a(i,s,r,n,e,t)};o.on("update",h),t.once("destroy",(function(){o.off("update",h),t.vp=void 0})),Object.defineProperty(t,"vpx",{get:function(){return i},set:function(t){i!==t&&(i=t,h())}}),Object.defineProperty(t,"vpy",{get:function(){return s},set:function(t){s!==t&&(s=t,h())}}),Object.defineProperty(t,"vpxOffset",{get:function(){return r},set:function(t){r!==t&&(r=t,h())}}),Object.defineProperty(t,"vpyOffset",{get:function(){return n},set:function(t){n!==t&&(n=t,h())}}),h()},Pn=function(t){return t.preFX?t.preFX:t.postFX?t.postFX:null},Tn=function(t,e){t._effectSwitchNames||(t._effectSwitchNames=[],t.clearAllEffects=function(){for(var e=t._effectSwitchNames,i=0,s=e.length;i0&&void 0!==t.setTint},useAlphaFadeEffect(t){return(void 0===this.fadeMode||1===this.fadeMode)&&this.fadeTime>0&&void 0!==t.setAlpha},useRevealEffect(t){return this.fadeMode>=2&&this.fadeMode<=5&&this.fadeTime>0&&(t.preFX||t.postFX)},fadeBob(t,e,i,s){var r=t.gameObject;if(this.useTintFadeEffect(r))void 0!==e&&t.setProperty("tintGray",255*e),t.easeProperty({property:"tintGray",value:Math.floor(255*i),duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s});else if(this.useAlphaFadeEffect(r))void 0!==e&&t.setProperty("alpha",e),t.easeProperty({property:"alpha",value:i,duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s});else if(this.useRevealEffect(r)){var n;switch(En(r,"reveal"),this.fadeMode){case 2:n="revealUp";break;case 3:n="revealDown";break;case 4:n="revealLeft";break;case 5:n="revealRight"}void 0===e&&(e=0),r[n]=e,t.easeProperty({property:n,value:i,duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s}),t.getTweenTask(n).once("complete",(function(){r[n]=null}))}else s&&s(r);return this}},zn=function(t){return void 0!==t.displayWidth?t.displayWidth:t.width},Fn=function(t){return void 0!==t.displayHeight?t.displayHeight:t.height};const Yn=Phaser.Geom.Rectangle,Xn=Phaser.Math.Vector2,Wn=Phaser.Math.RotateAround,Vn=Phaser.GameObjects.Container;var Gn=function(t,e){if(void 0===e?e=new Yn:!0===e&&(void 0===Hn&&(Hn=new Yn),e=Hn),t.getBounds&&!(t instanceof Vn))return t.getBounds(e);var i,s,r,n,a,o,h,l;if(t.parentContainer){var d=t.parentContainer.getBoundsTransformMatrix();Un(t,e),d.transformPoint(e.x,e.y,e),i=e.x,s=e.y,Nn(t,e),d.transformPoint(e.x,e.y,e),r=e.x,n=e.y,$n(t,e),d.transformPoint(e.x,e.y,e),a=e.x,o=e.y,Kn(t,e),d.transformPoint(e.x,e.y,e),h=e.x,l=e.y}else Un(t,e),i=e.x,s=e.y,Nn(t,e),r=e.x,n=e.y,$n(t,e),a=e.x,o=e.y,Kn(t,e),h=e.x,l=e.y;return e.x=Math.min(i,r,a,h),e.y=Math.min(s,n,o,l),e.width=Math.max(i,r,a,h)-e.x,e.height=Math.max(s,n,o,l)-e.y,e},Hn=void 0,Un=function(t,e,i){return void 0===e?e=new Xn:!0===e&&(void 0===qn&&(qn=new Xn),e=qn),t.getTopLeft?t.getTopLeft(e):(e.x=t.x-zn(t)*t.originX,e.y=t.y-Fn(t)*t.originY,Zn(t,e,i))},Nn=function(t,e,i){return void 0===e?e=new Xn:!0===e&&(void 0===qn&&(qn=new Xn),e=qn),t.getTopRight?t.getTopRight(e):(e.x=t.x-zn(t)*t.originX+zn(t),e.y=t.y-Fn(t)*t.originY,Zn(t,e,i))},$n=function(t,e,i){return void 0===e?e=new Xn:!0===e&&(void 0===qn&&(qn=new Xn),e=qn),t.getBottomLeft?t.getBottomLeft(e):(e.x=t.x-zn(t)*t.originX,e.y=t.y-Fn(t)*t.originY+Fn(t),Zn(t,e,i))},Kn=function(t,e,i){return void 0===e?e=new Xn:!0===e&&(void 0===qn&&(qn=new Xn),e=qn),t.getBottomRight?t.getBottomRight(e):(e.x=t.x-zn(t)*t.originX+zn(t),e.y=t.y-Fn(t)*t.originY+Fn(t),Zn(t,e,i))},Jn=function(t,e,i){void 0===e?e=new Xn:!0===e&&(void 0===qn&&(qn=new Xn),e=qn);var s=zn(t),r=Fn(t);return e.x=t.x+s*(.5-t.originX),e.y=t.y+r*(.5-t.originY),Zn(t,e,i)},qn=void 0,Zn=function(t,e,i){return void 0===i&&(i=!1),0!==t.rotation&&Wn(e,t.x,t.y,t.rotation),i&&t.parentContainer&&t.parentContainer.getBoundsTransformMatrix().transformPoint(e.x,e.y,e),e};const Qn=Phaser.Utils.Objects.GetValue;var ta=function(t,e,i){var s,r,n,a,o;if("number"==typeof i?s=i:(s=Qn(i,"color"),r=Qn(i,"lineWidth"),n=Qn(i,"fillColor"),a=Qn(i,"fillAlpha",1),o=Qn(i,"padding",0)),Array.isArray(t))for(var h=0,l=t.length;h0?-this.delay:0,this.state=this.nowTime>=0?Ha:Ga,this.repeatCounter=0,this}stop(){return this.state=Va,this}update(t,e){this.state!==Va&&this.state!==Na&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=Ua)):(this.nowTime=this.duration,this.state=Na):this.nowTime>=0&&(this.state=Ha))}get t(){var t;switch(this.state){case Va:case Ga:case Ua:t=0;break;case Ha:t=this.nowTime/this.duration;break;case Na:t=1}return Xa(t,0,1)}set t(t){(t=Xa(t,-1,1))<0?(this.state=Ga,this.nowTime=-this.delay*t):(this.state=Ha,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===Va}get isDelay(){return this.state===Ga}get isCountDown(){return this.state===Ha}get isRunning(){return this.state===Ga||this.state===Ha}get isDone(){return this.state===Na}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}};const Va=0,Ga=1,Ha=2,Ua=3,Na=-1;class $a extends za{constructor(t,e){super(t,e),this.timer=new Wa}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const Ka=Phaser.Utils.Objects.GetValue,Ja=Phaser.Utils.Objects.GetAdvancedValue,qa=Phaser.Tweens.Builders.GetEaseFunction;class Za extends $a{resetFromJSON(t){return this.timer.resetFromJSON(Ka(t,"timer")),this.setEnable(Ka(t,"enable",!0)),this.setTarget(Ka(t,"target",this.parent)),this.setDelay(Ja(t,"delay",0)),this.setDuration(Ja(t,"duration",1e3)),this.setEase(Ka(t,"ease","Linear")),this.setRepeat(Ka(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=qa(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Qa=Phaser.Sound.BaseSound;var to=function(t){return t instanceof Qa};const eo=Phaser.Utils.Objects.GetValue,io=Phaser.Utils.Objects.GetAdvancedValue,so=Phaser.Math.Linear;let ro=class extends Za{constructor(t,e,i){to(t)&&(i=e,e=t,t=void 0),e.active=!0,e.scene=t,e.game=e.manager.game,super(e,i),this.volume={},this.resetFromJSON(i)}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(eo(t,"mode",0)),this.setEnable(eo(t,"enable",!0)),this.setVolumeRange(io(t,"volume.start",this.parent.volume),io(t,"volume.end",0)),this}setMode(t){return"string"==typeof t&&(t=no[t]),this.mode=t,this}setVolumeRange(t,e){return this.volume.start=t,this.volume.end=e,this}start(){return this.timer.isRunning||(this.parent.setVolume(this.volume.start),this.timer.setDelay(this.delay).setDuration(this.duration),super.start()),this}updateTarget(t,e){t.volume=so(this.volume.start,this.volume.end,e.t)}complete(){switch(super.complete(),this.mode){case 1:this.parent.stop();break;case 2:this.parent.stop(),this.parent.destroy()}return this}};const no={stop:1,destroy:2};var ao=function(t,e,i,s,r){to(t)&&(r=s,s=i,i=e,e=t,t=void 0),void 0===s&&(s=1),void 0===r&&(r=0);var n,a={mode:0,volume:{start:r,end:s},duration:i};return"string"==typeof e&&(e=t.sys.sound.add(e)),e.hasOwnProperty("_fade")?(n=e._fade).stop().resetFromJSON(a):(n=new ro(t,e,a),e._fade=n),n.start(),e.isPlaying||e.setVolume(r).play(),e},oo=function(t,e,i,s){to(t)&&(s=i,i=e,e=t,t=void 0),void 0===s&&(s=!0);var r,n={mode:s?2:1,volume:{start:e.volume,end:0},duration:i};return e.hasOwnProperty("_fade")?(r=e._fade).stop().resetFromJSON(n):(r=new ro(t,e,n),e._fade=r),r.start(),e.isPlaying||e.play(),e};const ho=Phaser.Utils.Objects.GetValue;var lo={setBackgroundMusicLoop(t){return void 0===t&&(t=!0),this.backgroundMusicLoop=t,this},setBackgroundMusicFadeTime(t){return this.backgroundMusicFadeTime=t,this},getBackgroundMusic(){return this.backgroundMusic},setCurrentBackgroundMusic(t){return this.backgroundMusic=t,t&&(t.once("complete",(function(){this.backgroundMusic===t&&(this.backgroundMusic.destroy(),this.backgroundMusic=void 0)}),this).once("destroy",(function(){this.backgroundMusic===t&&(this.backgroundMusic=void 0)}),this),t.isPlaying||t.play()),this},playBackgroundMusic(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;if(this.backgroundMusic&&this.backgroundMusic.key===t)return this;this.stopBackgroundMusic();var i=this.sound.add(t,{loop:ho(e,"loop",this.backgroundMusicLoop),mute:ho(e,"mute",this.backgroundMusicMute),volume:ho(e,"volume",this.backgroundMusicVolume),detune:ho(e,"detune",0),rate:ho(e,"rate",1)});return this.setCurrentBackgroundMusic(i),this.backgroundMusicFadeTime>0&&this.fadeInBackgroundMusic(this.backgroundMusicFadeTime),this},pauseBackgroundMusic(){return this.backgroundMusic&&this.backgroundMusic.pause(),this},resumeBackgroundMusic(){return this.backgroundMusic&&this.backgroundMusic.resume(),this},stopBackgroundMusic(){return this.backgroundMusic&&(this.backgroundMusicFadeTime>0?this.fadeOutBackgroundMusic(this.backgroundMusicFadeTime,!0):(this.backgroundMusic.stop(),this.backgroundMusic.destroy(),this.backgroundMusic=void 0)),this},fadeInBackgroundMusic(t){return this.backgroundMusic&&ao(this.backgroundMusic,t,this.backgroundMusicVolume,0),this},fadeOutBackgroundMusic(t,e){return this.backgroundMusic&&oo(this.backgroundMusic,t,e),this},crossFadeBackgroundMusic(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;var i=this.backgroundMusicFadeTime;return this.backgroundMusicFadeTime=0,this.fadeOutBackgroundMusic(e,!0).playBackgroundMusic(t).fadeInBackgroundMusic(e),this.backgroundMusicFadeTime=i,this},setBackgroundMusicMute(t){return void 0===t&&(t=!0),this.backgroundMusicMute=t,this},setBackgroundMusicVolume(t){return this.backgroundMusicVolume=t,this},setBackgroundMusicRate(t){return this.backgroundMusic&&this.backgroundMusic.setRate(t),this},setBackgroundMusicDetune(t){return this.backgroundMusic&&this.backgroundMusic.setDetune(t),this}};const co=Phaser.Utils.Objects.GetValue;var uo={setBackgroundMusic2Loop(t){return void 0===t&&(t=!0),this.backgroundMusic2Loop=t,this},setBackgroundMusic2FadeTime(t){return this.backgroundMusic2FadeTime=t,this},getBackgroundMusic2(){return this.backgroundMusic2},setCurrentBackgroundMusic2(t){return this.backgroundMusic2=t,t&&(t.once("complete",(function(){this.backgroundMusic2===t&&(this.backgroundMusic2.destroy(),this.backgroundMusic2=void 0)}),this).once("destroy",(function(){this.backgroundMusic2===t&&(this.backgroundMusic2=void 0)}),this),t.isPlaying||t.play()),this},playBackgroundMusic2(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;if(this.backgroundMusic2&&this.backgroundMusic2.key===t)return this;this.stopBackgroundMusic2();var i=this.sound.add(t,{loop:co(e,"loop",this.backgroundMusicLoop),mute:co(e,"mute",this.backgroundMusic2Mute),volume:co(e,"volume",this.backgroundMusic2Volume),detune:co(e,"detune",0),rate:co(e,"rate",1)});return this.setCurrentBackgroundMusic2(i),this.backgroundMusic2FadeTime>0&&this.fadeInBackgroundMusic2(this.backgroundMusic2FadeTime),this},pauseBackgroundMusic2(){return this.backgroundMusic2&&this.backgroundMusic2.pause(),this},resumeBackgroundMusic2(){return this.backgroundMusic2&&this.backgroundMusic2.resume(),this},stopBackgroundMusic2(){return this.backgroundMusic2&&(this.backgroundMusic2FadeTime>0?this.fadeOutBackgroundMusic2(this.backgroundMusic2FadeTime,!0):(this.backgroundMusic2.stop(),this.backgroundMusic2.destroy(),this.backgroundMusic2=void 0)),this},fadeInBackgroundMusic2(t){return this.backgroundMusic2&&ao(this.backgroundMusic2,t,this.backgroundMusic2Volume,0),this},fadeOutBackgroundMusic2(t,e){return this.backgroundMusic2&&oo(this.backgroundMusic2,t,e),this},crossFadeBackgroundMusic2(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;var i=this.backgroundMusic2FadeTime;return this.backgroundMusic2FadeTime=0,this.fadeOutBackgroundMusic2(e,!0).playBackgroundMusic2(t).fadeInBackgroundMusic2(e),this.backgroundMusic2FadeTime=i,this},setBackgroundMusic2Mute(t){return void 0===t&&(t=!0),this.backgroundMusic2Mute=t,this},setBackgroundMusic2Volume(t){return this.backgroundMusic2Volume=t,this},setBackgroundMusic2Rate(t){return this.backgroundMusic2&&this.backgroundMusic2.setRate(t),this},setBackgroundMusic2Detune(t){return this.backgroundMusic2&&this.backgroundMusic2.setDetune(t),this}};const po=Phaser.Utils.Array.Remove,go=Phaser.Utils.Objects.GetValue;var vo={getSoundEffects(){return this.soundEffects},getLastSoundEffect(){return this.soundEffects[this.soundEffects.length-1]},playSoundEffect(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;var i=this.sound.add(t,{mute:go(e,"mute",this.soundEffectsMute),volume:go(e,"volume",this.soundEffectsVolume),detune:go(e,"detune",0),rate:go(e,"rate",1)});return this.soundEffects.push(i),i.once("complete",(function(){i.destroy(),this.sound&&po(this.soundEffects,i)}),this).once("destroy",(function(){this.sound&&po(this.soundEffects,i)}),this).play(),this},stopAllSoundEffects(){for(var t=this.soundEffects.length-1;t>=0;t--){var e=this.soundEffects[t];e.stop(),e.destroy()}return this},fadeInSoundEffect(t){var e=this.getLastSoundEffect();return e&&ao(e,t,this.soundEffectsVolume,0),this},fadeOutSoundEffect(t,e){var i=this.getLastSoundEffect();return i&&oo(i,t,e),this},fadeOutAllSoundEffects(t,e){for(var i=this.soundEffects.length-1;i>=0;i--)oo(this.soundEffects[i],t,e);return this},setSoundEffectMute(t,e){if(void 0===t&&(t=!0),void 0===e&&(e=!1),e){var i=this.getLastSoundEffect();i&&i.setMute(t)}else this.soundEffectsMute=t;return this},setSoundEffectVolume(t,e){if(void 0===e&&(e=!1),e){var i=this.getLastSoundEffect();i&&i.setVolume(t)}else this.soundEffectsVolume=t;return this},setSoundEffectDetune(t,e){var i;void 0===e&&(e=!1);for(var s=0,r=(i=e?[this.getLastSoundEffect()]:this.soundEffects).length;s=0;t--){var e=this.soundEffects[t];e.stop(),e.destroy()}return this},fadeInSoundEffect2(t){var e=this.getLastSoundEffect2();return e&&ao(e,t,this.soundEffects2Volume,0),this},fadeOutSoundEffect2(t,e){var i=this.getLastSoundEffect2();return i&&oo(i,t,e),this},fadeOutAllSoundEffects2(t,e){for(var i=this.soundEffects2.length-1;i>=0;i--)oo(this.soundEffects2[i],t,e);return this},setSoundEffect2Mute(t,e){if(void 0===t&&(t=!0),void 0===e&&(e=!1),e){var i=this.getLastSoundEffect2();i&&i.setMute(t)}else this.soundEffects2Mute=t;return this},setSoundEffect2Volume(t,e){if(void 0===e&&(e=!1),e){var i=this.getLastSoundEffect2();i&&i.setVolume(t)}else this.soundEffects2Volume=t;return this},setSoundEffect2Detune(t,e){var i;void 0===e&&(e=!1);for(var s=0,r=(i=e?[this.getLastSoundEffect2()]:this.soundEffects2).length;s=0;t--)this.soundEffects[t].destroy();if(this.soundEffects.length=0,this.soundEffects2.length)for(t=this.soundEffects2.length-1;t>=0;t--)this.soundEffects2[t].destroy();return this.soundEffects2.length=0,this.sound=void 0,this}get backgroundMusicMute(){return this._backgroundMusicMute}set backgroundMusicMute(t){this._backgroundMusicMute=t,this.backgroundMusic&&this.backgroundMusic.setMute(mute)}get backgroundMusicVolume(){return this._backgroundMusicVolume}set backgroundMusicVolume(t){this._backgroundMusicVolume=t,this.backgroundMusic&&this.backgroundMusic.setVolume(t)}get backgroundMusic2Mute(){return this._backgroundMusic2Mute}set backgroundMusic2Mute(t){this._backgroundMusic2Mute=t,this.backgroundMusic2&&this.backgroundMusic2.setMute(mute)}get backgroundMusic2Volume(){return this._backgroundMusic2Volume}set backgroundMusic2Volume(t){this._backgroundMusic2Volume=t,this.backgroundMusic2&&this.backgroundMusic2.setVolume(t)}get soundEffectsMute(){return this._soundEffectsMute}set soundEffectsMute(t){this._soundEffectsMute=t;for(var e=this.soundEffects,i=0,s=e.length;i");this.setDelimiters(e[0],e[1]),this.setTranslateTagNameCallback(J(t,"translateTagNameCallback")),this.isRunning=!1,this.isPaused=!1,this.skipEventFlag=!1,this.justCompleted=!1,this.lastTagStart=null,this.lastTagEnd=null,this.lastContent=null}shutdown(){this.destroyEventEmitter()}destroy(){this.shutdown()}setMultipleLinesTagEnable(t){return void 0===t&&(t=!0),this.multipleLinesTagEnable=t,this}setDelimiters(t,e){void 0===e&&(e=t[1],t=t[0]),this.delimiterLeft=t,this.delimiterRight=e,t=Zi(this.delimiterLeft),e=Zi(this.delimiterRight);var i=this.multipleLinesTagEnable?"gs":"gi";return this.reSplit=RegExp(`${t}(.+?)${e}`,i),this}setTranslateTagNameCallback(t){return this.translateTagNameCallback=t,this}setValueConverter(t){return!0===t?t=Qo:t||(t=eh),this.valueConverter=t,this}setLoopEnable(t){return void 0===t&&(t=!0),this.loopEnable=t,this}setSource(t){return this.source=t,this}resetIndex(t){return void 0===t&&(t=0),this.progressIndex=t,this.reSplit.lastIndex=t,this.lastTagStart=null,this.lastTagEnd=null,this.lastContent=null,this.justCompleted=!1,this.isRunning=!1,this}start(t){return this.setSource(t).restart(),this}restart(){this.resetIndex().next()}next(){if(this.isPaused&&this.onResume(),this.isRunning)return this;if(this.isRunning=!0,this.justCompleted)return this.isRunning=!1,this;0===this.reSplit.lastIndex&&this.onStart();var t=this.source,e=t.length;for(this.reSplit.lastIndex=this.progressIndex;;){var i=this.reSplit.exec(t);if(!i){if(this.progressIndex");this.setDelimiters(e[0],e[1])}setTagExpression(t){return t||(t=sh),this.tagExpression=t,this}setValueExpression(t){return t||(t=sh),this.valueExpression=t,this}setDelimiters(t,e){super.setDelimiters(t,e);var i=`(${this.tagExpression})(=(${this.valueExpression}))?`;if(this.reTag=RegExp(i,"i"),this.tagExpression!==sh||this.valueExpression!==sh){var s=`${this.tagExpression}(=${this.valueExpression})?`,r=`/${this.tagExpression}`;t=Zi(this.delimiterLeft),e=Zi(this.delimiterRight);var n=this.multipleLinesTagEnable?"gs":"gi";this.reSplit=RegExp(`${t}((${s})|(${r}))${e}`,n)}return this}onTag(t){var e=t.match(this.reTag),i=e[1],s="/"===i.charAt(0);if(s&&(i=i.substring(1,i.length)),this.translateTagNameCallback&&(i=this.translateTagNameCallback(i)),this.skipEventFlag=!1,s)this.emit(`-${i}`),this.skipEventFlag||this.emit("-",i),this.lastTagEnd=i;else{var r=function(t,e,i){if(null==t)return[];void 0===e&&(e=Qo),void 0===i&&(i=",");for(var s=t.split(i),r=0,n=s.length;r0){var n=this.timeline.addTimer({name:hl,target:s,duration:r.duration,yoyo:r.yoyo,onStart:r.onStart,onProgress:r.onProgress,onComplete:r.onComplete});this.skipTypingAnimation&&n.seek(1)}else r.onStart&&r.onStart(s,0);this.minSizeEnable&&this.textPlayer.setToMinSize(),this.textPlayer.emit("typing",s);var a=this.nextChild;if(a)if(this.skipSpaceEnable&&(e=a).type===rr&&" "===e.text);else if(i+=this.speed+t,t=0,i>0){this.typingTimer=this.timeline.addTimer({name:"delay",target:this,duration:i,onComplete:function(t,e,i){t.typingTimer=void 0,ll.call(t,i.remainder)}});break}}else ur(s)&&s.exec()}this.minSizeEnable&&this.textPlayer.setToMinSize(),this.inTypingProcessLoop=!1},dl=function(t){switch(t){case"camera.fadein":case"camera.fadeout":case"camera.flash":case"camera.shake":case"camera.zoom":case"camera.rotate":case"camera.scroll":return!0;default:return!1}},cl=function(t,e){var i=e.split(".");return t.gameObjectManagers.hasOwnProperty(i[0])},ul=function(t,e,i,s){var r=t.waitEventManager,n=e.split("."),a=n[0],o=t.getGameObjectManager(a),h=`wait.${a}`;switch(n.length){case 1:return r.waitGameObjectManagerEmpty(a),void t.emit(h);case 2:var l=n[1];return r.waitGameObjectDestroy(a,l),void t.emit(h,l);case 3:l=n[1];var d=n[2];if("number"==typeof o.getProperty(l,d))return r.waitGameObjectTweenComplete(a,l,d),void t.emit(h,l,d);var c=d,u=c.startsWith("!");return u&&(c=c.substring(1)),o.hasData(l,c)?(r.waitGameObjectDataFlag(a,l,c,!u),void t.emit(h,l,c)):void r.waitTime(0)}};const pl=Phaser.Input.Keyboard.KeyCodes;var gl=function(t,e,i,s){var r=t.waitEventManager;r.clearWaitCompleteCallbacks().addWaitCompleteCallback(i,s);for(var n=0,a=(e="string"==typeof e&&e.length>1&&-1!==e.indexOf("|")?e.split("|"):[e]).length;n0&&n.chainAnimation(i,s)},El=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).stopAnimation(...i)},_l=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).pauseAnimation(...i)},Rl=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).chainAnimation(...i)};const Ll=[function(t,e,i){var s=i.name;e.on("+",(function(i,...r){if(!e.skipEventFlag){var n,a=i.split(".");Ol(a,s)&&(n=a[1],Cr.call(t,`${s}.play`,Ml,[s,n,r],t),e.skipEvent())}})).on("+",(function(i){if(!e.skipEventFlag){var r,n=i.split(".");(function(t,e){return 3===t.length&&t[0]===e&&"stop"===t[2]})(n,s)&&(r=n[1],Cr.call(t,`${s}.stop`,El,[s,r],t),e.skipEvent())}})).on("-",(function(i){if(!e.skipEventFlag){var r,n=i.split(".");Ol(n,s)&&(r=n[1],Cr.call(t,`${s}.stop`,El,[s,r],t),e.skipEvent())}}))},function(t,e,i){var s=i.name;e.on("+",(function(i){if(!e.skipEventFlag){var r,n=i.split(".");(function(t,e){return 3===t.length&&t[0]===e&&"pause"===t[2]})(n,s)&&(r=n[1],Cr.call(t,`${s}.pause`,_l,[s,r],t),e.skipEvent())}}))},function(t,e,i){var s=i.name;e.on("+",(function(i){if(!e.skipEventFlag){var r,n=i.split(".");if(function(t,e){return 3===t.length&&t[0]===e&&"chain"===t[2]}(n,s)){r=n[1];var a=Array.prototype.slice.call(arguments,1);Cr.call(t,`${s}.chain`,Rl,[s,r,a],t),e.skipEvent()}}}))}];var Bl=function(t){void 0===t&&(t={}),t.name="sprite",t.parseCallbacks=Ll,t.createGameObject=wl(t.createGameObject),this.addGameObjectManager(t,Tl)},Il=function(t,e){return 2===t.length&&t[0]===e},Dl=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).add(...i)},jl=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).remove(...i)},Al=function(t){this.getGameObjectManager(t).removeAll()},zl=function(t){var e,i,s,r;[e,i,s,...r]=t;var n=`${e}.${s}`;if(this.emit(n,i,...r),!(this.listenerCount(n)>0)){var a=this.getGameObjectManager(e);a.hasMethod(i,s)?a.call(i,s,...r):a.setProperty(i,s,r[0])}},Fl={to:!0,yoyo:!0,from:!0,toLeft:!0,toRight:!0,toUp:!0,toDown:!0,yoyoLeft:!0,yoyoRight:!0,yoyoUp:!0,yoyoDown:!0,fromLeft:!0,fromRight:!0,fromUp:!0,fromDown:!0},Yl=function(t){var e,i,s,r,n,a,o,h;[e,i,s,r,n,a,o,h]=t;var l=this.getGameObjectManager(e),d=l.getProperty(i,s);if("number"==typeof d){h.endsWith("Left")||h.endsWith("Up")?h.startsWith("to")||h.startsWith("yoyo")?r=d-r:h.startsWith("from")&&(l.setProperty(i,s,d-r),r=d):h.endsWith("Right")||h.endsWith("Down")?h.startsWith("to")||h.startsWith("yoyo")?r=d+r:h.startsWith("from")&&(l.setProperty(i,s,d+r),r=d):"from"===h&&(l.setProperty(i,s,r),r=d);var c=h.startsWith("yoyo");l.easeProperty(i,{property:s,value:r,duration:n,ease:a,repeat:o,yoyo:c})}};const Xl=[function(t,e,i){var s=i.name;e.on("+",(function(i,...r){if(!e.skipEventFlag){var n,a=i.split(".");Il(a,s)&&(n=a[1],Cr.call(t,`${s}.add`,Dl,[s,n,...r],t),e.skipEvent())}})).on("-",(function(i){if(!e.skipEventFlag){var r,n=i.split(".");Il(n,s)&&(r=n[1],Cr.call(t,`${s}.remove`,jl,[s,r],t),e.skipEvent())}}))},function(t,e,i){var s=i.name;e.on("-",(function(i){e.skipEventFlag||i===s&&(Cr.call(t,`${s}.removeall`,Al,s,t),e.skipEvent())}))},function(t,e,i){var s=i.name;e.on("+",(function(i,...r){if(!e.skipEventFlag){var n,a,o=i.split(".");(function(t,e){return 3===t.length&&t[0]===e})(o,s)&&(n=o[1],a=o[2],Cr.call(t,`${s}.call`,zl,[s,n,a,...r],t),e.skipEvent())}}))},function(t,e,i){var s=i.name;t.getGameObjectManager(s),e.on("+",(function(i,r,n,a,o){if(!e.skipEventFlag){var h,l,d,c=i.split(".");(function(t,e){return 4===t.length&&t[0]===e&&Fl[t[3]]})(c,s)&&(h=c[1],l=c[2],d=c[3],"number"==typeof a&&(o=a,a=void 0),Cr.call(t,`${s}.ease`,Yl,[s,h,l,r,n,a,o,d],t),e.skipEvent())}}))}],Wl=Go.addGameObjectManager;var Vl={addGameObjectManager(t,e){(t=t?Ge(t):{}).name||console.warn("[TextPlayer] Parameter 'name' is required in addGameObjectManager(config) method");var i=t.defaultLayer,s=t.createGameObject,r=this.layerManager;t.createGameObject=function(t,...e){var n=s.call(this,t,...e);return i&&r&&r.addToLayer(i,n),n},Wl.call(this,t,e);for(var n=t.parseCallbacks,a=0,o=(n=n?[...n,...Xl]:Xl).length;a0)return od.length=0,!0;return od.length=0,!1},od=[],hd=void 0;const ld=Phaser.Utils.Objects.GetValue;var dd=function(t,e,i){var s,r;for(var n in void 0===i&&(i={}),t)s=t[n],void 0!==(r=ld(e,n,s[1]))&&(i[s[0]]=r);return i},cd=function(t){t.addEventListener("touchstart",ud,!1),t.addEventListener("touchmove",ud,!1),t.addEventListener("touchend",ud,!1),t.addEventListener("mousedown",ud,!1),t.addEventListener("mouseup",ud,!1),t.addEventListener("mousemove",ud,!1)},ud=function(t){t.stopPropagation()},pd=function(){return this.close(),this.emit("keydown-ENTER",this.parent,this),this},gd=function(){this.isOpened=!0,this.initText(),this.enterCloseEnable&&this.scene.input.keyboard.once("keydown-ENTER",pd,this),this.scene.sys.events.on("postupdate",this.updateText,this),this.clickOutSideTarget?(ka.call(this.clickOutSideTarget,this.parent),Ca.call(this.clickOutSideTarget,this.parent),this.clickOutSideTarget.setInteractive().on("pointerdown",this.onClickOutside,this)):this.scene.input.on("pointerdown",this.onClickOutside,this),this.onOpenCallback&&this.onOpenCallback(this.parent,this),this.emit("open",this)},vd=function(){this.isOpened=!1,this.updateText(),this.enterCloseEnable&&this.scene.input.keyboard.off("keydown-ENTER",pd,this),this.scene.sys.events.off("postupdate",this.updateText,this),this.clickOutSideTarget?this.clickOutSideTarget.disableInteractive().off("pointerdown",this.onClickOutside,this):this.scene.input.off("pointerdown",this.onClickOutside,this),this.onCloseCallback&&this.onCloseCallback(this.parent,this),function(t){if(t){var e=t.parentElement;e&&e.removeChild(t)}}(this.node),this.node=void 0,this.emit("close",this)};const fd=Phaser.Utils.Objects.GetValue;var md=function(t,e){var i,s=fd(e,"inputType",void 0);void 0===s&&(s=fd(e,"type","text")),"textarea"===s?(i=document.createElement("textarea")).style.resize="none":(i=document.createElement("input")).type=s;var r=fd(e,"style",void 0),n=i.style;dd(sd,r,n),n.position="absolute",n.opacity=0,n.pointerEvents="none",n.zIndex=0,n.transform="scale(0)",dd(id,e,i),cd(i);var a=t.scene.sys.scale;return(a.isFullscreen?a.fullscreenTarget:document.body).appendChild(i),i.addEventListener("focus",(function(e){gd.call(t)})),i.addEventListener("blur",(function(e){vd.call(t)})),i},yd={open:function(){return this.isOpened||this.readOnly||((t=this)!==hd&&(void 0!==hd&&hd.close(),hd=t),this.node||(this.node=md(this,this.nodeConfig)),this.setFocus()),this;var t},close:function(){return this.isOpened?(this===hd&&(hd=void 0),this.setBlur(),this):this}};const bd=Phaser.Utils.Objects.GetValue;class xd extends Ba{constructor(t,e){super(t);var i=bd(e,"inputType",void 0);void 0===i&&(i=bd(e,"type","text")),this.setEnterCloseEnable(bd(e,"enterClose","textarea"!==i));var s=bd(e,"onOpen",void 0);s||(s=bd(e,"onFocus",void 0)),this.onOpenCallback=s,this.clickOutSideTarget=bd(e,"clickOutSideTarget",void 0);var r=bd(e,"onClose",void 0);r||(r=bd(e,"onBlur",void 0)),this.onCloseCallback=r,this.onUpdateCallback=bd(e,"onUpdate",void 0),this.isOpened=!1,t.on("pointerdown",(function(){this.open()}),this).setInteractive(),this.nodeConfig=function(t){void 0===t&&(t={});var e={};return rd(t,e,"inputType"),rd(t,e,"type"),rd(t,e,"style"),rd(t,e,sd),rd(t,e,id),e}(e),this.node=void 0}destroy(){this.close(),this.clickOutSideTarget&&this.clickOutSideTarget.destroy(),super.destroy()}onClickOutside(t){nd(this.parent,t)||this.close()}setEnterCloseEnable(t){return void 0===t&&(t=!0),this.enterCloseEnable=t,this}initText(){}updateText(){}get text(){return this.node?this.node.value:""}set text(t){this.node&&(this.node.value=t)}setText(t){return this.text=t,this}get maxLength(){return this.nodeConfig.maxLength}set maxLength(t){this.nodeConfig.maxLength=t,this.node&&(this.node.maxLength=t)}setMaxLength(t){return this.maxLength=t,this}get minLength(){return this.nodeConfig.minLength}set minLength(t){this.nodeConfig.minLength=t,this.node&&(this.node.minLength=t)}setMinLength(t){return this.minLength=t,this}get placeholder(){return this.node.placeholder}set placeholder(t){this.node&&(this.node.placeholder=t)}setPlaceholder(t){return this.placeholder=t,this}selectText(t,e){return this.node?(void 0===t?this.node.select():this.node.setSelectionRange(t,e),this):this}selectAll(){return this.selectText(),this}get selectionStart(){return this.node?this.node.selectionStart:0}get selectionEnd(){return this.node?this.node.selectionEnd:0}get selectedText(){if(!this.node)return"";var t=this.node;return t.value.substring(t.selectionStart,t.selectionEnd)}get cursorPosition(){return this.node?this.node.selectionStart:0}set cursorPosition(t){this.node&&this.node.setSelectionRange(t,t)}setCursorPosition(t){return void 0===t?t=this.text.length:t<0&&(t=this.text.length+t),this.cursorPosition=t,this}get tooltip(){return this.node?this.node.title:""}set tooltip(t){if(!this.node)return this;this.node.title=t}setTooltip(t){return this.tooltip=t,this}setTextChangedCallback(t){return this.onTextChanged=t,this}get readOnly(){return this.nodeConfig.readOnly}set readOnly(t){this.nodeConfig.readOnly=t,this.node&&(this.node.readOnly=t)}setReadOnly(t){return void 0===t&&(t=!0),this.readOnly=t,this}get spellCheck(){return this.node?this.node.spellcheck:""}set spellCheck(t){this.node&&(this.node.spellcheck=t)}setSpellCheck(t){return this.spellCheck=t,this}get fontColor(){if(this.node)return this.node.style.color}set fontColor(t){this.node&&(this.node.style.color=t)}setFontColor(t){return this.fontColor=t,this}setStyle(t,e){return this.node?(this.node.style[t]=e,this):this}getStyle(t){if(this.node)return this.node.style[t]}scrollToBottom(){return this.node?(this.node.scrollTop=this.node.scrollHeight,this):this}setEnabled(t){return this.node?(void 0===t&&(t=!0),this.node.disabled=!t,this):this}setBlur(){return this.node?(this.node.blur(),this):this}setFocus(){return this.node?(this.node.focus(),this):this}get isFocused(){return this.isOpened}}Object.assign(xd.prototype,yd);var Cd=function(t,e,i){t=t.replace(" ","");var s=i.previousText;if(t===s)return t;if(isNaN(t)){i.emit("nan",t,i),t=s;var r=i.cursorPosition-1;i.setText(t),i.setCursorPosition(r)}else i.previousText=t;return t},kd=function(t){var e=t.prevSelectionStart;if(null!==e){for(var i=t.prevSelectionEnd,s=t.parent,r=e;r=r&&h=i&&hi.length&&(t.prevCursorPosition=null),null!==t.prevCursorPosition&&(s=e.getCharChild(t.prevCursorPosition))&&("\n"===s.text&&s.clearTextSize(),e.emit("cursorout",s,t.prevCursorPosition,e)),null!=r&&(s=e.getCharChild(r))&&("\n"===s.text&&s.copyTextSize(e.lastInsertCursor),function(t){var e,i,s=t.parent,r=s.width,n=s.height,a=t.drawX,o=t.drawY,h=a+t.drawTLX,l=a+t.drawTRX,d=o+t.drawTLY,c=o+t.drawBLY;e=h<0?0-h:l>r?r-l:0,i=d<0?0-d:c>n?n-c:0,s._textOX+=e,s._textOY+=i}(s),e.emit("cursorin",s,r,e)),e.emit("movecursor",r,t.prevCursorPosition,e),t.prevCursorPosition=r)}(this)):(kd(this),wd(this)),this}setNumberInput(){return this.onUpdateCallback=Cd,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}};const Td=Phaser.Utils.Objects.GetValue,Od=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var Md=function(t,e){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return!0;if(-1!==e.indexOf(".")){for(var i=e.split("."),s=t,r=0;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,a=1/i.zoom,o=r/2,h=n/2,l=r*a,d=n*a;e.x===o&&e.y===h||e.setPosition(o,h),e.width===l&&e.height===d||e.setSize(l,d)}}}const Rd=Phaser.GameObjects.Zone;let Ld=class extends Rd{constructor(t){super(t,0,0,2,2),this.fullWindow=new _d(this)}};var Bd=function(t,e,i,s){if(void 0===i&&(i="."),void 0===s&&(s={}),!t)return s;if(e in t)return Object.assign(s,t[e]);for(var r in e+=i,t)r.startsWith(e)&&(s[r.replace(e,"")]=t[r]);return s},Id=function(){var t=this.scene.input.keyboard;this.textEdit.on("open",(function(){t.on("keydown-UP",this.cursorMoveUp,this).on("keydown-DOWN",this.cursorMoveDown,this)}),this).on("close",(function(){t.off("keydown-UP",this.cursorMoveUp,this).off("keydown-DOWN",this.cursorMoveDown,this)}),this)},Dd=function(t,e,i){if(void 0===i&&(i={}),Array.isArray(e))for(var s=0,r=e.length;st.length?i:t})),a.value=t.join(e)}else a.value=t.join(i.slice(o,o+a.count));o+=a.count,a.added||(h+=a.count)}}let l=e[a-1];return a>1&&"string"==typeof l.value&&(l.added||l.removed)&&t.equals("",l.value)&&(e[a-2].value+=l.value,e.pop()),e}Yd.prototype={diff(t,e,i={}){let s=i.callback;"function"==typeof i&&(s=i,i={}),this.options=i;let r=this;function n(t){return s?(setTimeout((function(){s(void 0,t)}),0),!0):t}t=this.castInput(t),e=this.castInput(e),t=this.removeEmpty(this.tokenize(t));let a=(e=this.removeEmpty(this.tokenize(e))).length,o=t.length,h=1,l=a+o;i.maxEditLength&&(l=Math.min(l,i.maxEditLength));let d=[{newPos:-1,components:[]}],c=this.extractCommon(d[0],e,t,0);if(d[0].newPos+1>=a&&c+1>=o)return n([{value:this.join(e),count:e.length}]);function u(){for(let s=-1*h;s<=h;s+=2){let h,l=d[s-1],c=d[s+1],u=(c?c.newPos:0)-s;l&&(d[s-1]=void 0);let p=l&&l.newPos+1=a&&u+1>=o)return n(Xd(r,h.components,e,t,r.useLongestToken));d[s]=h}else d[s]=void 0}var i;h++}if(s)!function t(){setTimeout((function(){if(h>l)return s();u()||t()}),0)}();else for(;h<=l;){let t=u();if(t)return t}},pushComponent(t,e,i){let s=t[t.length-1];s&&s.added===e&&s.removed===i?t[t.length-1]={count:s.count+1,added:e,removed:i}:t.push({count:1,added:e,removed:i})},extractCommon(t,e,i,s){let r=e.length,n=i.length,a=t.newPos,o=a-s,h=0;for(;a+1t,tokenize:t=>t.split(""),join:t=>t.join("")};const Wd=new Yd,Vd=/^[a-zA-Z\u{C0}-\u{FF}\u{D8}-\u{F6}\u{F8}-\u{2C6}\u{2C8}-\u{2D7}\u{2DE}-\u{2FF}\u{1E00}-\u{1EFF}]+$/u,Gd=/\S/,Hd=new Yd;Hd.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!Gd.test(t)&&!Gd.test(e)},Hd.tokenize=function(t){let e=t.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/);for(let t=0;tvoid 0===i?e:i}=this.options;return"string"==typeof t?t:JSON.stringify(Kd(t,null,null,i),i," ")},$d.equals=function(t,e){return Yd.prototype.equals.call($d,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const Jd=new Yd;Jd.tokenize=function(t){return t.slice()},Jd.join=Jd.removeEmpty=function(t){return t};const qd=Phaser.Utils.Array.Remove;var Zd=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),qd(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(h=i,l=e,Wd.diff(h,l,d)),r=0,n=0,a=s.length;nr)i+=a;else{if(s!==r)break;i+=Math.min(e.position,a)}}return i},sc={cursorMoveLeft(){if(!this.isOpened)return this;var t=tc(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=tc(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=ec(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=tc(ic(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=ec(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=tc(ic(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const rc=Phaser.Utils.Objects.IsPlainObject;class nc extends ln{constructor(t,e,i,s,r,n){rc(e)?n=e:rc(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(Md(e,"wrap.vAlign")||P(e,"wrap.vAlign",s=i?"center":"top"),Md(e,"wrap.wrapMode")||P(e,"wrap.wrapMode","char"),Md(e,"wrap.maxLines")||P(e,"wrap.maxLines",s=i?1:void 0),i&&P(e,"wrap.wrapWidth",1/0),Md(e,"wrap.useDefaultTextHeight")||P(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!Md(e.edit,"inputType")){var s=i?"text":"textarea";P(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new Ld(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var a=n.text;a&&delete n.text;var o=Bd(n.background,"focus"),h=Bd(n.style,"cursor"),l=Bd(n.style,"range");super(t,e,i,s,r,n),this.type="rexCanvasInput",this.contentWidth=void 0,this.contentHeight=void 0,this.lineHeight=void 0,this.linesCount=void 0,this.characterCountOfLines=[],this._text,this.textEdit=function(t,e){var i=Td(e,"edit");return void 0===i&&(i={}),rd(e,i,Od),new Pd(t,i)}(this,n),Id.call(this),n.focusStyle&&Object.assign(o,n.focusStyle),Fd.call(this,o),n.cursorStyle&&Object.assign(h,n.cursorStyle),Ad.call(this,h),n.rangeStyle&&Object.assign(l,n.rangeStyle),vn(l)&&Object.assign(l,h),zd.call(this,l);var d=n.onAddChar;d&&this.on("addchar",d);var c=n.onCursorIn;c&&this.on("cursorin",c);var u=n.onCursorOut;u&&this.on("cursorout",u);var p=!n.onRangeIn&&!n.onRangeOut,g=p?n.onCursorIn:n.onRangeIn;g&&this.on("rangein",g);var v=p?n.onCursorOut:n.onRangeOut;v&&this.on("rangeout",v);var f,m=n.onMoveCursor;m&&this.on("movecursor",m),this.setParseTextCallback(n.parseTextCallback),this.lastInsertCursor=((f=this.createCharChild("|")).text="",f),a||(a=""),this.setText(a)}addChild(t,e){if(super.addChild(t,e),Array.isArray(t))for(var i=t,s=0,r=i.length;s0,a=0,o=e.length;a0;this.dirty=this.dirty||this._radiusTL!==t||this._convexTL!==e,this._convexTL=e,this._radiusTL=Math.abs(t)}get radiusTR(){return this._radiusTR}set radiusTR(t){var e=t>0;this.dirty=this.dirty||this._radiusTR!==t||this._convexTR!==e,this._convexTR=e,this._radiusTR=Math.abs(t)}get radiusBL(){return this._radiusBL}set radiusBL(t){var e=t>0;this.dirty=this.dirty||this._radiusBL!==t||this._convexBL!==e,this._convexBL=e,this._radiusBL=Math.abs(t)}get radiusBR(){return this._radiusBR}set radiusBR(t){var e=t>0;this.dirty=this.dirty||this._radiusBR!==t||this._convexBR!==e,this._convexBR=e,this._radiusBR=Math.abs(t)}get radius(){return Math.max(this.radiusTL,this.radiusTR,this.radiusBL,this.radiusBR)}set radius(t){"number"==typeof t?(this.radiusTL=t,this.radiusTR=t,this.radiusBL=t,this.radiusBR=t):(this.radiusTL=Jc(t,"tl",0),this.radiusTR=Jc(t,"tr",0),this.radiusBL=Jc(t,"bl",0),this.radiusBR=Jc(t,"br",0))}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}get iterations(){return this._iterations}set iterations(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t}setIterations(t){return this.iterations=t,this}updateData(){var t=this.pathData;t.length=0;var e,i=this.width,s=this.height,r=this.iterations+1;return(e=this.radiusTL)>0?this._convexTL?Bt(e,e,e,e,180,270,!1,r,t):Bt(0,0,e,e,90,0,!0,r,t):Rt(0,0,t),(e=this.radiusTR)>0?this._convexTR?Bt(i-e,e,e,e,270,360,!1,r,t):Bt(i,0,e,e,180,90,!0,r,t):Rt(i,0,t),(e=this.radiusBR)>0?this._convexBR?Bt(i-e,s-e,e,e,0,90,!1,r,t):Bt(i,s,e,e,270,180,!0,r,t):Rt(i,s,t),(e=this.radiusBL)>0?this._convexBL?Bt(e,s-e,e,e,90,180,!1,r,t):Bt(0,s,e,e,360,270,!0,r,t):Rt(0,s,t),t.push(t[0],t[1]),Lc(this.x,this.y,t),super.updateData(),this}}const Zc=Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlpha;var Qc={buildShapes(){this.addShape((new qc).setName("box")).addShape((new $c).setName("checker"))},updateShapes(){var t=this.width/2,e=this.height/2,i=Math.min(t,e),s=2*i,r=t-i,n=e-i,a=this.boxLineWidth,o=Math.max(s/10,2),h=this.getShape("box"),l=this.getShape("checker");if(this.isSizeChanged){var d=s*(1-this.boxSize)/2,c=a/2,u=s*this.boxSize-a;h.setTopLeftPosition(r+c+d,n+c+d).setSize(u,u),this.isCircleShape?h.setRadius(u/2):h.setRadius(0),d=s*(1-this.checkerSize)/2;var p=s*this.checkerSize/4,g=1*p,v=2*p,f=3*p;l.startAt(g,v).lineTo(v,f).lineTo(f,g).offset(r+d,n+d).end()}this.checked?(h.fillStyle(this.boxFillColor,this.boxFillAlpha).lineStyle(a,this.boxStrokeColor,this.boxStrokeAlpha),l.lineStyle(o,this.checkerColor)):(h.fillStyle(this.uncheckedBoxFillColor,this.uncheckedBoxFillAlpha).lineStyle(a,this.uncheckedBoxStrokeColor,this.uncheckedBoxStrokeAlpha),l.lineStyle()),this.checked&&l.setDisplayPathSegment(this.checkerAnimProgress)}};const tu=Phaser.Utils.Objects.GetValue,eu=Phaser.Math.Linear;class iu extends Za{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=tu(t,"key","value");var i=e[this.propertyKey];return this.fromValue=tu(t,"from",i),this.toValue=tu(t,"to",i),this.setEase(tu(t,"ease",this.ease)),this.setDuration(tu(t,"duration",this.duration)),this.setRepeat(tu(t,"repeat",0)),this.setDelay(tu(t,"delay",0)),this.setRepeatDelay(tu(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=eu(this.fromValue,this.toValue,i)}}var su={setCheckerAnimationDuration(t){return void 0===t&&(t=0),this.checkerAnimDuration=t,this},playCheckerAnimation(){return void 0===this.checkerAnimProgressTask&&(this.checkerAnimProgressTask=new iu(this,{eventEmitter:null})),this.checkerAnimProgressTask.restart({key:"checkerAnimProgress",from:0,to:1,duration:this.checkerAnimDuration}),this},stopCheckerAnimation(){return void 0===this.checkerAnimProgressTask||this.checkerAnimProgressTask.stop(),this}},ru={};Object.assign(ru,mc,yc,Qc,su);const nu=23730,au=Phaser.Utils.Objects.GetValue,ou=Phaser.Utils.Objects.IsPlainObject;class hu extends fc{constructor(t,e,i,s,r,n,a){ou(e)?(e=au(a=e,"x",0),i=au(a,"y",0),s=au(a,"width",2),r=au(a,"height",2),n=au(a,"color",nu)):ou(n)&&(n=au(a=n,"color",nu)),super(t,e,i,s,r),this.type="rexCheckbox",void 0===n&&(n=nu),this.setBoxShape(au(a,"circleBox",!1)),this.setBoxFillStyle(n,au(a,"boxFillAlpha",1)),this.setUncheckedBoxFillStyle(au(a,"uncheckedColor",null),au(a,"uncheckedBoxFillAlpha",1)),this.setBoxStrokeStyle(au(a,"boxLineWidth",4),au(a,"boxStrokeColor",n),au(a,"boxStrokeAlpha",1)),this.setUncheckedBoxStrokeStyle(this.boxLineWidth,au(a,"uncheckedBoxStrokeColor",this.boxStrokeColor),au(a,"uncheckedBoxStrokeAlpha",this.boxStrokeAlpha)),this.setCheckerStyle(au(a,"checkerColor",16777215),au(a,"checkerAlpha",1)),this.setBoxSize(au(a,"boxSize",1)),this.setCheckerSize(au(a,"checkerSize",1)),this.setCheckerAnimationDuration(au(a,"animationDuration",150)),this.buildShapes();var o=au(a,"checked");void 0===o&&(o=au(a,"value",!1)),this.setValue(o)}get value(){return this._value}set value(t){t=!!t,this._value!==t&&(this.dirty=!0,this._value=t,t?this.playCheckerAnimation():this.stopCheckerAnimation(),this.emit("valuechange",t))}setValue(t){return this.value=t,this}toggleValue(){return this.setValue(!this.value),this}get checked(){return this.value}set checked(t){this.value=t}setChecked(t){return void 0===t&&(t=!0),this.setValue(t),this}toggleChecked(){return this.toggleValue(),this}get checkerAnimProgress(){return this._checkerAnimProgress}set checkerAnimProgress(t){this._checkerAnimProgress!==t&&(this._checkerAnimProgress=t,this.dirty=!0)}}Object.assign(hu.prototype,ru);const lu=Phaser.Utils.Objects.GetValue;class du extends Ba{constructor(t,e){super(t,e),this._enable=void 0,t.setInteractive(lu(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.isDown=!1,this.isOver=!1,this.setEnable(lu(t,"enable",!0)),this.setMode(lu(t,"mode",1)),this.setClickInterval(lu(t,"clickInterval",100)),this.setDragThreshold(lu(t,"threshold",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPress,this),t.on("pointerup",this.onRelease,this),t.on("pointerout",this.onPointOut,this),t.on("pointermove",this.onMove,this),t.on("pointerover",this.onOver,this),t.on("pointerout",this.onOut,this)}shutdown(t){this.isShutdown||(this.pointer=null,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=cu[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}onPress(t,e,i,s){void 0===this.pointer&&(this.pointer=t,this.isDown=!0,this.emit("down",this,this.parent,t,s),0===this.mode&&this.click(t.downTime,t,s))}onRelease(t,e,i,s){this.pointer===t&&(this.isDown=!1,this.emit("up",this,this.parent,t,s),1===this.mode&&this.click(t.upTime,t,s),this.pointer=void 0)}onPointOut(t,e){this.pointer===t&&this.cancel()}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&t.getDistance()>=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const cu={press:0,pointerdown:0,release:1,pointerup:1},uu=Phaser.Utils.Objects.GetValue,pu=Phaser.Utils.Objects.IsPlainObject;class gu extends hu{constructor(t,e,i,s,r,n,a){pu(e)?(e=uu(a=e,"x",0),i=uu(a,"y",0),s=uu(a,"width",2),r=uu(a,"height",2),n=uu(a,"color",nu)):pu(n)&&(n=uu(a=n,"color",nu)),super(t,e,i,s,r,n,a),this._click=new du(this,uu(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(uu(a,"readOnly",!1))}get readOnly(){return!this._click.enable}set readOnly(t){this._click.enable=!t}setReadOnly(t){return void 0===t&&(t=!0),this.readOnly=t,this}}t.register("checkbox",(function(t,e,i,s,r,n){var a=new gu(this.scene,t,e,i,s,r,n);return this.scene.add.existing(a),a})),P(window,"RexPlugins.UI.Checkbox",gu);var vu={setTrackFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.trackFillColor!==t||this.trackFillAlpha!==e,this.trackFillColor=t,this.trackFillAlpha=e,this},setFalseValueTrackFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.falseValueTrackColor!==t||this.uncheckedTrackFillAlpha!==e,this.falseValueTrackColor=t,this.falseValueTrackFillAlpha=e,this},setThumbStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.thumbColor!==t||this.checkAlpha!==e,this.thumbColor=t,this.thumbAlpha=e,this}},fu={setTrackSize(t,e){return this.dirty=this.dirty||this.trackWidth!==t||this.trackHeight!==e,this.trackWidth=t,this.trackHeight=e,this},setTrackRadius(t){return this.dirty=this.dirty||this.trackRadius!==t,this.trackRadius=t,this},setThumbSize(t,e){return void 0===e&&(e=t),this.dirty=this.dirty||this.thumbWidth!==t||this.thumbHeight!==e,this.thumbWidth=t,this.thumbHeight=e,this},setThumbRadius(t){return this.dirty=this.dirty||this.thumbRadius!==t,this.thumbRadius=t,this}},mu={setThumbPosition(t,e){return void 0===e&&(e=1-t),this.thumbLeftX=t,this.thumbRightX=e,this},setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}},yu=function(t,e,i){return(e-t)*i+t};const bu=Phaser.Math.Linear;var xu={buildShapes(){this.addShape((new qc).setName("track")).addShape((new qc).setName("thumb"))},updateShapes(){var t=this.width,e=this.height,i=this.value?this.toggleAnimProgress:1-this.toggleAnimProgress,s=this.getShape("track");if(this.isSizeChanged){var r=t*this.trackWidth,n=e*this.trackHeight,a=(t-r)/2,o=(e-n)/2,h=e*this.trackRadius;s.setTopLeftPosition(a,o).setSize(r,n).setRadius(h)}var l,d,c,u=(l=this.falseValueTrackColor,d=this.trackFillColor,c=i,(255&yu(yn(l),yn(d),c))<<16|(255&yu(bn(l),bn(d),c))<<8|255&yu(xn(l),xn(d),c)),p=bu(this.falseValueTrackFillAlpha,this.trackFillAlpha,i);s.fillStyle(u,p);var g=this.getShape("thumb");if(this.isSizeChanged){var v=t*this.thumbWidth,f=e*this.thumbHeight,m=e*this.thumbRadius;g.setSize(v,f).setRadius(m)}var y=bu(this.thumbLeftX,this.thumbRightX,i)*t;this.rtl&&(y=t-y);var b=e/2;g.setCenterPosition(y,b),g.fillStyle(this.thumbColor,this.thumbAlpha)}},Cu={setToggleAnimationDuration(t){return void 0===t&&(t=0),this.toggleAnimDuration=t,this},playToggleAnimation(){return void 0===this.toggleAnimProgressTask&&(this.toggleAnimProgressTask=new iu(this,{eventEmitter:null})),this.toggleAnimProgressTask.restart({key:"toggleAnimProgress",from:0,to:1,duration:this.toggleAnimDuration}),this},stopToggleAnimation(){return void 0===this.toggleAnimProgressTask||this.toggleAnimProgressTask.stop(),this}},ku={};Object.assign(ku,vu,fu,mu,xu,Cu);const wu=Phaser.Utils.Objects.GetValue,Su=Phaser.Utils.Objects.IsPlainObject,Pu=23730;class Tu extends fc{constructor(t,e,i,s,r,n,a){Su(e)?(e=wu(a=e,"x",0),i=wu(a,"y",0),s=wu(a,"width",2),r=wu(a,"height",2),n=wu(a,"color",Pu)):Su(n)&&(n=wu(a=n,"color",Pu)),super(t,e,i,s,r),this.type="rexToggleSwitch",void 0===n&&(n=Pu),this.setTrackFillStyle(n,wu(a,"trackFillAlpha",1)),this.setFalseValueTrackFillStyle(wu(a,"falseValueTrackColor",function(t){var e=.3*yn(t)+.59*bn(t)+.11*xn(t);return(255&e)<<16|(255&e)<<8|255&e}(n)),wu(a,"falseValueTrackFillAlpha",1)),this.setThumbStyle(wu(a,"thumbColor",16777215),wu(a,"thumbAlpha",1)),this.setTrackSize(wu(a,"trackWidth",.9),wu(a,"trackHeight",.5)),this.setTrackRadius(wu(a,"trackRadius",.5*this.trackHeight));var o=wu(a,"thumbHeight",void 0),h=wu(a,"thumbWidth",o);void 0===h&&(h=.9*this.trackHeight),this.setThumbSize(h,o),this.setThumbRadius(wu(a,"thumbRadius",.5*this.thumbHeight)),this.setThumbPosition(wu(a,"thumbLeft",.3),wu(a,"thumbRight",void 0)),this.setRTL(wu(a,"rtl",!1)),this.setToggleAnimationDuration(wu(a,"animationDuration",150)),this.buildShapes(),this.setValue(wu(a,"value",!1),0)}get value(){return this._value}set value(t){t=!!t,this._value!==t&&(this.dirty=!0,this._value=t,this.playToggleAnimation(),this.emit("valuechange",t))}setValue(t,e){void 0===e&&(e=this.toggleAnimDuration);var i=this.toggleAnimDuration;return this.toggleAnimDuration=e,this.value=t,this.toggleAnimDuration=i,this}toggleValue(t){return this.setValue(!this.value,t),this}get toggleAnimProgress(){return this._toggleAnimProgress}set toggleAnimProgress(t){this._toggleAnimProgress!==t&&(this._toggleAnimProgress=t,this.dirty=!0)}}Object.assign(Tu.prototype,ku);const Ou=Phaser.Utils.Objects.GetValue;class Mu extends Tu{constructor(t,e,i,s,r,n,a){super(t,e,i,s,r,n,a),this._click=new du(this,Ou(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(Ou(a,"readOnly",!1))}get readOnly(){return!this._click.enable}set readOnly(t){this._click.enable=!t}setReadOnly(t){return void 0===t&&(t=!0),this.readOnly=t,this}}t.register("toggleSwitch",(function(t,e,i,s,r,n){var a=new Mu(this.scene,t,e,i,s,r,n);return this.scene.add.existing(a),a})),P(window,"RexPlugins.UI.ToggleSwitch",Mu);var Eu={loadFromURL(t,e){var i=this,s=new Image;return s.onload=function(){i.width!==s.width||i.height!==s.height?i.resize(s.width,s.height):i.clear(),i.context.drawImage(s,0,0),i.updateTexture(),e&&e(),s.onload=null,s.src="",s.remove()},s.src=t,this},loadFromURLPromise(t){var e=this;return new Promise((function(i,s){e.loadFromURL(t,i)}))},loadFromFile(t,e){var i=URL.createObjectURL(t);return this.loadFromURL(i,(function(){URL.revokeObjectURL(i),e&&e()})),this},loadFromFilePromise(t){var e=this;return new Promise((function(i,s){e.loadFromFile(t,i)}))}};class _u extends $t{}Object.assign(_u.prototype,Eu),t.register("canvas",(function(t,e,i,s){var r=new _u(this.scene,t,e,i,s);return this.scene.add.existing(r),r})),P(window,"RexPlugins.UI.Canvas",_u);const Ru=Phaser.Utils.Objects.GetValue;class Lu extends $t{constructor(t,e,i,s,r,n){super(t,e,i),this.type="rexCircleMaskImage",this.setTexture(s,r,n)}setTexture(t,e,i){"object"==typeof e&&(i=e,e=void 0),"string"==typeof i&&(i={maskType:i});var s=Ru(i,"maskType",0),r=Ru(i,"backgroundColor",void 0),n=Ru(i,"strokeColor",void 0),a=Ru(i,"strokeWidth",null!=n?10:0);if(void 0===s?s=0:"string"==typeof s&&(s=Bu[s]),this._textureKey=t,this._frameName=e,null===s)return this.loadTexture(t,e),this.dirty=!0,this;var o=this.scene.sys.textures.getFrame(t,e);if(!o)return this;o.cutWidth!==this.width||o.cutHeight!==this.height?this.setCanvasSize(o.cutWidth,o.cutHeight):this.clear();var h=this.canvas,l=this.context,d=h.width,c=h.height;null!=r&&(l.fillStyle=r,l.fillRect(0,0,d,c)),l.save(),l.beginPath();var u=a/2;switch(s){case 1:var p=(m=Math.floor(d/2))-u,g=(y=Math.floor(c/2))-u;l.ellipse(m,y,p,g,0,0,2*Math.PI);break;case 2:var v=Ru(i,"radius",0),f=Ru(i,"iteration",void 0);Qt(l,u,u,d-a,c-a,v,f);break;default:var m=Math.floor(d/2),y=Math.floor(c/2),b=Math.min(m,y)-u;l.arc(m,y,b,0,2*Math.PI)}return null!=n&&(l.strokeStyle=n,l.lineWidth=a,l.stroke()),l.clip(),this.loadTexture(t,e),l.restore(),this.dirty=!0,this}resize(t,e){return this.setDisplaySize(t,e),this}}const Bu={circle:0,ellipse:1,roundRectangle:2};t.register("circleMaskImage",(function(t,e,i,s,r){var n=new Lu(this.scene,t,e,i,s,r);return this.scene.add.existing(n),n})),P(window,"RexPlugins.UI.CircleMaskImage",Lu);const Iu=Phaser.Utils.Objects.GetValue;class Du extends $t{constructor(t,e,i,s,r,n){super(t,e,i),this.type="rexAlphaMaskImage",this.maskFrame=null,this.setTexture(s,r,n)}setTexture(t,e,i){"object"==typeof e&&(i=e,e=void 0),"string"==typeof i&&(i={mask:{key:i}});var s=Iu(i,"mask.key"),r=Iu(i,"mask.frame"),n=Iu(i,"mask.invertAlpha",!1),a=Iu(i,"mask.scale"),o=Iu(i,"backgroundColor");if(s){this._maskKey=s,this._maskFrame=r,this._maskScale=a;var h=s?this.scene.sys.textures.get(s):null;this.maskFrame=h?h.get(r):null}this._textureKey=t,this._frameName=e;var l=this.maskFrame;if(null===l)return this.loadTexture(t,e),this.dirty=!0,this;var d=null!=o;this.loadTexture(t,e);var c,u,p=this.canvas,g=this.context,v=p.width,f=p.height;g.save(),g.globalCompositeOperation=n?"destination-out":"destination-in",null!=this._maskScale?(c=l.cutWidth*this._maskScale,u=l.cutHeight*this._maskScale):(c=v,u=f);var m=(v-c)/2,y=(f-u)/2;return this.drawFrame(this._maskKey,this._maskFrame,m,y,c,u),g.restore(),d&&(g.save(),g.globalCompositeOperation="destination-over",g.fillStyle=o,g.fillRect(0,0,v,f),g.restore()),this.dirty=!0,this}resize(t,e){return this.setDisplaySize(t,e),this}}t.register("alphaMaskImage",(function(t,e,i,s,r){var n=new Du(this.scene,t,e,i,s,r);return this.scene.add.existing(n),n})),P(window,"RexPlugins.UI.AlphaMaskImage",Du);const ju=Phaser.Math.Linear,Au=Phaser.Math.Percent;var zu={setValue(t,e,i){return null==t||(void 0!==e&&(t=Au(t,e,i)),this.value=t),this},addValue(t,e,i){return void 0!==e&&(t=Au(t,e,i)),this.value+=t,this},getValue(t,e){var i=this.value;return void 0!==t&&(i=ju(t,e,i)),i}};const Fu=Phaser.Math.Percent;var Yu={setEaseValuePropName:function(t){return this.easeValuePropName=t,this},setEaseValueDuration:function(t){return this.easeValueDuration=t,this},setEaseValueFunction:function(t){return this.easeFunction=t,this},stopEaseValue:function(){return this.easeValueTask&&this.easeValueTask.stop(),this},easeValueTo:function(t,e,i){return null==t||(void 0!==e&&(t=Fu(t,e,i)),void 0===this.easeValueTask&&(this.easeValueTask=new iu(this,{eventEmitter:null})),this.easeValueTask.restart({key:this.easeValuePropName,to:t,duration:this.easeValueDuration,ease:this.easeFunction})),this},easeValueRepeat:function(t,e,i,s){return void 0===i&&(i=-1),void 0===s&&(s=0),void 0===this.easeValueTask&&(this.easeValueTask=new iu(this,{eventEmitter:null})),this.easeValueTask.restart({key:this.easeValuePropName,from:t,to:e,duration:this.easeValueDuration,ease:this.easeFunction,repeat:i,repeatDelay:s}),this}};const Xu=Phaser.Utils.Objects.GetValue,Wu=Phaser.Math.Clamp;function Vu(t){class e extends t{bootProgressBase(t){this.eventEmitter=Xu(t,"eventEmitter",this);var e=Xu(t,"valuechangeCallback",null);if(null!==e){var i=Xu(t,"valuechangeCallbackScope",void 0);this.eventEmitter.on("valuechange",e,i)}return this.setEaseValuePropName("value").setEaseValueDuration(Xu(t,"easeValue.duration",0)).setEaseValueFunction(Xu(t,"easeValue.ease","Linear")),this}get value(){return this._value}set value(t){t=Wu(t,0,1);var e=this._value,i=e!=t;this.dirty=this.dirty||i,this._value=t,i&&this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter)}}return Object.assign(e.prototype,zu,Yu),e}const Gu=Phaser.Math.RadToDeg,Hu=Phaser.Math.DegToRad;var Uu=function(t,e,i,s,r,n,a,o){var h=360===Math.abs(a-n),l=Hu(n),d=Hu(a),c=Math.cos(l),u=Math.sin(l),p=Math.cos(d),g=Math.sin(d);return t.startAt(e+c*s,i+u*s),t.arc(e,i,s,n,a,o),h&&0===r||(t.lineTo(e+p*r,i+g*r),r>0&&t.arc(e,i,r,a,n,!o)),t.close(),t},Nu={buildShapes(){var t=this.iterations;this.addShape((new $c).setIterations(t).setName("track")).addShape((new $c).setIterations(t).setName("bar")).addShape((new Pc).setIterations(t).setName("center"))},updateShapes(){var t=this.radius,e=this.thickness*this.radius,i=this.radius,s=i-e,r=this.getShape("track");null!=this.trackColor&&this.thickness>0?(r.fillStyle(this.trackColor),Uu(r,t,t,i,s,0,360,!1)):r.reset();var n,a,o,h=this.getShape("bar");null!=this.barColor&&this.thickness>0?(1===this.value?(n=!1,a=0,o=360):(n=this.anticlockwise,a=Gu(this.startAngle),o=360*(n?1-this.value:this.value)+a),h.fillStyle(this.barColor),Uu(h,t,t,i+1,s-1,a,o,!1)):h.reset();var l=this.getShape("center");this.centerColor&&s>0?l.setCenterPosition(t,t).setRadius(s).fillStyle(this.centerColor):l.reset()}};const $u=Phaser.Utils.Objects.GetValue,Ku=Phaser.Utils.Objects.IsPlainObject,Ju=Phaser.Math.Clamp,qu=Phaser.Math.DegToRad(270);let Zu=class extends(Vu(fc)){constructor(t,e,i,s,r,n,a){Ku(e)&&(e=$u(a=e,"x",0),i=$u(a,"y",0),s=$u(a,"radius",1),r=$u(a,"barColor",void 0),n=$u(a,"value",0)),void 0===s&&(s=1);var o=2*s;super(t,e,i,o,o),this.type="rexCircularProgress",this.bootProgressBase(a),this.setRadius(s),this.setTrackColor($u(a,"trackColor",void 0)),this.setBarColor(r),this.setCenterColor($u(a,"centerColor",void 0)),this.setThickness($u(a,"thickness",.2)),this.setStartAngle($u(a,"startAngle",qu)),this.setAnticlockwise($u(a,"anticlockwise",!1)),this.iterations=$u(a,"iterations",128),this.buildShapes(),this.setValue(n)}resize(t,e){return(t=Math.floor(Math.min(t,e)))===this.width||(super.resize(t,t),this.setRadius(t/2)),this}get radius(){return this._radius}set radius(t){this.dirty=this.dirty||this._radius!=t,this._radius=t;var e=2*t;this.resize(e,e)}setRadius(t){return this.radius=t,this}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get startAngle(){return this._startAngle}set startAngle(t){this.dirty=this.dirty||this._startAngle!=t,this._startAngle=t}setStartAngle(t){return this.startAngle=t,this}get anticlockwise(){return this._anticlockwise}set anticlockwise(t){this.dirty=this.dirty||this._anticlockwise!=t,this._anticlockwise=t}setAnticlockwise(t){return void 0===t&&(t=!0),this.anticlockwise=t,this}get thickness(){return this._thickness}set thickness(t){t=Ju(t,0,1),this.dirty=this.dirty||this._thickness!=t,this._thickness=t}setThickness(t){return this.thickness=t,this}get centerColor(){return this._centerColor}set centerColor(t){this.dirty=this.dirty||this._centerColor!=t,this._centerColor=t}setCenterColor(t){return this.centerColor=t,this}};Object.assign(Zu.prototype,Nu),t.register("circularProgress",(function(t,e,i,s,r,n){var a=new Zu(this.scene,t,e,i,s,r,n);return this.scene.add.existing(a),a})),P(window,"RexPlugins.UI.CircularProgress",Zu);var Qu=function(t,e,i,s,r,n,a,o,h,l,d,c){void 0===l&&(l=0),void 0===d&&(d=2*Math.PI),void 0===c&&(c=!1),e.beginPath(),e.ellipse(i,s,r,n,0,l,d,c),null!=a&&(e.fillStyle=a,e.fill()),null!=o&&(e.strokeStyle=o,e.lineWidth=h,e.stroke())};const tp=Phaser.Math.PI2;var ep=function(){var t,e=this.radius,i=this.thickness*this.radius,s=this.radius-i/2,r=this.radius-i,n=(this.canvas,this.context),a=this.anticlockwise,o=this.startAngle,h=this.endAngle,l=this._deltaAngle;if(this.trackColor&&i>0&&(n.save(),Qu(0,n,e,e,s,s,void 0,this.trackColor,i,o,h,a),n.restore()),this.barColor&&s>0){var d,c;if(d=this.value>=1?h:a?(o-l*this.value+tp)%tp:(o+l*this.value)%tp,n.save(),this.barColor2){var u=e+s*Math.cos(o),p=e+s*Math.sin(o),g=e+s*Math.cos(d),v=e+s*Math.sin(d),f=n.createLinearGradient(u,p,g,v);f.addColorStop(0,this.barColor2),f.addColorStop(1,this.barColor),c=f}else c=this.barColor;Qu(0,n,e,e,s,s,void 0,c,i,o,d,a),n.restore()}this.centerColor&&r>0&&(this.centerColor2?((t=this.context.createRadialGradient(e,e,0,e,e,r)).addColorStop(0,this.centerColor),t.addColorStop(1,this.centerColor2)):t=this.centerColor,n.save(),Qu(0,n,e,e,r,r,t),n.restore()),this.textFormatCallback&&(this.textColor||this.textStrokeColor)&&(n.save(),function(t,e,i,s,r,n,a,o,h,l,d){void 0===h&&null!=o&&(h=2),void 0===l&&(l="start"),void 0===d&&(d="alphabetic"),e.font=n,e.textAlign=l,e.textBaseline=d,e.fillStyle=a,e.strokeStyle=o,e.lineWidth=h,e.lineCap="round",e.lineJoin="round",null!=o&&"none"!==o&&h>0&&e.strokeText(r,i,s),null!=a&&"none"!==a&&e.fillText(r,i,s)}(0,n,e,e,this.getFormatText(),this.textFont,this.textColor,this.textStrokeColor,this.textStrokeThickness,"center","middle"),n.restore())};const ip=Phaser.Utils.Objects.GetValue,sp=Phaser.Utils.Objects.IsPlainObject,rp=Phaser.Math.Clamp,np=Phaser.Math.DegToRad(270),ap=Phaser.Math.PI2;class op extends(Vu($t)){constructor(t,e,i,s,r,n,a){sp(e)&&(e=ip(a=e,"x",0),i=ip(a,"y",0),s=ip(a,"radius",1),r=ip(a,"barColor",void 0),n=ip(a,"value",0));var o=2*s;super(t,e,i,o,o,ip(a,"resolution",1)),this.type="rexCircularProgressCanvas",this.bootProgressBase(a),this.setRadius(s),this.setTrackColor(ip(a,"trackColor",void 0)),this.setBarColor(r),this.setBarColor2(ip(a,"barColor2",void 0)),this.setCenterColor(ip(a,"centerColor",void 0)),this.setThickness(ip(a,"thickness",.2)),this.setStartAngle(ip(a,"startAngle",np)),this.setEndAngle(ip(a,"endAngle",this.startAngle+ap)),this.setAnticlockwise(ip(a,"anticlockwise",!1)),this.setTextColor(ip(a,"textColor",void 0)),this.setTextStrokeColor(ip(a,"textStrokeColor",void 0),ip(a,"textStrokeThickness",void 0));var h=ip(a,"textFont",void 0);h?this.setTextFont(h):this.setTextFont(ip(a,"textSize","16px"),ip(a,"textFamily","Courier"),ip(a,"textStyle","")),this.setTextFormatCallback(ip(a,"textFormatCallback",void 0),ip(a,"textFormatCallbackScope",void 0)),this.setValue(n)}resize(t,e){return(t=Math.floor(Math.min(t,e)))===this.width||(super.resize(t,t),this.setRadius(t/2)),this}get radius(){return this._radius}set radius(t){this.dirty=this.dirty||this._radius!=t,this._radius=t;var e=2*t;this.resize(e,e)}setRadius(t){return this.radius=t,this}get trackColor(){return this._trackColor}set trackColor(t){t=qt(t,this.canvas,this.context),this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get barColor(){return this._barColor}set barColor(t){t=qt(t,this.canvas,this.context),this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get barColor2(){return this._barColor2}set barColor2(t){t=qt(t,this.canvas,this.context),this.dirty=this.dirty||this._barColor2!=t,this._barColor2=t}setBarColor2(t){return this.barColor2=t,this}get startAngle(){return this._startAngle}set startAngle(t){this.dirty=this.dirty||this._startAngle!=t,this._startAngle=t,this._deltaAngle=hp(this._startAngle,this._endAngle,this._anticlockwise)}setStartAngle(t){return this.startAngle=t,this}get endAngle(){return this._endAngle}set endAngle(t){this.dirty=this.dirty||this._endAngle!=t,this._endAngle=t,this._deltaAngle=hp(this._startAngle,this._endAngle,this._anticlockwise)}setEndAngle(t){return this.endAngle=t,this}get anticlockwise(){return this._anticlockwise}set anticlockwise(t){this.dirty=this.dirty||this._anticlockwise!=t,this._anticlockwise=t,this._deltaAngle=hp(this._startAngle,this._endAngle,this._anticlockwise)}setAnticlockwise(t){return void 0===t&&(t=!0),this.anticlockwise=t,this}get thickness(){return this._thickness}set thickness(t){t=rp(t,0,1),this.dirty=this.dirty||this._thickness!=t,this._thickness=t}setThickness(t){return this.thickness=t,this}get centerColor(){return this._centerColor}set centerColor(t){t=qt(t,this.canvas,this.context),this.dirty=this.dirty||this._centerColor!=t,this._centerColor=t}get centerColor2(){return this._centerColor2}set centerColor2(t){t=qt(t,this.canvas,this.context),this.dirty=this.dirty||this._centerColor2!=t,this._centerColor2=t}setCenterColor(t,e){return this.centerColor=t,this.centerColor2=e,this}get textColor(){return this._textColor}set textColor(t){t=qt(t,this.canvas,this.context),this.dirty=this.dirty||this._textColor!=t,this._textColor=t}setTextColor(t){return this.textColor=t,this}get textStrokeColor(){return this._textStrokeColor}set textStrokeColor(t){t=qt(t,this.canvas,this.context),this.dirty=this.dirty||this._textStrokeColor!=t,this._textStrokeColor=t}get textStrokeThickness(){return this._textStrokeThickness}set textStrokeThickness(t){this.dirty=this.dirty||this._textStrokeThickness!=t,this._textStrokeThickness=t}setTextStrokeColor(t,e){return void 0===e&&(e=2),this.textStrokeColor=t,this.textStrokeThickness=e,this}get textFont(){return this._textFont}set textFont(t){this.dirty=this.dirty||this._textFont!=t,this._textFont=t}setTextFont(t,e,i){var s;return s=void 0===e?t:i+" "+t+" "+e,this.textFont=s,this}setTextFormatCallback(t,e){return this.textFormatCallback=t,this.textFormatCallbackScope=e,this}updateTexture(){return super.updateTexture((function(){this.clear(),ep.call(this)}),this),this}getFormatText(t){return void 0===t&&(t=this.value),this.textFormatCallbackScope?this.textFormatCallback(t):this.textFormatCallback.call(this.textFormatCallbackScope,t)}}var hp=function(t,e,i){return i?t<=e?ap+t-e:t-e:t>=e?ap+e-t:e-t};t.register("circularProgressCanvas",(function(t,e,i,s,r,n){var a=new op(this.scene,t,e,i,s,r,n);return this.scene.add.existing(a),a})),P(window,"RexPlugins.UI.CircularProgressCanvas",op);var lp=function(t,e,i,s,r,n){var a=(e+s)/2;return n>=0?t.startAt(a+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(a+n,i):t.startAt(a,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(a,i),t.close(),t};const dp=Phaser.Utils.Objects.GetValue,cp=Phaser.Utils.Objects.IsPlainObject;let up=class extends(Vu(fc)){constructor(t,e,i,s,r,n,a,o){cp(e)?(e=(o=e).x,i=o.y,s=o.width,r=o.height,n=o.barColor,a=o.value):cp(s)?(s=(o=s).width,r=o.height,n=o.barColor,a=o.value):cp(n)&&(n=(o=n).barColor,a=o.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===a&&(a=0),super(t,e,i,s,r,o),this.type="rexLineProgress",this.bootProgressBase(o),this.addShape((new $c).setName("trackFill")).addShape((new $c).setName("bar")).addShape((new $c).setName("trackStroke")),this.setTrackColor(dp(o,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(dp(o,"trackStrokeThickness",2),dp(o,"trackStrokeColor",void 0)),this.setSkewX(dp(o,"skewX",0)),this.setRTL(dp(o,"rtl",!1)),this.setValue(a)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}};var pp={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&lp(s,0,0,e,i,t);var r,n,a=this.getShape("bar");a.fillStyle(this.barColor),a.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),lp(a,r,0,n,i,t));var o=this.getShape("trackStroke");o.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),o.isStroked&&lp(o,0,0,e,i,t)}};Object.assign(up.prototype,pp),t.register("lineProgress",(function(t,e,i,s,r,n,a){var o=new up(this.scene,t,e,i,s,r,n,a);return this.scene.add.existing(o),o})),P(window,"RexPlugins.UI.LineProgress",up);var gp=function(t,e,i,s,r){t.setIterations(r).start();var n=s.tl;if(_t(n))if(n.convex){var a=n.x,o=n.y;t.ellipticalArc(a,o,n.x,n.y,180,270,!1)}else a=0,o=0,t.ellipticalArc(a,o,n.x,n.y,90,0,!0);else t.lineTo(0,0);return n=s.tr,_t(n)?n.convex?(a=e-n.x,o=n.y,t.ellipticalArc(a,o,n.x,n.y,270,360,!1)):(a=e,o=0,t.ellipticalArc(a,o,n.x,n.y,180,90,!0)):t.lineTo(e,0),n=s.br,_t(n)?n.convex?(a=e-n.x,o=i-n.y,t.ellipticalArc(a,o,n.x,n.y,0,90,!1)):(a=e,o=i,t.ellipticalArc(a,o,n.x,n.y,270,180,!0)):t.lineTo(e,i),n=s.bl,_t(n)?n.convex?(a=n.x,o=i-n.y,t.ellipticalArc(a,o,n.x,n.y,90,180,!1)):(a=0,o=i,t.ellipticalArc(a,o,n.x,n.y,360,270,!0)):t.lineTo(0,i),t.close(),t},vp=Phaser.Math.RadToDeg,fp=function(t,e,i,s,r){var n=e*r,a=s.tl;if(_t(a)){l=n>a.x?90:vp(Math.acos((a.x-n)/a.x));var o=a.x,h=a.y;t.ellipticalArc(o,h,a.x,a.y,180,180+l,!1)}else t.lineTo(0,0);if(a=s.tr,_t(a)&&n>e-a.x){var l=90-vp(Math.acos((n-(e-a.x))/a.x));o=e-a.x,h=a.y,t.ellipticalArc(o,h,a.x,a.y,270,270+l,!1)}else t.lineTo(n,0);a=s.br,_t(a)&&n>e-a.x?(l=90-vp(Math.acos((n-(e-a.x))/a.x)),o=e-a.x,h=i-a.y,t.ellipticalArc(o,h,a.x,a.y,90-l,90,!1)):t.lineTo(n,i),a=s.bl,_t(a)?(l=n>a.x?90:vp(Math.acos((a.x-n)/a.x)),o=a.x,h=i-a.y,t.ellipticalArc(o,h,a.x,a.y,180-l,180,!1)):t.lineTo(0,i)},mp=Phaser.Math.RadToDeg,yp=function(t,e,i,s,r){var n=i*r,a=s.tl;if(_t(a)){l=n>a.y?90:mp(Math.acos((a.y-n)/a.y));var o=a.x,h=a.y;t.ellipticalArc(o,h,a.x,a.y,270-l,270,!1)}else t.lineTo(0,0);if(a=s.tr,_t(a)?(l=n>a.y?90:mp(Math.acos((a.y-n)/a.y)),o=e-a.x,h=a.y,t.ellipticalArc(o,h,a.x,a.y,270,270+l,!1)):t.lineTo(e,0),a=s.br,_t(a)&&n>i-a.y){var l=90-mp(Math.acos((n-(i-a.y))/a.y));o=e-a.x,h=i-a.y,t.ellipticalArc(o,h,a.x,a.y,0,0+l,!1)}else t.lineTo(e,n);a=s.bl,_t(a)&&n>i-a.y?(l=90-mp(Math.acos((n-(i-a.y))/a.y)),o=a.x,h=i-a.y,t.ellipticalArc(o,h,a.x,a.y,180-l,180,!1)):t.lineTo(0,n)},bp=Phaser.Math.RadToDeg,xp=function(t,e,i,s,r){var n=e*r,a=s.tr;if(_t(a)){l=n>a.x?90:bp(Math.acos((a.x-n)/a.x));var o=e-a.x,h=a.y;t.ellipticalArc(o,h,a.x,a.y,360-l,360,!1)}else t.lineTo(e,0);if(a=s.br,_t(a)?(l=n>a.x?90:bp(Math.acos((a.x-n)/a.x)),o=e-a.x,h=i-a.y,t.ellipticalArc(o,h,a.x,a.y,0,0+l,!1)):t.lineTo(e,i),a=s.bl,_t(a)&&n>e-a.x){var l=90-bp(Math.acos((n-(e-a.x))/a.x));o=a.x,h=i-a.y,t.ellipticalArc(o,h,a.x,a.y,90,90+l,!1)}else t.lineTo(e-n,i);a=s.tl,_t(a)&&n>e-a.x?(l=90-bp(Math.acos((n-(e-a.x))/a.x)),o=a.x,h=a.y,t.ellipticalArc(o,h,a.x,a.y,270-l,270,!1)):t.lineTo(e-n,0)},Cp=Phaser.Math.RadToDeg,kp=function(t,e,i,s,r){var n=i*r,a=s.br;if(_t(a)){l=n>a.y?90:Cp(Math.acos((a.y-n)/a.y));var o=e-a.x,h=i-a.y;t.ellipticalArc(o,h,a.x,a.y,90-l,90,!1)}else t.lineTo(e,i);if(a=s.bl,_t(a)?(l=n>a.y?90:Cp(Math.acos((a.y-n)/a.y)),o=a.x,h=i-a.y,t.ellipticalArc(o,h,a.x,a.y,90,90+l,!1)):t.lineTo(0,i),a=s.tl,_t(a)&&n>i-a.y){var l=90-Cp(Math.acos((n-(i-a.y))/a.y));o=a.x,h=a.y,t.ellipticalArc(o,h,a.x,a.y,180,180+l,!1)}else t.lineTo(0,i-n);a=s.tr,_t(a)&&n>i-a.y?(l=90-Cp(Math.acos((n-(i-a.y))/a.y)),o=e-a.x,h=a.y,t.ellipticalArc(o,h,a.x,a.y,360-l,360,!1)):t.lineTo(e,i-n)},wp={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},Sp=function(t){return"string"==typeof t&&(t=wp[t]),t};const Pp=Phaser.Utils.Objects.GetValue,Tp=Phaser.Utils.Objects.IsPlainObject;class Op extends(Vu(fc)){constructor(t,e,i,s,r,n,a,o,h){Tp(e)?(e=(h=e).x,i=h.y,s=h.width,r=h.height,n=h.radius,a=h.barColor,o=h.value):Tp(s)?(s=(h=s).width,r=h.height,n=h.radius,a=h.barColor,o=h.value):Tp(n)&&(n=(h=n).radius,a=h.barColor,o=h.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=s),void 0===n&&(n=0),void 0===o&&(o=0),super(t,e,i,s,r,h),this.type="rexRoundRectangleProgress",this.rrGeom=new Tt,this.bootProgressBase(h),this.addShape((new $c).setName("trackFill")).addShape((new $c).setName("bar")).addShape((new $c).setName("trackStroke")),this.setTrackColor(Pp(h,"trackColor",void 0)),this.setBarColor(a),this.setTrackStroke(Pp(h,"trackStrokeThickness",2),Pp(h,"trackStrokeColor",void 0)),this.setOrientation(Pp(h,"orientation",0)),this.setRTL(Pp(h,"rtl",!1)),this.setRadius(n),this.setIteration(Pp(n,"iteration",void 0)),this.setValue(o)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get orientation(){return this._orientation}set orientation(t){t=Sp(t),this.dirty=this.dirty||this._orientation!=t,this._orientation=t}setOrientation(t){return this.orientation=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get radius(){return this.rrGeom.radius}set radius(t){this.rrGeom.setRadius(t),this.dirty=!0}get radiusTL(){return this.rrGeom.radiusTL}set radiusTL(t){this.rrGeom.radiusTL=t,this.dirty=!0}get radiusTR(){return this.rrGeom.radiusTR}set radiusTR(t){this.rrGeom.radiusTR=t,this.dirty=!0}get radiusBL(){return this.rrGeom.radiusBL}set radiusBL(t){this.rrGeom.radiusBL=t,this.dirty=!0}get radiusBR(){return this.rrGeom.radiusBR}set radiusBR(t){this.rrGeom.radiusBR=t,this.dirty=!0}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setRadiusTL(t){return void 0===t&&(t=0),this.radiusTL=t,this}setRadiusTR(t){return void 0===t&&(t=0),this.radiusTR=t,this}setRadiusBL(t){return void 0===t&&(t=0),this.radiusBL=t,this}setRadiusBR(t){return void 0===t&&(t=0),this.radiusBR=t,this}get cornerRadius(){return this.rrGeom.cornerRadius}set cornerRadius(t){this.radius=t}setCornerRadius(t){return this.setRadius(t)}get iteration(){return this._iteration}set iteration(t){void 0!==this._iteration?this._iteration!==t&&(this._iteration=t,this.dirty=!0):this._iteration=t}setIteration(t){return void 0===t&&(t=6),this.iteration=t,this}}var Mp={updateShapes:function(){var t=this.width,e=this.height,i=this.rrGeom.cornerRadius,s=this.value,r=this.orientation,n=this.rtl,a=this.iteration+1,o=this.getShape("trackFill");o.fillStyle(this.trackColor),o.isFilled&&gp(o,t,e,i,a);var h=this.getShape("bar");h.fillStyle(this.barColor),h.isFilled&&function(t,e,i,s,r,n,a,o){t.setIterations(o).start(),0===r||(1===r?gp(t,e,i,s,o):((0===n?a?xp:fp:a?kp:yp)(t,e,i,s,r),t.close()))}(h,t,e,i,s,r,n,a);var l=this.getShape("trackStroke");l.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),l.isStroked&&gp(l,t,e,i,a)}};Object.assign(Op.prototype,Mp),t.register("roundRectanleProgress",(function(t,e,i,s,r,n,a,o){var h=new Op(this.scene,t,e,i,s,r,n,a,o);return this.scene.add.existing(h),h})),P(window,"RexPlugins.UI.RoundRectangleProgress",Op);var Ep=function(t,e,i,s,r,n,a){void 0===a&&(a="round"),function(t,e){t.save(),t.beginPath();var i=e[0];t.moveTo(i.x,i.y);for(var s=1,r=e.length;s0&&(n.save(),Ep(0,n,this.trackPoints,void 0,this.trackStrokeColor,this.trackStrokeThickness),n.restore())},Rp=function(t,e,i,s,r,n){void 0===n&&(n=[]),n.length=4;for(var a=0;a<4;a++)n[a]||(n[a]={});var o;return r>=0?((o=n[0]).x=t+r,o.y=e,(o=n[1]).x=i+r,o.y=e,(o=n[2]).x=i,o.y=s,(o=n[3]).x=t,o.y=s):((o=n[0]).x=t,o.y=e,(o=n[1]).x=i,o.y=e,(o=n[2]).x=i-r,o.y=s,(o=n[3]).x=t-r,o.y=s),n};const Lp=Phaser.Utils.Objects.GetValue,Bp=Phaser.Utils.Objects.IsPlainObject;class Ip extends(Vu($t)){constructor(t,e,i,s,r,n,a,o){Bp(e)?(e=Lp(o=e,"x",0),i=Lp(o,"y",0),s=Lp(o,"width",2),r=Lp(o,"height",2),n=Lp(o,"barColor",void 0),a=Lp(o,"value",0)):Bp(s)?(s=Lp(o=s,"width",2),r=Lp(o,"height",2),n=Lp(o,"barColor",void 0),a=Lp(o,"value",0)):Bp(n)&&(n=Lp(o=n,"barColor",void 0),a=Lp(o,"value",0)),super(t,e,i,s,r,Lp(o,"resolution",1)),this.type="rexLineProgressCanvas",this.trackPoints=[],this.barPoints=[],this.bootProgressBase(o),this.setTrackColor(Lp(o,"trackColor",void 0)),this.setBarColor(n,Lp(o,"barColor2",void 0),Lp(o,"isHorizontalGradient",void 0)),this.setTrackStroke(Lp(o,"trackStrokeThickness",2),Lp(o,"trackStrokeColor",void 0)),this.setSkewX(Lp(o,"skewX",0)),this.setRTL(Lp(o,"rtl",!1)),this.setValue(a)}get trackColor(){return this._trackColor}set trackColor(t){t=qt(t,this.canvas,this.context),this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){t=qt(t,this.canvas,this.context),this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){t=qt(t,this.canvas,this.context),this.dirty=this.dirty||this._barColor!=t,this._barColor=t}get barColor2(){return this._barColor2}set barColor2(t){t=qt(t,this.canvas,this.context),this.dirty=this.dirty||this._barColor2!=t,this._barColor2=t}get isHorizontalGradient(){return this._isHorizontalGradient}set isHorizontalGradient(t){this.dirty|=this._isHorizontalGradient!=t,this._isHorizontalGradient=t}setBarColor(t,e,i){return void 0===i&&(i=!0),this.barColor=t,this.barColor2=e,this.isHorizontalGradient=i,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}updateTexture(){return super.updateTexture((function(){this.clear(),_p.call(this)}),this),this}}t.register("circularProgressCanvas",(function(t,e,i,s,r,n,a){var o=new Ip(this.scene,t,e,i,s,r,n,a);return this.scene.add.existing(o),o})),P(window,"RexPlugins.UI.LineProgressCanvas",Ip),Phaser.Math.Wrap;const Dp=Phaser.Math.Linear;var jp=function(){var t,e,i,s,r,n,a=this.getShape("triangle"),o=this.padding,h=this.width-o.right,l=0+o.left,d=this.height-o.bottom,c=0+o.top,u=(l+h)/2,p=(c+d)/2,g={0:{a:{x:l,y:c},b:{x:h,y:p},c:{x:l,y:d}},1:{a:{x:l,y:c},b:{x:u,y:d},c:{x:h,y:c}},2:{a:{x:h,y:c},b:{x:l,y:p},c:{x:h,y:d}},3:{a:{x:l,y:d},b:{x:u,y:c},c:{x:h,y:d}}};if(void 0===this.previousDirection){var v=g[this.direction],f=v.a,m=v.b,y=v.c;t=f.x,e=f.y,i=m.x,s=m.y,r=y.x,n=y.y}else{var b=g[this.previousDirection],x=g[this.direction],C=this.easeDirectionProgress;t=Dp(b.a.x,x.a.x,C),e=Dp(b.a.y,x.a.y,C),i=Dp(b.b.x,x.b.x,C),s=Dp(b.b.y,x.b.y,C),r=Dp(b.c.x,x.c.x,C),n=Dp(b.c.y,x.c.y,C)}a.startAt(t,e).lineTo(i,s).lineTo(r,n),this.arrowOnly?a.end():a.close()};const Ap=(0,Phaser.Math.DegToRad)(120);var zp=function(t){t=this.getShape("triangle");var e=this.width/2,i=this.height/2,s=Math.min(e,i)*this.radius,r=this.verticeRotation;t.startAt(e+s*Math.cos(r+Ap),i+s*Math.sin(r+Ap)).lineTo(e+s*Math.cos(r),i+s*Math.sin(r)).lineTo(e+s*Math.cos(r-Ap),i+s*Math.sin(r-Ap)),this.arrowOnly?t.end():t.close()},Fp={buildShapes(){this.addShape((new $c).setName("triangle"))},updateShapes(){var t=this.getShape("triangle");this.arrowOnly?t.fillStyle().lineStyle(this.lineWidth,this.strokeColor,this.strokeAlpha):t.fillStyle(this.fillColor,this.fillAlpha).lineStyle(this.lineWidth,this.strokeColor,this.strokeAlpha),0===this.shapeMode?jp.call(this):zp.call(this)}},Yp={setEaseDuration(t){return void 0===t&&(t=0),this.easeDuration=t,this},playEaseDirectionation(){return void 0===this.easeDirectionProgressTask&&(this.easeDirectionProgressTask=new iu(this,{eventEmitter:null})),this.easeDirectionProgressTask.restart({key:"easeDirectionProgress",from:0,to:1,duration:this.easeDuration}),this},stopEaseDirection(){return void 0===this.easeDirectionProgressTask||this.easeDirectionProgressTask.stop(),this}};const Xp=Phaser.Utils.Objects.GetValue,Wp=Phaser.Utils.Objects.IsPlainObject,Vp=Phaser.Math.DegToRad,Gp=Phaser.Math.RadToDeg;class Hp extends fc{constructor(t,e,i,s,r,n,a){var o,h,l,d,c,u,p,g;if(Wp(e)){var v=e;e=v.x,i=v.y,s=v.width,r=v.height,n=v.color,a=v.alpha,o=v.strokeColor,h=v.strokeAlpha,l=v.strokeWidth,d=v.arrowOnly,c=v.direction,u=v.easeDuration,p=v.padding,g=v.radius}void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=s),void 0===d&&(d=!1),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),void 0===g&&(g=void 0),super(t,e,i,s,r),this.type="rexTriangle",this.setFillStyle(n,a),void 0!==o&&void 0===l&&(l=2),this.setStrokeStyle(l,o,h),this.setArrowOnly(d),this.setDirection(c,u),this.setPadding(p),this.setRadius(g),this.buildShapes()}get arrowOnly(){return this._arrowOnly}set arrowOnly(t){this.dirty=this.dirty||this._arrowOnly!=t,this._arrowOnly=t}setArrowOnly(t){return void 0===t&&(t=!0),this.arrowOnly=t,this}get direction(){return this._direction}set direction(t){t=Np(t),this._direction!==t&&(this.easeDuration>0&&void 0!==this._direction?this.previousDirection=this._direction:this.previousDirection=void 0,this._direction=t,this.verticeAngle=90*t,this.dirty=!0,void 0!==this.previousDirection?this.playEaseDirectionation():this.stopEaseDirection())}setDirection(t,e){return void 0!==e&&this.setEaseDuration(e),this.direction=t,this}toggleDirection(t){return this.setDirection(this.direction+2,t),this}get easeDirectionProgress(){return this._easeDirectionProgress}set easeDirectionProgress(t){this._easeDirectionProgress!==t&&(this._easeDirectionProgress=t,this.dirty=!0)}setPadding(t,e,i,s){if("object"==typeof t){var r=t,n=Xp(r,"x",null);null!==n?(t=n,i=n):(t=Xp(r,"left",0),i=Xp(r,"right",t));var a=Xp(r,"y",null);null!==a?(e=a,s=a):(e=Xp(r,"top",0),s=Xp(r,"bottom",e))}else void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=t),void 0===s&&(s=e);return void 0===this.padding&&(this.padding={}),this.dirty=this.dirty||this.padding.left!=t||this.padding.top!=e||this.padding.right!=i||this.padding.bottom!=s,this.padding.left=t,this.padding.top=e,this.padding.right=i,this.padding.bottom=s,this.setRadius(),this}get radius(){return this._radius}set radius(t){this.dirty=this.dirty||this._radius!=t,this._radius=t}setRadius(t){return this.radius=t,this.shapeMode=null==t?0:1,this}get verticeRotation(){return this._verticeRotation}set verticeRotation(t){this.dirty=this.dirty||this._verticeRotation!=t,this._verticeRotation=t}setVerticeRotation(t){return this.verticeRotation=t,this}get verticeAngle(){return Gp(this.verticeRotation)}set verticeAngle(t){this.verticeRotation=Vp(t)}setVerticeAngle(t){return this.verticeAngle=t,this}}const Up={right:0,down:1,left:2,up:3};var Np=function(t){return"string"==typeof t&&(t=Up[t]),t%=4};Object.assign(Hp.prototype,Fp,Yp),t.register("triangle",(function(t,e,i,s,r,n){var a=new Hp(this.scene,t,e,i,s,r,n);return this.scene.add.existing(a),a})),P(window,"RexPlugins.UI.Triangle",Hp),F();const $p=Phaser.GameObjects.Zone,Kp=Phaser.Utils.Array.Add,Jp=Phaser.Utils.Array.Remove;let qp=class extends $p{constructor(t,e,i,s,r){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),super(t,e,i,s,r),this.children=[]}destroy(t){if(this.scene&&!this.ignoreDestroy){if(t)for(var e,i=this.children.length-1;i>=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return Kp(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return Jp(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;isg(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;esg(t).x,getChildLocalY:t=>sg(t).y};const bg=Phaser.Math.DegToRad;var xg={updateChildRotation(t){var e=sg(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=sg(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return sg(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return sg(t).rotation=bg(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=sg(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>sg(t).rotation},Cg={updateChildScale(t){var e=sg(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=sg(t),i=e.parent;return e.scaleX=mg(t.scaleX,i.scaleX),e.scaleY=mg(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=sg(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=sg(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>sg(t).scaleX,getChildLocalScaleY:t=>sg(t).scaleY},kg={updateChildVisible(t){var e=sg(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=sg(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),sg(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),sg(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=sg(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>sg(t).visible},wg={updateChildAlpha(t){var e=sg(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=sg(t),i=e.parent;return e.alpha=mg(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return sg(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=sg(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>sg(t).alpha},Sg={updateChildActive(t){var e=sg(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return sg(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),sg(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=sg(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>sg(t).active},Pg={updateChildScrollFactor(t){var e=sg(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},Tg={updateCameraFilter(t){var e=sg(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},Og={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(t){void 0===t&&(t=!1);var e=this;return this._mask=null,this.setChildMaskVisible(this),this.children.forEach((function(t){t.clearMask&&t.clearMask(!1),t.hasOwnProperty("isRexContainerLite")||e.setChildMaskVisible(t)})),t&&this.mask&&this.mask.destroy(),this}},Mg=function(t){return t.filter((function(t){return!!t.displayList||!!t.parentContainer||void 0}))},Eg={setDepth(t,e){if(this.depth=t,!e&&this.children)for(var i=this.getAllChildren(),s=0,r=i.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},_g=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const Lg=Phaser.Utils.Array;var Bg={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Uv=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const Nv=/(\S+)\[(\d+)\]/i;var $v={getInnerPadding(t){return Ts(this.space,t)},setInnerPadding(t,e){return Os(this.space,t,e),this},getOuterPadding(t){return Ts(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Os(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Ts(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Os(this.getSizerConfig(t).padding,e,i),this}},Kv=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Jv=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},qv=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Zv=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},Qv=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},tf=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},ef={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},sf=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var vm={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Ra(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},fm={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=h),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=h),this.transitOutCallback=t,this}},mm={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},ym={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},bm={};Object.assign(bm,vm,fm,mm,ym);const xm=Phaser.Utils.Objects.GetValue;class Cm extends Ba{constructor(t,e){super(t,e),this.setTransitInTime(xm(e,"duration.in",200)),this.setTransitOutTime(xm(e,"duration.out",200)),this.setTransitInCallback(xm(e,"transitIn")),this.setTransitOutCallback(xm(e,"transitOut")),this.oneShotMode=xm(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new gm(this,{eventEmitter:!1,initState:xm(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(Cm.prototype,bm);const km=Phaser.GameObjects.Rectangle;class wm extends km{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new _d(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Sm=Phaser.Utils.Objects.GetValue;class Pm extends Ba{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Sm(t,"hitAreaMode",0)),this.setEnable(Sm(t,"enable",!0)),this.setStopMode(Sm(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Tm[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Tm={default:0,fullWindow:1};const Om=Phaser.Utils.Objects.GetValue;class Mm extends wm{constructor(t,e){super(t,Om(e,"color",0),Om(e,"alpha",.8)),this.touchEventStop=new Pm(this,{hitAreaMode:1})}}var Em={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,yf(t,e)},scaleDown(t,e){bf(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Ef(t,e)},fadeOut(t,e){_f(t,e,!1)}},_m=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Ef(t,e,t.alpha)},Rm=function(t,e){_f(t,e,!1)},Lm=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!Gn(t,!0).contains(e,i)||r&&!r(t,e,i))};const Bm=Phaser.Utils.Objects.GetValue;let Im=class extends Cm{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Dm.popUp),null==e.transitOut&&(e.transitOut=Dm.scaleDown),e.destroy=Bm(e,"destroy",!0),super(t,e);var i=Bm(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Mm(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Bm(i,"transitIn",_m)),this.setCoverTransitOutCallback(Bm(i,"transitOut",Rm)));var s=Bm(e,"touchOutsideClose",!1),r=Bm(e,"duration.hold",-1),n=Bm(e,"timeOutClose",r>=0),a=Bm(e,"anyTouchClose",!1);Bm(e,"manualClose",!1)&&(s=!1,a=!1,n=!1),a&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),a?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Bm(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Lm(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=Dm[t]),t){case Dm.popUp:t=Em.popUp;break;case Dm.fadeIn:t=Em.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Dm[t]),t){case Dm.scaleDown:t=Em.scaleDown;break;case Dm.fadeOut:t=Em.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Dm={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var jm=function(t,e){var i=new Im(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i},Am=function(t,e){t.emit("modal.requestClose",e)},zm=function(t){return t&&"function"==typeof t},Fm={modal(t,e){return zm(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=jm(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return Am(this,t),this}},Ym=function(t,e,i,s,r){zm(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},Xm={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return Ym.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return Ym.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return Ym.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return Ym.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return Ym.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return Ym.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return Ym.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return Ym.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return Ym.call(this,"shutdown",t,e,i,s),this}},Wm=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=Vm),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},Vm={},Gm=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,a=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return a?Lm(t,e.x,e.y,i,s):!!(r=Wm(e,n,!0))&&Lm(t,r.x,r.y,i,s);for(var o=t.scene.input.manager,h=o.pointersTotal,l=o.pointers,d=0;d=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const sy={press:0,pointerdown:0,release:1,pointerup:1};var ry={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new iy(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class ny extends pm{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const ay=Phaser.Utils.Objects.GetValue;class oy extends Ba{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new ny,this.parent.setInteractive(ay(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(ay(t,"enable",!0)),this.setCooldown(ay(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var hy={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&Gm(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new oy(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new oy(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},ly={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},dy=function(t,e,i,s){if("parent"===t){for(var r,n=0,a=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Ty,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Oy&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Ty,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=My,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&Gm(t,s,e,i)}}const Ty=0,Oy=1,My="IDLE",Ey=Phaser.Utils.Objects.GetValue,_y=Phaser.Math.Distance.Between;class Ry extends Py{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=Ly},eventEmitter:!1};this.setRecongizedStateObject(new pm(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Ey(t,"time",250)),this.setTapInterval(Ey(t,"tapInterval",200)),this.setDragThreshold(Ey(t,"threshold",9)),this.setTapOffset(Ey(t,"tapOffset",10));var e=Ey(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Ey(t,"maxTaps",void 0)),this.setMinTaps(Ey(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case Ly:this.state=By;break;case By:var t=this.lastPointer;_y(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=Iy,this.state=By);break;case Iy:this.state=By}}onDragEnd(){this.state===By&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=Iy))}onDrag(){this.state!==Ly&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Ly)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===By){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=Ly):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=Iy:this.state=Ly)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Iy&&(this.state=Ly)}get isTapped(){return this.state===Iy}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const Ly="IDLE",By="BEGIN",Iy="RECOGNIZED",Dy=Phaser.Utils.Objects.GetValue;class jy extends Py{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=Ay},eventEmitter:!1};this.setRecongizedStateObject(new pm(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Dy(t,"threshold",9)),this.setHoldTime(Dy(t,"time",251)),this}onDragStart(){this.state=zy,0===this.holdTime&&(this.state=Fy)}onDragEnd(){this.state=Ay}onDrag(){this.state!==Ay&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Ay)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===zy&&t-this.pointer.downTime>=this.holdTime&&(this.state=Fy)}get isPressed(){return this.state===Fy}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const Ay="IDLE",zy="BEGIN",Fy="RECOGNIZED",Yy=Phaser.Utils.Objects.GetValue;class Xy extends Py{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{},BEGIN:{enter:function(){var t=i.pointer;i.startX=t.x,i.startY=t.y,i.startWorldX=t.worldX,i.startWorldY=t.worldY}},RECOGNIZED:{enter:function(){i.emit("panstart",i,i.gameObject,i.lastPointer)},exit:function(){var t=i.lastPointer;i.endX=t.x,i.endY=t.y;var e=Wm(t,i.pointerCamera,!0);i.endWorldX=e.x,i.endWorldY=e.y,i.emit("panend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=Wy},eventEmitter:!1};this.setRecongizedStateObject(new pm(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Yy(t,"threshold",10)),this}onDragStart(){this.state=Vy,0===this.dragThreshold&&(this.state=Gy)}onDragEnd(){this.state=Wy}onDrag(){switch(this.state){case Vy:if(this.pointer.getDistance()>=this.dragThreshold){this.state=Gy,this.dx=0,this.dy=0,this.dWorldX=0,this.dWorldY=0;var t=this.pointer;this.x=t.x,this.y=t.y,this.worldX=t.worldX,this.worldY=t.worldY}break;case Gy:var e=this.pointerCamera,i=this.pointer.position,s=this.pointer.prevPosition;this.dx=i.x-s.x,this.dy=i.y-s.y,this.dWorldX=this.dx/e.zoom,this.dWorldY=this.dy/e.zoom,t=this.pointer,this.x=t.x,this.y=t.y;var r=Wm(t,e,!0);this.worldX=r.x,this.worldY=r.y,this.emit("pan",this,this.gameObject,this.lastPointer)}}get isPanned(){return this.state===Gy}setDragThreshold(t){return this.dragThreshold=t,this}}const Wy="IDLE",Vy="BEGIN",Gy="RECOGNIZED",Hy=Phaser.Math.Distance.Between,Uy=Phaser.Math.Angle.Between;var Ny={getDt:function(){return oc(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Hy(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Uy(e.x,e.y,t.x,t.y)}},$y={"up&down":0,"left&right":1,"4dir":2,"8dir":3},Ky={};const Jy=Phaser.Utils.Objects.GetValue,qy=Phaser.Math.RadToDeg;class Zy extends Py{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=Qy},eventEmitter:!1};this.setRecongizedStateObject(new pm(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Jy(t,"threshold",10)),this.setVelocityThreshold(Jy(t,"velocityThreshold",1e3)),this.setDirectionMode(Jy(t,"dir","8dir")),this}onDragStart(){this.state=tb}onDragEnd(){this.state=Qy}onDrag(){this.state===tb&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=eb))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===eb&&(this.state=Qy)}get isSwiped(){return this.state===eb}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=$y[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=Ky),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(qy(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(Zy.prototype,Ny);const Qy="IDLE",tb="BEGIN",eb="RECOGNIZED",ib=Phaser.Utils.Objects.GetValue,sb=Phaser.Utils.Array.SpliceOne,rb=Phaser.Math.Distance.Between,nb=Phaser.Math.Angle.Between;class ab{constructor(t,e){var i=Ra(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(ib(e,"inputConfig",void 0)),this.setEventEmitter(ib(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(ib(t,"enable",!0)),this.bounds=ib(t,"bounds",void 0),this.tracerState=hb,this.pointers.length=0,q(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,q(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case hb:this.tracerState=lb,this.onDrag1Start();break;case lb:this.tracerState=db,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],sb(this.pointers,e),this.tracerState){case lb:this.tracerState=hb,this.onDrag1End();break;case db:this.tracerState=lb,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case lb:this.onDrag1();break;case db:this.onDrag2()}}}dragCancel(){return this.tracerState===db&&this.onDrag2End(),this.pointers.length=0,q(this.movedState),this.tracerState=hb,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==db)return 0;var t=this.pointers[0],e=this.pointers[1];return rb(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==db)return 0;var t=this.pointers[0],e=this.pointers[1];return nb(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;ob.x=e.x-i.x,ob.y=e.y-i.y}else ob.x=0,ob.y=0;return ob}get centerX(){if(this.tracerState!==db)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==db)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==db)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==db)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=cb,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&Gm(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&Gm(t,s,e,i)}}Object.assign(ab.prototype,dn);var ob={};const hb=0,lb=1,db=2,cb="IDLE",ub=Phaser.Utils.Objects.GetValue;class pb extends ab{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.prevDistance=void 0,i.scaleFactor=1}},BEGIN:{},RECOGNIZED:{enter:function(){i.emit("pinchstart",i)},exit:function(){i.emit("pinchend",i)}}},init:function(){this.state=gb},eventEmitter:!1};this.setRecongizedStateObject(new pm(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(ub(t,"threshold",0)),this}onDrag2Start(){this.scaleFactor=1,this.prevDistance=this.distanceBetween,this.state=vb,0===this.dragThreshold&&(this.state=fb)}onDrag2End(){this.state=gb}onDrag2(){switch(this.state){case vb:if(this.pointers[0].getDistance()>=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=this.distanceBetween;this.scaleFactor=t/this.prevDistance,this.prevDistance=t,this.state=fb}break;case fb:t=this.distanceBetween,this.scaleFactor=t/this.prevDistance,this.emit("pinch",this),this.prevDistance=t}}get isPinched(){return this.state===fb}setDragThreshold(t){return this.dragThreshold=t,this}}const gb="IDLE",vb="BEGIN",fb="RECOGNIZED",mb=Phaser.Math.RotateAround;var yb=function(t,e,i,s){return mb(t,e,i,s),t.rotation+=s,t},bb={};const xb=Phaser.Utils.Objects.GetValue,Cb=Phaser.Math.Angle.WrapDegrees,kb=Phaser.Math.Angle.ShortestBetween,wb=Phaser.Math.RadToDeg,Sb=Phaser.Math.DegToRad;class Pb extends ab{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.prevAngle=void 0,i.angle=0}},BEGIN:{},RECOGNIZED:{enter:function(){i.emit("rotatestart",i)},exit:function(){i.emit("rotateend",i)}}},init:function(){this.state=Ob},eventEmitter:!1};this.setRecongizedStateObject(new pm(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(xb(t,"threshold",0)),this}onDrag2Start(){this.prevAngle=Cb(wb(this.angleBetween)),this.state=Mb,0===this.dragThreshold&&(this.state=Eb)}onDrag2End(){this.state=Ob}onDrag2(){switch(this.state){case Mb:if(this.pointers[0].getDistance()>=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Cb(wb(this.angleBetween));this.angle=kb(this.prevAngle,t),this.prevAngle=t,this.state=Eb}break;case Eb:t=Cb(wb(this.angleBetween)),this.angle=kb(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Eb}get rotation(){return Sb(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}var Tb={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=bb),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,a=r.y,o=this.rotation;if(Array.isArray(t))for(var h=t,l=0,d=h.length;l0&&(r=!0,void 0===n&&(n=0),void 0===a&&(a=0)),(u=this.getSizerConfig(t)).align=i,u.padding=Bv(s),Nb(r)?(u.expandWidth=$b(r,"width",!1),u.expandHeight=$b(r,"height",!1)):(u.expandWidth=r,u.expandHeight=r),t.isRexSizer||(u.expandWidth&&(t.minWidth=void 0===n?zn(t):n),u.expandHeight&&(t.minHeight=void 0===a?Fn(t):a)),u.alignOffsetX=o,u.alignOffsetY=h,u.alignOffsetOriginX=d,u.alignOffsetOriginY=c,u.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,p&&this.addChildrenMap(e,t),this}};const Zb=Zg.prototype.clear;var Qb=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),Zb.call(this,t),i)for(var s,r=0,n=e.length;r0&&(Hb.width=e.aspectRatio,Hb.height=1,Ub.width=l,Ub.height=d,l=(c=Xb(Hb,Ub,"FIT",!0)).width,d=c.height),t.isRexSizer?(t.runLayout(this,l,d),Gb(t,this)):af(t,l,d),s=u+i.left*this.scaleX,n=g-(i.left+i.right)*this.scaleX,r=p+i.top*this.scaleY,a=v-(i.top+i.bottom)*this.scaleY,void 0===l&&(l=zn(t)),void 0===d&&(d=Fn(t)),o=(e.alignOffsetX+e.alignOffsetOriginX*l)*this.scaleX,h=(e.alignOffsetY+e.alignOffsetOriginY*d)*this.scaleY,qm.call(this,t,s,r,n,a,e.align,o,h))}};Object.assign(ex,qb,tx);var ix=function(t,e){if(Array.isArray(t))return t.indexOf(e);for(var i in t)if(t[i]===e)return i;return null};const sx=Phaser.Utils.Objects.IsPlainObject,rx=Phaser.Utils.Objects.GetValue;class nx extends Yb{constructor(t,e,i,s,r,n){sx(e)?(e=rx(n=e,"x",0),i=rx(n,"y",0),s=rx(n,"width",void 0),r=rx(n,"height",void 0)):sx(s)&&(s=rx(n=s,"width",void 0),r=rx(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexOverlapSizer",this.sizerChildren={},this.addChildrenMap("items",this.sizerChildren)}childToKey(t){if("string"!=typeof t)return ix(this.sizerChildren,t);var e=t;return this.sizerChildren.hasOwnPropery(e)?e:null}}Object.assign(nx.prototype,ex);var ax=Phaser.Math.Distance.Between,ox=function(t,e,i){var s=t.width/2;return ax(s,s,e,i)<=s};const hx=Phaser.Math.Angle.Between,lx=Phaser.Math.Angle.Normalize;var dx=function(t,e,i){if(this.enable&&t.isDown){var s=this.sizerChildren.knob;if(ox(s,e,i)){var r=s.width/2,n=s.startAngle,a=hx(r,r,e,i),o=s.anticlockwise?n-a:a-n,h=lx(o)/(2*Math.PI);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-h)<.1?this.value=h:this.easeValueTo(h)}}},cx=function(){this.sizerChildren.knob.on("pointerdown",dx,this).on("pointermove",dx,this).setInteractive()};const ux=Phaser.Math.Angle.Between,px=Phaser.Math.Angle.Wrap;var gx=function(t,e,i){if(this.enable&&!this.panPointer){var s=this.sizerChildren.knob;ox(s,e,i)&&mx.call(this,t)}},vx=function(t,e,i){if(this.enable&&t.isDown){var s=this.sizerChildren.knob;switch(this.panState){case xx:ox(s,e,i)&&mx.call(this,t);break;case Cx:ox(s,e,i)?bx.call(this):yx.call(this)}}},fx=function(t,e,i){this.enable&&this.panPointer===t&&yx.call(this)},mx=function(t){this.panPointer=t,this.panState=Cx},yx=function(){this.panPointer=void 0,this.panState=xx},bx=function(){var t=this.panPointer.prevPosition,e=this.panPointer.position,i=this.sizerChildren.knob,s=ux(i.x,i.y,t.x,t.y),r=ux(i.x,i.y,e.x,e.y),n=i.anticlockwise?s-r:r-s,a=px(n)/(2*Math.PI);this.stopEaseValue(),this.value+=a};const xx=0,Cx=1;var kx=function(){this.sizerChildren.knob.on("pointerdown",gx,this).on("pointermove",vx,this).on("pointerup",fx,this).setInteractive(),this.panPointer=void 0,this.panState=xx},wx=function(t){return void 0===t&&(t=this.value),this.textFormatCallbackScope?this.textFormatCallback(t):this.textFormatCallback.call(this.textFormatCallbackScope,t)},Sx={setTextFormatCallback:function(t,e){return this.textFormatCallback=t,this.textFormatCallbackScope=e,this},getFormatText:wx,updateText:function(t){var e=this.sizerChildren.text;return e&&this.textFormatCallback&&(e.setText(wx.call(this,t)),e.layout&&e.layout()),this}};const Px=Phaser.Utils.Objects.GetValue,Tx=Phaser.Math.Snap.To;class Ox extends(Vu(nx)){constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexKnob",this.bootProgressBase(e);var i=Px(e,"background",void 0),s=Px(e,"text",void 0);i&&this.addBackground(i),s&&(e.textColor=void 0,e.textStrokeColor=void 0,this.setTextFormatCallback(Px(e,"textFormatCallback",void 0),Px(e,"textFormatCallbackScope",void 0)),e.textFormatCallback=void 0,e.textFormatCallbackScope=void 0);var r=new op(t,e);r.setDepth(Px(e,"knobDepth",0)),r._value=-1,t.add.existing(r),this.add(r,"knob"),s&&(this.add(s,"text","center",0,!1),t.children.moveBelow(r,s)),this.addChildrenMap("background",i),this.addChildrenMap("knob",r),this.addChildrenMap("text",s),this.setEnable(Px(e,"enable",void 0)),this.setGap(Px(e,"gap",void 0)),this.setValue(Px(e,"value",0),Px(e,"min",void 0),Px(e,"max",void 0));var n=Px(e,"input",0);switch("string"==typeof n&&(n=Mx[n]),n){case 0:kx.call(this);break;case 1:cx.call(this)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setGap(t){return this.gap=t,this}get value(){return this.sizerChildren.knob.value}set value(t){void 0!==this.gap&&(t=Tx(t,this.gap));var e=this.value;this.sizerChildren.knob.value=t;var i=this.value;e!==i&&(this.updateText(),this.eventEmitter.emit("valuechange",i,e,this.eventEmitter))}}const Mx={pan:0,drag:0,click:1,none:-1};Object.assign(Ox.prototype,Sx),t.register("knob",(function(t){var e=new Ox(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.Knob",Ox);const Ex={arc:Sc,circle:Pc,curve:class extends kc{constructor(t){super(),this.setCurve(t),this.setIterations(32)}get curve(){return this._curve}set curve(t){this.dirty=this.dirty||this._curve!==t,this._curve=t}setCurve(t){return this.curve=t,this}get iterations(){return this._iterations}set iterations(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t}setIterations(t){return this.iterations=t,this}updateData(){this.pathData.length=0;for(var t=this.curve.getPoints(this.iterations),e=0,i=t.length;ethis.value)for(var d=0;dthis.value&&(t+=1));for(var r=this.getShapes(),n=0,a=r.length;n0?d.pop().setTexture(u,O):r(c,u,O),h&&c.add.existing(T),l){var M=b+k*P+a*k,E=x+w*S+o*w;T.setOrigin(a,o).setPosition(M,E).setScale(v,f).setRotation(m),gk(T,b,x,m)}C.push(T)}return C}(t,e,i,s),a=0,o=n.length;a0&&(a=this.getChildLocalScaleX(s),a/=s.biasScale,this.setChildLocalScale(s,a)),r.biasScale&&(a=this.getChildLocalScaleX(r),a/=r.biasScale,this.setChildLocalScale(r,a))),e?t.call(e,i,s,r,n):t(i,s,r,n),this.scaleMode&&(s.biasScale>0&&(a=this.getChildLocalScaleX(s),a*=s.biasScale,this.setChildLocalScale(s,a)),r.biasScale&&(a=this.getChildLocalScaleX(r),a*=r.biasScale,this.setChildLocalScale(r,a))))};Object.assign(Sk.prototype,mk);const Tk={fit:1,FIT:1,envelop:2,ENVELOP:2};t.register("transitionImage",(function(t,e,i,s,r){var n=new Sk(this.scene,t,e,i,s,r);return this.scene.add.existing(n),n})),P(window,"RexPlugins.UI.TransitionImage",Sk);const Ok=Phaser.Renderer.WebGL.Pipelines.PostFXPipeline,Mk=Phaser.Utils.Objects.GetValue,Ek=Phaser.Math.Clamp;class _k extends Ok{constructor(t){super({name:"rexDissolvePostFx",game:t,renderTarget:!0,fragShader:"#ifdef GL_FRAGMENT_PRECISION_HIGH\n#define highmedp highp\n#else\n#define highmedp mediump\n#endif\nprecision highmedp float;\n// Scene buffer\nuniform sampler2D uMainSampler;\nuniform sampler2D uMainSampler2;\n\nuniform int resizeMode;\nuniform float progress;\nuniform float fromRatio;\nuniform float toRatio;\nvarying vec2 outFragCoord;\n// Effect parameters\nuniform float noiseX;\nuniform float noiseY;\nuniform float noiseZ;\nuniform float fromEdgeStart;\nuniform float fromEdgeWidth;\nuniform float toEdgeStart;\nuniform float toEdgeWidth;\n\nvec3 mod289(vec3 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }\nvec4 mod289(vec4 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }\nvec4 permute(vec4 x) { return mod289(((x*34.0)+1.0)*x); }\nvec4 taylorInvSqrt(vec4 r) { return 1.79284291400159 - 0.85373472095314 * r; }\nvec3 fade(vec3 t) { return t*t*t*(t*(t*6.0-15.0)+10.0); }\nfloat Perlin(vec3 P) {\n vec3 i0 = mod289(floor(P)), i1 = mod289(i0 + vec3(1.0));\n vec3 f0 = fract(P), f1 = f0 - vec3(1.0), f = fade(f0);\n vec4 ix = vec4(i0.x, i1.x, i0.x, i1.x), iy = vec4(i0.yy, i1.yy);\n vec4 iz0 = i0.zzzz, iz1 = i1.zzzz;\n vec4 ixy = permute(permute(ix) + iy), ixy0 = permute(ixy + iz0), ixy1 = permute(ixy + iz1);\n vec4 gx0 = ixy0 * (1.0 / 7.0), gy0 = fract(floor(gx0) * (1.0 / 7.0)) - 0.5;\n vec4 gx1 = ixy1 * (1.0 / 7.0), gy1 = fract(floor(gx1) * (1.0 / 7.0)) - 0.5;\n gx0 = fract(gx0); gx1 = fract(gx1);\n vec4 gz0 = vec4(0.5) - abs(gx0) - abs(gy0), sz0 = step(gz0, vec4(0.0));\n vec4 gz1 = vec4(0.5) - abs(gx1) - abs(gy1), sz1 = step(gz1, vec4(0.0));\n gx0 -= sz0 * (step(0.0, gx0) - 0.5); gy0 -= sz0 * (step(0.0, gy0) - 0.5);\n gx1 -= sz1 * (step(0.0, gx1) - 0.5); gy1 -= sz1 * (step(0.0, gy1) - 0.5);\n vec3 g0 = vec3(gx0.x,gy0.x,gz0.x), g1 = vec3(gx0.y,gy0.y,gz0.y),\n g2 = vec3(gx0.z,gy0.z,gz0.z), g3 = vec3(gx0.w,gy0.w,gz0.w),\n g4 = vec3(gx1.x,gy1.x,gz1.x), g5 = vec3(gx1.y,gy1.y,gz1.y),\n g6 = vec3(gx1.z,gy1.z,gz1.z), g7 = vec3(gx1.w,gy1.w,gz1.w);\n vec4 norm0 = taylorInvSqrt(vec4(dot(g0,g0), dot(g2,g2), dot(g1,g1), dot(g3,g3)));\n vec4 norm1 = taylorInvSqrt(vec4(dot(g4,g4), dot(g6,g6), dot(g5,g5), dot(g7,g7)));\n g0 *= norm0.x; g2 *= norm0.y; g1 *= norm0.z; g3 *= norm0.w;\n g4 *= norm1.x; g6 *= norm1.y; g5 *= norm1.z; g7 *= norm1.w;\n vec4 nz = mix(vec4(dot(g0, vec3(f0.x, f0.y, f0.z)), dot(g1, vec3(f1.x, f0.y, f0.z)),\n dot(g2, vec3(f0.x, f1.y, f0.z)), dot(g3, vec3(f1.x, f1.y, f0.z))),\n vec4(dot(g4, vec3(f0.x, f0.y, f1.z)), dot(g5, vec3(f1.x, f0.y, f1.z)),\n dot(g6, vec3(f0.x, f1.y, f1.z)), dot(g7, vec3(f1.x, f1.y, f1.z))), f.z);\n return 2.2 * mix(mix(nz.x,nz.z,f.y), mix(nz.y,nz.w,f.y), f.x);\n}\nfloat Perlin(vec2 P) { return Perlin(vec3(P, 0.0)); }\n\n\nvec4 getFromColor (vec2 uv) {\n return texture2D(uMainSampler, uv);\n}\n\nvec4 getToColor (vec2 uv) {\n if (resizeMode == 2) {\n // cover\n return texture2D(uMainSampler2, 0.5 + (vec2(uv.x, 1.0 - uv.y) - 0.5) * vec2(min(fromRatio / toRatio, 1.0), min((toRatio / fromRatio), 1.0)));\n } else if (resizeMode == 1) {\n // contain\n return texture2D(uMainSampler2, 0.5 + (vec2(uv.x, 1.0 - uv.y) - 0.5) * vec2(max(fromRatio / toRatio, 1.0), max((toRatio / fromRatio), 1.0)));\n } else {\n // stretch\n return texture2D(uMainSampler2, vec2(uv.x, 1.0 - uv.y));\n }\n}\n\nvec4 transition (vec2 uv) { \n vec4 colorFront = getFromColor(uv);\n vec4 colorTo = getToColor(uv);\n\n float noise = (Perlin(vec3(uv.x * noiseX, uv.y * noiseY, noiseZ)) + 1.0) / 2.0\n * (1.0 - (fromEdgeStart + fromEdgeWidth + toEdgeStart + toEdgeWidth))\n + (fromEdgeStart + fromEdgeWidth + toEdgeStart + toEdgeWidth) * 0.5;\n vec4 colorResult = colorFront * smoothstep(progress - (fromEdgeStart + fromEdgeWidth), progress - fromEdgeStart, noise)\n + colorTo * smoothstep((1.0 - progress) - (toEdgeStart + toEdgeWidth), (1.0 - progress) - toEdgeStart, (1.0 - noise));\n return colorResult;\n}\n\nvoid main () {\n vec2 uv = outFragCoord;\n gl_FragColor = transition(uv);\n}\n"}),this._progress=0,this.toFrame=null,this.targetTexture=null,this.resizeMode=1,this.toRatio=1,this.noiseX=0,this.noiseY=0,this.noiseZ=0,this.fromEdgeStart=.01,this.fromEdgeWidth=.05,this.toEdgeStart=.01,this.toEdgeWidth=.05}resetFromJSON(t){return this.setProgress(Mk(t,"progress",0)),this.setTransitionTargetTexture(Mk(t,"toTexture","__DEFAULT"),Mk(t,"toFrame",void 0),Mk(t,"resizeMode",1)),this.setNoise(Mk(t,"noiseX",void 0),Mk(t,"noiseY",void 0),Mk(t,"noiseZ",void 0)),this.setFromEdge(Mk(t,"fromEdgeStart",.01),Mk(t,"fromEdgeWidth",.05)),this.setToEdge(Mk(t,"toEdgeStart",.01),Mk(t,"toEdgeWidth",.05)),this}onBoot(){}onPreRender(){this.set1f("progress",this.progress),this.set1i("resizeMode",this.resizeMode),this.set1f("noiseX",this.noiseX),this.set1f("noiseY",this.noiseY),this.set1f("noiseZ",this.noiseZ),this.set1f("fromEdgeStart",this.fromEdgeStart),this.set1f("fromEdgeWidth",this.fromEdgeWidth),this.set1f("toEdgeStart",this.toEdgeStart),this.set1f("toEdgeWidth",this.toEdgeWidth)}onDraw(t){this.set1f("fromRatio",t.width/t.height),this.set1f("toRatio",this.toRatio),this.set1i("uMainSampler2",1),this.bindTexture(this.targetTexture,1),this.bindAndDraw(t)}get progress(){return this._progress}set progress(t){this._progress=Ek(t,0,1)}setProgress(t){return this.progress=t,this}setTransitionTargetTexture(t,e,i){void 0===t&&(t="__DEFAULT");var s=this.game.textures.getFrame(t,e);return s||(s=this.game.textures.getFrame("__DEFAULT")),this.toRatio=s.width/s.height,this.toFrame=s,this.targetTexture=s.glTexture,void 0!==i&&(this.resizeMode=i),this}setResizeMode(t){return"string"==typeof t&&(t=Rk[t]),this.resizeMode=t,this}setNoise(t,e,i){return void 0===t&&(t=4+6*Math.random()),void 0===e&&(e=4+6*Math.random()),void 0===i&&(i=10*Math.random()),this.noiseX=t,this.noiseY=e,this.noiseZ=i,this}setFromEdge(t,e){return this.fromEdgeStart=t,this.fromEdgeWidth=e,this}setToEdge(t,e){return this.toEdgeStart=t,this.toEdgeWidth=e,this}}var Rk={stretch:0,contain:1,cover:2};const Lk=Phaser.Utils.Array.SpliceOne,Bk=.1,Ik=[function(t){t.addTransitionMode("slideAwayRight",{ease:"Linear",dir:"out",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=e.width*s;t.setChildLocalPosition(e,r,0)},onComplete:function(t,e,i,s){t.setChildLocalPosition(e,0,0)}}).addTransitionMode("slideAwayLeft",{ease:"Linear",dir:"out",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=e.width*-s;t.setChildLocalPosition(e,r,0)},onComplete:function(t,e,i,s){t.setChildLocalPosition(e,0,0)}}).addTransitionMode("slideAwayDown",{ease:"Linear",dir:"out",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=e.height*s;t.setChildLocalPosition(e,0,r)},onComplete:function(t,e,i,s){t.setChildLocalPosition(e,0,0)}}).addTransitionMode("slideAwayUp",{ease:"Linear",dir:"out",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=e.height*-s;t.setChildLocalPosition(e,0,r)},onComplete:function(t,e,i,s){t.setChildLocalPosition(e,0,0)}})},function(t){t.addTransitionMode("slideRight",{ease:"Linear",dir:"in",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=i.width*(s-1);t.setChildLocalPosition(i,r,0)},onComplete:function(t,e,i,s){t.setChildLocalPosition(i,0,0)}}).addTransitionMode("slideLeft",{ease:"Linear",dir:"in",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=i.width*(1-s);t.setChildLocalPosition(i,r,0)},onComplete:function(t,e,i,s){t.setChildLocalPosition(i,0,0)}}).addTransitionMode("slideDown",{ease:"Linear",dir:"in",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=i.height*(s-1);t.setChildLocalPosition(i,0,r)},onComplete:function(t,e,i,s){t.setChildLocalPosition(i,0,0)}}).addTransitionMode("slideUp",{ease:"Linear",dir:"in",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=i.height*(1-s);t.setChildLocalPosition(i,0,r)},onComplete:function(t,e,i,s){t.setChildLocalPosition(i,0,0)}})},function(t){t.addTransitionMode("pushRight",{ease:"Linear",dir:"out",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=e.width*s;t.setChildLocalPosition(e,r,0),r=i.width*(s-1),t.setChildLocalPosition(i,r,0)},onComplete:function(t,e,i,s){t.setChildLocalPosition(e,0,0),t.setChildLocalPosition(i,0,0)}}).addTransitionMode("pushLeft",{ease:"Linear",dir:"out",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=e.width*-s;t.setChildLocalPosition(e,r,0),r=i.width*(1-s),t.setChildLocalPosition(i,r,0)},onComplete:function(t,e,i,s){t.setChildLocalPosition(e,0,0),t.setChildLocalPosition(i,0,0)}}).addTransitionMode("pushDown",{ease:"Linear",dir:"out",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=e.height*s;t.setChildLocalPosition(e,0,r),r=i.height*(s-1),t.setChildLocalPosition(i,0,r)},onComplete:function(t,e,i,s){t.setChildLocalPosition(e,0,0),t.setChildLocalPosition(i,0,0)}}).addTransitionMode("pushUp",{ease:"Linear",dir:"out",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=e.height*-s;t.setChildLocalPosition(e,0,r),r=i.height*(1-s),t.setChildLocalPosition(i,0,r)},onComplete:function(t,e,i,s){t.setChildLocalPosition(e,0,0),t.setChildLocalPosition(i,0,0)}})},function(t){t.addTransitionMode("zoomOut",{ease:"Linear",dir:"out",mask:!1,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=1-s;t.setChildLocalScale(e,r,r)},onComplete:function(t,e,i,s){t.setChildLocalScale(e,1,1)}}).addTransitionMode("zoomIn",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=s;t.setChildLocalScale(i,r,r)},onComplete:function(t,e,i,s){t.setChildLocalScale(i,1,1)}}).addTransitionMode("zoomInOut",{ease:"Linear",dir:"out",mask:!1,onStart:function(t,e,i,s){i.tint=0},onProgress:function(t,e,i,s){var r;s<.5?(r=1-Po(s),t.setChildLocalScale(e,r,r)):(e.visible&&t.setChildVisible(e,!1),r=1-Po(s),t.setChildLocalScale(i,r,r))},onComplete:function(t,e,i,s){t.setChildLocalScale(e,1,1),t.setChildVisible(e,!0),e.tint=16777215,t.setChildLocalScale(i,1,1),t.setChildVisible(i,!0),i.tint=16777215}})},function(t){t.addTransitionMode("fade",{ease:"Linear",dir:"out",mask:!1,onStart:function(t,e,i,s){i.tint=0},onProgress:function(t,e,i,s){var r;s<.5?(s=Po(s),r=Math.floor(255*(1-s)),e.tint=(r<<16)+(r<<8)+r):(e.visible&&t.setChildVisible(e,!1),s=Po(s),r=Math.floor(255*(1-s)),i.tint=(r<<16)+(r<<8)+r)},onComplete:function(t,e,i,s){t.setChildVisible(e,!0),e.tint=16777215,t.setChildVisible(i,!0),i.tint=16777215}}).addTransitionMode("crossFade",{ease:"Linear",dir:"out",mask:!1,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){t.setChildLocalAlpha(e,1-s),t.setChildLocalAlpha(i,s)},onComplete:function(t,e,i,s){t.setChildLocalAlpha(e,1)}})},function(t){var e,i=(e=t.scene,new Gx(e,{type:"Graphics",create:[{name:"rect",type:"rectangle"}],update:function(){this.getShape("rect").fillStyle(16777215).setSize(this.width*this.value,this.height*this.value).setCenterPosition(this.centerX,this.centerY)}}));t.once("destroy",(function(){i.destroy()})).addTransitionMode("irisOut",{ease:"Linear",dir:"out",mask:i,onStart:function(t,e,i,s){t.setCurrentImageMaskEnable(!0,!0)},onProgress:function(t,e,i,s){t.maskGameObject.setValue(s)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1)}}).addTransitionMode("irisIn",{ease:"Linear",dir:"in",mask:i,onStart:function(t,e,i,s){t.setNextImageMaskEnable(!0,!0)},onProgress:function(t,e,i,s){t.maskGameObject.setValue(1-s)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1)}}).addTransitionMode("irisInOut",{ease:"Linear",dir:"out",mask:i,onStart:function(t,e,i,s){i.tint=0,t.setCurrentImageMaskEnable(!0),t.setNextImageMaskEnable(!0)},onProgress:function(t,e,i,s){var r;s<.5?(s=Po(s),r=Math.floor(255*(1-s)),t.maskGameObject.setValue(1-s),e.tint=(r<<16)+(r<<8)+r):(e.visible&&t.setChildVisible(e,!1),s=Po(s),r=Math.floor(255*(1-s)),t.maskGameObject.setValue(1-s),i.tint=(r<<16)+(r<<8)+r)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1),t.setChildVisible(e,!0),e.tint=16777215,t.setChildVisible(i,!0),i.tint=16777215}})},function(t){var e,i=(e=t.scene,new Gx(e,{type:"Graphics",create:[{name:"pie",type:"arc"}],update:function(){var t=2*Math.max(this.width,this.height),e=90*this.value;this.getShape("pie").fillStyle(16777215).setCenterPosition(this.centerX,0).setRadius(t).setAngle(90-e,90+e).setPie()}}));t.once("destroy",(function(){i.destroy()})).addTransitionMode("pieOut",{ease:"Linear",dir:"out",mask:i,onStart:function(t,e,i,s){t.setCurrentImageMaskEnable(!0,!0)},onProgress:function(t,e,i,s){t.maskGameObject.setValue(s)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1)}}).addTransitionMode("pieIn",{ease:"Linear",dir:"in",mask:i,onStart:function(t,e,i,s){t.setNextImageMaskEnable(!0,!0)},onProgress:function(t,e,i,s){t.maskGameObject.setValue(1-s)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1)}}).addTransitionMode("pieInOut",{ease:"Linear",dir:"out",mask:i,onStart:function(t,e,i,s){i.tint=0,t.setCurrentImageMaskEnable(!0),t.setNextImageMaskEnable(!0)},onProgress:function(t,e,i,s){var r;s<.5?(s=Po(s),r=Math.floor(255*(1-s)),t.maskGameObject.setValue(1-s),e.tint=(r<<16)+(r<<8)+r):(e.visible&&t.setChildVisible(e,!1),s=Po(s),r=Math.floor(255*(1-s)),t.maskGameObject.setValue(1-s),i.tint=(r<<16)+(r<<8)+r)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1),t.setChildVisible(e,!0),e.tint=16777215,t.setChildVisible(i,!0),i.tint=16777215}})},function(t){var e,i=(e=t.scene,new Gx(e,{type:"Graphics",create:[{name:"rect",type:"rectangle"}],update:function(){var t=this.getShape("rect").fillStyle(16777215),e=1-this.value;switch(this.wipeMode){case"right":t.setSize(this.width*e,this.height).setTopLeftPosition(this.width-t.width,0);break;case"left":t.setSize(this.width*e,this.height).setTopLeftPosition(0,0);break;case"down":t.setSize(this.width,this.height*e).setTopLeftPosition(0,this.height-t.height);break;case"up":t.setSize(this.width,this.height*e).setTopLeftPosition(0,0)}}}));t.once("destroy",(function(){i.destroy()})).addTransitionMode("wipeRight",{ease:"Linear",dir:"out",mask:i,onStart:function(t,e,i,s){t.setCurrentImageMaskEnable(!0),t.maskGameObject.wipeMode="right"},onProgress:function(t,e,i,s){t.maskGameObject.setValue(s)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1)}}).addTransitionMode("wipeLeft",{ease:"Linear",dir:"out",mask:i,onStart:function(t,e,i,s){t.setCurrentImageMaskEnable(!0),t.maskGameObject.wipeMode="left"},onProgress:function(t,e,i,s){t.maskGameObject.setValue(s)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1)}}).addTransitionMode("wipeDown",{ease:"Linear",dir:"out",mask:i,onStart:function(t,e,i,s){t.setCurrentImageMaskEnable(!0),t.maskGameObject.wipeMode="down"},onProgress:function(t,e,i,s){t.maskGameObject.setValue(s)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1)}}).addTransitionMode("wipeUp",{ease:"Linear",dir:"out",mask:i,onStart:function(t,e,i,s){t.setCurrentImageMaskEnable(!0),t.maskGameObject.wipeMode="up"},onProgress:function(t,e,i,s){t.maskGameObject.setValue(s)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1)}})},function(t){var e=function(t,e){var i=new Gx(t,{type:"Graphics",create:{rectangle:e},update:function(){for(var t=this.getShapes(),i=this.width/e,s=0;s=0;s--)(a=r[s])instanceof e&&(a.destroy(),Lk(r,s));else{s=0;for(var r,n=(r=t.postPipelines).length;s0}(e,_k),delete e.effect}})},function(t){t.addTransitionMode("revealRight",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(Bk,0,0)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}}).addTransitionMode("revealLeft",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(Bk,1,0)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}}).addTransitionMode("revealDown",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(Bk,0,1)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}}).addTransitionMode("revealUp",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(Bk,1,1)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}})}];class Dk extends Sk{constructor(t,e,i,s,r,n){super(t,e,i,s,r,n);for(var a=0,o=Ik.length;at.dropEnable}),this.on("drop",(function(t,e){this._files=e.dataTransfer.files;var i=this._files;if(i&&this.filters)for(var s in this.filters){for(var r=this.filters[s],n=[],a=0,o=i.length;a0&&this.emit(`drop.${s}`,n)}}),this)}get files(){return this._files}}Object.assign(bw.prototype,gw),t.register("fileDropZone",(function(t){var e=new bw(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.FileDropZone",bw);const xw=Phaser.Math.Wrap;var Cw=function(t,e){if(this.hasRatioFitChild){var i,s,r;0===this.orientation?i=e-(this.getInnerPadding("top")+this.getInnerPadding("bottom"))*this.scaleY:(this.getInnerPadding("left"),this.getInnerPadding("right"),this.scaleX);for(var n=this.sizerChildren,a=0,o=n.length;a(i=0===this.orientation?Math.abs(h.left-t):Math.abs(h.top-e))&&(n=i,r=a)}return h=s[s.length-1],n>(i=0===this.orientation?Math.abs(h.right-t):Math.abs(h.bottom-e))&&(n=i,r=a+1),r};const Pw=Phaser.Utils.Objects.IsPlainObject,Tw=Phaser.Utils.Objects.GetValue,Ow=Phaser.Display.Align.CENTER,Mw={min:0,full:-1};var Ew=function(t,e,i,s,r,n,a,o,h,l){var d,c,u,p;Dv.call(this,t);var g=t.isRexSpace,v=typeof e;if(null===e)return this;if("number"===v);else if("string"===v)e=Mw[e];else if(Pw(e)){var f;e=Tw(f=e,"proportion",void 0),i=Tw(f,"align",Ow),s=Tw(f,"padding",0),r=Tw(f,"expand",!1),n=Tw(f,"key",void 0),a=Tw(f,"index",void 0),t.isRexSizer||(o=Tw(f,"minWidth",void 0),h=Tw(f,"minHeight",void 0)),l=Tw(f,"fitRatio",0),d=Tw(f,"offsetX",0),c=Tw(f,"offsetY",0),u=Tw(f,"offsetOriginX",0),p=Tw(f,"offsetOriginY",0)}return"string"==typeof i&&(i=ev[i]),void 0===e&&(e=g?1:0),void 0===i&&(i=Ow),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===o&&(g?o=0:t.isRexSizer||(o=t._minWidth)),void 0===h&&(g?h=0:t.isRexSizer||(h=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=zn(t)/Fn(t)),void 0===d&&(d=0),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),(f=this.getSizerConfig(t)).proportion=e,f.align=i,f.padding=Bv(s),f.expand=r,f.fitRatio=0===e?l:0,f.alignOffsetX=d,f.alignOffsetY=c,f.alignOffsetOriginX=u,f.alignOffsetOriginY=p,void 0===a||a>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(a,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===o?zn(t):o:t.minHeight=void 0===h?Fn(t):h),r&&(0===this.orientation?t.minHeight=h:t.minWidth=o)),void 0!==n&&this.addChildrenMap(n,t),this},_w={add:Ew,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),Ew.call(this,new ww(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,o){return Pw(i)&&(i.index=t),Ew.call(this,e,i,s,r,n,a,t,o),this},insertAtPosition(t,e,i,s,r,n,a,o,h){var l=Sw.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,o,h),this}};const Rw=Phaser.Utils.Array.Remove;var Lw={remove(t,e){return this.getParentSizer(t)!==this||(Rw(this.sizerChildren,t),Wv.call(this,t,e)),this},removeAll(t){for(var e=this.sizerChildren.length-1;e>=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,Qb.call(this,t),this}},Bw={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=ev[e]),this.getSizerConfig(t).align=e,this}},Iw={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},Dw={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},jw={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},Aw={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,o=this.sizerChildren,h=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=o.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?h=!0:n=0)):n=0,h||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,a+=n)));else for(d=0,c=o.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?h=!0:n=0)):n=0,h||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,a+=n)))}return h?void 0:a+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,a=s.padding;i=n-(a.left+a.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,a=s.padding;i=n-(a.top+a.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(af(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,sf.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,o,h,l,d,c,u=this.sizerChildren,p=this.innerLeft,g=this.innerTop,v=this.innerWidth,f=this.innerHeight,m=p,y=g,b=this.startChildIndex,x=0,C=u.length;x0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Zv.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Jv.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&Cw.call(this,t,void 0),qv.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Qv.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&Cw.call(this,void 0,t),tf.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],a=n&&n.isRexSpace;return"center"===t?a||this.insertSpace(r+1):a&&this.remove(n,!0),this}};Object.assign(Aw,_w,Lw,Bw,Iw,Dw,jw);var zw=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i};const Fw=Phaser.Utils.Objects.IsPlainObject,Yw=Phaser.Utils.Objects.GetValue;class Xw extends Yb{constructor(t,e,i,s,r,n,a){Fw(e)?(e=Yw(a=e,"x",0),i=Yw(a,"y",0),s=Yw(a,"width",void 0),r=Yw(a,"height",void 0),n=Yw(a,"orientation",0)):Fw(s)?(s=Yw(a=s,"width",void 0),r=Yw(a,"height",void 0),n=Yw(a,"orientation",0)):Fw(n)&&(n=Yw(a=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,a),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Yw(a,"space.item",0)),this.setStartChildIndex(Yw(a,"startChildIndex",0)),this.setRTL(Yw(a,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=Sp(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=zw.call(this)),this._childrenProportion}}Object.assign(Xw.prototype,Aw);var Ww=function(t,e,i){if(t){var s=null==e,r=null==i;return s&&r||(s||(t.displayWidth=e),r||(t.displayHeight=i),s&&(t.scaleX=t.scaleY),r&&(t.scaleY=t.scaleX)),t}},Vw={appendText:Ei,resetDisplayContent:function(t){void 0===t?t={}:"string"==typeof t&&(t={text:t});var e=t.text||"";this.setText(e);var i=this.childrenMap.icon;if(i){t.icon?this.show(i):this.hide(i);var s=t.iconSize;s&&(this.setChildDisplaySize(i,s,s),void 0!==this.iconWidth&&this.setIconSize(s)),!0!==t.icon&&this.setIconTexture(t.icon,t.iconFrame)}var r=this.childrenMap.action;if(r){t.action?this.show(r):this.hide(r);var n=t.actionSize;n&&(this.setChildDisplaySize(r,n,n),void 0!==this.actionWidth&&this.setActionSize(n)),!0!==t.action&&this.setActionTexture(t.action,t.actionFrame)}return this}};class Gw extends Xw{get text(){var t=this.childrenMap.text;return t?t.text:""}set text(t){var e=this.childrenMap.text;e&&e.setText(t)}setText(t){return this.text=t,this}setIconTexture(t,e){var i=this.childrenMap.icon;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.iconWidth&&void 0!==this.iconHeight&&(Ww(i,this.iconWidth,this.iconHeight),this.resetChildScaleState(i)),this):this}setTexture(t,e){return this.setIconTexture(t,e),this}setIconSize(t,e){return void 0===e&&(e=t),this.iconWidth=t,this.iconHeight=e,this}get texture(){var t=this.childrenMap.icon;if(t)return t.texture}get frame(){var t=this.childrenMap.icon;if(t)return t.frame}setActionTexture(t,e){var i=this.childrenMap.action;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.actionWidth&&void 0!==this.actionHeight&&(Ww(i,this.actionWidth,this.actionHeight),this.resetChildScaleState(i)),this):this}get actionTexture(){var t=this.childrenMap.action;if(t)return t.texture}get actionFrame(){var t=this.childrenMap.action;if(t)return t.frame}setActionSize(t,e){return void 0===e&&(e=t),this.actionWidth=t,this.actionHeight=e,this}preLayout(){var t=this.childrenMap.icon;t&&void 0!==this.iconWidth&&void 0!==this.iconHeight&&Ww(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&Ww(e,this.actionWidth,this.actionHeight),super.preLayout()}postLayout(t,e,i){var s=this.childrenMap.iconMask;s&&(s.setPosition(),this.resetChildPositionState(s));var r=this.childrenMap.actionMask;return r&&(r.setPosition(),this.resetChildPositionState(r)),super.postLayout(t,e,i),this}resize(t,e){super.resize(t,e);var i=this.childrenMap.iconMask;i&&i.resize();var s=this.childrenMap.actionMask;return s&&s.resize(),this}}Object.assign(Gw.prototype,Vw);var Hw=function(t,e,i,s){var r=new hk(e,i,s);if(t&&!t.isRexSizer){var n=r.createGeometryMask();t.setMask(n),this.once("destroy",(function(){t.setMask(),n.destroy()}))}return this.pin(r),r};const Uw=Phaser.GameObjects.Text;var Nw=function(t){return t instanceof Uw};const $w=Phaser.GameObjects.BitmapText;var Kw=function(t){return t instanceof $w},Jw=function(t){return Kw(t)?2:Nw(t)?0:1},qw=function(t,e){for(var i=[],s=t.split("\n"),r=e.style,n=r.wordWrapWidth,a=r.hasOwnProperty("wrapMode")?r.wrapMode:3,o=e.context,h=0,l=s.length;h0&&r.push(h.join("")),r},Qw=function(t,e){switch(Jw(t)){case 0:switch("string"==typeof e&&(e=Ie[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=qw;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Ie[e]||0),t.style.wrapMode=e}},tS=function(t,e){return void 0===e&&(e=0),t._minWidth=e,t.runWidthWrap=function(t){return t instanceof ln}(t)?function(t){return function(e){return t.setFixedSize(e,0).runWordWrap(),t.minHeight=t.height,t}}(t):Kw(t)?function(t){return function(e){return t.setMaxWidth(e),t.minHeight=t.height,t}}(t):function(t){return function(e){var i=t.padding,s=e-(i.left+i.right)*t.scaleX,r=t.style;return Nw(t)?(r.wordWrapWidth=s,r.maxLines=0):(0===r.wrapMode&&(r.wrapMode=1),r.wrapWidth=s,r.maxLines=0),r.fixedWidth=e,r.fixedHeight=0,t.updateText(),t.minHeight=t.height,t}}(t),t};const eS=65535;var iS=function(t,e,i){if(null==e)return t;if(0===e)return nS(t,0,i),t;var s=t.text.length;if(0===s)return nS(t,e,i),t;var r=Math.floor(1.5*e/s);void 0!==i&&r>i&&(r=Math.floor(i));for(var n={},a=rS(t,r,e,i,n),o=0;o<=eS&&0!==a;o++){if((r+=a)<0){r=0;break}a=rS(t,r,e,i,n)}return o===eS&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),nS(t,e,i),t},sS=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},rS=function(t,e,i,s,r){var n,a=sS(t,e,r),o=sS(t,e+1,r);if(void 0!==s)if(a.height<=s&&o.height>s)n=0;else{if(a.height>s)return-1;n=Math.floor(s-a.height)}if(a.width<=i&&o.width>i)return 0;if(a.width>i)return-1;var h=Math.floor(i-a.width);return void 0===n?h:Math.min(h,n)},nS=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const aS=Phaser.Utils.Objects.GetValue;var oS=function(t,e){"number"==typeof e&&(e={minWidth:e});var i=aS(e,"minWidth",0),s=aS(e,"minHeight",0),r=aS(e,"fitHeight",!1);return t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return iS(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),iS(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t}),t};const hS=Phaser.Utils.Objects.GetValue;class lS extends Gw{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=hS(e,"background",void 0),r=hS(e,"icon",void 0),n=hS(e,"iconMask",void 0),a=hS(e,"text",void 0),o=hS(e,"action",void 0),h=hS(e,"actionMask",void 0),l=hS(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(a||o)&&(i={right:hS(e,"space.icon",0),top:hS(e,"space.iconTop",0),bottom:hS(e,"space.iconBottom",0),left:hS(e,"space.iconLeft",0)}):(a||o)&&(i={bottom:hS(e,"space.icon",0),left:hS(e,"space.iconLeft",0),right:hS(e,"space.iconRight",0),top:hS(e,"space.iconTop",0)});var d=hS(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=Hw.call(this,r,r,1)),!d){var c=hS(e,"iconSize",void 0);this.setIconSize(hS(e,"iconWidth",c),hS(e,"iconHeight",c))}}if(a){var u=hS(e,"wrapText",!1),p=hS(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),Qw(a,u),e.expandTextWidth=!0,tS(a)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,oS(a,{fitHeight:!0}));var g,v,f=hS(e,"space.text",0),m=hS(e,"expandTextWidth",!1),y=hS(e,"expandTextHeight",!1);0===this.orientation?(g=m?1:0,o&&(i={right:f}),v=y):(g=y?1:0,o&&(i={bottom:f}),v=m),this.add(a,{proportion:g,expand:v,padding:i})}if(o&&(i=0===this.orientation?{top:hS(e,"space.actionTop",0),bottom:hS(e,"space.actionBottom",0),right:hS(e,"space.actionRight",0)}:{left:hS(e,"space.actionLeft",0),right:hS(e,"space.actionRight",0),bottom:hS(e,"space.actionBottom",0)},d=hS(e,"squareFitAction",!1)?1:0,this.add(o,{proportion:0,padding:i,fitRatio:d}),h&&(h=Hw.call(this,o,o,1)),!d)){var b=hS(e,"actionSize");this.setActionSize(hS(e,"actionWidth",b),hS(e,"actionHeight",b))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",a),this.addChildrenMap("action",o),this.addChildrenMap("actionMask",h)}}const dS=Phaser.Utils.Objects.GetValue;var cS=function(t,e){var i=dS(e,"canvas"),s=dS(i,"width",128),r=dS(i,"height",128),n=new _u(t,0,0,s,r);t.add.existing(n);var a=dS(i,"key"),o=dS(i,"frame"),h=dS(i,"fill");return void 0!==h?n.fill(h):void 0!==a&&n.loadTexture(a,o),n.setTexture=n.loadTexture.bind(n),n};const uS=Phaser.Utils.Objects.GetValue;var pS=function(t,e){var i=uS(e,"clickTarget",this);return"string"==typeof i&&(i=t.getElement(i)),i};const gS=Phaser.Utils.Objects.GetValue,vS={accept:"image/*",multiple:!1};var fS=function(t,e){if(0!==e.length){var i=t.childrenMap.icon,s=i.image,r=e[0];return s.loadFromFilePromise(r).then((function(){return i.scaleImage(),t.emit("select",r,t),Promise.resolve(r)}))}},mS={async openPromise(){var t=this;return sw(this.scene.game,vS).then((function(e){return fS(t,e.files)}))},open(){return this.openPromise(),this},setClickOpenEnable(t){return void 0===t&&(t=!0),this.clickBehavior&&this.clickBehavior.setEnable(t),this.fileChooser&&this.fileChooser.setOpenEnable(t),this}},yS={getFileName:function(t){if(!t)return null;var e=t.name;return e.substr(0,e.lastIndexOf("."))},saveTexture:function(t){return this.childrenMap.canvas.generateTexture(t),this}};Object.assign(yS,mS);const bS=Phaser.Utils.Objects.GetValue;class xS extends lS{constructor(t,e){var i=function(t,e){var i=new Yk(t,{scaleUp:dS(e,"scaleUpIcon",!1),background:dS(e,"iconBackground"),image:cS(t,e)});return t.add.existing(i),i}(t,e);e.icon=i,super(t,e),this.type="rexImageFileInputLabel";var s=this.iconWidth,r=this.iconWidth;void 0!==s&&void 0!==r&&i.resize(s,r),this.clickTarget=pS(this,e),this.clickTarget&&(bS(e,"domButton",!0)?this.fileChooser=function(t){var e=t.scene,i=new dw(e,vS);return e.add.existing(i),t.pin(i),i.on("change",(function(){fS(t,i.files)})),i}(this):this.clickBehavior=function(t,e){var i=pS(t,e);if(i){var s=gS(e,"click"),r=new du(i,s);return r.on("click",t.open,t),r}}(this,e)),this.addChildrenMap("canvas",i.image),this.addChildrenMap("iconBackground",i.background),this.addChildrenMap("fileChooser",this.fileChooser)}postLayout(t,e,i){this.fileChooser&&(this.fileChooser.syncTo(this.clickTarget),this.resetChildState(this.fileChooser)),super.postLayout(t,e,i)}}Object.assign(xS.prototype,yS),t.register("imageInputLabel",(function(t){var e=new xS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ImageInputLabel",xS);let CS=class extends Ba{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(oe(t,e))return t[e];var i=t.parent;return oe(i,e)?i[e]:void 0}set(t,e,i){return oe(t,e)?t[e]=i:oe(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.texture.key}set key(t){this.parent.setTexture(t,this.frame)}get frame(){return this.parent.frame.name}set frame(t){this.parent.setFrame(t)}get scale(){return this.parent.scaleX}set scale(t){this.parent.setScale(t)}};const kS=Phaser.Utils.Objects.GetValue;class wS extends Ba{constructor(t,e){super(t,e),this.style=kS(e,"style",this);var i=kS(e,"propertiesMap");this.activeStyle=SS(e,"active",i),this.hoverStyle=SS(e,"hover",i),this.disableStyle=SS(e,"disable",i),this.onModifyStyle=kS(e,"onModifyStyle")}getStyle(t){return Dd(this.style,t)}modifyStyle(t){for(var e in t)this.style[e]=t[e];return this.onModifyStyle&&this.onModifyStyle(this.parent,t),this}applyStyle(t){if(t){var e=this.getStyle(t);return jd(e,t)?void 0:(this.modifyStyle(t),e)}}setActiveState(t){return PS.call(this,"active",t),this}setHoverState(t){return PS.call(this,"hover",t),this}setDisableState(t){return PS.call(this,"disable",t),this}}var SS=function(t,e,i){var s=Bd(t,e);if(i)for(var r in s)i.hasOwnProperty(r)&&(s[i[r]]=s[r],delete s[r]);return s},PS=function(t,e){void 0===e&&(e=!0);var i=`${t}State`,s=`${t}Style`,r=`${t}StyleSave`;this[i]!==e&&(this[i]=e,e?this[r]=this.applyStyle(this[s]):(this.applyStyle(this[r]),this[r]=void 0))},TS={addStyleManager(t){return this.styleManager=new wS(this,t),this},setActiveState(t){return this.styleManager.setActiveState(t),this},setHoverState(t){return this.styleManager.setHoverState(t),this},setDisableState(t){return this.styleManager.setDisableState(t),this}};const OS=Phaser.GameObjects.Image,MS=Phaser.Utils.Objects.GetValue;class ES extends OS{constructor(t,e){void 0===e&&(e={}),super(t,MS(e,"x",0),MS(e,"y",0),MS(e,"key",""),MS(e,"frame",void 0)),this.type="rexStatesImage";var i=MS(e,"effects",!0);i&&En(this,i),this.style=new CS(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(ES.prototype,TS),t.register("statesImage",(function(t){var e=new ES(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesImage",ES);class _S extends At{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesRoundRectangleShape",e.style=this,e.propertiesMap=RS,this.addStyleManager(e),delete e.style,delete e.propertiesMap}}const RS={color:"fillColor",alpha:"fillAlpha",strokeWidth:"lineWidth"};Object.assign(_S.prototype,TS),t.register("statesRoundRectangle",(function(t){var e=new _S(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesRoundRectangle",_S);let LS=class extends Ba{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(oe(t,e))return t[e];var i=t.parent;return oe(i,e)?i[e]:void 0}set(t,e,i){return oe(t,e)?t[e]=i:oe(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.texture.key}set key(t){this.key!==t&&this.parent.setTexture(t,this.frame)}get frame(){return this.parent.frame.name}set frame(t){this.frame!==t&&this.parent.setFrame(t)}};const BS=Phaser.GameObjects.NineSlice,IS=Phaser.Utils.Objects.GetValue;class DS extends BS{constructor(t,e){void 0===e&&(e={}),super(t,IS(e,"x",0),IS(e,"y",0),IS(e,"key",null),IS(e,"frame",null),IS(e,"width",0),IS(e,"height",0),IS(e,"leftWidth",0),IS(e,"rightWidth",0),IS(e,"topHeight",0),IS(e,"bottomHeight",0)),this.type="rexStatesNineSlice";var i=IS(e,"effects",!0);i&&En(this,i),this.style=new LS(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(DS.prototype,TS),t.register("statesNineSlice",(function(t){var e=new DS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesNineSlice",DS);let jS=class extends Ba{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(oe(t,e))return t[e];var i=t.parent;return oe(i,e)?i[e]:void 0}set(t,e,i){return oe(t,e)?t[e]=i:oe(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}};const AS=Phaser.Utils.Objects.GetValue;class zS extends k{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=AS(e,"effects",!0);i&&En(this,i),this.style=new jS(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(zS.prototype,TS),t.register("statesNinePatch",(function(t){var e=new zS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesNinePatch",zS);const FS=Phaser.GameObjects.Text,YS=Phaser.Utils.Objects.GetValue;class XS extends FS{constructor(t,e){void 0===e&&(e={}),super(t,YS(e,"x",0),YS(e,"y",0),YS(e,"text",""),e),this.type="rexStatesText",e.style=this.style,e.onModifyStyle=function(t,e){var i=e.hasOwnProperty("fontStyle")||e.hasOwnProperty("fontSize")||e.hasOwnProperty("fontFamily");t.style.update(i)},this.addStyleManager(e),delete e.style}}Object.assign(XS.prototype,TS),t.register("statesText",(function(t){var e=new XS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesText",XS);class WS extends Ba{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(oe(t,e))return t[e];var i=t.parent;return oe(i,e)?i[e]:void 0}set(t,e,i){return oe(t,e)?t[e]=i:oe(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.texture.key}set key(t){this.parent.setTexture(t,this.frame)}get fontSize(){return this.parent.fontSize}set fontSize(t){this.parent.setFontSize(t)}get tint(){return this.parent.tintTopLeft}set tint(t){this.parent.setTint(t)}get letterSpacing(){return this.parent.letterSpacing}set letterSpacing(t){this.parent.setLetterSpacing(t)}get lineSpacing(){return this.parent.lineSpacing}set lineSpacing(t){this.parent.setLineSpacing(t)}}const VS=Phaser.GameObjects.BitmapText,GS=Phaser.Utils.Objects.GetValue;class HS extends VS{constructor(t,e){void 0===e&&(e={});var i=GS(e,"x",0),s=GS(e,"y",0),r=GS(e,"font",""),n=GS(e,"fontSize",!1),a=GS(e,"align",0),o=GS(e,"tint");super(t,i,s,r,"",n,a),this.type="rexStatesBitmapText",void 0!==o&&this.setTint(o);var h=GS(e,"effects",!0);h&&En(this,h),this.style=new WS(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(HS.prototype,TS),t.register("statesBitmapText",(function(t){var e=new HS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesBitmapText",HS);class US extends up{constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("value")||(e.value=0),e.hasOwnProperty("hover.bar")||(e["hover.bar"]=!0),e.hasOwnProperty("easeDuration")||(e.easeDuration=200),e.hasOwnProperty("ease")||(e.ease="Quad"),P(e,"easeValue.duration",e.easeDuration),P(e,"easeValue.ease",e.ease),super(t,e),this.type="rexStatesBarRectangleShape",this.barState=!1,e.style=this,e.propertiesMap=NS,this.addStyleManager(e),delete e.style,delete e.propertiesMap}get bar(){return this.barState}set bar(t){t=!!t,this.barState!==t&&(this.barState=t,this.easeValueTo(this.barState?1:0))}}const NS={color:"trackColor",strokeColor:"trackStrokeColor",strokeWidth:"trackStrokeThickness"};Object.assign(US.prototype,TS),t.register("statesBarRectangle",(function(t){var e=new US(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesBarRectangle",US);var $S=function(t,e){void 0===e&&(e={}),void 0===e.options&&(e.options={});var i=e.options;i.responsive=!1,i.maintainAspectRatio=!1,i.hasOwnProperty("devicePixelRatio")||(i.devicePixelRatio=1);var s=!1;void 0===i.animation?i.animation={}:!1===i.animation&&(s=!0,i.animation={});var r=i.animation;s&&(r.duration=0);var n=r.onProgress;r.onProgress=function(e){n&&n(e),t.needRedraw()};var a=r.onComplete;return r.onComplete=function(e){a&&a(e),t.needRedraw()},e};let KS=class extends _u{constructor(t,e,i,s,r,n){super(t,e,i,s,r),this.type="rexChart",this.chart=void 0,void 0!==n&&this.setChart(n)}destroy(t){this.scene&&(this.chart&&(this.chart.destroy(),this.chart=void 0),super.destroy(t))}resize(t,e){if(t===this.width&&e===this.height)return this;if(super.resize(t,e),this.chart){var i=this.chart;i.height=this.canvas.height,i.width=this.canvas.width,i.aspectRatio=i.height?i.width/i.height:null,i.update()}return this}};var JS={setChart:function(t){return window.Chart?(this.chart&&this.chart.destroy(),this.chart=new Chart(this.context,$S(this,t)),this):(console.error("Can not find chartjs! Load chartjs in preload stage.\nscene.load.script('chartjs', 'https://cdnjs.cloudflare.com/ajax/libs/Chart.js/3.8.0/Chart.min.js');"),this)},getChartDataset:function(t){if(void 0!==this.chart){if("string"!=typeof t)return this.chart.data.datasets[t];for(var e,i=this.chart.data.datasets,s=0,r=i.length;s=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return rP(this.sizerChildren,null),Qb.call(this,t),this}},aP={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)rP(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},dP={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,o=this.sizerChildren,h=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Zv.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,rP(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)rP(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},uP=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const pP=Phaser.Utils.Objects.IsPlainObject,gP=Phaser.Utils.Objects.GetValue;class vP extends Yb{constructor(t,e,i,s,r,n,a,o,h,l){pP(e)?(e=gP(l=e,"x",0),i=gP(l,"y",0),s=gP(l,"width",void 0),r=gP(l,"height",void 0),n=gP(l,"column",l.col||0),a=gP(l,"row",0),o=gP(l,"columnProportions",0),h=gP(l,"rowProportions",0)):pP(s)?(s=gP(l=s,"width",void 0),r=gP(l,"height",void 0),n=gP(l,"column",l.col||0),a=gP(l,"row",0),o=gP(l,"columnProportions",0),h=gP(l,"rowProportions",0)):pP(n)?(n=gP(l=n,"column",l.col||0),a=gP(l,"row",0),o=gP(l,"columnProportions",0),h=gP(l,"rowProportions",0)):pP(o)&&(o=gP(l=o,"columnProportions",0),h=gP(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(gP(l,"createCellContainerCallback")),this.setIndentLeft(gP(l,"space.indentLeftOdd",0),gP(l,"space.indentLeftEven",0)),this.setIndentTop(gP(l,"space.indentTopOdd",0),gP(l,"space.indentTopEven",0)),this.resetGrid(n,a,o,h,gP(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=cP.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=uP.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(vP.prototype,dP),t.register("gridSizer",(function(t,e,i,s,r,n,a,o,h){var l=new vP(this.scene,t,e,i,s,r,n,a,o,h);return this.scene.add.existing(l),l})),P(window,"RexPlugins.UI.GridSizer",vP);var fP=function(t,e,i,s){return e/t<=i?e/(s-1):0},mP=function(t){var e,i,s,r,n,a={lines:[],width:0,height:0},o=this.sizerChildren,h=0,l=a.lines,d=void 0;if(0===this.orientation){for(var c=0,u=o.length;co.height/2)){r>(h=yP(o.left,o.centerY,t,e))&&(r=h,s=n);var h,l=i[n+1];l&&l.y===o.y||r>(h=yP(o.right,o.centerY,t,e))&&(r=h,s=n+1)}}return s};const xP=Phaser.Utils.Objects.IsPlainObject,CP=Phaser.Utils.Objects.GetValue,kP=Phaser.Display.Align.CENTER;var wP=function(t,e,i,s){return"\n"===t?(this.addNewLine(),this):(Dv.call(this,t),xP(e)&&(e=CP(h=e,"padding",0),i=CP(h,"key",void 0),s=CP(h,"index",void 0),r=CP(h,"offsetX",0),n=CP(h,"offsetY",0),a=CP(h,"offsetOriginX",0),o=CP(h,"offsetOriginY",0)),void 0===e&&(e=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=0),void 0===o&&(o=0),(h=this.getSizerConfig(t)).align=kP,h.padding=Bv(e),h.alignOffsetX=r,h.alignOffsetY=n,h.alignOffsetOriginX=a,h.alignOffsetOriginY=o,void 0===s||s>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(s,0,t),void 0!==i&&this.addChildrenMap(i,t),this);var r,n,a,o,h},SP={add(t,e,i){if(Hm(t))for(var s=t,r=0,n=s.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,Qb.call(this,t),this}},OP={getChildrenWidth:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=0===this.orientation&&t?this.maxChildWidth:this.rexSizer.resolved?this.wrapResult.width:void 0)?e+(this.space.left+this.space.right)*this.scaleX:void 0);var e},getChildrenHeight:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=1===this.orientation&&t?this.maxChildHeight:this.rexSizer.resolved?this.wrapResult.height:void 0)?e+(this.space.top+this.space.bottom)*this.scaleY:void 0);var e},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const mT=Phaser.Utils.Objects.GetValue,yT=Phaser.Math.Distance.Between;class bT extends Ba{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=mT(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(mT(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(mT(t,"enable",!0)),this.holdThreshold=mT(t,"holdThreshold",50),this.pointerOutReleaseEnable=mT(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return oc(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:yT(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!Gm(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!Gm(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const xT=Phaser.Utils.Objects.GetValue;class CT{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(xT(t,"value",0)),this.setSpeed(xT(t,"speed",0)),this.setAcceleration(xT(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class kT{constructor(){this.value,this.dir,this.movement=new CT}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const TT={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},OT=Phaser.Utils.Objects.GetValue;class MT extends Ba{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=OT(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(OT(e,"speed",.1)),this.setEnable(OT(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(OT(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||Gm(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const ET=Phaser.Utils.Objects.GetValue;var _T=function(t,e,i,s){var r,n,a="Y"===(i=i.toUpperCase()),o=2===t.scrollMode,h=t.childrenMap.child,l=`slider${i}`;if(r=o||s.hasOwnProperty(l)?ET(s,l,void 0):ET(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=a?1:0,n=function(t,e){void 0===e&&(e={});var i=Ge(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new vT(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r),n.tickLength=ET(r,"tickLength",void 0);var p=ET(r,"position",0);"string"==typeof p&&(p=RT[p]);var g,v,f=ET(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=ET(s,"space.slider",void 0))&&(o?f=0:g=ET(s,"space.child",0)),v=void 0===g?"number"==typeof f:"number"==typeof g,a?0===p?(d=2,c=1,u=void 0===g?v?{left:f}:f:{left:ET(g,"right",g)}):(d=0,c=1,u=void 0===g?v?{right:f}:f:{right:ET(g,"left",g)}):0===p?(d=1,c=2,u=void 0===g?v?{top:f}:f:{top:ET(g,"bottom",g)}):(d=1,c=0,u=void 0===g?v?{bottom:f}:f:{bottom:ET(g,"top",g)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=ET(r,"hideUnscrollableSlider",!1),t[`disableUnscrollableDrag${i}`]=ET(r,"disableUnscrollableDrag",!1),t[`adaptThumb${i}SizeMode`]=ET(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=ET(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`disableUnscrollableDrag${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=ET(s,"scrollDetectionMode");"string"==typeof b&&(b=LT[b]);var x=`scroller${i}`;(m=o||s.hasOwnProperty(x)?ET(s,x,!0):ET(s,"scroller",!0))&&h&&(!0===m&&(m={}),m.orientation=a?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new PT(h,m),h.isRexContainerLite&&h.sendChildToBack(h));var C,k,w,S,P,T=ET(s,o?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);T&&h&&(void 0!==b&&(T.focus=1===b?2:0),C=new MT(h,T)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,C),o&&!a||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.disableUnscrollableDrag=t[`disableUnscrollableDrag${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",C)),n&&(o?(k=a?"t":"s",S=`scroll${i}`):(k="t",S="scroll"),n.on("valuechange",(function(e){t[k]=e,t.emit(S,t)}))),y&&(o?(w=`childO${i}`,S=`scroll${i}`):(w="childOY",S="scroll"),y.on("valuechange",(function(e){t[w]=e,t.emit(S,t)}))),C&&(P=o?`addChildO${i}`:"addChildOY",C.on("scroll",(function(e){t[P](-e,!0)})))};const RT={right:0,left:1,bottom:0,top:1},LT={gameObject:0,rectBounds:1},BT=Phaser.Utils.Objects.GetValue;var IT=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=BT(e,"width"),a=BT(e,"height");n||BT(e,"child.expandWidth",!0)||(s[1]=0),a||BT(e,"child.expandHeight",!0)||(r[1]=0);var o=new vP(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=YP(i,"child"),r=YP(s,"gameObject",void 0);if(r){var n=YP(i,"space.child",0);t.childMargin={};var a=t.childMargin,o={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:a.top=0,a.bottom=0,a.left=0,a.right=0;break;default:a.top=n,a.bottom=n,a.left=n,a.right=n}else switch(t.scrollMode){case 0:a.top=YP(n,"top",0),a.bottom=YP(n,"bottom",0),o.left=YP(n,"left",0),o.right=YP(n,"right",0);break;case 1:a.top=YP(n,"left",0),a.bottom=YP(n,"right",0),o.top=YP(n,"top",0),o.bottom=YP(n,"bottom",0);break;default:a.top=YP(n,"top",0),a.bottom=YP(n,"bottom",0),a.left=YP(n,"left",0),a.right=YP(n,"right",0)}e.add(r,{column:1,row:1,align:YP(s,"align","center"),padding:o,expand:{width:YP(s,"expandWidth",!0),height:YP(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,o,e),t.scrollMode){case 0:_T(t,o,"y",e);break;case 1:_T(t,o,"x",e);break;default:_T(t,o,"y",e),_T(t,o,"x",e)}return o},DT=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}i*="Y"===t?this.scaleY:this.scaleX,s&&s.setBounds(e,i),r&&(r.setEnable(e!==i),r.tickLength&&r.setTick(r.tickLength,e,i))},jT=function(t){switch(this.scrollMode){case 0:case 1:(i=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(i,this.isOverflow),(r=this.childrenMap.scroller)&&this.disableUnscrollableDrag&&r.setEnable(this.isOverflow);break;default:var e=this[`isOverflow${t=t.toUpperCase()}`],i=this.childrenMap[`slider${t}`],s=this[`hideUnscrollableSlider${t}`];i&&s&&this.setChildVisible(i,e);var r=this.childrenMap.scroller,n=this[`disableUnscrollableDrag${t}`];r&&n&&r.setEnable(e)}},AT=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(o=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=o.childrenMap.track,s=o.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&n0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n")}return i},GT=function(t){return(t-this.textLineSpacing)/(this.textLineHeight+this.textLineSpacing)},HT=function(t){return t*(this.textLineHeight+this.textLineSpacing)-this.textLineSpacing},UT=function(t){var e,i=t+this.visibleLinesCount+1;switch(this.textObjectType){case 0:case 2:e=this.lines.slice(t,i).join("\n");break;case 1:var s=this.lines.getLineStartIndex(t),r=this.lines.getLineEndIndex(i-1);e=this.lines.getSliceTagText(s,r,!0)}return e},NT=function(t,e){switch(Jw(t)){case 0:var i=(r=t.style).wordWrapWidth,s=r.wordWrapCallback;r.wordWrapWidth=0,r.wordWrapCallback=void 0,t.setText(e),r.wordWrapWidth=i,r.wordWrapCallback=s;break;case 1:var r,n=(r=t.style).wrapMode;r.wrapMode=0,t.setText(e),r.wrapMode=n;break;case 2:var a=t._maxWidth;t._maxWidth=0,t.setText(e),t._maxWidth=a}},$T=function(){var t=this.textObject.rexSizer;this.textObject.y+=t.offsetY-t.preOffsetY,t.preOffsetY=t.offsetY,this.resetChildPositionState(this.textObject),this.textCropEnable&&KT.call(this)},KT=function(){if(this.textObject.setCrop){var t,e,i=this.textObject.rexSizer.offsetY;i<=0?(t=-i,e=this.height):(t=0,e=this.height-i),this.textObject.setCrop(0,t,this.width,e)}},JT=function(t,e,i){if(i+=this.textLineHeight+this.textLineSpacing,this.textObjectWidth!==e||this._textObjectRealHeight!==i){switch(this.textObjectWidth=e,this._textObjectRealHeight=i,this.textObjectType){case 0:case 1:t.setFixedSize(e,i);var s=t.style,r=Math.max(e,0);0===this.textObjectType?s.wordWrapWidth=r:(0===s.wrapMode&&(s.wrapMode=1),s.wrapWidth=r);break;case 2:t.setMaxWidth(e)}this.setText()}},qT={setText:function(t){return void 0!==t&&(this.text=t),this.lines=VT(this.textObject,this.text,this.lines),this.linesCount=this.lines.length,this._textHeight=void 0,this._textVisibleHeight=void 0,this.updateTextObject(),this},updateTextObject:function(){var t=Math.max(Math.floor(GT.call(this,-this.textOY)),0),e=HT.call(this,t)+this.textOY,i=UT.call(this,t);return NT(this.textObject,i),this.textObject.rexSizer.offsetY=e,$T.call(this),this},preLayout:function(){return this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,sf.call(this),this},layoutChildren:function(){var t,e,i,s,r,n,a,o=this.left,h=this.top;(t=this.textObject).rexSizer.hidden||(s=o+(i=(e=t.rexSizer).padding).left*this.scaleX,r=h+i.top*this.scaleY,n=this.width*this.scaleX-(i.left+i.right)*this.scaleX,a=this.height*this.scaleY-(i.top+i.bottom)*this.scaleY,JT.call(this,t,n,a),Pv(t,s,r,n,a,e.align),e.preOffsetY=0,$T.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const ZT=Phaser.Utils.Objects.IsPlainObject,QT=Phaser.Utils.Objects.GetValue,tO=Phaser.Display.Align.TOP_LEFT;class eO extends Yb{constructor(t,e,i,s,r,n){ZT(e)?(e=QT(n=e,"x",0),i=QT(n,"y",0),s=QT(n,"width",void 0),r=QT(n,"height",void 0)):ZT(s)&&(s=QT(n=s,"width",void 0),r=QT(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexTextBlock",this.textObject=void 0,this.linesCount=0,this.textMask=void 0,this.textObjectType=void 0,this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,this._textObjectRealHeight=0,this.lines=void 0,this.text=QT(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode(QT(n,"clampTextOY",!0)),this.alwaysScrollable=QT(n,"alwaysScrollable",!1);var a=QT(n,"background",void 0),o=QT(n,"text",void 0);void 0===o&&(o=iO(t)),this.textCropEnable=QT(n,"textCrop",!!o.setCrop);var h=QT(n,"textMask",!this.textCropEnable);a&&this.addBackground(a),this.add(o),this.sizerChildren=[o];var l=this.getSizerConfig(o);l.align=tO,l.padding=Bv(0),l.expand=!0,this.textObject=o,this.textObjectType=Jw(o),l.preOffsetY=0,l.offsetY=0,h&&(this.textMask=Hw.call(this,this.textObject,this)),this.addChildrenMap("background",a),this.addChildrenMap("text",o)}destroy(t){if(this.scene&&!this.ignoreDestroy){if(this.textObject=void 0,this.textMask=void 0,this.lines){switch(this.textObjectType){case 0:case 2:this.lines.length=0;break;case 1:this.lines.destroy()}this.lines=void 0}super.destroy(t)}}setClampMode(t){return void 0===t&&(t=!0),this.clampTextOY=t,this}get textLineHeight(){if(void 0===this._textLineHeight){var t;switch(this.textObjectType){case 0:case 1:var e=this.textObject.style;t=e.metrics.fontSize+e.strokeThickness;break;case 2:var i=this.textObject.fontSize/this.textObject.fontData.size;t=this.textObject.fontData.lineHeight*i}this._textLineHeight=t}return this._textLineHeight}get textLineSpacing(){if(void 0===this._textLineSpacing){var t;switch(this.textObjectType){case 0:case 1:t=this.textObject.lineSpacing;break;case 2:t=0}this._textLineSpacing=t}return this._textLineSpacing}get visibleLinesCount(){return void 0===this._visibleLinesCount&&(this._visibleLinesCount=Math.floor(GT.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=HT.call(this,this.linesCount)),this._textHeight}get textObjectHeight(){return this._textObjectRealHeight-(this.textLineHeight+this.textLineSpacing)}get textVisibleHeight(){if(void 0===this._textVisibleHeight){var t=this.textHeight-this.textObjectHeight;!this.alwaysScrollable&&t<0&&(t=0),this._textVisibleHeight=t}return this._textVisibleHeight}textOYExceedTop(t){return void 0===t&&(t=this.textOY),t>this.topTextOY}textOYExeceedBottom(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:s?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}setTextOY(t){return this.textOY=t,this}set t(t){this.textOY=-this.textVisibleHeight*t}get t(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t}setTextOYByPercentage(t){return this.t=t,this}}var iO=function(t){return t.add.text(0,0,"")};Object.assign(eO.prototype,qT);var sO={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},rO={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const nO=Phaser.Utils.Objects.GetValue;class aO extends XT{constructor(t,e){void 0===e&&(e={});var i=nO(e,"text",void 0),s=nO(e,"textWidth",void 0),r=nO(e,"textHeight",void 0),n=nO(e,"textCrop",!!i.setCrop),a=nO(e,"textMask",!n),o=nO(e,"content",""),h=new eO(t,{width:s,height:r,text:i,textMask:a,textCrop:n&&!a,content:o,clampTextOY:nO(e,"clampChildOY",!1),alwaysScrollable:nO(e,"alwaysScrollable",!1)});t.add.existing(h),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textObjectHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.textHeight}})}(h),e.scrollMode=0,e.type="rexTextArea",e.child={gameObject:h,expandWidth:void 0===s,expandHeight:void 0===r};var l=nO(e,"space",void 0);l&&(l.child=nO(l,"text",0)),super(t,e),this.addChildrenMap("text",i)}get text(){return this.childrenMap.child.text}get lineHeight(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.textHeight}}Object.assign(aO.prototype,sO,rO);const oO=Phaser.Utils.Objects.GetValue;var hO=function(t,e,s){e=e?i(e):{};var r=oO(s,"background",jP),n=oO(s,"text",lO),a=oO(s,"track",jP),o=oO(s,"thumb",jP);r?e.background=r(t,e.background):delete e.background,n?e.text=n(t,e.text):delete e.text;var h=e.slider;!1!==h&&null!==h&&(void 0===h&&(h={}),a?h.track=a(t,h.track):delete h.track,o?h.thumb=o(t,h.thumb):delete h.thumb,e.slider=h);var l=new aO(t,e);return t.add.existing(l),l},lO=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("key")&&(i="bitmaptext",e.font=e.key)),i){case"bitmaptext":case"bitmap":s=new HS(t,e);break;case"bbcodetext":case"bbcode":s=new cs(t,0,0,"",e);break;case"label":s=new pO(t,e);break;case"textarea":s=hO(t,e);break;default:s=new XS(t,e)}return DP(s,e),t.add.existing(s),s},dO=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("leftWidth")?i="nineSlice":(e.hasOwnProperty("color")||e.hasOwnProperty("strokeColor"))&&(i="roundRectangle")),i){case"nineSlice":s=e.hasOwnProperty("stretchMode")?new zS(t,e):new DS(t,e);break;case"roundRectangle":s=new _S(t,e);break;default:s=new ES(t,e)}return DP(s,e),t.add.existing(s),s};const cO=Phaser.Utils.Objects.GetValue;var uO=function(t,e,s){e=e?i(e):{};var r=cO(s,"background",jP),n=cO(s,"text",lO),a=cO(s,"icon",dO),o=cO(s,"action",dO);return null!==e.background&&r?e.background=r(t,e.background):delete e.background,null!==e.text&&n?e.text=n(t,e.text):delete e.text,null!==e.icon&&a?e.icon=a(t,e.icon):delete e.icon,null!==e.action&&o?e.action=o(t,e.action):delete e.action,e};class pO extends lS{constructor(t,e,i){super(t,e=uO(t,e,i)),this.type="rexSimpleLabel"}setActiveState(t){return gO(this.getChildren(),"setActiveState",t),this}setHoverState(t){return gO(this.getChildren(),"setHoverState",t),this}setDisableState(t){return gO(this.getChildren(),"setDisableState",t),this}}var gO=function(t,e,i){for(var s=0,r=t.length;sthis.maxExp&&(t=this.maxExp),void 0===e&&(e=this.getLevel(t)),this._exp=t,this._level=e,this._requiredExp=this.getRequiredExpToNextLevel(e,t),this}get exp(){return this._exp}set exp(t){if(this.hasMaxLevel&&t>this.maxExp&&(t=this.maxExp),tthis.maxLevel?this.exp=this.maxExp:this.exp=this.getExp(t)}get requiredExp(){return this._requiredExp}getExp(t){return void 0===t?this._exp:this.isLevelMapFunction?this.levelTable(t):(this.hasMaxLevel&&t>this.maxLevel&&(t=this.maxLevel),this.levelTable[t])}getLevel(t,e){if(void 0===t)return this._level;for(void 0===e&&(e=0);;){var i=this.getExp(e+1);if(i>t)break;if(e++,this.hasMaxLevel&&i===this.maxExp)break}return e}getRequiredExpToNextLevel(t,e){return void 0===t&&(t=this.level),void 0===e&&(e=this.exp),this.getExp(t+1)-e}checkLevel(t,e){return e>=this.getExp(t)&&e=0;n--)s=LO(t[n],e,i);else for(var n=0,a=t.length;ns?1:it)return this;for(var e=this.commands;;){var i=e[this.index],s=i[1];if(Hm(s)||(s=Dc(AO,i,1)),LO(s,this.scope),this.emit("runcommand",s,this.scope),this.index>=e.length-1)return this.nextTime=0,this.complete(),this;if(this.index++,this.nextTime=this.getNextDt(this.nextTime),this.nextTime>t)return this}}complete(){this.clock.stop(),this.state=2,this.emit("complete",this.parent,this)}getNextDt(t){var e=this.commands[this.index][0];return 1===this.timeUnit&&(e*=1e3),1===this.dtMode&&(e+=t),e}setDtMode(t){return"string"==typeof t&&(t=FO[t]),this.dtMode=t,this}setTimeUnit(t){return"string"==typeof t&&(t=zO[t]),this.timeUnit=t,this}}var AO=[];const zO={ms:0,s:1,sec:1},FO={abs:0,absolute:0,inc:1,increment:1};var YO=function(t,e,i,s,r){var n=(i-e)/(r-s)*this.totalEaseDuration,a=i===r?t+1:t;this.player.append(0,this.setEaseValueDuration,n).append(0,this.easeValueTo,i,s,r).append(0,this.emit,"levelup.start",t,e,i,this).append(n,h).append(0,this.emit,"levelup.end",a,e,i,this),this.player.isPlaying||this.player.start()},XO={setExpTable(t){return this.levelCounter.setTable(t),this},resetExp(t){return this.levelCounter.resetExp(t),this.setValue(this.exp,this.getExp(this.level),this.getExp(this.level+1)),this},getExp(t){return this.levelCounter.getExp(t)},getLevel(t,e){return this.levelCounter.getLevel(t,e)},getRequiredExpToNextLevel(t,e){return this.levelCounter.getRequiredExpToNextLevel(t,e)},gainExp(t){return this.levelCounter.gainExp(t),this},setExp(t){return this.levelCounter.setExp(t),this},setLevel(t){return this.levelCounter.setLevel(t),this}};const WO=Phaser.Utils.Objects.GetValue;class VO extends _O{constructor(t,e){super(t,e),this.type="rexExpBar",this.setTotalEaseDuration(WO(e,"easeDuration",1e3)),this.levelCounter=new RO(WO(e,"levelCounter")),this.player=new jO(this,{scope:this,dtMode:1}),this.levelCounter.on("levelup",YO,this),this.player.on("complete",(function(){this.player.clear(),this.emit("levelup.complete",this.level,this)}),this),this.setValue(this.exp,this.getExp(this.level),this.getExp(this.level+1))}destroy(t){this.scene&&!this.ignoreDestroy&&(this.levelCounter.destroy(),this.levelCounter=void 0,this.player.destroy(),this.player=void 0,super.destroy(t))}get exp(){return this.levelCounter.exp}set exp(t){this.levelCounter.exp=t}get level(){return this.levelCounter.level}set level(t){this.levelCounter.level=t}get requiredExp(){return this.levelCounter.requiredExp}setTotalEaseDuration(t){return this.totalEaseDuration=t,this}}Object.assign(VO.prototype,XO),t.register("expBar",(function(t){var e=new VO(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ExpBar",VO);const GO=Xw.prototype.add,HO=Xw.prototype.addSpace;var UO=function(t){var e=!t.isRexSpace,i=!e||this.buttonsExpand?1:0;if(0===this.sizerChildren.length)if(e){!this.buttonsExpand&&("right"===this.buttonsAlign||"center"===this.buttonsAlign||"bottom"===this.buttonsAlign)&&HO.call(this),GO.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&HO.call(this),this.hasTailSpace=s}else GO.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;GO.call(this,t,{index:r,proportion:i,expand:!0})}else GO.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},NO={addButton(t){if(Hm(t))for(var e=t,i=0,s=e.length;i=0;i--)JO.call(this,e[i],t);return this}},ZO=function(t,e,i){if(t){var s=this.setValueCallback,r=this.setValueCallbackScope;s&&(r?s.call(r,t,e,i):s(t,e,i)),this.fireEvent("button.statechange",t,e,i)}},QO=function(t){var e=this;t._selected=void 0,Object.defineProperty(t,"selected",{get:function(){return t._selected},set:function(i){if(t._selected!==i){var s=t._selected;t._selected=i,ZO.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},tM={add(t){return this.buttons.push(t),t._click||(t._click=new du(t,this.clickConfig),t._click.on("click",(function(t,e,i,s){this.fireEvent("button.click",e,i,s)}),this).on("enable",(function(t,e){this.fireEvent("button.enable",e)}),this).on("disable",(function(t,e){this.fireEvent("button.disable",e)}),this).on("over",(function(t,e,i,s){this.fireEvent("button.over",e,i,s)}),this).on("out",(function(t,e,i,s){this.fireEvent("button.out",e,i,s)}),this).on("down",(function(t,e,i,s){this.fireEvent("button.down",e,i,s)}),this).on("up",(function(t,e,i,s){this.fireEvent("button.up",e,i,s)}),this),t.isRexContainerLite&&t.sendChildToBack(t)),this.buttonsType&&(void 0===t.name&&console.error(`${this.parent.constructor.name}: Option button miss value`),QO.call(this,t)),this},addMultiple(t){for(var e=0,i=t.length;e0},setButtonEnable(t,e){var i=this.buttons;if(void 0===t||"boolean"==typeof t){e=t;for(var s=0,r=i.length;s=0;i--)fM.call(this,e[i],t);return this}};const yM=Phaser.Utils.Objects.GetValue;class bM extends vP{constructor(t,e){void 0===e&&(e={});var i=yM(e,"row",0),s=yM(e,"column",e.col||0),r=yM(e,"createCellContainerCallback"),n=yM(e,"buttons",void 0),a=yM(e,"expand",!0),o=a?1:0;if(r&&(e.createCellContainerCallback=void 0),void 0!==n){i=Math.max(i,n.length);for(var h=0,l=n.length;hr&&xM.addNewLine(this)}else for(n=0,a=t.length;n=0;i--)PM.call(this,e[i],t);return this}};const OM=Phaser.Utils.Objects.GetValue;class MM extends LP{constructor(t,e){void 0===e&&(e={});var i=e.space;"number"==typeof i&&(e.space={item:i,line:i}),super(t,e),this.type="rexFixWidthButtons",this.buttonGroup=new oM({parent:this,eventEmitter:OM(e,"eventEmitter",this),groupName:OM(e,"groupName",void 0),clickConfig:OM(e,"click",void 0)}).setButtonsType(e);var s=OM(e,"background",void 0),r=OM(e,"buttons",void 0);this.buttonsAlign=OM(e,"align",void 0),s&&this.addBackground(s),r&&this.addButtons(r),this.addChildrenMap("background",s),this.addChildrenMap("buttons",this.buttonGroup.buttons)}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.buttonGroup.destroy(),this.buttonGroup=void 0)}get buttons(){return this.buttonGroup.buttons}get groupName(){return this.buttonGroup.groupName}set groupName(t){this.buttonGroup.groupName=t}get eventEmitter(){return this.buttonGroup.eventEmitter}}Object.assign(MM.prototype,kM,TM,aM,lM),t.register("fixWidthButtons",(function(t){var e=new MM(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.FixWidthButtons",MM);var EM={setAccept(t){return this.childrenMap.fileChooser.setAccept(t),this},setMultiple(t){return this.childrenMap.fileChooser.setMultiple(t),this},loadFile(t,e,i,s,r){return this.childrenMap.fileChooser.loadFile(t,e,i,s,r),this},loadFilePromise(t,e,i,s){return this.childrenMap.fileChooser.loadFilePromise(t,e,i,s)}};const _M=Phaser.Utils.Objects.GetValue;class RM extends lS{constructor(t,e){super(t,e),this.type="rexFileSelectorButton";var i=new dw(t);t.add.existing(i),this.addBackground(i),this.addChildrenMap("fileChooser",i),this.setAccept(_M(e,"accept","")),this.setMultiple(_M(e,"multiple",!1)),i.on("change",(function(t){var e=t.files;0!==e.length&&(e=Array.from(e),this.emit("select",e,this))}),this)}get files(){return this.childrenMap.fileChooser.files}}Object.assign(RM.prototype,EM),t.register("fileSelectorButton",(function(t){var e=new RM(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.FileSelectorButton",RM);var LM={getChoice(t){var e=this.childrenMap.choicesSizer;return e?e.getButton(t):void 0},getAction(t){return this.childrenMap.actionsSizer.getButton(t)},getToolbar(t){return this.childrenMap.toolbarSizer.getButton(t)},getLeftToolbar(t){return this.childrenMap.leftToolbarSizer.getButton(t)},setChoiceEnable(t,e){var i=this.childrenMap.choicesSizer;return i&&i.setButtonEnable(t,e),this},setActionEnable(t,e){return this.childrenMap.actionsSizer.setButtonEnable(t,e),this},setToolbarEnable(t,e){return this.childrenMap.toolbarSizer.setButtonEnable(t,e),this},setLeftToolbarEnable(t,e){return this.childrenMap.leftToolbarSizer.setButtonEnable(t,e),this},toggleChoiceEnable(t){var e=this.childrenMap.choicesSizer;return e&&e.toggleButtonEnable(t),this},toggleActionEnable(t){return this.childrenMap.actionsSizer.toggleButtonEnable(t),this},toggleToolbarEnable(t){return this.childrenMap.toolbarSizer.toggleButtonEnable(t),this},toggleLeftToolbarEnable(t){return this.childrenMap.leftToolbarSizer.toggleButtonEnable(t),this},getChoiceEnable(t){var e=this.childrenMap.choicesSizer;return!!e&&e.getButtonEnable(t)},getActionEnable(t){return this.childrenMap.actionsSizer.getButtonEnable(t)},getToolbarEnable(t){return this.childrenMap.toolbarSizer.getButtonEnable(t)},getLeftToolbarEnable(t){return this.childrenMap.leftToolbarSizer.getButtonEnable(t)},emitChoiceClick(t){var e=this.childrenMap.choicesSizer;return e&&e.emitButtonClick(t),this},emitActionClick(t){return this.childrenMap.actionsSizer.emitButtonClick(t),this},emitToolbarClick(t){return this.childrenMap.toolbarSizer.emitButtonClick(t),this},emitLeftToolbarClick(t){return this.childrenMap.leftToolbarSizer.emitButtonClick(t),this},showChoice(t){var e=this.childrenMap.choicesSizer;return e&&e.showButton(t),this},showAction(t){return this.childrenMap.actionsSizer.showButton(t),this},showToolbar(t){return this.childrenMap.toolbarSizer.showButton(t),this},showLeftToolbar(t){return this.childrenMap.leftToolbarSizer.showButton(t),this},hideChoice(t){var e=this.childrenMap.choicesSizer;return e&&e.hideButton(t),this},hideAction(t){return this.childrenMap.actionsSizer.hideButton(t),this},hideToolbar(t){return this.childrenMap.toolbarSizer.hideButton(t),this},hideLeftToolbar(t){return this.childrenMap.leftToolbarSizer.hideButton(t),this},addChoice(t){var e=this.childrenMap.choicesSizer;return e&&e.addButton(t),this},addAction(t){return this.childrenMap.actionsSizer.addButton(t),this},addToolbar(t){return this.childrenMap.toolbarSizer.addButton(t),this},addLeftToolbar(t){return this.childrenMap.leftToolbarSizer.addButton(t),this},removeChoice(t,e){var i=this.childrenMap.choicesSizer;return i&&i.removeButton(t,e),this},removeAction(t,e){return this.childrenMap.actionsSizer.removeButton(t,e),this},removeToolbar(t,e){return this.childrenMap.toolbarSizer.removeButton(t,e),this},removeLeftToolbar(t,e){return this.childrenMap.leftToolbarSizer.removeButton(t,e),this},clearChoices(t){var e=this.childrenMap.choicesSizer;return e&&e.clearButtons(t),this},clearActions(t){return this.childrenMap.actionsSizer.clearButtons(t),this},clearToolbar(t){return this.childrenMap.toolbarSizer.clearButtons(t),this},clearLeftToolbar(t){return this.childrenMap.leftToolbarSizer.clearButtons(t),this},forEachChoice(t,e){var i=this.childrenMap.choicesSizer;return i&&i.forEachButtton(t,e),this},forEachAction(t,e){return this.childrenMap.actionsSizer.forEachButtton(t,e),this},forEachToolbar(t,e){return this.childrenMap.toolbarSizer.forEachButtton(t,e),this},forEachLeftToolbar(t,e){return this.childrenMap.leftToolbarSizer.forEachButtton(t,e),this},setAllButtonsEnable(t){return void 0===t&&(t=!0),this.childrenMap.toolbarSizer&&this.setToolbarEnable(t),this.childrenMap.leftToolbarSizer&&this.setLeftToolbarEnable(t),this.childrenMap.actionsSizer&&this.setActionEnable(t),this.childrenMap.choicesSizer&&this.setChoiceEnable(t),this},getChoicesButtonStates(){var t=this.childrenMap.choicesSizer;return t?t.getAllButtonsState():{}},getChoicesButtonState(t){var e=this.childrenMap.choicesSizer;return void 0===t?e?e.getAllButtonsState():{}:!!e&&e.getButtonState(t)},setChoicesButtonState(t,e){var i=this.childrenMap.choicesSizer;return i&&i.setButtonState(t,e),this},clearChoicesButtonStates(){var t=this.childrenMap.choicesSizer;return t&&t.clearAllButtonsState(),this},getChoicesSelectedButtonName(){var t=this.childrenMap.choicesSizer;return t?t.getSelectedButtonName():""},setChoicesSelectedButtonName(t){var e=this.childrenMap.choicesSizer;return e&&e.setSelectedButtonName(t),this},hasAnyChoice(){var t=this.childrenMap.choicesSizer;return!!t&&t.hasAnyButton()},hasAnyAction(){var t=this.childrenMap.actionsSizer;return!!t&&t.hasAnyButton()},hasAnyToolbar(){var t=this.childrenMap.toolbarSizer;return!!t&&t.hasAnyButton()},hasAnyLeftToolbar(){var t=this.childrenMap.leftToolbarSizer;return!!t&&t.hasAnyButton()}},BM={onCreateModalBehavior(t){t.on("button.click",(function(e,i,s,r,n){var a=!1;switch(i){case"actions":a=!0;break;case"choices":t.hasAnyAction()||(a=!0)}if(a){var o={index:s,text:e.text,button:e,dialog:t};switch(t.buttonsType){case"radio":o.value=t.getChoicesSelectedButtonName();break;case"checkboxes":o.value=t.getChoicesButtonStates();break;default:o.value=void 0}t.modalClose(o)}}))},modal(t,e){return t&&!1===t.defaultBehavior?this.onCreateModalBehavior=!1:delete this.onCreateModalBehavior,Fm.modal.call(this,t,e),this}},IM={};Object.assign(IM,LM,BM);const DM=Phaser.Utils.Objects.GetValue;class jM extends Xw{constructor(t,e){void 0===e&&(e={}),e.orientation=1,super(t,e),this.type="rexDialog",this.eventEmitter=DM(e,"eventEmitter",this);var i,s,r,n,a=DM(e,"background",void 0),o=DM(e,"title",void 0),h=DM(e,"toolbar",void 0),l=DM(e,"toolbarBackground",void 0),d=DM(e,"leftToolbar",void 0),c=DM(e,"leftToolbarBackground",void 0),u=DM(e,"content",void 0),p=DM(e,"description",void 0),g=DM(e,"choices",void 0),v=DM(e,"choicesBackground",void 0),f=DM(e,"actions",void 0),m=DM(e,"actionsBackground",void 0),y=DM(e,"click",void 0);if(a&&this.addBackground(a),h&&(r=new cM(t,{groupName:"toolbar",background:l,buttons:h,orientation:0,space:{item:DM(e,"space.toolbarItem",0)},click:y,eventEmitter:this.eventEmitter}),t.add.existing(r)),d&&(n=new cM(t,{groupName:"leftToolbar",background:c,buttons:d,orientation:0,space:{item:DM(e,"space.leftToolbarItem",0)},click:y,eventEmitter:this.eventEmitter}),t.add.existing(n)),o||h||d){var b,x=!!o&&DM(e,"expand.title",!0),C=DM(e,"align.title","center"),k=!(o&&!x&&"center"===C||!o&&(h||d));b=k?new Xw(t,{orientation:0}):new nx(t),t.add.existing(b);var w=!!k||{height:!0};if(n&&b.add(n,{align:"left",expand:w}),o){k&&!x&&"right"===C&&b.addSpace();var S={left:DM(e,"space.titleLeft",0),right:DM(e,"space.titleRight",0)},P=x?1:0;b.add(o,{align:C,proportion:P,expand:w,padding:S}),k&&!x&&"left"===C&&b.addSpace()}r&&(k&&!o&&b.addSpace(),b.add(r,{align:"right",expand:w})),(u||p||g||f)&&(S={bottom:DM(e,"space.title",0),top:DM(e,"space.titleTop",0)}),P=DM(e,"proportion.title",0),this.add(b,{padding:S,proportion:P,expand:!0})}if(u){var T=DM(e,"align.content","center"),O=DM(e,"space.content",0),M=(S={left:DM(e,"space.contentLeft",0),right:DM(e,"space.contentRight",0),bottom:p||g||f?O:0},P=DM(e,"proportion.content",0),DM(e,"expand.content",!0));this.add(u,{align:T,padding:S,proportion:P,expand:M})}if(p){T=DM(e,"align.description","center");var E=DM(e,"space.description",0);S={left:DM(e,"space.descriptionLeft",0),right:DM(e,"space.descriptionRight",0),bottom:g||f?E:0},P=DM(e,"proportion.description",0),M=DM(e,"expand.description",!0),this.add(p,{align:T,padding:S,proportion:P,expand:M})}if(g){var _=DM(e,"choicesType","").split("-"),R=AM(_,"wrap")?MM:AM(_,"grid")?bM:cM,L=AM(_,"radio")?"radio":AM(_,"checkboxes")?"checkboxes":void 0,B={left:DM(e,"space.choicesBackgroundLeft",0),right:DM(e,"space.choicesBackgroundRight",0),top:DM(e,"space.choicesBackgroundTop",0),bottom:DM(e,"space.choicesBackgroundBottom",0)},I=DM(e,"space.choice",0);R===cM?B.item=I:R===MM?(B.item=I,B.line=DM(e,"space.choiceLine",I)):(B.column=DM(e,"space.choiceColumn",I),B.row=DM(e,"space.choiceRow",I));var D={width:DM(e,"choicesWidth",void 0),height:DM(e,"choicesHeight",void 0),groupName:"choices",buttonsType:L,background:v,buttons:g,space:B,click:y,eventEmitter:this.eventEmitter,setValueCallback:DM(e,"choicesSetValueCallback",void 0),setValueCallbackScope:DM(e,"choicesSetValueCallbackScope",void 0)};R===cM&&(D.orientation=AM(_,"x")?0:1),i=new R(t,D),t.add.existing(i);var j=DM(e,"space.choices",0);S={left:DM(e,"space.choicesLeft",0),right:DM(e,"space.choicesRight",0),bottom:f?j:0},T=DM(e,"align.choices","center"),P=DM(e,"proportion.choices",0),M=DM(e,"expand.choices",!0),this.add(i,{align:T,padding:S,proportion:P,expand:M}),this.buttonsType=L}f&&(s=new cM(t,{groupName:"actions",background:m,buttons:f,orientation:0,space:{item:DM(e,"space.action",0)},expand:DM(e,"expand.actions",!1),align:DM(e,"align.actions","center"),click:y,eventEmitter:this.eventEmitter}),t.add.existing(s),S={left:DM(e,"space.actionsLeft",0),right:DM(e,"space.actionsRight",0),bottom:DM(e,"space.actionsBottom",0)},P=DM(e,"proportion.action",0),this.add(s,{align:"center",padding:S,proportion:P,expand:!0})),FM(this,"click"),FM(this,"over"),FM(this,"out"),FM(this,"enable"),FM(this,"disable"),this.addChildrenMap("background",a),this.addChildrenMap("title",o),this.addChildrenMap("toolbar",h),this.addChildrenMap("leftToolbar",d),this.addChildrenMap("content",u),this.addChildrenMap("description",p),this.addChildrenMap("choices",i?i.buttons:void 0),this.addChildrenMap("actions",s?s.buttons:void 0),this.addChildrenMap("choicesSizer",i),this.addChildrenMap("actionsSizer",s),this.addChildrenMap("toolbarSizer",r),this.addChildrenMap("leftToolbarSizer",n)}}var AM=function(t,e){return-1!==t.indexOf(e)},zM={actions:"action",choices:"choice",toolbar:"toolbar",leftToolbar:"leftToolbar"},FM=function(t,e){t.on(`button.${e}`,(function(i,s,r,n,a){zM.hasOwnProperty(s)&&t.emit(`${zM[s]}.${e}`,i,r,n,a)}))};Object.assign(jM.prototype,IM),t.register("dialog",(function(t){var e=new jM(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.Dialog",jM);var YM=function(t,e,i){var s=new pO(t,e,i);return t.add.existing(s),s},XM=function(t){var e=this.childrenMap.title;null===(t=t.title)?e.hide():(e.show(),e.resetDisplayContent(t))},WM=function(t){var e=this.childrenMap.content;if(null===(t=t.content))e.hide();else if(e.show(),e.resetDisplayContent)e.resetDisplayContent(t);else{var i=t||"";e.setText(i)}},VM=function(t){var e=this.childrenMap.actions;if(e){var i=t.buttons;if(i){for(var s=this.scene,r=this.defaultActionConfig,n=this.defaultActionButtonCreator,a=0,o=i.length;a=0&&t=0&&i0&&s)){if(0===n)return 2===e&&(i+=1),i;if(1===e){var a=i;(s=(i+=1)>=0&&i=this.colCount?null:e*this.colCount+t}rowIndexToHeight(t,e){if(this.defaultCellHeightMode)return(e-t+1)*this.defaultCellHeight;for(var i=0,s=t;s<=e;s++)i+=this.getRowHeight(s);return i}colIndexToWidth(t,e){return(e-t+1)*this.defaultCellWidth}getRowHeight(t){var e=this.colCount;if(e<=1)return this.getCellHeight(this.colRowToCellIndex(0,t));for(var i,s=0,r=0;ri,n=tthis.leftTableOX,n=tt?this.removeCells(t,e-t):this.insertNewCells(e,t-e)),this},insertNewCells:function(t,e){return"object"==typeof t&&(t=t.index),void 0===e&&(e=1),e<=0||(t=qE(t,0,this.cellsCount),this.table.insertNewCells(t,e)),this},removeCells:function(t,e){if("object"==typeof t&&(t=t.index),void 0===e&&(e=1),t<0&&(e+=t,t=0),e<=0)return this;if(t>this.cellsCount)return this;for(var i,s=t,r=t+e;sthis.topChildOY}childOYExeceedBottom(t){return void 0===t&&(t=this.childOY),tthis.leftChildOX}childOXExeceedRight(t){return void 0===t&&(t=this.childOX),tthis.childHeight?t=0:s?t=e:r&&(t=i)),this._childOY!==t&&(this._childOY=t,this.resetChildPosition()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}get childOX(){return this._childOX}set childOX(t){var e=this.leftChildOX,i=this.rightChildOX,s=this.childOXExceedLeft(t),r=this.childOXExeceedRight(t);this.clampChildOX&&(this.childVisibleWidth>this.childWidth?t=0:s?t=e:r&&(t=i)),this._childOX!==t&&(this._childOX=t,this.resetChildPosition()),s&&(this.execeedLeftState||this.emit("execeedleft",this,t,e)),this.execeedLeftState=s,r&&(this.execeedRightState||this.emit("execeedright",this,t,i)),this.execeedRightState=r}setChildOY(t){return this.childOY=t,this}setChildOX(t){return this.childOX=t,this}set t(t){this.childOY=-this.visibleHeight*t}get t(){var t=this.visibleHeight;return 0===t?0:this.childOY/-t}set s(t){this.childOX=-this.visibleWidth*t}get s(){var t=this.visibleWidth;return 0===t?0:this.childOX/-t}setChildOYByPercentage(t){return this.t=t,this}setChildOXByPercentage(t){return this.s=t,this}}Object.assign(G_.prototype,Y_);const H_=["top","bottom","centerY","center"],U_=["left","right","centerX","center"];var N_=function(t,e,i){var s,r="Y"===(e=e.toUpperCase()),n=this.childrenMap.child;if(r){if(i)for(var a=0,o=H_.length;a=0?0:Math.abs(l)<=Math.abs(d)?l:d}}else{if(i)for(a=0,o=U_.length;a=0?0:Math.abs(c)<=Math.abs(u)?c:u}}switch(this.scrollMode){case 0:case 1:this.childOY+=s;break;default:this[`childO${e}`]+=s}};const $_=Phaser.Utils.Objects.GetValue;class K_ extends XT{constructor(t,e){void 0===e&&(e={});var i=zP(e),s=$_(e,"panel",void 0);void 0===s&&(s={}),s.scrollMode=i,s.clampChildOY=$_(e,"clampChildOY",!1),s.clampChildOX=$_(e,"clampChildOX",!1);var r,n,a=new G_(t,s);switch(t.add.existing(a),i){case 0:r=$_(e,"expand.panel",!0),n=!0;break;case 1:r=!0,n=$_(e,"expand.panel",!0);break;default:r=!0,n=!0}e.type="rexScrollablePanel",e.child={gameObject:a,expandWidth:r,expandHeight:n,align:$_(e,"align.panel","center")};var o=$_(e,"space",void 0);o&&(o.child=$_(o,"panel",0)),super(t,e),this.addChildrenMap("panel",a.child),this.addChildrenMap("panelLayer",a.maskLayer),this.addChildrenMap("mask",a.maskGameObject),this.addChildrenMap("scrollableBlock",a)}setChildrenInteractive(t){return void 0===t&&(t={}),t.hasOwnProperty("eventEmitter")||(t.eventEmitter=this),t.hasOwnProperty("targets")||(t.targets=[this.childrenMap.panel]),Ab(this.childrenMap.child,t),this}}var J_={scrollToChild:function(t,e){if(!this.hasChild(t))return this;switch(this.scrollMode){case 0:N_.call(this,t,"y",e);break;case 1:N_.call(this,t,"x",e);break;default:N_.call(this,t,"y",e),N_.call(this,t,"x",e)}return this}};Object.assign(K_.prototype,J_);const q_=Phaser.Utils.Objects.GetValue;var Z_=function(){var t,e=this.scene,i=this.listCreateBackgroundCallback;i&&(t=i.call(this,e),e.add.existing(t));var s=[],r=this.listCreateButtonCallback;if(r)for(var n=this.options,a=0,o=n.length;a0||this.listMaxHeight>0)){if(s=Q_(e,u,this.listWrapEnable),this.listMaxHeight>0&&(s.layout(),s.height<=this.listMaxHeight&&(d=s)),!d){0===c&&(c=this.listMaxHeight);var p=tR(e,this.listCreateSliderTrackCallback),g=tR(e,this.listCreateSliderThumbCallback);d=new K_(e,{height:c,scrollMode:0,panel:{child:s,mask:{padding:1}},slider:{track:p,thumb:g,adaptThumbSize:this.listSliderAdaptThumbSizeEnable},scrollDetectionMode:1,scroller:this.listScrollerConfig,mouseWheelScroller:this.listMouseWheelScrollerConfig,space:{panel:q_(this.listSpace,"panel",0)}}),e.add.existing(d)}}else u.height=c,s=Q_(e,u,this.listWrapEnable),d=s;return t&&d.addBackground(t,"background"),this.listDraggable&&d.setDraggable(!0),d!==s&&s.on("button.over",(function(t,e,i,s){d.emit("button.over",t,e,i,s)})).on("button.out",(function(t,e,i,s){d.emit("button.out",t,e,i,s)})).on("button.click",(function(t,e,i,s){d.emit("button.click",t,e,i,s)})),d},Q_=function(t,e,i){var s;return i?(e.orientation="x",s=new MM(t,e)):(e.orientation="y",s=new cM(t,e)),t.add.existing(s),s},tR=function(t,e,i){var s;return e&&(s=e.call(i,t),t.add.existing(s)),s};const eR=Phaser.Utils.Objects.GetValue;var iR=function(t,e){var i=eR(e,"expandDirection",void 0);"string"==typeof i&&(i=sR[i]);var s,r,n,a,o,h,l,d=(n="alignTargetX",Md(s=e,r="alignTarget")?J(s,r):n&&Md(s,n)?J(s,n):a&&Md(s,a)?J(s,a):o),c=eR(e,"alignTargetY",d),u=eR(e,"alignOffsetX",0),p=eR(e,"alignOffsetY",0),g=eR(e,"alignSide","").includes("right"),v=eR(e,"bounds"),f=0===i,m=!(f||1===i),y=g?1:0,b=f||m?0:1;t.setOrigin(y,b),h=g?d.getTopRight().x:d.getTopLeft().x,l=c.getBottomLeft().y,t.setPosition(h+u,l+p);var x=v;x||(x=ha(t.scene)),m&&t.getBottomLeft().y>x.bottom&&(l=c.getTopLeft().y,t.setOrigin(0,1).setPosition(h+u,l+p))};const sR={down:0,up:1},rR=Phaser.Utils.Objects.GetValue;class nR extends Cm{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=function(t,e){yf(t,e,"y","Cubic")}),null==e.transitOut&&(e.transitOut=function(t,e){!function(t,e,i,s,r){void 0===s&&(s="Linear");var n={mode:0};switch(i){case 0:case"x":n.end={x:0};break;case 1:case"y":n.end={y:0};break;default:n.end=0}n.duration=e,n.ease=s,void 0===r?r=new ff(t,n):r.resetFromJSON(n),r.restart()}(t,e,"y","Linear")}),e.manualClose=!0,e.clickOutsideClose=!0,e.destroy=!0,super(t,e),iR(t,e),t.isRexSizer&&t.layout();var i=rR(e,"touchOutsideClose",!1),s=rR(e,"anyTouchClose",!1);s&&(i=!1),s?this.once("open",this.anyTouchClose,this):i&&this.once("open",this.touchOutsideClose,this),this.requestOpen()}shutdown(t){this.isShutdown||(this.scene.input.off("pointerup",this.touchCloseCallback,this),super.shutdown(t))}touchOutsideClose(){return this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Lm(this.parent,t.worldX,t.worldY)||this.requestClose()}onOpen(){this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.parent,this),super.onClose()}}var aR={focusNextButton(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;return t=void 0===e?0:(e+1)%this.listPanel.getButtons().length,this.emitButtonOver(t),this},focusPrevButton(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;if(void 0===e)t=0;else{var i=this.listPanel.getButtons().length;t=(e-1+i)%i}return this.emitButtonOver(t),this}},oR={openListPanel:function(){if(this.listPanel)return this;if(0===this.options.length)return this;var t,e=Z_.call(this);e.on("button.over",(function(t,i,s,r){this.currentOverIndex=i,this.listOnButtonOver&&this.listOnButtonOver.call(this,t,i,s,r),this.emit("button.over",this,e,t,i,s,r)}),this).on("button.out",(function(t,i,s,r){this.currentOverIndex===i&&(this.currentOverIndex=void 0),this.listOnButtonOut&&this.listOnButtonOut.call(this,t,i,s,r),this.emit("button.out",this,e,t,i,s,r)}),this),t=this.listAlignMode&&"label"!==this.listAlignMode?this.getElement(this.listAlignMode):this;var i=new nR(e,{duration:{in:this.listEaseInDuration,out:this.listEaseOutDuration},transitIn:this.listTransitInCallback,transitOut:this.listTransitOutCallback,expandDirection:this.listExpandDirection,alignTargetX:t,alignTargetY:this,alignSide:this.listAlignSide,bounds:this.listBounds}).on("open",(function(){e.on("button.click",(function(t,i,s,r){this.listOnButtonClick&&this.listOnButtonClick.call(this,t,i,s,r),this.emit("button.click",this,e,t,i,s,r),this.dropDownBehavior.requestClose()}),this),this.emit("list.open",this,e)}),this).on("close",(function(){this.listPanel=void 0,this.dropDownBehavior=void 0,this.emit("list.close",this)}),this);return e.onClickOutside((function(){i.requestClose()})),this.listPanel=e,this.dropDownBehavior=i,this.pin(e),this},closeListPanel:function(){return this.dropDownBehavior?(this.dropDownBehavior.requestClose(),this.currentOverIndex=void 0,this):this},toggleListPanel:function(){return this.listPanel?this.closeListPanel():this.openListPanel(),this},emitButtonClick:function(t){if(void 0===t&&(t=this.currentOverIndex),void 0===t)return this;var e=this.listPanel,i=e?e.getButton(t):this.options[t];return this.listOnButtonClick&&this.listOnButtonClick.call(this,i,t),this.emit("button.click",this,e,i,t),this},emitButtonOver:function(t){var e=this.listPanel;return e?(e.emitButtonOver(t),this):this}};Object.assign(oR,z_,aR);const hR=Phaser.Utils.Objects.GetValue;class lR extends lS{constructor(t,e){super(t,e),this.type="rexDropDownList",this.timer=void 0,this.listPanel=void 0,this.currentOverIndex=void 0,this.setOptions(hR(e,"options"));var i=hR(e,"list");this.setWrapEnable(hR(i,"wrap",!1)),this.setCreateButtonCallback(hR(i,"createButtonCallback")),this.setCreateListBackgroundCallback(hR(i,"createBackgroundCallback")),this.setCreateListSliderTrackCallback(hR(i,"createTrackCallback")),this.setCreateListSliderThumbCallback(hR(i,"createThumbCallback")),this.setListSliderAdaptThumbSizeEnable(hR(i,"sliderAdaptThumbSize",!1)),this.setListScrollerConfig(hR(i,"scroller")),this.setListMouseWheelScrollerConfig(hR(i,"mouseWheelScroller")),this.setButtonClickCallback(hR(i,"onButtonClick")),this.setButtonOverCallback(hR(i,"onButtonOver")),this.setButtonOutCallback(hR(i,"onButtonOut")),this.setListExpandDirection(hR(i,"expandDirection")),this.setListEaseInDuration(hR(i,"easeIn",500)),this.setListEaseOutDuration(hR(i,"easeOut",100)),this.setListTransitInCallback(hR(i,"transitIn")),this.settListTransitOutCallback(hR(i,"transitOut")),this.setListMaxHeight(hR(i,"maxHeight",0)),this.setListSize(hR(i,"width"),hR(i,"height",0)),this.setListAlignmentMode(hR(i,"alignParent","text")),this.setListAlignmentSide(hR(i,"alignSide","")),this.setListBounds(hR(i,"bounds")),this.setListSpace(hR(i,"space")),this.setListDraggable(hR(i,"draggable",!1)),this.setValueChangeCallback(hR(e,"setValueCallback"),hR(e,"setValueCallbackScope")),this.setValue(hR(e,"value")),this.onClick(this.toggleListPanel,this)}destroy(t){this.scene&&!this.ignoreDestroy&&(this.listPanel&&(this.listPanel.destroy(t),this.listPanel=void 0),super.destroy(t))}get isOpened(){return!!this.listPanel}setOptions(t){return void 0===t&&(t=[]),this.options=t,this}setValueChangeCallback(t,e){return this.valueChangeCallback=t,this.valueChangeCallbackScope=e,this}setValue(t){return this.value=t,this}get value(){return this._value}set value(t){if(this._value!==t){var e=this._value;this._value=t;var i=this.valueChangeCallback,s=this.valueChangeCallbackScope;i&&(s?i.call(s,this,t,e):i(this,t,e)),this.emit("valuechange",this,t,e)}}}Object.assign(lR.prototype,oR),t.register("dropDownList",(function(t){var e=new lR(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.DropDownList",lR);var dR=function(t,e,s){void 0===s&&(s={});var r=(e=e?i(e):{}).label||e.button,n=e.button||e.label;delete e.label,delete e.button;var a=s.label||s.button||s,o=s.button||s.label||s,h=uO(t,r,a);h.list=e.list||{},h.list.createButtonCallback=function(t,e){var i=YM(t,n,o).resetDisplayContent(e);return e.hasOwnProperty("value")&&(i.value=e.value),i};var l=e.track;l&&(h.list.createTrackCallback=function(t){return jP(t,l)},delete e.track);var d=e.thumb;return d&&(h.list.createThumbCallback=function(t){return jP(t,d)},delete e.thumb),h.list.onButtonOver=function(t,e,i,s){t.setHoverState&&t.setHoverState(!0)},h.list.onButtonOut=function(t,e,i,s){t.setHoverState&&t.setHoverState(!1)},h};class cR extends lR{constructor(t,e,i){super(t,e=dR(t,e,i)),this.type="rexSimpleDropDownList"}setOptions(t){void 0===t&&(t=[]);for(var e=0,i=t.length;e0?Math.ceil(s/this.pageLinesCount):1;for(var r=0;r0?t+i:this.totalLinesCount}var s;switch(e>this.totalLinesCount&&(e=this.totalLinesCount),this.textObjectType){case 0:case 2:s=this.lines.slice(t,e).join("\n");break;case 1:var r=this.lines.getLineStartIndex(t),n=this.lines.getLineEndIndex(e-1);((s=this.lines.getSliceTagText(r,n,!0)).match(/\n/g)||[]).length>e-t-1&&(s=s.substring(0,s.length-1))}return s}};Object.assign(fR,uR,gR,vR);const mR=Phaser.Utils.Objects.GetValue;Phaser.Math.Clamp;class yR extends Ba{constructor(t,e){super(t,{eventEmitter:!1}),this.textObjectType=Jw(this.parent),this.pageStartIndexes=[],this.lines=VT(this.parent,""),this.sections=[],this.resetFromJSON(e)}resetFromJSON(t){this.setMaxLines(mR(t,"maxLines",void 0)),this.setPageBreak(mR(t,"pageBreak","\f\n")),this.setText(mR(t,"text","")),this.startLineIndex=mR(t,"start",-1),this.endLineIndex=mR(t,"end",void 0);var e=mR(t,"page");return void 0===e?this.resetIndex():this.setPageIndex(e),this}toJSON(){return{maxLines:this.maxLines,text:this.content,start:this.startLineIndex,end:this.endLineIndex,page:this.pageIndex,pageBreak:this.pageBreak}}shutdown(t){if(!this.isShutdown){switch(this.textObjectType){case 0:case 2:this.lines.length=0;break;case 1:this.lines.destroy()}this.pageStartIndexes.length=0,this.sections.length=0,this.lines=void 0,this.pageStartIndexes=void 0,this.sections=void 0,super.shutdown(t)}}setMaxLines(t){return this.maxLines=t,this}setPageBreak(t){return this.pageBreak=t,this}get pageCount(){return this.pageStartIndexes.length}get lastPageIndex(){return this.pageCount-1}get isFirstPage(){return this.pageIndex<=0}get isLastPage(){return this.pageIndex>=this.pageCount-1}get totalLinesCount(){return this.lines?this.lines.length:0}get pageLinesCount(){if(void 0!==this.maxLines)return this.maxLines;var t;switch(this.textObjectType){case 0:case 1:var e=this.parent.style.maxLines;t=e>0?e:Math.floor(function(t){var e,i,s;switch(Jw(t)){case 0:case 1:e=t.height-t.padding.top-t.padding.bottom,i=t.lineSpacing,s=t.style.metrics.fontSize+t.style.strokeThickness;break;case 2:e=t.height,i=0;var r=t.fontSize/t.fontData.size;s=t.fontData.lineHeight*r}return(e-i)/(s+i)}(this.parent));break;case 2:t=this.totalLinesCount}return t}get isFirstLine(){return this.startLineIndex<=0}get isLastLine(){return this.endLineIndex===this.totalLinesCount}get content(){return this.sections.join(this.pageBreak)}}Object.assign(yR.prototype,fR);var bR={setText(t){this.setTextCallback&&(t=this.setTextCallbackScope?this.setTextCallback.call(this.setTextCallbackScope,t,this.isLastChar,this.insertIndex):this.setTextCallback(t,this.isLastChar,this.insertIndex)),this.textWrapEnable?NT(this.parent,t):this.parent.setText(t)},appendText(t){var e=this.text.concat(ze(t));return this.isTyping?this.setTypingContent(e):this.start(e,void 0,this.textLength),this}},xR=function(t,e){return t.getPlainText&&(e=t.getPlainText(e)),e},CR=function(t,e){for(var i=void 0,s=0;s0?kR(n,t,a=(o=i)-d,o):"";var c,u=e-d;u>0?(o=(a=0)+u,this.insertIndex=o,c=kR(n,t,a,o)):(c="",this.insertIndex=0),r=c+l}return this.insertChar=r.charAt(this.insertIndex-1),r},SR={start:function(t,e,i,s){return void 0!==t&&this.setTypingContent(t),void 0!==e&&(this.speed=e),void 0===i&&(i=0),this.typingIndex=i+1,0===this.speed?this.stop(!0):(this.setText(""),this.startTimer(s)),this},startFromLine:function(t,e,i,s,r){var n;if(e>0){void 0===s&&(s=0);var a=xR(this.parent,t);n=CR(a,e)+s}return this.start(t,i,n,r)},stop:function(t){if(this.getTimer()&&this.freeTimer(),t){for(;!this.isLastChar;)wR.call(this,this.text,this.typingIndex,this.textLength,this.typeMode),this.emit("typechar",this.insertChar),this.typingIndex++;this.setText(this.text),this.emit("type"),this.emit("complete",this,this.parent)}return this},pause:function(){var t=this.getTimer();return t&&(t.paused=!0),this},resumeTyping:function(){var t=this.getTimer();return t&&(t.paused=!1),this}};Object.assign(SR,bR);const PR=Phaser.Utils.Objects.GetFastValue,TR=Phaser.Utils.Objects.GetValue;class OR extends Ba{constructor(t,e){super(t,e),this.timer=null,this.resetFromJSON(e)}resetFromJSON(t){this.setTextWrapEnable(TR(t,"wrap",!1)),this.setTypeMode(TR(t,"typeMode",0)),this.setTypingSpeed(TR(t,"speed",333)),this.setTextCallback=PR(t,"setTextCallback",null),this.setTextCallbackScope=PR(t,"setTextCallbackScope",null),this.setTypingContent(PR(t,"text","")),this.typingIndex=PR(t,"typingIndex",0),this.insertIndex=null,this.insertChar=null;var e=PR(t,"elapsed",null);return null!==e&&this.start(void 0,void 0,this.typingIndex,e),this}shutdown(t){this.isShutdown||(this.freeTimer(),super.shutdown(t))}setTypeMode(t){return"string"==typeof t&&(t=MR[t]),this.typeMode=t,this}setTypeSpeed(t){return this.speed=t,this}setTypingSpeed(t){return this.speed=t,this}setTextWrapEnable(t){return void 0===t&&(t=!0),this.textWrapEnable=t,this}set text(t){var e=ze(t);this.textWrapEnable&&(e=function(t,e){switch(Jw(t)){case 0:t.style.syncFont(t.canvas,t.context),e=t.runWordWrap(e);break;case 1:e=t.getText(e,void 0,void 0,!0);break;case 2:e=t.setText(e).getTextBounds().wrappedText}return e}(this.parent,e)),this._text=e}get text(){return this._text}get isTyping(){return null!==this.getTimer()}get isLastChar(){return this.typingIndex===this.textLength}setTypingContent(t){return this.text=t,this.textLength=xR(this.parent,this.text).length,this}onTyping(){var t=wR.call(this,this.text,this.typingIndex,this.textLength,this.typeMode);this.setText(t),this.emit("typechar",this.insertChar),this.emit("type"),this.isLastChar?(this.freeTimer(),this.scene.sys.events.once("preupdate",(function(){this.emit("complete",this,this.parent)}),this)):(this.timer.delay=this.speed,this.typingIndex++)}startTimer(t){var e;return this.timer&&this.freeTimer(),void 0===t?e=0:(this.speed,e=t),this.timer=this.scene.time.addEvent({delay:1e-4,startAt:e,loop:!0,callback:this.onTyping,callbackScope:this}),this}getTimer(){return this.timer}freeTimer(){return this.timer&&(this.timer.remove(),this.timer=null),this}setText(t){this.setTextCallback&&(t=this.setTextCallbackScope?this.setTextCallback.call(this.setTextCallbackScope,t,this.isLastChar,this.insertIndex):this.setTextCallback(t,this.isLastChar,this.insertIndex)),this.textWrapEnable?NT(this.parent,t):this.parent.setText(t)}}const MR={"left-to-right":0,"right-to-left":1,"middle-to-sides":2,"sides-to-middle":3};Object.assign(OR.prototype,SR);const ER=Phaser.Utils.Objects.GetValue,_R={page:0,line:1};class RR extends(function(t,e){return void 0===e&&(e="rexTextBox"),class extends t{constructor(t,i){super(t,i),this.type=e,this.isRunning=!1,this._isPageEnd=!1;var s=this.childrenMap.text,r=ER(i,"expandTextWidth",!1),n=ER(i,"expandTextHeight",!1);if(r||n){var a=Jw(s);switch(a){case 0:case 1:if(s.resize=function(t,e){var i=r?t:0,a=n?e:0;s.setFixedSize(i,a),i>0&&s.setWordWrapWidth(i)},1===a){var o=s.style;0===o.wrapMode&&(o.wrapMode=1)}}r&&(s._minWidth=0),n&&(s._minHeight=0)}this.setTypingMode(ER(i,"typingMode","page")),this.page=new yR(s,ER(i,"page",void 0)),this.typing=new OR(s,ER(i,"typing",i.type)),this.typing.on("complete",this.onTypingComplete,this).on("type",this.onType,this).on("typechar",this.onTypeChar,this),this.textWidthSave=s.width,this.textHeightSave=s.height}setTypingMode(t){return"string"==typeof t&&(t=_R[t]),this.typingMode=t,this}start(t,e){return void 0!==e&&this.setTypingSpeed(e),this.isRunning=!0,this.page.setText(t),this.emit("start"),0===this.typingMode?this.typeNextPage():this.typeNextLine(),this}more(t,e){if(void 0!==e&&this.setTypingSpeed(e),!this.isRunning){if(this.isRunning=!0,this.page.appendText(t),this.emit("start"),0===this.typingMode){this._isPageEnd=!1;var i=this.page.getPage(),s=this.typing.textLength;this.typing.start(i,void 0,s)}return this}this.page.appendText(t),this.typing.appendText(t)}typeNextPage(){if(!this.isRunning)return this;if(this.isLastPage)this.emit("complete");else{this._isPageEnd=!1;var t=this.page.getNextPage();this.typing.start(t)}return this}typeNextLine(){if(!this.isRunning)return this;if(this.isLastLine)this.isRunning=!1,this.emit("pageend"),this.emit("complete");else{var t,e=this.page.getPageOfNextLine();t=this.isFirstLine?0:this.page.pageLinesCount-1,this.typing.startFromLine(e,t)}}pause(){return this.isRunning?(this.isTyping&&(this.typing.pause(),this.emit("pause")),this):this}resume(){return this.isRunning?(this.isTyping||(this.emit("resume"),this.typing.resume()),this):this}stop(t){return this.isRunning?(this.typing.stop(t),this):this}showLastPage(){return this.isRunning?(this.typing.stop(),0===this.typingMode?this.page.showLastPage():this.page.showLastLine(),this.emit("type"),this.onTypingComplete(),this):this}setTypeSpeed(t){return this.typing.setTypingSpeed(t),this}setTypingSpeed(t){return this.typing.setTypingSpeed(t),this}get isTyping(){return this.typing.isTyping}get isPageEnd(){return this._isPageEnd}get isLastPage(){return this.page.isLastPage}get isFirstPage(){return this.page.isFirstPage}get pageCount(){return this.page.pageCount}get pageIndex(){return this.page.pageIndex}get isLastLine(){return this.page.isLastLine}get isFirstLine(){return this.page.isFirstLine}get lineCound(){return this.page.totalLinesCount}get startLineIndex(){return this.page.startLineIndex}get endLineIndex(){return this.page.endLineIndex}get typingSpeed(){return this.typing.speed}onType(){var t=this.childrenMap.text;this.textWidthSave===t.width&&this.textHeightSave===t.height||(this.textWidthSave=t.width,this.textHeightSave=t.height,this.getTopmostSizer().layout()),this.emit("type")}onTypeChar(t){this.emit("typechar",t)}onTypingComplete(){if(0===this.typingMode){this._isPageEnd=!0;var t=this.isLastPage;this.isRunning=!t,this.emit("pageend"),t&&this.emit("complete")}else this.typeNextLine()}}}(bO)){constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("layoutMode")||(e.layoutMode=1),super(t,e)}}t.register("textBox",(function(t){var e=new RR(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.TextBox",RR);class LR extends RR{constructor(t,e,i){super(t,e=CO(t,e,i))}}t.register("simpleTextBox",(function(t){var e=new LR(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.SimpleTextBox",LR);const BR=Phaser.Utils.Objects.GetValue;class IR extends Xw{constructor(t,e){super(t,e),this.type="rexNumberBar";var i,s,r,n=BR(e,"background",void 0),a=BR(e,"icon",void 0),o=BR(e,"iconMask",void 0),h=BR(e,"slider",void 0),l=BR(e,"text",void 0),d=BR(e,"space.icon",0),c=BR(e,"space.slider",0);(n&&this.addBackground(n),a&&(0===this.orientation?(h||l)&&(s={right:d}):(h||l)&&(s={bottom:d}),this.add(a,{proportion:0,align:"center",padding:s}),o&&(o=Hw.call(this,a,a,1))),h)&&(h.orientation=this.orientation,h.eventEmitter=this,h.value=null,h.hasOwnProperty("input")||(h.input=-1),i=new cT(t,h),t.add.existing(i),0===this.orientation?l&&(s={right:c}):l&&(s={bottom:c}),r=0===this.orientation?void 0===BR(h,"width",void 0)?1:0:void 0===BR(h,"height",void 0)?1:0,this.add(i,{proportion:r,align:"center",padding:s}));l&&this.add(l),this.addChildrenMap("background",n),this.addChildrenMap("icon",a),this.addChildrenMap("iconMask",o),this.addChildrenMap("slider",i),this.addChildrenMap("text",l);var u=BR(e,"valuechangeCallback",null);if(null!==u){var p=BR(e,"valuechangeCallbackScope",void 0);this.on("valuechange",u,p)}this.setEnable(BR(e,"enable",void 0)),this.setValue(BR(e,"value",0))}get enable(){return!!this.childrenMap.slider&&this.childrenMap.slider.enable}set enable(t){this.childrenMap.slider&&this.childrenMap.slider.setEnable(t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get value(){return this.childrenMap.slider?this.childrenMap.slider.value:0}set value(t){this.childrenMap.slider&&(this.childrenMap.slider.value=t)}setValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setValue(t,e,i),this}addValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.addValue(t,e,i),this}getValue(t,e){return this.childrenMap.slider?this.childrenMap.slider.getValue(t,e):0}easeValueTo(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.easeValueTo(t,e,i),this}stopEaseValue(){return this.childrenMap.slider&&this.childrenMap.slider.stopEaseValue(),this}setEaseValueDuration(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueDuration(t),this}setEaseValueFunction(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueFunction(t),this}get text(){var t=this.childrenMap.text;return void 0===t?"":t.text?t.text:t.getData("text")}set text(t){var e=this.childrenMap.text;void 0!==e&&(e.setText?e.setText(t):e.setData("text",t))}setText(t){return this.text=t,this}}t.register("numberBar",(function(t){var e=new IR(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.NumberBar",IR),t.register("scrollBar",(function(t){var e=new vT(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ScrollBar",vT);const DR=Phaser.Utils.Objects.GetValue,jR={leftTop:"left-top",centerTop:"center-top",rightTop:"right-top",leftCenter:"left-center",center:"center",rightCenter:"right-center",leftBottom:"left-bottom",centerBottom:"center-bottom",rightBottom:"right-bottom"};class AR extends nx{constructor(t,e){super(t,e),this.type="rexBadge";var i=DR(e,"background",void 0);i&&this.addBackground(i),this.addChildrenMap("background",i);var s=DR(e,"main",void 0);for(var r in s&&this.add(s,{key:"main",align:"center",expand:!1}),this.addChildrenMap("main",s),jR){var n=DR(e,r,void 0);n&&(this.add(n,{key:r,align:jR[r],expand:!1}),this.addChildrenMap(r,n))}}}t.register("badgeLabel",(function(t){var e=new AR(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.BadgeLabel",AR);const zR=nx.prototype.add;var FR=function(t,e,i,s,r,n,a,o,h){return t.setVisible(!1),zR.call(this,t,e,i,s,r,n,a,o,h),this},YR={add:FR,addPage:FR};const XR=Zg.prototype.setChildVisible;var WR={getPage:function(t){return void 0===t?null:this.sizerChildren.hasOwnProperty(t)?this.sizerChildren[t]:null},swapPage:function(t,e){this._previousKey=this._currentKey;var i=this.previousPage;i&&(0===this.swapMode?(XR.call(this,i,!1),this.emit("pageinvisible",i,this._previousKey,this)):i.destroy()),t&&!this.sizerChildren.hasOwnProperty(t)&&this.emit("createpage",t,this),this._currentKey=t;var s=this.currentPage;return s&&(XR.call(this,s,!0),this.emit("pagevisible",s,this._currentKey,this),void 0===e&&(e=this.fadeInDuration),e>0&&s.setAlpha(0).fadeIn(e,1)),this},hasPage:function(t){return this.sizerChildren.hasOwnProperty(t)}};Object.assign(WR,YR);const VR=Phaser.Utils.Objects.GetValue;class GR extends nx{constructor(t,e){super(t,e),this.type="rexPages",this.childrenMap=this.sizerChildren,this._previousKey=void 0,this._currentKey=void 0,this.setSwapMode(VR(e,"swapMode",0)),this.setFadeInDuration(VR(e,"fadeIn",0))}setSwapMode(t){return"string"==typeof t&&(t=HR[t]),this.swapMode=t,this}setFadeInDuration(t){return this.fadeInDuration=t,this}get previousKey(){return this._previousKey}get currentKey(){return this._currentKey}set currentKey(t){this.swapPage(t)}get currentPage(){return this.getPage(this.currentKey)}get previousPage(){return this.getPage(this.previousKey)}get keys(){return Object.keys(this.sizerChildren)}}Object.assign(GR.prototype,WR);const HR={invisible:0,destroy:1};t.register("pages",(function(t){var e=new GR(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.Pages",GR);const UR=Phaser.GameObjects.Mesh;class NR extends UR{get tint(){return 0===this.vertices.length?16777215:this.vertices[0].color}forceUpdate(){return this.dirtyCache[10]=1,this}}const $R=Phaser.Math.Vector3,KR=Phaser.Math.Matrix4;var JR=new $R,qR=new $R,ZR=new KR;const QR=Phaser.Utils.Objects.IsPlainObject,tL=Phaser.Utils.Objects.GetValue,eL=Phaser.Geom.Mesh.GenerateGridVerts,iL=Phaser.Math.RadToDeg,sL=Phaser.Math.DegToRad,rL=1+1/Math.sin(sL(45));let nL=class extends NR{constructor(t,e,i,s,r,n){QR(e)&&(e=tL(n=e,"x",0),i=tL(n,"y",0),s=tL(n,"key",null),r=tL(n,"frame",null)),super(t,e,i,s,r),this.type="rexPerspectiveImage",this.setSizeToFrame(),this.resetPerspective(),this.panZ(rL),this.hideCCW=tL(n,"hideCCW",!0);var a=tL(n,"gridWidth",0),o=tL(n,"gridHeight",a);this.resetVerts(a,o),this.prevFrame=this.frame}preUpdate(t,e){this.prevFrame!==this.frame&&(this.prevFrame=this.frame,this.syncSize()),super.preUpdate(t,e)}get originX(){return.5}get originY(){return.5}resetPerspective(){return this.setPerspective(this.width,this.height,45),this}resetVerts(t,e){if(void 0!==t&&(this.gridWidth=t),void 0!==e&&(this.gridHeight=e),this.clear(),this.dirtyCache[9]=-1,0===this.width||0===this.height)return this;var i=this.frame.cutWidth,s=this.frame.cutHeight;0===this.gridWidth?t=Math.max(i/8,32):e=this.gridWidth,e=0===this.gridHeight?Math.max(s/8,32):this.gridHeight,eL({mesh:this,width:i/this.height,height:s/this.height,widthSegments:Math.ceil(i/t),heightSegments:Math.ceil(s/e)});var r=this.transformInfo;return r&&this.transformVerts(r.x,r.y,r.z,r.rotateX,r.rotateY,r.rotateZ),this}syncSize(){return this.setSizeToFrame(),this.resetPerspective(),this.resetVerts(),this}get rotationX(){return this.modelRotation.x}set rotationX(t){this.modelRotation.x=t}get angleX(){return iL(this.rotationX)}set angleX(t){this.rotationX=sL(t)}get rotationY(){return this.modelRotation.y}set rotationY(t){this.modelRotation.y=t}get angleY(){return iL(this.rotationY)}set angleY(t){this.rotationY=sL(t)}get rotationZ(){return this.modelRotation.z}set rotationZ(t){this.modelRotation.z=t}get angleZ(){return iL(this.rotationZ)}set angleZ(t){this.rotationZ=sL(t)}transformVerts(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=0),this.transformInfo||(this.transformInfo={}),this.transformInfo.x=t,this.transformInfo.y=e,this.transformInfo.rotateX=s,this.transformInfo.rotateY=r,this.transformInfo.rotateZ=n,function(t,e,i,s,r,n,a){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=0),JR.set(e,i,s),qR.set(r,n,a),ZR.fromRotationXYTranslation(qR,JR,!0);for(var o=0,h=t.vertices.length;o=0;i--)this.removePage(e[i].name,t);return this}},HL={top:1,left:3,right:5,bottom:7},UL={top:"bottom",left:"right",right:"left",bottom:"top"},NL={setTabsPadding(t,e){return this.childrenMap.tabs.setOuterPadding(t,e),this},getTabsPadding(t){return this.childrenMap.tabs.getOuterPadding(t)}},$L={getPageKey:function(t){var e=this.getElement("tabs.buttons");if(!(t>=e.length))return e[t].name},getPageIndex:function(t){for(var e=this.getElement("tabs.buttons"),i=0,s=e.length;i=a.y)continue;break;case 2:if(n.x<=a.x)continue;break;case 3:if(n.x>=a.x)continue}KB.call(r,s,a.x,a.y)}}(t,s,r,i),t.transitInCallback(e,i,t)},ZB={showMessage(t){var e=function(t,e,i){var s=e(t.scene,i,t);if(NB.call(s,(function(){t.removeMessage(s)})),t.displayTime){var r=t.transitInTime+t.displayTime+10;$B.call(s,r,(function(){t.removeMessage(s)}))}return s}(this,this.createMessageLabelCallback,t);return qB(this,e,this.transitInTime),this},removeMessage(t){if(this.getParentSizer(t)!==this)return this;if(!t.__isDestroying){t.__isDestroying=!0;var e=this.transitOutTime;return this.transitOutCallback(t,e,this),$B.call(t,e+10,(function(){delete t.__isDestroying,t.destroy()})),this}},removeAllMessages(){for(var t=this.childrenMap.items,e=0,i=t.length;e0&&{height:this.colorComponentsHeight,formatLabel:this.colorComponentsFormatLabelConfig,inputText:this.colorComponentsInputTextConfig,space:this.colorComponentsSpace};var a=new NI(t,{width:s,height:n,background:e,space:this.colorPickerSpace,hPalette:{position:this.colorPickerHPalettePosition},colorComponents:r,value:this.value});return t.add.existing(a),a},KI={openColorPicker:function(){if(!this.colorPicker){var t=$I.call(this).layout(),e=new nR(t,{duration:{in:this.colorPickerEaseInDuration,out:this.colorPickerEaseOutDuration},transitIn:this.colorPickerTransitInCallback,transitOut:this.colorPickerTransitOutCallback,expandDirection:this.colorPickerExpandDirection,alignTargetX:this,alignTargetY:this,bounds:this.colorPickerBounds,touchOutsideClose:!0}).on("open",(function(){t.on("valuechange",(function(t){this.setValue(t)}),this)}),this).on("close",(function(){this.colorPicker=void 0,this.dropDownBehavior=void 0}),this);return this.colorPicker=t,this.dropDownBehavior=e,this.pin(t),this}}};Object.assign(KI,fI);const JI=Phaser.Utils.Objects.GetValue;class qI extends vI{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexColorInput",e.hasOwnProperty("colorPicker")||(e.colorPicker={background:{color:0}});var i=e.colorPicker,s=!1!==i&&null!==i;if(s){var r;this.setColorPickerSize(JI(i,"width",160),JI(i,"height",170));var n=JI(i,"background");r=n?function(t){return jP(t,n)}:JI(i,"createBackgroundCallback"),this.setCreateColorPickerBackgroundCallback(r),this.setColorPickerHPalettePosition(JI(i,"hPalettePosition",0)),this.setColorPickerExpandDirection(JI(i,"expandDirection")),this.setColorPickerEaseInDuration(JI(i,"easeIn",200)),this.setColorPickerEaseOutDuration(JI(i,"easeOut",200)),this.setColorPickerTransitInCallback(JI(i,"transitIn")),this.setColorPickerTransitOutCallback(JI(i,"transitOut")),this.setColorPickerBounds(JI(i,"bounds"));var a=JI(i,"space");void 0===a&&(a={left:10,right:10,top:10,bottom:10,item:8}),this.setColorPickerSpace(a)}var o=e.colorComponents;if(s&&!1!==o&&null!==o){this.setColorComponentsHeight(JI(o,"height",30)),this.setColorComponentsFormatLabelConfig(JI(o,"formatLabel"));var h=JI(o,"inputText");h||(h=JI(e,"inputText")),this.setColorComponentsInputTextConfig(h);var l=JI(o,"space");void 0===l&&(l={item:8}),this.setColorComponentsSpace(l)}var d=this.childrenMap.swatch;d&&s&&this.onClick(d,this.openColorPicker,this)}}Object.assign(qI.prototype,KI),t.register("colorInput",(function(t){var e=new qI(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ColorInput",qI),t.register("colorInputLite",(function(t){var e=new vI(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ColorInputBase",vI),t.register("colorPicker",(function(t){var e=new zI(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ColorPicker",zI),t.register("colorComponents",(function(t){var e=new HI(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ColorComponents",HI);var ZI=function(t){for(var e,i=t.scene.input,s=i.manager,r=s.pointersTotal,n=s.pointers,a=0;a0&&c0&&u0&&b0&&xh;d--){for(c=0;c0&&this.wrapMode!==_e&&0===this.wrapWidth}setStyle(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wordWrap")){var s=t.wordWrap;s.hasOwnProperty("width")&&(t.wrap={mode:"word",width:s.width})}if(t&&t.hasOwnProperty("wrap")){var r=t.wrap;if(r.hasOwnProperty("mode")){var n=r.mode;"string"==typeof n&&(r.mode=Ie[n])}else r.hasOwnProperty("width")&&(r.mode=1)}t&&t.rtl&&i&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var a=this.propertyMap;for(var o in a){var h=a[o],l=h[0],d=i?h[1]:this[o],c=h[2];if("wrapCallback"===o||"wrapCallbackScope"===o)this[o]=je(t,l,d);else{var u=De(t,l,d);c&&(u=c(u)),this[o]=u}}var p=je(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var g=je(t,"fill",null);null!==g&&(this.color=qt(g));var v=je(t,"metrics",!1);return v?this.metrics={ascent:je(v,"ascent",0),descent:je(v,"descent",0),fontSize:je(v,"fontSize",0)}:!e&&this.metrics||(this.metrics=Te(this)),e?this.parent.updateText():this.parent}syncFont(t,e){e.font=this._font}syncStyle(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"}syncShadow(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)}update(t){return t&&(this._font=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim(),this.metrics=Te(this)),this.parent.updateText(t)}buildFont(){var t=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim();return t!==this._font&&(this._font=t),this}setFont(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=je(t,"fontFamily","Courier"),this.fontSize=je(t,"fontSize","16px"),this.fontStyle=je(t,"fontStyle","")),this.update(!0)}setFontFamily(t){return this.fontFamily=t,this.update(!0)}setFontStyle(t){return this.fontStyle=t,this.update(!0)}setFontSize(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}setTestString(t){return this.testString=t,this.update(!0)}setFixedSize(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}setResolution(t){return this.resolution=t,this.update(!1)}setXOffset(t){return this.xOffset=t,this.update(!1)}setBackgroundColor(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=qt(t,this.parent.canvas,this.parent.context),this.backgroundColor2=qt(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=qt(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}setBackgroundCornerRadius(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}setFill(t){return this.color=qt(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=qt(t,this.parent.canvas,this.parent.context),this.update(!1)}setStroke(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=qt(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}setShadow(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===n&&(n=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=qt(i,this.parent.canvas,this.parent.context),this.shadowBlur=s,this.shadowStroke=r,this.shadowFill=n,this.update(!1)}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}setShadowColor(t){return void 0===t&&(t="#000"),this.shadowColor=qt(t,this.parent.canvas,this.parent.context),this.update(!1)}setShadowBlur(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}setShadowStroke(t){return this.shadowStroke=t,this.update(!1)}setShadowFill(t){return this.shadowFill=t,this.update(!1)}setUnderline(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=qt(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}setUnderlineColor(t){return void 0===t&&(t="#000"),this.underlineColor=qt(t,this.parent.canvas,this.parent.context),this.update(!1)}setUnderlineThickness(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}setUnderlineOffset(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}setStrikethrough(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=qt(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}setStrikethroughColor(t){return void 0===t&&(t="#000"),this.strikethroughColor=qt(t,this.parent.canvas,this.parent.context),this.update(!1)}setStrikethroughThickness(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}setStrikethroughOffset(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}setWrapMode(t){return"string"==typeof t&&(t=Ie[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}setWrapWidth(t){return this.wrapWidth=t,this.update(!1)}setAlign(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}setHAlign(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}setVAlign(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}setMaxLines(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}getTextMetrics(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}setTextMetrics(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=je(e,"fontFamily",this.fontFamily),this.fontSize=je(e,"fontSize",this.fontSize),this.fontStyle=je(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}get lineHeight(){return this.metrics.fontSize+this.parent.lineSpacing}toJSON(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}destroy(){this.parent=void 0}};var ze=function(t){return null==t?t="":Array.isArray(t)?t=t.join("\n"):"number"==typeof t&&(t=t.toString()),t},Fe={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var a=this.defaultStyle;this.clear(),se(this,a.backgroundColor,a.backgroundStrokeColor,a.backgroundStrokeLineWidth,a.backgroundCornerRadius,a.backgroundColor2,a.backgroundHorizontalGradient,a.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var o,h,l,d,c,u,p=a.halign,g=a.valign,v=a.lineHeight,f=r.lines,m=f.length,y=a.maxLines;y>0&&m>y?(h=y,l="center"===g?Math.floor((m-h)/2):"bottom"===g?m-h:0):(h=m,l=0),d=l+h;var b=this.rtl,x=b?this.parent.width:void 0;u="center"===g?Math.max((s-h*v)/2,0):"bottom"===g?Math.max(s-h*v-2,0):0,u+=e;for(var C=l;C0){var o=this.defaultStyle.metrics,h=i-o.ascent,l=o.fontSize;this.drawRectangle(e,h,t.width,l,a.bgcolor,a)}if(a.underlineThickness>0&&t.width>0){var d=i+a.underlineOffset-a.underlineThickness/2;this.drawLine(e,d,t.width,a.underlineThickness,a.underlineColor,a)}if(t.isTextPen&&(a.buildFont(),a.syncFont(r,n),a.syncStyle(r,n),this.drawText(e,i,t.text,a)),t.isImagePen&&this.drawImage(e,i,t.prop.img,t.prop.color,a),a.strikethroughThickness>0&&t.width>0&&(d=i+a.strikethroughOffset-a.strikethroughThickness/2,this.drawLine(e,d,t.width,a.strikethroughThickness,a.strikethroughColor,a)),n.restore(),t.hasAreaMarker&&t.width>0){var c,u=t.prop.area;if(u)c={key:u};else{var p=t.prop.url;c={key:`url:${p}`,url:p}}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,c)}},clear(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawRectangle(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;a.fillStyle=r,a.fillRect(t,e,i,s)},drawLine(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;n.syncShadow(a,n.shadowStroke);var o=a.lineCap;a.lineCap="butt",a.strokeStyle=r,a.lineWidth=s,a.beginPath(),a.moveTo(t,e),a.lineTo(t+i,e),a.stroke(),a.lineCap=o},drawText(t,e,i,s){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;s.stroke&&"none"!==s.stroke&&s.strokeThickness>0&&(s.syncShadow(r,s.shadowStroke),r.strokeText(i,t,e)),s.color&&"none"!==s.color&&(s.syncShadow(r,s.shadowFill),r.fillText(i,t,e))},drawImage(t,e,i,s,r){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,s,this.autoRound)}};const Ye=Phaser.Utils.Objects.GetValue,Xe=Oe,We=Me;class Ve{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=Ye(t,"text",""),this.x=Ye(t,"x",0),this.y=Ye(t,"y",0),this.width=Ye(t,"width",0);var e=Ye(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=Ye(t,"newLineMode",0),this.startIndex=Ye(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===We&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==Xe&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===We&&(t+=1),t}get endIndex(){return this.startIndex+this.rawTextLength}get lastX(){return this.x+this.width}get isTextPen(){return""!==this.text}get isImagePen(){return!!this.prop.img}get hasAreaMarker(){return!!this.prop.area||!!this.prop.url}}var Ge=function(t,e){var i=Array.isArray(t);if(void 0===e?e=i?[]:{}:q(e),i){e.length=t.length;for(var s=0,r=t.length;s=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}getLineEndIndex(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,s=!1;for(e=t;e>=0&&!(s=null!=(i=this.lines[e])&&i.length>0);e--);return s?i[i.length-1].endIndex:0}getLineWidth(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}getMaxLineWidth(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,s=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}getLineWidths(){for(var t=[],e=0,i=this.lines.length;e=t&&h<=e||(a=a.substring(t-o,e-o)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,a,l,d):c+=this.tagToText(a,l,d),d=l,!(h>=e)));u++);return c}get length(){return this.lines.length}set length(t){this.clear()}}var Ke={};const Je=Phaser.Geom.Rectangle;var qe=new I;class Ze{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&gi(v)){""!==b?a.push(n.getLine(b,x,oi)):0===C&&r>0&&a.push(n.getLine("",0,oi)),a.push(...ui(v,e,di,s,0,n));var w=a.pop();b=w.text,x=w.width,n.freeLine(w)," "===b&&(b="",x=0)}else(m=x+f)>h?(a.push(n.getLine(b,x,oi)),b=v,x=f,h=s):(b+=v,x=m),C===k-1&&a.push(n.getLine(b,x,l))}return a},pi=function(t,e){var i;switch(e){case li:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==fi&&i0&&t>e&&(t=e),t}get linesWidth(){return Math.ceil(this.penManager.getMaxLineWidth())}get linesHeight(){var t=this.displayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}get imageManager(){return this.parent.imageManager}get rtl(){return this.parent.style.rtl}newPenManager(){return new $e({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}get tmpPenManager(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}getPlainText(t,e,i){var s;if(null==t)s=this.penManager.plainText;else{var r=this.parser.splitText(t,1);s="";for(var n=0,a=r.length;n${t}`:e.hasOwnProperty("_style")?`${t}`:t}destroy(){this.tags=void 0}isTextTag(t){var e=this.tags[t];return!!e&&null==e.img}};var vs=function(t){for(var e,i,s,r={},n=0,a=(t=t.split(";")).length;n=1&&(s.color=o[0]),h>=2&&(s.thickness=parseInt(o[1].replace("px","")));break;case"shadow":o=s.split(" "),s={},(h=o.length)>=1&&(s.color=o[0]),h>=2&&(s.offsetX=parseInt(o[1].replace("px",""))),h>=3&&(s.offsetY=parseInt(o[2].replace("px",""))),h>=4&&(s.blur=parseInt(o[3].replace("px","")));break;case"u":case"underline":case"s":case"strikethrough":var h;o=s.split(" "),s={},(h=o.length)>=1&&(s.color=o[0]),h>=2&&(s.thickness=parseInt(o[1].replace("px",""))),h>=3&&(s.offset=parseInt(o[2].replace("px",""))),"underline"===i?i="u":"strikethrough"===i&&(i="s");break;case"y":s=parseFloat(s)}r[i]=s}return r},fs=function(t){return 0===(t=t.replace(ks,"")).length},ms=/<\s*class=["|']([^"|']+)["|']\s*\>([\s\S]*?)<\s*\/class\s*\>|<\s*style=["|']([^"|']+)["|']\s*\>([\s\S]*?)<\s*\/style\s*\>/g,ys=/<\s*class=/i,bs=/<\s*class=["|']([^"|']+)["|']\s*\>([\s\S]*?)<\s*\/class\s*\>/,xs=/<\s*style=/i,Cs=/<\s*style=["|']([^"|']+)["|']\s*\>([\s\S]*?)<\s*\/style\s*\>/,ks=/^\s+|\s+$/;const ws=Phaser.Utils.Objects.GetValue;class Ss extends Xi{constructor(t,e,i,s,r){var n=ws(r,"tags",void 0);super(t,e,i,s,r,"rexTagText",new gs(n))}addTag(t,e){return this.parser.addTag(t,e),this.updateText(!0)}addTags(t){for(var e in t)this.parser.addTag(e,t[e]);return this.updateText(!0)}getTag(t){return this.parser.getTag(t)}preDestroy(){super.preDestroy(),this.parser.destroy(),this.parser=void 0}}t.register("tagText",(function(t,e,i,s){var r=new Ss(this.scene,t,e,i,s);return this.scene.add.existing(r),r})),P(window,"RexPlugins.UI.TagText",Ss);const Ps=Phaser.Utils.Objects.GetValue;var Ts=function(t,e){return void 0===e?t:t[e]},Os=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Ps(e,"left",0),t.right=Ps(e,"right",0),t.top=Ps(e,"top",0),t.bottom=Ps(e,"bottom",0)),t};let Ms=class{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}};Object.assign(Ms.prototype,Z);var Es={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const _s=Phaser.Math.RotateAround;var Rs;const Ls=Phaser.Geom.Rectangle;var Bs,Is=function(t){void 0===Bs&&(Bs=new Ls);var e=t.drawTLX,i=t.drawTLY;return Bs.setTo(e,i,t.drawTRX-e,t.drawBLY-i),Bs};const Ds=Phaser.Math.RotateAround;var js,As=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===js&&(js={}),s=js),s.x=e,s.y=i,0!==t.rotation&&Ds(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const zs=Phaser.GameObjects.Components.TransformMatrix;var Fs,Ys,Xs={},Ws=function(t,e,i,s,r){var n=As(e,i,s,!0),a=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=Xs);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===Fs&&(Fs=new zs,Ys=new zs),t.parentContainer?t.getWorldTransformMatrix(Fs,Ys):Fs.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),Fs.transformPoint(r,n,s),s}(t,n.x,n.y,r);return a},Vs=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,a=e.drawCenterY+s;return Ws(t,e,n,a,r)},Gs={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Rs&&(Rs={}),s=Rs),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&_s(s,0,0,-i.rotation),s}(t,e,this,!0);return Is(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return Vs(this.parent,this,t,e,i)}};Object.assign(Gs,Es);const Hs=Phaser.Math.DegToRad,Us=Phaser.Math.RadToDeg,Ns=Phaser.Utils.Objects.GetValue;class $s extends Ms{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return Us(this._rotation)}set angle(t){this.rotation=Hs(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=Ns(t,"width",void 0),i=Ns(t,"height",void 0),s=Ns(t,"scaleX",void 0),r=Ns(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign($s.prototype,Gs);var Ks=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Js=Phaser.Utils.Objects.GetValue;class qs extends $s{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(Js(e,"color",null),Js(e,"color2",null),Js(e,"horizontalGradient",!0)),this.setStroke(Js(e,"stroke",null),Js(e,"strokeThickness",2)),this.setCornerRadius(Js(e,"cornerRadius",0),Js(e,"cornerIteration",null))}set color(t){t=qt(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=qt(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=qt(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,Ks("color2",t,this),Ks("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Ks("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Ks("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){se(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Zs=Phaser.Utils.Objects.GetValue;class Qs extends $s{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(Zs(e,"color",null),Zs(e,"color2",null),Zs(e,"horizontalGradient",!0)),this.setStroke(Zs(e,"stroke",null),Zs(e,"strokeThickness",2))}set color(t){t=qt(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=qt(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=qt(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,Zs(t,"color2",null),Zs(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Zs(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,a=this.parent.height-i.top-i.bottom,o=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?o.createLinearGradient(0,0,n,0):o.createLinearGradient(0,0,0,a)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,o.fillStyle=t,o.fillRect(s,r,n,a));null!=this.stroke&&this.strokeThickness>0&&(o.strokeStyle=this.stroke,o.lineWidth=this.strokeThickness,o.strokeRect(s,r,n,a))}}const tr=Phaser.Utils.Objects.GetValue;class er{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(tr(t,"bold",!1)),this.setItalic(tr(t,"italic",!1)),this.setFontSize(tr(t,"fontSize","16px")),this.setFontFamily(tr(t,"fontFamily","Courier")),this.setColor(tr(t,"color","#fff")),this.setStrokeStyle(tr(t,"stroke",null),tr(t,"strokeThickness",0)),this.setShadow(tr(t,"shadowColor",null),tr(t,"shadowOffsetX",0),tr(t,"shadowOffsetY",0),tr(t,"shadowBlur",0)),this.setOffset(tr(t,"offsetX",0),tr(t,"offsetY",0)),this.setSpace(tr(t,"leftSpace",0),tr(t,"rightSpace",0)),this.setAlign(tr(t,"align",void 0)),this.setBackgroundColor(tr(t,"backgroundColor",null)),this.setBackgroundHeight(tr(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(tr(t,"backgroundBottomY",void 0)),this.setBackgroundLeftX(tr(t,"backgroundLeftX",0)),this.setBackgroundRightX(tr(t,"backgroundRightX",0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(Ks("stroke",t,this),Ks("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Ks("shadowOffsetX",t,this),Ks("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),t.hasOwnProperty("backgroundLeftX")&&this.setBackgroundLeftX(t.backgroundLeftX),t.hasOwnProperty("backgroundRightX")&&this.setBackgroundRightX(t.backgroundRightX),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new er(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=qt(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=qt(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=qt(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=qt(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setBackgroundLeftX(t){return this.backgroundLeftX=t,this}setBackgroundRightX(t){return this.backgroundRightX=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}}const ir=Phaser.Utils.Array.Remove,sr=Phaser.Utils.Array.Remove,rr="text",nr="image",ar="drawer",or="space",hr="command";var lr=function(t){return t.type===rr&&"\n"===t.text},dr=function(t){return t.type===rr&&"\f"===t.text},cr=function(t){return t.type===rr},ur=function(t){return t.type===hr};class pr extends $s{constructor(t,e,i){super(t,rr),this.updateTextFlag=!1,this.style=new er(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX+e.backgroundLeftX,s=i,r=this.drawTRX+e.backgroundRightX-i+1;if(r>0){var n=e.backgroundBottomY;null==n&&(n=this.drawBLY);var a=e.backgroundHeight;null==a&&(a=n-this.drawTLY);var o=n-a;t.fillRect(s,o,r,a)}}var h=e.hasFill,l=e.hasStroke;(h||l)&&(e.syncFont(t).syncStyle(t),l&&(e.syncShadow(t),t.strokeText(this.text,0,0)),h&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var gr=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};Phaser.Display.Canvas.CanvasPool;class vr extends $s{constructor(t,e,i){super(t,nr),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){Ti(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}var fr=function(t,e,i){var s=this.createImageChild(t,e,i);return this.addChild(s),this};class mr extends $s{constructor(t,e,i,s){super(t,ar),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}let yr=class extends $s{constructor(t,e){super(t,or),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}};var br=function(t){var e=this.createSpaceChild(t);return this.addChild(e),this};class xr extends Ms{constructor(t,e,i,s,r){super(t,hr),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}var Cr=function(t,e,i,s){var r=this.createCommandChild(t,e,i,s);return this.addChild(r),this},kr=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const wr={none:0,word:1,char:2,character:2,mix:3};var Sr=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,a=!r&&!n,o=t.length,h=e,l=s.word,d=0,c=!1;h0&&!o){var h=this.fixedHeight-s;i>0?n=h/i:(n=(l=Mr.call(this)).height,a=l.ascent,i=Math.floor((h-a)/n))}else{var l;n=(l=Mr.call(this)).height,a=l.ascent}}else this.fixedHeight>0?void 0===(i=_r(t,"maxLines"))&&(h=this.fixedHeight-s,i=Math.floor(h/n)):i=_r(t,"maxLines",0);void 0===a&&(a=n);var d=0===i,c=_r(t,"wrapMode");void 0===c&&(c=_r(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=wr[c]);var u=_r(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=_r(t,"letterSpacing",0),g=_r(t,"hAlign",0),v=_r(t,"vAlign",0),f=_r(t,"justifyPercentage",.25),m=kr({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:g,vAlign:v,justifyPercentage:f,ascent:a,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,b=0,x=y.length;b0&&(E.push({children:_,width:R}),L=Math.max(L,R)),m.start+=M.length,m.isLastPage=!B&&m.start===O,m.maxLineWidth=L,m.linesHeight=E.length*n;var Y=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,X=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,a=t.vAlign,o=t.justifyPercentage,h=t.lines,l=0,d=h.length;l0?(a=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=Br(t,"maxLines",void 0))){var a=this.fixedWidth-r;i=Math.floor(a/n)+1}}else i=Br(t,"maxLines",0);var o=0===i,h=Br(t,"fixedCharacterHeight",void 0);if(void 0===h){var l=Br(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;h=Math.floor(d/l)}}var c=Br(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=Br(t,"letterSpacing",0),p=Br(t,"rtl",!0),g=Br(t,"hAlign",p?2:0),v=Br(t,"vAlign",0),f=kr({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:g,vAlign:v,lineWidth:n,fixedCharacterHeight:h,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(M.push({children:E,height:_}),R=Math.max(R,_)),f.start+=O.length,f.isLastPage=f.start===T,f.maxLineHeight=R,f.linesWidth=M.length*n;var A=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,z=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,a=t.vAlign,o=t.rtl,h=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}o&&(s+=l);for(var c=0,u=h.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,a=i.bottom;return Os(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||a!=i.bottom,this},getPadding:function(t){return Ts(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),ir(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return sr(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(rr);return null===i?i=new pr(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),Vs(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r>16&255},bn=function(t){return t>>8&255},xn=function(t){return 255&t};const Cn=Phaser.Events.EventEmitter;var kn=function(t,e,i,s,r,n){return void 0===n?n={}:!0===n&&(n=wn),"number"!=typeof i&&(i=0,s=0),n.x=r.x+r.width*t+i,n.y=r.y+r.height*e+s,n},wn={},Sn=function(t,e,i,s,r,n,a){if(t.hasOwnProperty("vp"))return t;"function"==typeof i&&(a=i,i=void 0),"function"==typeof r&&(a=r,r=void 0),void 0===i&&(i=.5),void 0===s&&(s=.5),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=kn),function(t){if(t.events)return t;var e=new Cn,i=t.x;Object.defineProperty(t,"x",{get:function(){return i},set:function(s){i!==s&&(i=s,e.emit("update",t))}});var s=t.y;Object.defineProperty(t,"y",{get:function(){return s},set:function(i){s!==i&&(s=i,e.emit("update",t))}});var r=t.width;Object.defineProperty(t,"width",{get:function(){return r},set:function(i){r!==i&&(r=i,e.emit("update",t))}});var n=t.height;Object.defineProperty(t,"height",{get:function(){return n},set:function(i){n!==i&&(n=i,e.emit("update",t))}}),t.events=e}(e);var o=e.events;t.vp=e;var h=function(){a(i,s,r,n,e,t)};o.on("update",h),t.once("destroy",(function(){o.off("update",h),t.vp=void 0})),Object.defineProperty(t,"vpx",{get:function(){return i},set:function(t){i!==t&&(i=t,h())}}),Object.defineProperty(t,"vpy",{get:function(){return s},set:function(t){s!==t&&(s=t,h())}}),Object.defineProperty(t,"vpxOffset",{get:function(){return r},set:function(t){r!==t&&(r=t,h())}}),Object.defineProperty(t,"vpyOffset",{get:function(){return n},set:function(t){n!==t&&(n=t,h())}}),h()},Pn=function(t){return t.preFX?t.preFX:t.postFX?t.postFX:null},Tn=function(t,e){t._effectSwitchNames||(t._effectSwitchNames=[],t.clearAllEffects=function(){for(var e=t._effectSwitchNames,i=0,s=e.length;i0&&void 0!==t.setTint},useAlphaFadeEffect(t){return(void 0===this.fadeMode||1===this.fadeMode)&&this.fadeTime>0&&void 0!==t.setAlpha},useRevealEffect(t){return this.fadeMode>=2&&this.fadeMode<=5&&this.fadeTime>0&&(t.preFX||t.postFX)},fadeBob(t,e,i,s){var r=t.gameObject;if(this.useTintFadeEffect(r))void 0!==e&&t.setProperty("tintGray",255*e),t.easeProperty({property:"tintGray",value:Math.floor(255*i),duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s});else if(this.useAlphaFadeEffect(r))void 0!==e&&t.setProperty("alpha",e),t.easeProperty({property:"alpha",value:i,duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s});else if(this.useRevealEffect(r)){var n;switch(En(r,"reveal"),this.fadeMode){case 2:n="revealUp";break;case 3:n="revealDown";break;case 4:n="revealLeft";break;case 5:n="revealRight"}void 0===e&&(e=0),r[n]=e,t.easeProperty({property:n,value:i,duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s}),t.getTweenTask(n).once("complete",(function(){r[n]=null}))}else s&&s(r);return this}},zn=function(t){return void 0!==t.displayWidth?t.displayWidth:t.width},Fn=function(t){return void 0!==t.displayHeight?t.displayHeight:t.height};const Yn=Phaser.Geom.Rectangle,Xn=Phaser.Math.Vector2,Wn=Phaser.Math.RotateAround,Vn=Phaser.GameObjects.Container;var Gn=function(t,e){if(void 0===e?e=new Yn:!0===e&&(void 0===Hn&&(Hn=new Yn),e=Hn),t.getBounds&&!(t instanceof Vn))return t.getBounds(e);var i,s,r,n,a,o,h,l;if(t.parentContainer){var d=t.parentContainer.getBoundsTransformMatrix();Un(t,e),d.transformPoint(e.x,e.y,e),i=e.x,s=e.y,Nn(t,e),d.transformPoint(e.x,e.y,e),r=e.x,n=e.y,$n(t,e),d.transformPoint(e.x,e.y,e),a=e.x,o=e.y,Kn(t,e),d.transformPoint(e.x,e.y,e),h=e.x,l=e.y}else Un(t,e),i=e.x,s=e.y,Nn(t,e),r=e.x,n=e.y,$n(t,e),a=e.x,o=e.y,Kn(t,e),h=e.x,l=e.y;return e.x=Math.min(i,r,a,h),e.y=Math.min(s,n,o,l),e.width=Math.max(i,r,a,h)-e.x,e.height=Math.max(s,n,o,l)-e.y,e},Hn=void 0,Un=function(t,e,i){return void 0===e?e=new Xn:!0===e&&(void 0===qn&&(qn=new Xn),e=qn),t.getTopLeft?t.getTopLeft(e):(e.x=t.x-zn(t)*t.originX,e.y=t.y-Fn(t)*t.originY,Zn(t,e,i))},Nn=function(t,e,i){return void 0===e?e=new Xn:!0===e&&(void 0===qn&&(qn=new Xn),e=qn),t.getTopRight?t.getTopRight(e):(e.x=t.x-zn(t)*t.originX+zn(t),e.y=t.y-Fn(t)*t.originY,Zn(t,e,i))},$n=function(t,e,i){return void 0===e?e=new Xn:!0===e&&(void 0===qn&&(qn=new Xn),e=qn),t.getBottomLeft?t.getBottomLeft(e):(e.x=t.x-zn(t)*t.originX,e.y=t.y-Fn(t)*t.originY+Fn(t),Zn(t,e,i))},Kn=function(t,e,i){return void 0===e?e=new Xn:!0===e&&(void 0===qn&&(qn=new Xn),e=qn),t.getBottomRight?t.getBottomRight(e):(e.x=t.x-zn(t)*t.originX+zn(t),e.y=t.y-Fn(t)*t.originY+Fn(t),Zn(t,e,i))},Jn=function(t,e,i){void 0===e?e=new Xn:!0===e&&(void 0===qn&&(qn=new Xn),e=qn);var s=zn(t),r=Fn(t);return e.x=t.x+s*(.5-t.originX),e.y=t.y+r*(.5-t.originY),Zn(t,e,i)},qn=void 0,Zn=function(t,e,i){return void 0===i&&(i=!1),0!==t.rotation&&Wn(e,t.x,t.y,t.rotation),i&&t.parentContainer&&t.parentContainer.getBoundsTransformMatrix().transformPoint(e.x,e.y,e),e};const Qn=Phaser.Utils.Objects.GetValue;var ta=function(t,e,i){var s,r,n,a,o;if("number"==typeof i?s=i:(s=Qn(i,"color"),r=Qn(i,"lineWidth"),n=Qn(i,"fillColor"),a=Qn(i,"fillAlpha",1),o=Qn(i,"padding",0)),Array.isArray(t))for(var h=0,l=t.length;h0?-this.delay:0,this.state=this.nowTime>=0?Ha:Ga,this.repeatCounter=0,this}stop(){return this.state=Va,this}update(t,e){this.state!==Va&&this.state!==Na&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=Ua)):(this.nowTime=this.duration,this.state=Na):this.nowTime>=0&&(this.state=Ha))}get t(){var t;switch(this.state){case Va:case Ga:case Ua:t=0;break;case Ha:t=this.nowTime/this.duration;break;case Na:t=1}return Xa(t,0,1)}set t(t){(t=Xa(t,-1,1))<0?(this.state=Ga,this.nowTime=-this.delay*t):(this.state=Ha,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===Va}get isDelay(){return this.state===Ga}get isCountDown(){return this.state===Ha}get isRunning(){return this.state===Ga||this.state===Ha}get isDone(){return this.state===Na}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}};const Va=0,Ga=1,Ha=2,Ua=3,Na=-1;class $a extends za{constructor(t,e){super(t,e),this.timer=new Wa}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const Ka=Phaser.Utils.Objects.GetValue,Ja=Phaser.Utils.Objects.GetAdvancedValue,qa=Phaser.Tweens.Builders.GetEaseFunction;class Za extends $a{resetFromJSON(t){return this.timer.resetFromJSON(Ka(t,"timer")),this.setEnable(Ka(t,"enable",!0)),this.setTarget(Ka(t,"target",this.parent)),this.setDelay(Ja(t,"delay",0)),this.setDuration(Ja(t,"duration",1e3)),this.setEase(Ka(t,"ease","Linear")),this.setRepeat(Ka(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=qa(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Qa=Phaser.Sound.BaseSound;var to=function(t){return t instanceof Qa};const eo=Phaser.Utils.Objects.GetValue,io=Phaser.Utils.Objects.GetAdvancedValue,so=Phaser.Math.Linear;let ro=class extends Za{constructor(t,e,i){to(t)&&(i=e,e=t,t=void 0),e.active=!0,e.scene=t,e.game=e.manager.game,super(e,i),this.volume={},this.resetFromJSON(i)}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(eo(t,"mode",0)),this.setEnable(eo(t,"enable",!0)),this.setVolumeRange(io(t,"volume.start",this.parent.volume),io(t,"volume.end",0)),this}setMode(t){return"string"==typeof t&&(t=no[t]),this.mode=t,this}setVolumeRange(t,e){return this.volume.start=t,this.volume.end=e,this}start(){return this.timer.isRunning||(this.parent.setVolume(this.volume.start),this.timer.setDelay(this.delay).setDuration(this.duration),super.start()),this}updateTarget(t,e){t.volume=so(this.volume.start,this.volume.end,e.t)}complete(){switch(super.complete(),this.mode){case 1:this.parent.stop();break;case 2:this.parent.stop(),this.parent.destroy()}return this}};const no={stop:1,destroy:2};var ao=function(t,e,i,s,r){to(t)&&(r=s,s=i,i=e,e=t,t=void 0),void 0===s&&(s=1),void 0===r&&(r=0);var n,a={mode:0,volume:{start:r,end:s},duration:i};return"string"==typeof e&&(e=t.sys.sound.add(e)),e.hasOwnProperty("_fade")?(n=e._fade).stop().resetFromJSON(a):(n=new ro(t,e,a),e._fade=n),n.start(),e.isPlaying||e.setVolume(r).play(),e},oo=function(t,e,i,s){to(t)&&(s=i,i=e,e=t,t=void 0),void 0===s&&(s=!0);var r,n={mode:s?2:1,volume:{start:e.volume,end:0},duration:i};return e.hasOwnProperty("_fade")?(r=e._fade).stop().resetFromJSON(n):(r=new ro(t,e,n),e._fade=r),r.start(),e.isPlaying||e.play(),e};const ho=Phaser.Utils.Objects.GetValue;var lo={setBackgroundMusicLoop(t){return void 0===t&&(t=!0),this.backgroundMusicLoop=t,this},setBackgroundMusicFadeTime(t){return this.backgroundMusicFadeTime=t,this},getBackgroundMusic(){return this.backgroundMusic},setCurrentBackgroundMusic(t){return this.backgroundMusic=t,t&&(t.once("complete",(function(){this.backgroundMusic===t&&(this.backgroundMusic.destroy(),this.backgroundMusic=void 0)}),this).once("destroy",(function(){this.backgroundMusic===t&&(this.backgroundMusic=void 0)}),this),t.isPlaying||t.play()),this},playBackgroundMusic(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;if(this.backgroundMusic&&this.backgroundMusic.key===t)return this;this.stopBackgroundMusic();var i=this.sound.add(t,{loop:ho(e,"loop",this.backgroundMusicLoop),mute:ho(e,"mute",this.backgroundMusicMute),volume:ho(e,"volume",this.backgroundMusicVolume),detune:ho(e,"detune",0),rate:ho(e,"rate",1)});return this.setCurrentBackgroundMusic(i),this.backgroundMusicFadeTime>0&&this.fadeInBackgroundMusic(this.backgroundMusicFadeTime),this},pauseBackgroundMusic(){return this.backgroundMusic&&this.backgroundMusic.pause(),this},resumeBackgroundMusic(){return this.backgroundMusic&&this.backgroundMusic.resume(),this},stopBackgroundMusic(){return this.backgroundMusic&&(this.backgroundMusicFadeTime>0?this.fadeOutBackgroundMusic(this.backgroundMusicFadeTime,!0):(this.backgroundMusic.stop(),this.backgroundMusic.destroy(),this.backgroundMusic=void 0)),this},fadeInBackgroundMusic(t){return this.backgroundMusic&&ao(this.backgroundMusic,t,this.backgroundMusicVolume,0),this},fadeOutBackgroundMusic(t,e){return this.backgroundMusic&&oo(this.backgroundMusic,t,e),this},crossFadeBackgroundMusic(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;var i=this.backgroundMusicFadeTime;return this.backgroundMusicFadeTime=0,this.fadeOutBackgroundMusic(e,!0).playBackgroundMusic(t).fadeInBackgroundMusic(e),this.backgroundMusicFadeTime=i,this},setBackgroundMusicMute(t){return void 0===t&&(t=!0),this.backgroundMusicMute=t,this},setBackgroundMusicVolume(t){return this.backgroundMusicVolume=t,this},setBackgroundMusicRate(t){return this.backgroundMusic&&this.backgroundMusic.setRate(t),this},setBackgroundMusicDetune(t){return this.backgroundMusic&&this.backgroundMusic.setDetune(t),this}};const co=Phaser.Utils.Objects.GetValue;var uo={setBackgroundMusic2Loop(t){return void 0===t&&(t=!0),this.backgroundMusic2Loop=t,this},setBackgroundMusic2FadeTime(t){return this.backgroundMusic2FadeTime=t,this},getBackgroundMusic2(){return this.backgroundMusic2},setCurrentBackgroundMusic2(t){return this.backgroundMusic2=t,t&&(t.once("complete",(function(){this.backgroundMusic2===t&&(this.backgroundMusic2.destroy(),this.backgroundMusic2=void 0)}),this).once("destroy",(function(){this.backgroundMusic2===t&&(this.backgroundMusic2=void 0)}),this),t.isPlaying||t.play()),this},playBackgroundMusic2(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;if(this.backgroundMusic2&&this.backgroundMusic2.key===t)return this;this.stopBackgroundMusic2();var i=this.sound.add(t,{loop:co(e,"loop",this.backgroundMusicLoop),mute:co(e,"mute",this.backgroundMusic2Mute),volume:co(e,"volume",this.backgroundMusic2Volume),detune:co(e,"detune",0),rate:co(e,"rate",1)});return this.setCurrentBackgroundMusic2(i),this.backgroundMusic2FadeTime>0&&this.fadeInBackgroundMusic2(this.backgroundMusic2FadeTime),this},pauseBackgroundMusic2(){return this.backgroundMusic2&&this.backgroundMusic2.pause(),this},resumeBackgroundMusic2(){return this.backgroundMusic2&&this.backgroundMusic2.resume(),this},stopBackgroundMusic2(){return this.backgroundMusic2&&(this.backgroundMusic2FadeTime>0?this.fadeOutBackgroundMusic2(this.backgroundMusic2FadeTime,!0):(this.backgroundMusic2.stop(),this.backgroundMusic2.destroy(),this.backgroundMusic2=void 0)),this},fadeInBackgroundMusic2(t){return this.backgroundMusic2&&ao(this.backgroundMusic2,t,this.backgroundMusic2Volume,0),this},fadeOutBackgroundMusic2(t,e){return this.backgroundMusic2&&oo(this.backgroundMusic2,t,e),this},crossFadeBackgroundMusic2(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;var i=this.backgroundMusic2FadeTime;return this.backgroundMusic2FadeTime=0,this.fadeOutBackgroundMusic2(e,!0).playBackgroundMusic2(t).fadeInBackgroundMusic2(e),this.backgroundMusic2FadeTime=i,this},setBackgroundMusic2Mute(t){return void 0===t&&(t=!0),this.backgroundMusic2Mute=t,this},setBackgroundMusic2Volume(t){return this.backgroundMusic2Volume=t,this},setBackgroundMusic2Rate(t){return this.backgroundMusic2&&this.backgroundMusic2.setRate(t),this},setBackgroundMusic2Detune(t){return this.backgroundMusic2&&this.backgroundMusic2.setDetune(t),this}};const po=Phaser.Utils.Array.Remove,go=Phaser.Utils.Objects.GetValue;var vo={getSoundEffects(){return this.soundEffects},getLastSoundEffect(){return this.soundEffects[this.soundEffects.length-1]},playSoundEffect(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;var i=this.sound.add(t,{mute:go(e,"mute",this.soundEffectsMute),volume:go(e,"volume",this.soundEffectsVolume),detune:go(e,"detune",0),rate:go(e,"rate",1)});return this.soundEffects.push(i),i.once("complete",(function(){i.destroy(),this.sound&&po(this.soundEffects,i)}),this).once("destroy",(function(){this.sound&&po(this.soundEffects,i)}),this).play(),this},stopAllSoundEffects(){for(var t=this.soundEffects.length-1;t>=0;t--){var e=this.soundEffects[t];e.stop(),e.destroy()}return this},fadeInSoundEffect(t){var e=this.getLastSoundEffect();return e&&ao(e,t,this.soundEffectsVolume,0),this},fadeOutSoundEffect(t,e){var i=this.getLastSoundEffect();return i&&oo(i,t,e),this},fadeOutAllSoundEffects(t,e){for(var i=this.soundEffects.length-1;i>=0;i--)oo(this.soundEffects[i],t,e);return this},setSoundEffectMute(t,e){if(void 0===t&&(t=!0),void 0===e&&(e=!1),e){var i=this.getLastSoundEffect();i&&i.setMute(t)}else this.soundEffectsMute=t;return this},setSoundEffectVolume(t,e){if(void 0===e&&(e=!1),e){var i=this.getLastSoundEffect();i&&i.setVolume(t)}else this.soundEffectsVolume=t;return this},setSoundEffectDetune(t,e){var i;void 0===e&&(e=!1);for(var s=0,r=(i=e?[this.getLastSoundEffect()]:this.soundEffects).length;s=0;t--){var e=this.soundEffects[t];e.stop(),e.destroy()}return this},fadeInSoundEffect2(t){var e=this.getLastSoundEffect2();return e&&ao(e,t,this.soundEffects2Volume,0),this},fadeOutSoundEffect2(t,e){var i=this.getLastSoundEffect2();return i&&oo(i,t,e),this},fadeOutAllSoundEffects2(t,e){for(var i=this.soundEffects2.length-1;i>=0;i--)oo(this.soundEffects2[i],t,e);return this},setSoundEffect2Mute(t,e){if(void 0===t&&(t=!0),void 0===e&&(e=!1),e){var i=this.getLastSoundEffect2();i&&i.setMute(t)}else this.soundEffects2Mute=t;return this},setSoundEffect2Volume(t,e){if(void 0===e&&(e=!1),e){var i=this.getLastSoundEffect2();i&&i.setVolume(t)}else this.soundEffects2Volume=t;return this},setSoundEffect2Detune(t,e){var i;void 0===e&&(e=!1);for(var s=0,r=(i=e?[this.getLastSoundEffect2()]:this.soundEffects2).length;s=0;t--)this.soundEffects[t].destroy();if(this.soundEffects.length=0,this.soundEffects2.length)for(t=this.soundEffects2.length-1;t>=0;t--)this.soundEffects2[t].destroy();return this.soundEffects2.length=0,this.sound=void 0,this}get backgroundMusicMute(){return this._backgroundMusicMute}set backgroundMusicMute(t){this._backgroundMusicMute=t,this.backgroundMusic&&this.backgroundMusic.setMute(mute)}get backgroundMusicVolume(){return this._backgroundMusicVolume}set backgroundMusicVolume(t){this._backgroundMusicVolume=t,this.backgroundMusic&&this.backgroundMusic.setVolume(t)}get backgroundMusic2Mute(){return this._backgroundMusic2Mute}set backgroundMusic2Mute(t){this._backgroundMusic2Mute=t,this.backgroundMusic2&&this.backgroundMusic2.setMute(mute)}get backgroundMusic2Volume(){return this._backgroundMusic2Volume}set backgroundMusic2Volume(t){this._backgroundMusic2Volume=t,this.backgroundMusic2&&this.backgroundMusic2.setVolume(t)}get soundEffectsMute(){return this._soundEffectsMute}set soundEffectsMute(t){this._soundEffectsMute=t;for(var e=this.soundEffects,i=0,s=e.length;i");this.setDelimiters(e[0],e[1]),this.setTranslateTagNameCallback(J(t,"translateTagNameCallback")),this.isRunning=!1,this.isPaused=!1,this.skipEventFlag=!1,this.justCompleted=!1,this.lastTagStart=null,this.lastTagEnd=null,this.lastContent=null}shutdown(){this.destroyEventEmitter()}destroy(){this.shutdown()}setMultipleLinesTagEnable(t){return void 0===t&&(t=!0),this.multipleLinesTagEnable=t,this}setDelimiters(t,e){void 0===e&&(e=t[1],t=t[0]),this.delimiterLeft=t,this.delimiterRight=e,t=Zi(this.delimiterLeft),e=Zi(this.delimiterRight);var i=this.multipleLinesTagEnable?"gs":"gi";return this.reSplit=RegExp(`${t}(.+?)${e}`,i),this}setTranslateTagNameCallback(t){return this.translateTagNameCallback=t,this}setValueConverter(t){return!0===t?t=Qo:t||(t=eh),this.valueConverter=t,this}setLoopEnable(t){return void 0===t&&(t=!0),this.loopEnable=t,this}setSource(t){return this.source=t,this}resetIndex(t){return void 0===t&&(t=0),this.progressIndex=t,this.reSplit.lastIndex=t,this.lastTagStart=null,this.lastTagEnd=null,this.lastContent=null,this.justCompleted=!1,this.isRunning=!1,this}start(t){return this.setSource(t).restart(),this}restart(){this.resetIndex().next()}next(){if(this.isPaused&&this.onResume(),this.isRunning)return this;if(this.isRunning=!0,this.justCompleted)return this.isRunning=!1,this;0===this.reSplit.lastIndex&&this.onStart();var t=this.source,e=t.length;for(this.reSplit.lastIndex=this.progressIndex;;){var i=this.reSplit.exec(t);if(!i){if(this.progressIndex");this.setDelimiters(e[0],e[1])}setTagExpression(t){return t||(t=sh),this.tagExpression=t,this}setValueExpression(t){return t||(t=sh),this.valueExpression=t,this}setDelimiters(t,e){super.setDelimiters(t,e);var i=`(${this.tagExpression})(=(${this.valueExpression}))?`;if(this.reTag=RegExp(i,"i"),this.tagExpression!==sh||this.valueExpression!==sh){var s=`${this.tagExpression}(=${this.valueExpression})?`,r=`/${this.tagExpression}`;t=Zi(this.delimiterLeft),e=Zi(this.delimiterRight);var n=this.multipleLinesTagEnable?"gs":"gi";this.reSplit=RegExp(`${t}((${s})|(${r}))${e}`,n)}return this}onTag(t){var e=t.match(this.reTag),i=e[1],s="/"===i.charAt(0);if(s&&(i=i.substring(1,i.length)),this.translateTagNameCallback&&(i=this.translateTagNameCallback(i)),this.skipEventFlag=!1,s)this.emit(`-${i}`),this.skipEventFlag||this.emit("-",i),this.lastTagEnd=i;else{var r=function(t,e,i){if(null==t)return[];void 0===e&&(e=Qo),void 0===i&&(i=",");for(var s=t.split(i),r=0,n=s.length;r0){var n=this.timeline.addTimer({name:hl,target:s,duration:r.duration,yoyo:r.yoyo,onStart:r.onStart,onProgress:r.onProgress,onComplete:r.onComplete});this.skipTypingAnimation&&n.seek(1)}else r.onStart&&r.onStart(s,0);this.minSizeEnable&&this.textPlayer.setToMinSize(),this.textPlayer.emit("typing",s);var a=this.nextChild;if(a)if(this.skipSpaceEnable&&(e=a).type===rr&&" "===e.text);else if(i+=this.speed+t,t=0,i>0){this.typingTimer=this.timeline.addTimer({name:"delay",target:this,duration:i,onComplete:function(t,e,i){t.typingTimer=void 0,ll.call(t,i.remainder)}});break}}else ur(s)&&s.exec()}this.minSizeEnable&&this.textPlayer.setToMinSize(),this.inTypingProcessLoop=!1},dl=function(t){switch(t){case"camera.fadein":case"camera.fadeout":case"camera.flash":case"camera.shake":case"camera.zoom":case"camera.rotate":case"camera.scroll":return!0;default:return!1}},cl=function(t,e){var i=e.split(".");return t.gameObjectManagers.hasOwnProperty(i[0])},ul=function(t,e,i,s){var r=t.waitEventManager,n=e.split("."),a=n[0],o=t.getGameObjectManager(a),h=`wait.${a}`;switch(n.length){case 1:return r.waitGameObjectManagerEmpty(a),void t.emit(h);case 2:var l=n[1];return r.waitGameObjectDestroy(a,l),void t.emit(h,l);case 3:l=n[1];var d=n[2];if("number"==typeof o.getProperty(l,d))return r.waitGameObjectTweenComplete(a,l,d),void t.emit(h,l,d);var c=d,u=c.startsWith("!");return u&&(c=c.substring(1)),o.hasData(l,c)?(r.waitGameObjectDataFlag(a,l,c,!u),void t.emit(h,l,c)):void r.waitTime(0)}};const pl=Phaser.Input.Keyboard.KeyCodes;var gl=function(t,e,i,s){var r=t.waitEventManager;r.clearWaitCompleteCallbacks().addWaitCompleteCallback(i,s);for(var n=0,a=(e="string"==typeof e&&e.length>1&&-1!==e.indexOf("|")?e.split("|"):[e]).length;n0&&n.chainAnimation(i,s)},El=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).stopAnimation(...i)},_l=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).pauseAnimation(...i)},Rl=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).chainAnimation(...i)};const Ll=[function(t,e,i){var s=i.name;e.on("+",(function(i,...r){if(!e.skipEventFlag){var n,a=i.split(".");Ol(a,s)&&(n=a[1],Cr.call(t,`${s}.play`,Ml,[s,n,r],t),e.skipEvent())}})).on("+",(function(i){if(!e.skipEventFlag){var r,n=i.split(".");(function(t,e){return 3===t.length&&t[0]===e&&"stop"===t[2]})(n,s)&&(r=n[1],Cr.call(t,`${s}.stop`,El,[s,r],t),e.skipEvent())}})).on("-",(function(i){if(!e.skipEventFlag){var r,n=i.split(".");Ol(n,s)&&(r=n[1],Cr.call(t,`${s}.stop`,El,[s,r],t),e.skipEvent())}}))},function(t,e,i){var s=i.name;e.on("+",(function(i){if(!e.skipEventFlag){var r,n=i.split(".");(function(t,e){return 3===t.length&&t[0]===e&&"pause"===t[2]})(n,s)&&(r=n[1],Cr.call(t,`${s}.pause`,_l,[s,r],t),e.skipEvent())}}))},function(t,e,i){var s=i.name;e.on("+",(function(i){if(!e.skipEventFlag){var r,n=i.split(".");if(function(t,e){return 3===t.length&&t[0]===e&&"chain"===t[2]}(n,s)){r=n[1];var a=Array.prototype.slice.call(arguments,1);Cr.call(t,`${s}.chain`,Rl,[s,r,a],t),e.skipEvent()}}}))}];var Bl=function(t){void 0===t&&(t={}),t.name="sprite",t.parseCallbacks=Ll,t.createGameObject=wl(t.createGameObject),this.addGameObjectManager(t,Tl)},Il=function(t,e){return 2===t.length&&t[0]===e},Dl=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).add(...i)},jl=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).remove(...i)},Al=function(t){this.getGameObjectManager(t).removeAll()},zl=function(t){var e,i,s,r;[e,i,s,...r]=t;var n=`${e}.${s}`;if(this.emit(n,i,...r),!(this.listenerCount(n)>0)){var a=this.getGameObjectManager(e);a.hasMethod(i,s)?a.call(i,s,...r):a.setProperty(i,s,r[0])}},Fl={to:!0,yoyo:!0,from:!0,toLeft:!0,toRight:!0,toUp:!0,toDown:!0,yoyoLeft:!0,yoyoRight:!0,yoyoUp:!0,yoyoDown:!0,fromLeft:!0,fromRight:!0,fromUp:!0,fromDown:!0},Yl=function(t){var e,i,s,r,n,a,o,h;[e,i,s,r,n,a,o,h]=t;var l=this.getGameObjectManager(e),d=l.getProperty(i,s);if("number"==typeof d){h.endsWith("Left")||h.endsWith("Up")?h.startsWith("to")||h.startsWith("yoyo")?r=d-r:h.startsWith("from")&&(l.setProperty(i,s,d-r),r=d):h.endsWith("Right")||h.endsWith("Down")?h.startsWith("to")||h.startsWith("yoyo")?r=d+r:h.startsWith("from")&&(l.setProperty(i,s,d+r),r=d):"from"===h&&(l.setProperty(i,s,r),r=d);var c=h.startsWith("yoyo");l.easeProperty(i,{property:s,value:r,duration:n,ease:a,repeat:o,yoyo:c})}};const Xl=[function(t,e,i){var s=i.name;e.on("+",(function(i,...r){if(!e.skipEventFlag){var n,a=i.split(".");Il(a,s)&&(n=a[1],Cr.call(t,`${s}.add`,Dl,[s,n,...r],t),e.skipEvent())}})).on("-",(function(i){if(!e.skipEventFlag){var r,n=i.split(".");Il(n,s)&&(r=n[1],Cr.call(t,`${s}.remove`,jl,[s,r],t),e.skipEvent())}}))},function(t,e,i){var s=i.name;e.on("-",(function(i){e.skipEventFlag||i===s&&(Cr.call(t,`${s}.removeall`,Al,s,t),e.skipEvent())}))},function(t,e,i){var s=i.name;e.on("+",(function(i,...r){if(!e.skipEventFlag){var n,a,o=i.split(".");(function(t,e){return 3===t.length&&t[0]===e})(o,s)&&(n=o[1],a=o[2],Cr.call(t,`${s}.call`,zl,[s,n,a,...r],t),e.skipEvent())}}))},function(t,e,i){var s=i.name;t.getGameObjectManager(s),e.on("+",(function(i,r,n,a,o){if(!e.skipEventFlag){var h,l,d,c=i.split(".");(function(t,e){return 4===t.length&&t[0]===e&&Fl[t[3]]})(c,s)&&(h=c[1],l=c[2],d=c[3],"number"==typeof a&&(o=a,a=void 0),Cr.call(t,`${s}.ease`,Yl,[s,h,l,r,n,a,o,d],t),e.skipEvent())}}))}],Wl=Go.addGameObjectManager;var Vl={addGameObjectManager(t,e){(t=t?Ge(t):{}).name||console.warn("[TextPlayer] Parameter 'name' is required in addGameObjectManager(config) method");var i=t.defaultLayer,s=t.createGameObject,r=this.layerManager;t.createGameObject=function(t,...e){var n=s.call(this,t,...e);return i&&r&&r.addToLayer(i,n),n},Wl.call(this,t,e);for(var n=t.parseCallbacks,a=0,o=(n=n?[...n,...Xl]:Xl).length;a0)return od.length=0,!0;return od.length=0,!1},od=[],hd=void 0;const ld=Phaser.Utils.Objects.GetValue;var dd=function(t,e,i){var s,r;for(var n in void 0===i&&(i={}),t)s=t[n],void 0!==(r=ld(e,n,s[1]))&&(i[s[0]]=r);return i},cd=function(t){t.addEventListener("touchstart",ud,!1),t.addEventListener("touchmove",ud,!1),t.addEventListener("touchend",ud,!1),t.addEventListener("mousedown",ud,!1),t.addEventListener("mouseup",ud,!1),t.addEventListener("mousemove",ud,!1)},ud=function(t){t.stopPropagation()},pd=function(){return this.close(),this.emit("keydown-ENTER",this.parent,this),this},gd=function(){this.isOpened=!0,this.initText(),this.enterCloseEnable&&this.scene.input.keyboard.once("keydown-ENTER",pd,this),this.scene.sys.events.on("postupdate",this.updateText,this),this.clickOutSideTarget?(ka.call(this.clickOutSideTarget,this.parent),Ca.call(this.clickOutSideTarget,this.parent),this.clickOutSideTarget.setInteractive().on("pointerdown",this.onClickOutside,this)):this.scene.input.on("pointerdown",this.onClickOutside,this),this.onOpenCallback&&this.onOpenCallback(this.parent,this),this.emit("open",this)},vd=function(){this.isOpened=!1,this.updateText(),this.enterCloseEnable&&this.scene.input.keyboard.off("keydown-ENTER",pd,this),this.scene.sys.events.off("postupdate",this.updateText,this),this.clickOutSideTarget?this.clickOutSideTarget.disableInteractive().off("pointerdown",this.onClickOutside,this):this.scene.input.off("pointerdown",this.onClickOutside,this),this.onCloseCallback&&this.onCloseCallback(this.parent,this),function(t){if(t){var e=t.parentElement;e&&e.removeChild(t)}}(this.node),this.node=void 0,this.emit("close",this)};const fd=Phaser.Utils.Objects.GetValue;var md=function(t,e){var i,s=fd(e,"inputType",void 0);void 0===s&&(s=fd(e,"type","text")),"textarea"===s?(i=document.createElement("textarea")).style.resize="none":(i=document.createElement("input")).type=s;var r=fd(e,"style",void 0),n=i.style;dd(sd,r,n),n.position="absolute",n.opacity=0,n.pointerEvents="none",n.zIndex=0,n.transform="scale(0)",dd(id,e,i),cd(i);var a=t.scene.sys.scale;return(a.isFullscreen?a.fullscreenTarget:document.body).appendChild(i),i.addEventListener("focus",(function(e){gd.call(t)})),i.addEventListener("blur",(function(e){vd.call(t)})),i},yd={open:function(){return this.isOpened||this.readOnly||((t=this)!==hd&&(void 0!==hd&&hd.close(),hd=t),this.node||(this.node=md(this,this.nodeConfig)),this.setFocus()),this;var t},close:function(){return this.isOpened?(this===hd&&(hd=void 0),this.setBlur(),this):this}};const bd=Phaser.Utils.Objects.GetValue;class xd extends Ba{constructor(t,e){super(t);var i=bd(e,"inputType",void 0);void 0===i&&(i=bd(e,"type","text")),this.setEnterCloseEnable(bd(e,"enterClose","textarea"!==i));var s=bd(e,"onOpen",void 0);s||(s=bd(e,"onFocus",void 0)),this.onOpenCallback=s,this.clickOutSideTarget=bd(e,"clickOutSideTarget",void 0);var r=bd(e,"onClose",void 0);r||(r=bd(e,"onBlur",void 0)),this.onCloseCallback=r,this.onUpdateCallback=bd(e,"onUpdate",void 0),this.isOpened=!1,t.on("pointerdown",(function(){this.open()}),this).setInteractive(),this.nodeConfig=function(t){void 0===t&&(t={});var e={};return rd(t,e,"inputType"),rd(t,e,"type"),rd(t,e,"style"),rd(t,e,sd),rd(t,e,id),e}(e),this.node=void 0}destroy(){this.close(),this.clickOutSideTarget&&this.clickOutSideTarget.destroy(),super.destroy()}onClickOutside(t){nd(this.parent,t)||this.close()}setEnterCloseEnable(t){return void 0===t&&(t=!0),this.enterCloseEnable=t,this}initText(){}updateText(){}get text(){return this.node?this.node.value:""}set text(t){this.node&&(this.node.value=t)}setText(t){return this.text=t,this}get maxLength(){return this.nodeConfig.maxLength}set maxLength(t){this.nodeConfig.maxLength=t,this.node&&(this.node.maxLength=t)}setMaxLength(t){return this.maxLength=t,this}get minLength(){return this.nodeConfig.minLength}set minLength(t){this.nodeConfig.minLength=t,this.node&&(this.node.minLength=t)}setMinLength(t){return this.minLength=t,this}get placeholder(){return this.node.placeholder}set placeholder(t){this.node&&(this.node.placeholder=t)}setPlaceholder(t){return this.placeholder=t,this}selectText(t,e){return this.node?(void 0===t?this.node.select():this.node.setSelectionRange(t,e),this):this}selectAll(){return this.selectText(),this}get selectionStart(){return this.node?this.node.selectionStart:0}get selectionEnd(){return this.node?this.node.selectionEnd:0}get selectedText(){if(!this.node)return"";var t=this.node;return t.value.substring(t.selectionStart,t.selectionEnd)}get cursorPosition(){return this.node?this.node.selectionStart:0}set cursorPosition(t){this.node&&this.node.setSelectionRange(t,t)}setCursorPosition(t){return void 0===t?t=this.text.length:t<0&&(t=this.text.length+t),this.cursorPosition=t,this}get tooltip(){return this.node?this.node.title:""}set tooltip(t){if(!this.node)return this;this.node.title=t}setTooltip(t){return this.tooltip=t,this}setTextChangedCallback(t){return this.onTextChanged=t,this}get readOnly(){return this.nodeConfig.readOnly}set readOnly(t){this.nodeConfig.readOnly=t,this.node&&(this.node.readOnly=t)}setReadOnly(t){return void 0===t&&(t=!0),this.readOnly=t,this}get spellCheck(){return this.node?this.node.spellcheck:""}set spellCheck(t){this.node&&(this.node.spellcheck=t)}setSpellCheck(t){return this.spellCheck=t,this}get fontColor(){if(this.node)return this.node.style.color}set fontColor(t){this.node&&(this.node.style.color=t)}setFontColor(t){return this.fontColor=t,this}setStyle(t,e){return this.node?(this.node.style[t]=e,this):this}getStyle(t){if(this.node)return this.node.style[t]}scrollToBottom(){return this.node?(this.node.scrollTop=this.node.scrollHeight,this):this}setEnabled(t){return this.node?(void 0===t&&(t=!0),this.node.disabled=!t,this):this}setBlur(){return this.node?(this.node.blur(),this):this}setFocus(){return this.node?(this.node.focus(),this):this}get isFocused(){return this.isOpened}}Object.assign(xd.prototype,yd);var Cd=function(t,e,i){t=t.replace(" ","");var s=i.previousText;if(t===s)return t;if(isNaN(t)){i.emit("nan",t,i),t=s;var r=i.cursorPosition-1;i.setText(t),i.setCursorPosition(r)}else i.previousText=t;return t},kd=function(t){var e=t.prevSelectionStart;if(null!==e){for(var i=t.prevSelectionEnd,s=t.parent,r=e;r=r&&h=i&&hi.length&&(t.prevCursorPosition=null),null!==t.prevCursorPosition&&(s=e.getCharChild(t.prevCursorPosition))&&("\n"===s.text&&s.clearTextSize(),e.emit("cursorout",s,t.prevCursorPosition,e)),null!=r&&(s=e.getCharChild(r))&&("\n"===s.text&&s.copyTextSize(e.lastInsertCursor),function(t){var e,i,s=t.parent,r=s.width,n=s.height,a=t.drawX,o=t.drawY,h=a+t.drawTLX,l=a+t.drawTRX,d=o+t.drawTLY,c=o+t.drawBLY;e=h<0?0-h:l>r?r-l:0,i=d<0?0-d:c>n?n-c:0,s._textOX+=e,s._textOY+=i}(s),e.emit("cursorin",s,r,e)),e.emit("movecursor",r,t.prevCursorPosition,e),t.prevCursorPosition=r)}(this)):(kd(this),wd(this)),this}setNumberInput(){return this.onUpdateCallback=Cd,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}};const Td=Phaser.Utils.Objects.GetValue,Od=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var Md=function(t,e){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return!0;if(-1!==e.indexOf(".")){for(var i=e.split("."),s=t,r=0;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,a=1/i.zoom,o=r/2,h=n/2,l=r*a,d=n*a;e.x===o&&e.y===h||e.setPosition(o,h),e.width===l&&e.height===d||e.setSize(l,d)}}}const Rd=Phaser.GameObjects.Zone;let Ld=class extends Rd{constructor(t){super(t,0,0,2,2),this.fullWindow=new _d(this)}};var Bd=function(t,e,i,s){if(void 0===i&&(i="."),void 0===s&&(s={}),!t)return s;if(e in t)return Object.assign(s,t[e]);for(var r in e+=i,t)r.startsWith(e)&&(s[r.replace(e,"")]=t[r]);return s},Id=function(){var t=this.scene.input.keyboard;this.textEdit.on("open",(function(){t.on("keydown-UP",this.cursorMoveUp,this).on("keydown-DOWN",this.cursorMoveDown,this)}),this).on("close",(function(){t.off("keydown-UP",this.cursorMoveUp,this).off("keydown-DOWN",this.cursorMoveDown,this)}),this)},Dd=function(t,e,i){if(void 0===i&&(i={}),Array.isArray(e))for(var s=0,r=e.length;st.length?i:t})),a.value=t.join(e)}else a.value=t.join(i.slice(o,o+a.count));o+=a.count,a.added||(h+=a.count)}}let l=e[a-1];return a>1&&"string"==typeof l.value&&(l.added||l.removed)&&t.equals("",l.value)&&(e[a-2].value+=l.value,e.pop()),e}Yd.prototype={diff(t,e,i={}){let s=i.callback;"function"==typeof i&&(s=i,i={}),this.options=i;let r=this;function n(t){return s?(setTimeout((function(){s(void 0,t)}),0),!0):t}t=this.castInput(t),e=this.castInput(e),t=this.removeEmpty(this.tokenize(t));let a=(e=this.removeEmpty(this.tokenize(e))).length,o=t.length,h=1,l=a+o;i.maxEditLength&&(l=Math.min(l,i.maxEditLength));let d=[{newPos:-1,components:[]}],c=this.extractCommon(d[0],e,t,0);if(d[0].newPos+1>=a&&c+1>=o)return n([{value:this.join(e),count:e.length}]);function u(){for(let s=-1*h;s<=h;s+=2){let h,l=d[s-1],c=d[s+1],u=(c?c.newPos:0)-s;l&&(d[s-1]=void 0);let p=l&&l.newPos+1=a&&u+1>=o)return n(Xd(r,h.components,e,t,r.useLongestToken));d[s]=h}else d[s]=void 0}var i;h++}if(s)!function t(){setTimeout((function(){if(h>l)return s();u()||t()}),0)}();else for(;h<=l;){let t=u();if(t)return t}},pushComponent(t,e,i){let s=t[t.length-1];s&&s.added===e&&s.removed===i?t[t.length-1]={count:s.count+1,added:e,removed:i}:t.push({count:1,added:e,removed:i})},extractCommon(t,e,i,s){let r=e.length,n=i.length,a=t.newPos,o=a-s,h=0;for(;a+1t,tokenize:t=>t.split(""),join:t=>t.join("")};const Wd=new Yd,Vd=/^[a-zA-Z\u{C0}-\u{FF}\u{D8}-\u{F6}\u{F8}-\u{2C6}\u{2C8}-\u{2D7}\u{2DE}-\u{2FF}\u{1E00}-\u{1EFF}]+$/u,Gd=/\S/,Hd=new Yd;Hd.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!Gd.test(t)&&!Gd.test(e)},Hd.tokenize=function(t){let e=t.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/);for(let t=0;tvoid 0===i?e:i}=this.options;return"string"==typeof t?t:JSON.stringify(Kd(t,null,null,i),i," ")},$d.equals=function(t,e){return Yd.prototype.equals.call($d,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const Jd=new Yd;Jd.tokenize=function(t){return t.slice()},Jd.join=Jd.removeEmpty=function(t){return t};const qd=Phaser.Utils.Array.Remove;var Zd=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),qd(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(h=i,l=e,Wd.diff(h,l,d)),r=0,n=0,a=s.length;nr)i+=a;else{if(s!==r)break;i+=Math.min(e.position,a)}}return i},sc={cursorMoveLeft(){if(!this.isOpened)return this;var t=tc(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=tc(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=ec(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=tc(ic(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=ec(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=tc(ic(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const rc=Phaser.Utils.Objects.IsPlainObject;class nc extends ln{constructor(t,e,i,s,r,n){rc(e)?n=e:rc(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(Md(e,"wrap.vAlign")||P(e,"wrap.vAlign",s=i?"center":"top"),Md(e,"wrap.wrapMode")||P(e,"wrap.wrapMode","char"),Md(e,"wrap.maxLines")||P(e,"wrap.maxLines",s=i?1:void 0),i&&P(e,"wrap.wrapWidth",1/0),Md(e,"wrap.useDefaultTextHeight")||P(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!Md(e.edit,"inputType")){var s=i?"text":"textarea";P(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new Ld(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var a=n.text;a&&delete n.text;var o=Bd(n.background,"focus"),h=Bd(n.style,"cursor"),l=Bd(n.style,"range");super(t,e,i,s,r,n),this.type="rexCanvasInput",this.contentWidth=void 0,this.contentHeight=void 0,this.lineHeight=void 0,this.linesCount=void 0,this.characterCountOfLines=[],this._text,this.textEdit=function(t,e){var i=Td(e,"edit");return void 0===i&&(i={}),rd(e,i,Od),new Pd(t,i)}(this,n),Id.call(this),n.focusStyle&&Object.assign(o,n.focusStyle),Fd.call(this,o),n.cursorStyle&&Object.assign(h,n.cursorStyle),Ad.call(this,h),n.rangeStyle&&Object.assign(l,n.rangeStyle),vn(l)&&Object.assign(l,h),zd.call(this,l);var d=n.onAddChar;d&&this.on("addchar",d);var c=n.onCursorIn;c&&this.on("cursorin",c);var u=n.onCursorOut;u&&this.on("cursorout",u);var p=!n.onRangeIn&&!n.onRangeOut,g=p?n.onCursorIn:n.onRangeIn;g&&this.on("rangein",g);var v=p?n.onCursorOut:n.onRangeOut;v&&this.on("rangeout",v);var f,m=n.onMoveCursor;m&&this.on("movecursor",m),this.setParseTextCallback(n.parseTextCallback),this.lastInsertCursor=((f=this.createCharChild("|")).text="",f),a||(a=""),this.setText(a)}addChild(t,e){if(super.addChild(t,e),Array.isArray(t))for(var i=t,s=0,r=i.length;s0,a=0,o=e.length;a0;this.dirty=this.dirty||this._radiusTL!==t||this._convexTL!==e,this._convexTL=e,this._radiusTL=Math.abs(t)}get radiusTR(){return this._radiusTR}set radiusTR(t){var e=t>0;this.dirty=this.dirty||this._radiusTR!==t||this._convexTR!==e,this._convexTR=e,this._radiusTR=Math.abs(t)}get radiusBL(){return this._radiusBL}set radiusBL(t){var e=t>0;this.dirty=this.dirty||this._radiusBL!==t||this._convexBL!==e,this._convexBL=e,this._radiusBL=Math.abs(t)}get radiusBR(){return this._radiusBR}set radiusBR(t){var e=t>0;this.dirty=this.dirty||this._radiusBR!==t||this._convexBR!==e,this._convexBR=e,this._radiusBR=Math.abs(t)}get radius(){return Math.max(this.radiusTL,this.radiusTR,this.radiusBL,this.radiusBR)}set radius(t){"number"==typeof t?(this.radiusTL=t,this.radiusTR=t,this.radiusBL=t,this.radiusBR=t):(this.radiusTL=qc(t,"tl",0),this.radiusTR=qc(t,"tr",0),this.radiusBL=qc(t,"bl",0),this.radiusBR=qc(t,"br",0))}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}get iterations(){return this._iterations}set iterations(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t}setIterations(t){return this.iterations=t,this}updateData(){var t=this.pathData;t.length=0;var e,i=this.width,s=this.height,r=this.iterations+1;return(e=this.radiusTL)>0?this._convexTL?Bt(e,e,e,e,180,270,!1,r,t):Bt(0,0,e,e,90,0,!0,r,t):Rt(0,0,t),(e=this.radiusTR)>0?this._convexTR?Bt(i-e,e,e,e,270,360,!1,r,t):Bt(i,0,e,e,180,90,!0,r,t):Rt(i,0,t),(e=this.radiusBR)>0?this._convexBR?Bt(i-e,s-e,e,e,0,90,!1,r,t):Bt(i,s,e,e,270,180,!0,r,t):Rt(i,s,t),(e=this.radiusBL)>0?this._convexBL?Bt(e,s-e,e,e,90,180,!1,r,t):Bt(0,s,e,e,360,270,!0,r,t):Rt(0,s,t),t.push(t[0],t[1]),Bc(this.x,this.y,t),super.updateData(),this}}const Qc=Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlpha;var tu={buildShapes(){this.addShape((new Zc).setName("box")).addShape((new Kc).setName("checker"))},updateShapes(){var t=this.width/2,e=this.height/2,i=Math.min(t,e),s=2*i,r=t-i,n=e-i,a=this.boxLineWidth,o=Math.max(s/10,2),h=this.getShape("box"),l=this.getShape("checker");if(this.isSizeChanged){var d=s*(1-this.boxSize)/2,c=a/2,u=s*this.boxSize-a;h.setTopLeftPosition(r+c+d,n+c+d).setSize(u,u),this.isCircleShape?h.setRadius(u/2):h.setRadius(0),d=s*(1-this.checkerSize)/2;var p=s*this.checkerSize/4,g=1*p,v=2*p,f=3*p;l.startAt(g,v).lineTo(v,f).lineTo(f,g).offset(r+d,n+d).end()}this.checked?(h.fillStyle(this.boxFillColor,this.boxFillAlpha).lineStyle(a,this.boxStrokeColor,this.boxStrokeAlpha),l.lineStyle(o,this.checkerColor)):(h.fillStyle(this.uncheckedBoxFillColor,this.uncheckedBoxFillAlpha).lineStyle(a,this.uncheckedBoxStrokeColor,this.uncheckedBoxStrokeAlpha),l.lineStyle()),this.checked&&l.setDisplayPathSegment(this.checkerAnimProgress)}};const eu=Phaser.Utils.Objects.GetValue,iu=Phaser.Math.Linear;class su extends Za{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=eu(t,"key","value");var i=e[this.propertyKey];return this.fromValue=eu(t,"from",i),this.toValue=eu(t,"to",i),this.setEase(eu(t,"ease",this.ease)),this.setDuration(eu(t,"duration",this.duration)),this.setRepeat(eu(t,"repeat",0)),this.setDelay(eu(t,"delay",0)),this.setRepeatDelay(eu(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=iu(this.fromValue,this.toValue,i)}}var ru={setCheckerAnimationDuration(t){return void 0===t&&(t=0),this.checkerAnimDuration=t,this},playCheckerAnimation(){return void 0===this.checkerAnimProgressTask&&(this.checkerAnimProgressTask=new su(this,{eventEmitter:null})),this.checkerAnimProgressTask.restart({key:"checkerAnimProgress",from:0,to:1,duration:this.checkerAnimDuration}),this},stopCheckerAnimation(){return void 0===this.checkerAnimProgressTask||this.checkerAnimProgressTask.stop(),this}},nu={};Object.assign(nu,mc,yc,tu,ru);const au=23730,ou=Phaser.Utils.Objects.GetValue,hu=Phaser.Utils.Objects.IsPlainObject;class lu extends fc{constructor(t,e,i,s,r,n,a){hu(e)?(e=ou(a=e,"x",0),i=ou(a,"y",0),s=ou(a,"width",2),r=ou(a,"height",2),n=ou(a,"color",au)):hu(n)&&(n=ou(a=n,"color",au)),super(t,e,i,s,r),this.type="rexCheckbox",void 0===n&&(n=au),this.setBoxShape(ou(a,"circleBox",!1)),this.setBoxFillStyle(n,ou(a,"boxFillAlpha",1)),this.setUncheckedBoxFillStyle(ou(a,"uncheckedColor",null),ou(a,"uncheckedBoxFillAlpha",1)),this.setBoxStrokeStyle(ou(a,"boxLineWidth",4),ou(a,"boxStrokeColor",n),ou(a,"boxStrokeAlpha",1)),this.setUncheckedBoxStrokeStyle(this.boxLineWidth,ou(a,"uncheckedBoxStrokeColor",this.boxStrokeColor),ou(a,"uncheckedBoxStrokeAlpha",this.boxStrokeAlpha)),this.setCheckerStyle(ou(a,"checkerColor",16777215),ou(a,"checkerAlpha",1)),this.setBoxSize(ou(a,"boxSize",1)),this.setCheckerSize(ou(a,"checkerSize",1)),this.setCheckerAnimationDuration(ou(a,"animationDuration",150)),this.buildShapes();var o=ou(a,"checked");void 0===o&&(o=ou(a,"value",!1)),this.setValue(o)}get value(){return this._value}set value(t){t=!!t,this._value!==t&&(this.dirty=!0,this._value=t,t?this.playCheckerAnimation():this.stopCheckerAnimation(),this.emit("valuechange",t))}setValue(t){return this.value=t,this}toggleValue(){return this.setValue(!this.value),this}get checked(){return this.value}set checked(t){this.value=t}setChecked(t){return void 0===t&&(t=!0),this.setValue(t),this}toggleChecked(){return this.toggleValue(),this}get checkerAnimProgress(){return this._checkerAnimProgress}set checkerAnimProgress(t){this._checkerAnimProgress!==t&&(this._checkerAnimProgress=t,this.dirty=!0)}}Object.assign(lu.prototype,nu);const du=Phaser.Utils.Objects.GetValue;class cu extends Ba{constructor(t,e){super(t,e),this._enable=void 0,t.setInteractive(du(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.isDown=!1,this.isOver=!1,this.setEnable(du(t,"enable",!0)),this.setMode(du(t,"mode",1)),this.setClickInterval(du(t,"clickInterval",100)),this.setDragThreshold(du(t,"threshold",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPress,this),t.on("pointerup",this.onRelease,this),t.on("pointerout",this.onPointOut,this),t.on("pointermove",this.onMove,this),t.on("pointerover",this.onOver,this),t.on("pointerout",this.onOut,this)}shutdown(t){this.isShutdown||(this.pointer=null,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=uu[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}onPress(t,e,i,s){void 0===this.pointer&&(this.pointer=t,this.isDown=!0,this.emit("down",this,this.parent,t,s),0===this.mode&&this.click(t.downTime,t,s))}onRelease(t,e,i,s){this.pointer===t&&(this.isDown=!1,this.emit("up",this,this.parent,t,s),1===this.mode&&this.click(t.upTime,t,s),this.pointer=void 0)}onPointOut(t,e){this.pointer===t&&this.cancel()}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&t.getDistance()>=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const uu={press:0,pointerdown:0,release:1,pointerup:1},pu=Phaser.Utils.Objects.GetValue,gu=Phaser.Utils.Objects.IsPlainObject;class vu extends lu{constructor(t,e,i,s,r,n,a){gu(e)?(e=pu(a=e,"x",0),i=pu(a,"y",0),s=pu(a,"width",2),r=pu(a,"height",2),n=pu(a,"color",au)):gu(n)&&(n=pu(a=n,"color",au)),super(t,e,i,s,r,n,a),this._click=new cu(this,pu(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(pu(a,"readOnly",!1))}get readOnly(){return!this._click.enable}set readOnly(t){this._click.enable=!t}setReadOnly(t){return void 0===t&&(t=!0),this.readOnly=t,this}}t.register("checkbox",(function(t,e,i,s,r,n){var a=new vu(this.scene,t,e,i,s,r,n);return this.scene.add.existing(a),a})),P(window,"RexPlugins.UI.Checkbox",vu);var fu={setTrackFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.trackFillColor!==t||this.trackFillAlpha!==e,this.trackFillColor=t,this.trackFillAlpha=e,this},setFalseValueTrackFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.falseValueTrackColor!==t||this.uncheckedTrackFillAlpha!==e,this.falseValueTrackColor=t,this.falseValueTrackFillAlpha=e,this},setThumbStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.thumbColor!==t||this.checkAlpha!==e,this.thumbColor=t,this.thumbAlpha=e,this}},mu={setTrackSize(t,e){return this.dirty=this.dirty||this.trackWidth!==t||this.trackHeight!==e,this.trackWidth=t,this.trackHeight=e,this},setTrackRadius(t){return this.dirty=this.dirty||this.trackRadius!==t,this.trackRadius=t,this},setThumbSize(t,e){return void 0===e&&(e=t),this.dirty=this.dirty||this.thumbWidth!==t||this.thumbHeight!==e,this.thumbWidth=t,this.thumbHeight=e,this},setThumbRadius(t){return this.dirty=this.dirty||this.thumbRadius!==t,this.thumbRadius=t,this}},yu={setThumbPosition(t,e){return void 0===e&&(e=1-t),this.thumbLeftX=t,this.thumbRightX=e,this},setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}},bu=function(t,e,i){return(e-t)*i+t};const xu=Phaser.Math.Linear;var Cu={buildShapes(){this.addShape((new Zc).setName("track")).addShape((new Zc).setName("thumb"))},updateShapes(){var t=this.width,e=this.height,i=this.value?this.toggleAnimProgress:1-this.toggleAnimProgress,s=this.getShape("track");if(this.isSizeChanged){var r=t*this.trackWidth,n=e*this.trackHeight,a=(t-r)/2,o=(e-n)/2,h=e*this.trackRadius;s.setTopLeftPosition(a,o).setSize(r,n).setRadius(h)}var l,d,c,u=(l=this.falseValueTrackColor,d=this.trackFillColor,c=i,(255&bu(yn(l),yn(d),c))<<16|(255&bu(bn(l),bn(d),c))<<8|255&bu(xn(l),xn(d),c)),p=xu(this.falseValueTrackFillAlpha,this.trackFillAlpha,i);s.fillStyle(u,p);var g=this.getShape("thumb");if(this.isSizeChanged){var v=t*this.thumbWidth,f=e*this.thumbHeight,m=e*this.thumbRadius;g.setSize(v,f).setRadius(m)}var y=xu(this.thumbLeftX,this.thumbRightX,i)*t;this.rtl&&(y=t-y);var b=e/2;g.setCenterPosition(y,b),g.fillStyle(this.thumbColor,this.thumbAlpha)}},ku={setToggleAnimationDuration(t){return void 0===t&&(t=0),this.toggleAnimDuration=t,this},playToggleAnimation(){return void 0===this.toggleAnimProgressTask&&(this.toggleAnimProgressTask=new su(this,{eventEmitter:null})),this.toggleAnimProgressTask.restart({key:"toggleAnimProgress",from:0,to:1,duration:this.toggleAnimDuration}),this},stopToggleAnimation(){return void 0===this.toggleAnimProgressTask||this.toggleAnimProgressTask.stop(),this}},wu={};Object.assign(wu,fu,mu,yu,Cu,ku);const Su=Phaser.Utils.Objects.GetValue,Pu=Phaser.Utils.Objects.IsPlainObject,Tu=23730;class Ou extends fc{constructor(t,e,i,s,r,n,a){Pu(e)?(e=Su(a=e,"x",0),i=Su(a,"y",0),s=Su(a,"width",2),r=Su(a,"height",2),n=Su(a,"color",Tu)):Pu(n)&&(n=Su(a=n,"color",Tu)),super(t,e,i,s,r),this.type="rexToggleSwitch",void 0===n&&(n=Tu),this.setTrackFillStyle(n,Su(a,"trackFillAlpha",1)),this.setFalseValueTrackFillStyle(Su(a,"falseValueTrackColor",function(t){var e=.3*yn(t)+.59*bn(t)+.11*xn(t);return(255&e)<<16|(255&e)<<8|255&e}(n)),Su(a,"falseValueTrackFillAlpha",1)),this.setThumbStyle(Su(a,"thumbColor",16777215),Su(a,"thumbAlpha",1)),this.setTrackSize(Su(a,"trackWidth",.9),Su(a,"trackHeight",.5)),this.setTrackRadius(Su(a,"trackRadius",.5*this.trackHeight));var o=Su(a,"thumbHeight",void 0),h=Su(a,"thumbWidth",o);void 0===h&&(h=.9*this.trackHeight),this.setThumbSize(h,o),this.setThumbRadius(Su(a,"thumbRadius",.5*this.thumbHeight)),this.setThumbPosition(Su(a,"thumbLeft",.3),Su(a,"thumbRight",void 0)),this.setRTL(Su(a,"rtl",!1)),this.setToggleAnimationDuration(Su(a,"animationDuration",150)),this.buildShapes(),this.setValue(Su(a,"value",!1),0)}get value(){return this._value}set value(t){t=!!t,this._value!==t&&(this.dirty=!0,this._value=t,this.playToggleAnimation(),this.emit("valuechange",t))}setValue(t,e){void 0===e&&(e=this.toggleAnimDuration);var i=this.toggleAnimDuration;return this.toggleAnimDuration=e,this.value=t,this.toggleAnimDuration=i,this}toggleValue(t){return this.setValue(!this.value,t),this}get toggleAnimProgress(){return this._toggleAnimProgress}set toggleAnimProgress(t){this._toggleAnimProgress!==t&&(this._toggleAnimProgress=t,this.dirty=!0)}}Object.assign(Ou.prototype,wu);const Mu=Phaser.Utils.Objects.GetValue;class Eu extends Ou{constructor(t,e,i,s,r,n,a){super(t,e,i,s,r,n,a),this._click=new cu(this,Mu(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(Mu(a,"readOnly",!1))}get readOnly(){return!this._click.enable}set readOnly(t){this._click.enable=!t}setReadOnly(t){return void 0===t&&(t=!0),this.readOnly=t,this}}t.register("toggleSwitch",(function(t,e,i,s,r,n){var a=new Eu(this.scene,t,e,i,s,r,n);return this.scene.add.existing(a),a})),P(window,"RexPlugins.UI.ToggleSwitch",Eu);var _u={loadFromURL(t,e){var i=this,s=new Image;return s.onload=function(){i.width!==s.width||i.height!==s.height?i.resize(s.width,s.height):i.clear(),i.context.drawImage(s,0,0),i.updateTexture(),e&&e(),s.onload=null,s.src="",s.remove()},s.src=t,this},loadFromURLPromise(t){var e=this;return new Promise((function(i,s){e.loadFromURL(t,i)}))},loadFromFile(t,e){var i=URL.createObjectURL(t);return this.loadFromURL(i,(function(){URL.revokeObjectURL(i),e&&e()})),this},loadFromFilePromise(t){var e=this;return new Promise((function(i,s){e.loadFromFile(t,i)}))}};class Ru extends $t{}Object.assign(Ru.prototype,_u),t.register("canvas",(function(t,e,i,s){var r=new Ru(this.scene,t,e,i,s);return this.scene.add.existing(r),r})),P(window,"RexPlugins.UI.Canvas",Ru);const Lu=Phaser.Utils.Objects.GetValue;class Bu extends $t{constructor(t,e,i,s,r,n){super(t,e,i),this.type="rexCircleMaskImage",this.setTexture(s,r,n)}setTexture(t,e,i){"object"==typeof e&&(i=e,e=void 0),"string"==typeof i&&(i={maskType:i});var s=Lu(i,"maskType",0),r=Lu(i,"backgroundColor",void 0),n=Lu(i,"strokeColor",void 0),a=Lu(i,"strokeWidth",null!=n?10:0);if(void 0===s?s=0:"string"==typeof s&&(s=Iu[s]),this._textureKey=t,this._frameName=e,null===s)return this.loadTexture(t,e),this.dirty=!0,this;var o=this.scene.sys.textures.getFrame(t,e);if(!o)return this;o.cutWidth!==this.width||o.cutHeight!==this.height?this.setCanvasSize(o.cutWidth,o.cutHeight):this.clear();var h=this.canvas,l=this.context,d=h.width,c=h.height;null!=r&&(l.fillStyle=r,l.fillRect(0,0,d,c)),l.save(),l.beginPath();var u=a/2;switch(s){case 1:var p=(m=Math.floor(d/2))-u,g=(y=Math.floor(c/2))-u;l.ellipse(m,y,p,g,0,0,2*Math.PI);break;case 2:var v=Lu(i,"radius",0),f=Lu(i,"iteration",void 0);Qt(l,u,u,d-a,c-a,v,f);break;default:var m=Math.floor(d/2),y=Math.floor(c/2),b=Math.min(m,y)-u;l.arc(m,y,b,0,2*Math.PI)}return null!=n&&(l.strokeStyle=n,l.lineWidth=a,l.stroke()),l.clip(),this.loadTexture(t,e),l.restore(),this.dirty=!0,this}resize(t,e){return this.setDisplaySize(t,e),this}}const Iu={circle:0,ellipse:1,roundRectangle:2};t.register("circleMaskImage",(function(t,e,i,s,r){var n=new Bu(this.scene,t,e,i,s,r);return this.scene.add.existing(n),n})),P(window,"RexPlugins.UI.CircleMaskImage",Bu);const Du=Phaser.Utils.Objects.GetValue;class ju extends $t{constructor(t,e,i,s,r,n){super(t,e,i),this.type="rexAlphaMaskImage",this.maskFrame=null,this.setTexture(s,r,n)}setTexture(t,e,i){"object"==typeof e&&(i=e,e=void 0),"string"==typeof i&&(i={mask:{key:i}});var s=Du(i,"mask.key"),r=Du(i,"mask.frame"),n=Du(i,"mask.invertAlpha",!1),a=Du(i,"mask.scale"),o=Du(i,"backgroundColor");if(s){this._maskKey=s,this._maskFrame=r,this._maskScale=a;var h=s?this.scene.sys.textures.get(s):null;this.maskFrame=h?h.get(r):null}this._textureKey=t,this._frameName=e;var l=this.maskFrame;if(null===l)return this.loadTexture(t,e),this.dirty=!0,this;var d=null!=o;this.loadTexture(t,e);var c,u,p=this.canvas,g=this.context,v=p.width,f=p.height;g.save(),g.globalCompositeOperation=n?"destination-out":"destination-in",null!=this._maskScale?(c=l.cutWidth*this._maskScale,u=l.cutHeight*this._maskScale):(c=v,u=f);var m=(v-c)/2,y=(f-u)/2;return this.drawFrame(this._maskKey,this._maskFrame,m,y,c,u),g.restore(),d&&(g.save(),g.globalCompositeOperation="destination-over",g.fillStyle=o,g.fillRect(0,0,v,f),g.restore()),this.dirty=!0,this}resize(t,e){return this.setDisplaySize(t,e),this}}t.register("alphaMaskImage",(function(t,e,i,s,r){var n=new ju(this.scene,t,e,i,s,r);return this.scene.add.existing(n),n})),P(window,"RexPlugins.UI.AlphaMaskImage",ju);const Au=Phaser.Math.Linear,zu=Phaser.Math.Percent;var Fu={setValue(t,e,i){return null==t||(void 0!==e&&(t=zu(t,e,i)),this.value=t),this},addValue(t,e,i){return void 0!==e&&(t=zu(t,e,i)),this.value+=t,this},getValue(t,e){var i=this.value;return void 0!==t&&(i=Au(t,e,i)),i}};const Yu=Phaser.Math.Percent;var Xu={setEaseValuePropName:function(t){return this.easeValuePropName=t,this},setEaseValueDuration:function(t){return this.easeValueDuration=t,this},setEaseValueFunction:function(t){return this.easeFunction=t,this},stopEaseValue:function(){return this.easeValueTask&&this.easeValueTask.stop(),this},easeValueTo:function(t,e,i){return null==t||(void 0!==e&&(t=Yu(t,e,i)),void 0===this.easeValueTask&&(this.easeValueTask=new su(this,{eventEmitter:null})),this.easeValueTask.restart({key:this.easeValuePropName,to:t,duration:this.easeValueDuration,ease:this.easeFunction})),this},easeValueRepeat:function(t,e,i,s){return void 0===i&&(i=-1),void 0===s&&(s=0),void 0===this.easeValueTask&&(this.easeValueTask=new su(this,{eventEmitter:null})),this.easeValueTask.restart({key:this.easeValuePropName,from:t,to:e,duration:this.easeValueDuration,ease:this.easeFunction,repeat:i,repeatDelay:s}),this}};const Wu=Phaser.Utils.Objects.GetValue,Vu=Phaser.Math.Clamp;function Gu(t){class e extends t{bootProgressBase(t){this.eventEmitter=Wu(t,"eventEmitter",this);var e=Wu(t,"valuechangeCallback",null);if(null!==e){var i=Wu(t,"valuechangeCallbackScope",void 0);this.eventEmitter.on("valuechange",e,i)}return this.setEaseValuePropName("value").setEaseValueDuration(Wu(t,"easeValue.duration",0)).setEaseValueFunction(Wu(t,"easeValue.ease","Linear")),this}get value(){return this._value}set value(t){t=Vu(t,0,1);var e=this._value,i=e!=t;this.dirty=this.dirty||i,this._value=t,i&&this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter)}}return Object.assign(e.prototype,Fu,Xu),e}const Hu=Phaser.Math.RadToDeg,Uu=Phaser.Math.DegToRad;var Nu=function(t,e,i,s,r,n,a,o){var h=360===Math.abs(a-n),l=Uu(n),d=Uu(a),c=Math.cos(l),u=Math.sin(l),p=Math.cos(d),g=Math.sin(d);return t.startAt(e+c*s,i+u*s),t.arc(e,i,s,n,a,o),h&&0===r||(t.lineTo(e+p*r,i+g*r),r>0&&t.arc(e,i,r,a,n,!o)),t.close(),t},$u={buildShapes(){var t=this.iterations;this.addShape((new Kc).setIterations(t).setName("track")).addShape((new Kc).setIterations(t).setName("bar")).addShape((new Pc).setIterations(t).setName("center"))},updateShapes(){var t=this.radius,e=this.thickness*this.radius,i=this.radius,s=i-e,r=this.getShape("track");null!=this.trackColor&&this.thickness>0?(r.fillStyle(this.trackColor),Nu(r,t,t,i,s,0,360,!1)):r.reset();var n,a,o,h=this.getShape("bar");null!=this.barColor&&this.thickness>0?(1===this.value?(n=!1,a=0,o=360):(n=this.anticlockwise,a=Hu(this.startAngle),o=360*(n?1-this.value:this.value)+a),h.fillStyle(this.barColor),Nu(h,t,t,i+1,s-1,a,o,!1)):h.reset();var l=this.getShape("center");this.centerColor&&s>0?l.setCenterPosition(t,t).setRadius(s).fillStyle(this.centerColor):l.reset()}};const Ku=Phaser.Utils.Objects.GetValue,Ju=Phaser.Utils.Objects.IsPlainObject,qu=Phaser.Math.Clamp,Zu=Phaser.Math.DegToRad(270);let Qu=class extends(Gu(fc)){constructor(t,e,i,s,r,n,a){Ju(e)&&(e=Ku(a=e,"x",0),i=Ku(a,"y",0),s=Ku(a,"radius",1),r=Ku(a,"barColor",void 0),n=Ku(a,"value",0)),void 0===s&&(s=1);var o=2*s;super(t,e,i,o,o),this.type="rexCircularProgress",this.bootProgressBase(a),this.setRadius(s),this.setTrackColor(Ku(a,"trackColor",void 0)),this.setBarColor(r),this.setCenterColor(Ku(a,"centerColor",void 0)),this.setThickness(Ku(a,"thickness",.2)),this.setStartAngle(Ku(a,"startAngle",Zu)),this.setAnticlockwise(Ku(a,"anticlockwise",!1)),this.iterations=Ku(a,"iterations",128),this.buildShapes(),this.setValue(n)}resize(t,e){return(t=Math.floor(Math.min(t,e)))===this.width||(super.resize(t,t),this.setRadius(t/2)),this}get radius(){return this._radius}set radius(t){this.dirty=this.dirty||this._radius!=t,this._radius=t;var e=2*t;this.resize(e,e)}setRadius(t){return this.radius=t,this}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get startAngle(){return this._startAngle}set startAngle(t){this.dirty=this.dirty||this._startAngle!=t,this._startAngle=t}setStartAngle(t){return this.startAngle=t,this}get anticlockwise(){return this._anticlockwise}set anticlockwise(t){this.dirty=this.dirty||this._anticlockwise!=t,this._anticlockwise=t}setAnticlockwise(t){return void 0===t&&(t=!0),this.anticlockwise=t,this}get thickness(){return this._thickness}set thickness(t){t=qu(t,0,1),this.dirty=this.dirty||this._thickness!=t,this._thickness=t}setThickness(t){return this.thickness=t,this}get centerColor(){return this._centerColor}set centerColor(t){this.dirty=this.dirty||this._centerColor!=t,this._centerColor=t}setCenterColor(t){return this.centerColor=t,this}};Object.assign(Qu.prototype,$u),t.register("circularProgress",(function(t,e,i,s,r,n){var a=new Qu(this.scene,t,e,i,s,r,n);return this.scene.add.existing(a),a})),P(window,"RexPlugins.UI.CircularProgress",Qu);var tp=function(t,e,i,s,r,n,a,o,h,l,d,c){void 0===l&&(l=0),void 0===d&&(d=2*Math.PI),void 0===c&&(c=!1),e.beginPath(),e.ellipse(i,s,r,n,0,l,d,c),null!=a&&(e.fillStyle=a,e.fill()),null!=o&&(e.strokeStyle=o,e.lineWidth=h,e.stroke())};const ep=Phaser.Math.PI2;var ip=function(){var t,e=this.radius,i=this.thickness*this.radius,s=this.radius-i/2,r=this.radius-i,n=(this.canvas,this.context),a=this.anticlockwise,o=this.startAngle,h=this.endAngle,l=this._deltaAngle;if(this.trackColor&&i>0&&(n.save(),tp(0,n,e,e,s,s,void 0,this.trackColor,i,o,h,a),n.restore()),this.barColor&&s>0){var d,c;if(d=this.value>=1?h:a?(o-l*this.value+ep)%ep:(o+l*this.value)%ep,n.save(),this.barColor2){var u=e+s*Math.cos(o),p=e+s*Math.sin(o),g=e+s*Math.cos(d),v=e+s*Math.sin(d),f=n.createLinearGradient(u,p,g,v);f.addColorStop(0,this.barColor2),f.addColorStop(1,this.barColor),c=f}else c=this.barColor;tp(0,n,e,e,s,s,void 0,c,i,o,d,a),n.restore()}this.centerColor&&r>0&&(this.centerColor2?((t=this.context.createRadialGradient(e,e,0,e,e,r)).addColorStop(0,this.centerColor),t.addColorStop(1,this.centerColor2)):t=this.centerColor,n.save(),tp(0,n,e,e,r,r,t),n.restore()),this.textFormatCallback&&(this.textColor||this.textStrokeColor)&&(n.save(),function(t,e,i,s,r,n,a,o,h,l,d){void 0===h&&null!=o&&(h=2),void 0===l&&(l="start"),void 0===d&&(d="alphabetic"),e.font=n,e.textAlign=l,e.textBaseline=d,e.fillStyle=a,e.strokeStyle=o,e.lineWidth=h,e.lineCap="round",e.lineJoin="round",null!=o&&"none"!==o&&h>0&&e.strokeText(r,i,s),null!=a&&"none"!==a&&e.fillText(r,i,s)}(0,n,e,e,this.getFormatText(),this.textFont,this.textColor,this.textStrokeColor,this.textStrokeThickness,"center","middle"),n.restore())};const sp=Phaser.Utils.Objects.GetValue,rp=Phaser.Utils.Objects.IsPlainObject,np=Phaser.Math.Clamp,ap=Phaser.Math.DegToRad(270),op=Phaser.Math.PI2;class hp extends(Gu($t)){constructor(t,e,i,s,r,n,a){rp(e)&&(e=sp(a=e,"x",0),i=sp(a,"y",0),s=sp(a,"radius",1),r=sp(a,"barColor",void 0),n=sp(a,"value",0));var o=2*s;super(t,e,i,o,o,sp(a,"resolution",1)),this.type="rexCircularProgressCanvas",this.bootProgressBase(a),this.setRadius(s),this.setTrackColor(sp(a,"trackColor",void 0)),this.setBarColor(r),this.setBarColor2(sp(a,"barColor2",void 0)),this.setCenterColor(sp(a,"centerColor",void 0)),this.setThickness(sp(a,"thickness",.2)),this.setStartAngle(sp(a,"startAngle",ap)),this.setEndAngle(sp(a,"endAngle",this.startAngle+op)),this.setAnticlockwise(sp(a,"anticlockwise",!1)),this.setTextColor(sp(a,"textColor",void 0)),this.setTextStrokeColor(sp(a,"textStrokeColor",void 0),sp(a,"textStrokeThickness",void 0));var h=sp(a,"textFont",void 0);h?this.setTextFont(h):this.setTextFont(sp(a,"textSize","16px"),sp(a,"textFamily","Courier"),sp(a,"textStyle","")),this.setTextFormatCallback(sp(a,"textFormatCallback",void 0),sp(a,"textFormatCallbackScope",void 0)),this.setValue(n)}resize(t,e){return(t=Math.floor(Math.min(t,e)))===this.width||(super.resize(t,t),this.setRadius(t/2)),this}get radius(){return this._radius}set radius(t){this.dirty=this.dirty||this._radius!=t,this._radius=t;var e=2*t;this.resize(e,e)}setRadius(t){return this.radius=t,this}get trackColor(){return this._trackColor}set trackColor(t){t=qt(t,this.canvas,this.context),this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get barColor(){return this._barColor}set barColor(t){t=qt(t,this.canvas,this.context),this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get barColor2(){return this._barColor2}set barColor2(t){t=qt(t,this.canvas,this.context),this.dirty=this.dirty||this._barColor2!=t,this._barColor2=t}setBarColor2(t){return this.barColor2=t,this}get startAngle(){return this._startAngle}set startAngle(t){this.dirty=this.dirty||this._startAngle!=t,this._startAngle=t,this._deltaAngle=lp(this._startAngle,this._endAngle,this._anticlockwise)}setStartAngle(t){return this.startAngle=t,this}get endAngle(){return this._endAngle}set endAngle(t){this.dirty=this.dirty||this._endAngle!=t,this._endAngle=t,this._deltaAngle=lp(this._startAngle,this._endAngle,this._anticlockwise)}setEndAngle(t){return this.endAngle=t,this}get anticlockwise(){return this._anticlockwise}set anticlockwise(t){this.dirty=this.dirty||this._anticlockwise!=t,this._anticlockwise=t,this._deltaAngle=lp(this._startAngle,this._endAngle,this._anticlockwise)}setAnticlockwise(t){return void 0===t&&(t=!0),this.anticlockwise=t,this}get thickness(){return this._thickness}set thickness(t){t=np(t,0,1),this.dirty=this.dirty||this._thickness!=t,this._thickness=t}setThickness(t){return this.thickness=t,this}get centerColor(){return this._centerColor}set centerColor(t){t=qt(t,this.canvas,this.context),this.dirty=this.dirty||this._centerColor!=t,this._centerColor=t}get centerColor2(){return this._centerColor2}set centerColor2(t){t=qt(t,this.canvas,this.context),this.dirty=this.dirty||this._centerColor2!=t,this._centerColor2=t}setCenterColor(t,e){return this.centerColor=t,this.centerColor2=e,this}get textColor(){return this._textColor}set textColor(t){t=qt(t,this.canvas,this.context),this.dirty=this.dirty||this._textColor!=t,this._textColor=t}setTextColor(t){return this.textColor=t,this}get textStrokeColor(){return this._textStrokeColor}set textStrokeColor(t){t=qt(t,this.canvas,this.context),this.dirty=this.dirty||this._textStrokeColor!=t,this._textStrokeColor=t}get textStrokeThickness(){return this._textStrokeThickness}set textStrokeThickness(t){this.dirty=this.dirty||this._textStrokeThickness!=t,this._textStrokeThickness=t}setTextStrokeColor(t,e){return void 0===e&&(e=2),this.textStrokeColor=t,this.textStrokeThickness=e,this}get textFont(){return this._textFont}set textFont(t){this.dirty=this.dirty||this._textFont!=t,this._textFont=t}setTextFont(t,e,i){var s;return s=void 0===e?t:i+" "+t+" "+e,this.textFont=s,this}setTextFormatCallback(t,e){return this.textFormatCallback=t,this.textFormatCallbackScope=e,this}updateTexture(){return super.updateTexture((function(){this.clear(),ip.call(this)}),this),this}getFormatText(t){return void 0===t&&(t=this.value),this.textFormatCallbackScope?this.textFormatCallback(t):this.textFormatCallback.call(this.textFormatCallbackScope,t)}}var lp=function(t,e,i){return i?t<=e?op+t-e:t-e:t>=e?op+e-t:e-t};t.register("circularProgressCanvas",(function(t,e,i,s,r,n){var a=new hp(this.scene,t,e,i,s,r,n);return this.scene.add.existing(a),a})),P(window,"RexPlugins.UI.CircularProgressCanvas",hp);var dp=function(t,e,i,s,r,n){var a=(e+s)/2;return n>=0?t.startAt(a+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(a+n,i):t.startAt(a,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(a,i),t.close(),t};const cp=Phaser.Utils.Objects.GetValue,up=Phaser.Utils.Objects.IsPlainObject;let pp=class extends(Gu(fc)){constructor(t,e,i,s,r,n,a,o){up(e)?(e=(o=e).x,i=o.y,s=o.width,r=o.height,n=o.barColor,a=o.value):up(s)?(s=(o=s).width,r=o.height,n=o.barColor,a=o.value):up(n)&&(n=(o=n).barColor,a=o.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===a&&(a=0),super(t,e,i,s,r,o),this.type="rexLineProgress",this.bootProgressBase(o),this.addShape((new Kc).setName("trackFill")).addShape((new Kc).setName("bar")).addShape((new Kc).setName("trackStroke")),this.setTrackColor(cp(o,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(cp(o,"trackStrokeThickness",2),cp(o,"trackStrokeColor",void 0)),this.setSkewX(cp(o,"skewX",0)),this.setRTL(cp(o,"rtl",!1)),this.setValue(a)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}};var gp={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&dp(s,0,0,e,i,t);var r,n,a=this.getShape("bar");a.fillStyle(this.barColor),a.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),dp(a,r,0,n,i,t));var o=this.getShape("trackStroke");o.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),o.isStroked&&dp(o,0,0,e,i,t)}};Object.assign(pp.prototype,gp),t.register("lineProgress",(function(t,e,i,s,r,n,a){var o=new pp(this.scene,t,e,i,s,r,n,a);return this.scene.add.existing(o),o})),P(window,"RexPlugins.UI.LineProgress",pp);var vp=function(t,e,i,s,r){t.setIterations(r).start();var n=s.tl;if(_t(n))if(n.convex){var a=n.x,o=n.y;t.ellipticalArc(a,o,n.x,n.y,180,270,!1)}else a=0,o=0,t.ellipticalArc(a,o,n.x,n.y,90,0,!0);else t.lineTo(0,0);return n=s.tr,_t(n)?n.convex?(a=e-n.x,o=n.y,t.ellipticalArc(a,o,n.x,n.y,270,360,!1)):(a=e,o=0,t.ellipticalArc(a,o,n.x,n.y,180,90,!0)):t.lineTo(e,0),n=s.br,_t(n)?n.convex?(a=e-n.x,o=i-n.y,t.ellipticalArc(a,o,n.x,n.y,0,90,!1)):(a=e,o=i,t.ellipticalArc(a,o,n.x,n.y,270,180,!0)):t.lineTo(e,i),n=s.bl,_t(n)?n.convex?(a=n.x,o=i-n.y,t.ellipticalArc(a,o,n.x,n.y,90,180,!1)):(a=0,o=i,t.ellipticalArc(a,o,n.x,n.y,360,270,!0)):t.lineTo(0,i),t.close(),t},fp=Phaser.Math.RadToDeg,mp=function(t,e,i,s,r){var n=e*r,a=s.tl;if(_t(a)){l=n>a.x?90:fp(Math.acos((a.x-n)/a.x));var o=a.x,h=a.y;t.ellipticalArc(o,h,a.x,a.y,180,180+l,!1)}else t.lineTo(0,0);if(a=s.tr,_t(a)&&n>e-a.x){var l=90-fp(Math.acos((n-(e-a.x))/a.x));o=e-a.x,h=a.y,t.ellipticalArc(o,h,a.x,a.y,270,270+l,!1)}else t.lineTo(n,0);a=s.br,_t(a)&&n>e-a.x?(l=90-fp(Math.acos((n-(e-a.x))/a.x)),o=e-a.x,h=i-a.y,t.ellipticalArc(o,h,a.x,a.y,90-l,90,!1)):t.lineTo(n,i),a=s.bl,_t(a)?(l=n>a.x?90:fp(Math.acos((a.x-n)/a.x)),o=a.x,h=i-a.y,t.ellipticalArc(o,h,a.x,a.y,180-l,180,!1)):t.lineTo(0,i)},yp=Phaser.Math.RadToDeg,bp=function(t,e,i,s,r){var n=i*r,a=s.tl;if(_t(a)){l=n>a.y?90:yp(Math.acos((a.y-n)/a.y));var o=a.x,h=a.y;t.ellipticalArc(o,h,a.x,a.y,270-l,270,!1)}else t.lineTo(0,0);if(a=s.tr,_t(a)?(l=n>a.y?90:yp(Math.acos((a.y-n)/a.y)),o=e-a.x,h=a.y,t.ellipticalArc(o,h,a.x,a.y,270,270+l,!1)):t.lineTo(e,0),a=s.br,_t(a)&&n>i-a.y){var l=90-yp(Math.acos((n-(i-a.y))/a.y));o=e-a.x,h=i-a.y,t.ellipticalArc(o,h,a.x,a.y,0,0+l,!1)}else t.lineTo(e,n);a=s.bl,_t(a)&&n>i-a.y?(l=90-yp(Math.acos((n-(i-a.y))/a.y)),o=a.x,h=i-a.y,t.ellipticalArc(o,h,a.x,a.y,180-l,180,!1)):t.lineTo(0,n)},xp=Phaser.Math.RadToDeg,Cp=function(t,e,i,s,r){var n=e*r,a=s.tr;if(_t(a)){l=n>a.x?90:xp(Math.acos((a.x-n)/a.x));var o=e-a.x,h=a.y;t.ellipticalArc(o,h,a.x,a.y,360-l,360,!1)}else t.lineTo(e,0);if(a=s.br,_t(a)?(l=n>a.x?90:xp(Math.acos((a.x-n)/a.x)),o=e-a.x,h=i-a.y,t.ellipticalArc(o,h,a.x,a.y,0,0+l,!1)):t.lineTo(e,i),a=s.bl,_t(a)&&n>e-a.x){var l=90-xp(Math.acos((n-(e-a.x))/a.x));o=a.x,h=i-a.y,t.ellipticalArc(o,h,a.x,a.y,90,90+l,!1)}else t.lineTo(e-n,i);a=s.tl,_t(a)&&n>e-a.x?(l=90-xp(Math.acos((n-(e-a.x))/a.x)),o=a.x,h=a.y,t.ellipticalArc(o,h,a.x,a.y,270-l,270,!1)):t.lineTo(e-n,0)},kp=Phaser.Math.RadToDeg,wp=function(t,e,i,s,r){var n=i*r,a=s.br;if(_t(a)){l=n>a.y?90:kp(Math.acos((a.y-n)/a.y));var o=e-a.x,h=i-a.y;t.ellipticalArc(o,h,a.x,a.y,90-l,90,!1)}else t.lineTo(e,i);if(a=s.bl,_t(a)?(l=n>a.y?90:kp(Math.acos((a.y-n)/a.y)),o=a.x,h=i-a.y,t.ellipticalArc(o,h,a.x,a.y,90,90+l,!1)):t.lineTo(0,i),a=s.tl,_t(a)&&n>i-a.y){var l=90-kp(Math.acos((n-(i-a.y))/a.y));o=a.x,h=a.y,t.ellipticalArc(o,h,a.x,a.y,180,180+l,!1)}else t.lineTo(0,i-n);a=s.tr,_t(a)&&n>i-a.y?(l=90-kp(Math.acos((n-(i-a.y))/a.y)),o=e-a.x,h=a.y,t.ellipticalArc(o,h,a.x,a.y,360-l,360,!1)):t.lineTo(e,i-n)},Sp={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},Pp=function(t){return"string"==typeof t&&(t=Sp[t]),t};const Tp=Phaser.Utils.Objects.GetValue,Op=Phaser.Utils.Objects.IsPlainObject;class Mp extends(Gu(fc)){constructor(t,e,i,s,r,n,a,o,h){Op(e)?(e=(h=e).x,i=h.y,s=h.width,r=h.height,n=h.radius,a=h.barColor,o=h.value):Op(s)?(s=(h=s).width,r=h.height,n=h.radius,a=h.barColor,o=h.value):Op(n)&&(n=(h=n).radius,a=h.barColor,o=h.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=s),void 0===n&&(n=0),void 0===o&&(o=0),super(t,e,i,s,r,h),this.type="rexRoundRectangleProgress",this.rrGeom=new Tt,this.bootProgressBase(h),this.addShape((new Kc).setName("trackFill")).addShape((new Kc).setName("bar")).addShape((new Kc).setName("trackStroke")),this.setTrackColor(Tp(h,"trackColor",void 0)),this.setBarColor(a),this.setTrackStroke(Tp(h,"trackStrokeThickness",2),Tp(h,"trackStrokeColor",void 0)),this.setOrientation(Tp(h,"orientation",0)),this.setRTL(Tp(h,"rtl",!1)),this.setRadius(n),this.setIteration(Tp(n,"iteration",void 0)),this.setValue(o)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get orientation(){return this._orientation}set orientation(t){t=Pp(t),this.dirty=this.dirty||this._orientation!=t,this._orientation=t}setOrientation(t){return this.orientation=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get radius(){return this.rrGeom.radius}set radius(t){this.rrGeom.setRadius(t),this.dirty=!0}get radiusTL(){return this.rrGeom.radiusTL}set radiusTL(t){this.rrGeom.radiusTL=t,this.dirty=!0}get radiusTR(){return this.rrGeom.radiusTR}set radiusTR(t){this.rrGeom.radiusTR=t,this.dirty=!0}get radiusBL(){return this.rrGeom.radiusBL}set radiusBL(t){this.rrGeom.radiusBL=t,this.dirty=!0}get radiusBR(){return this.rrGeom.radiusBR}set radiusBR(t){this.rrGeom.radiusBR=t,this.dirty=!0}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setRadiusTL(t){return void 0===t&&(t=0),this.radiusTL=t,this}setRadiusTR(t){return void 0===t&&(t=0),this.radiusTR=t,this}setRadiusBL(t){return void 0===t&&(t=0),this.radiusBL=t,this}setRadiusBR(t){return void 0===t&&(t=0),this.radiusBR=t,this}get cornerRadius(){return this.rrGeom.cornerRadius}set cornerRadius(t){this.radius=t}setCornerRadius(t){return this.setRadius(t)}get iteration(){return this._iteration}set iteration(t){void 0!==this._iteration?this._iteration!==t&&(this._iteration=t,this.dirty=!0):this._iteration=t}setIteration(t){return void 0===t&&(t=6),this.iteration=t,this}}var Ep={updateShapes:function(){var t=this.width,e=this.height,i=this.rrGeom.cornerRadius,s=this.value,r=this.orientation,n=this.rtl,a=this.iteration+1,o=this.getShape("trackFill");o.fillStyle(this.trackColor),o.isFilled&&vp(o,t,e,i,a);var h=this.getShape("bar");h.fillStyle(this.barColor),h.isFilled&&function(t,e,i,s,r,n,a,o){t.setIterations(o).start(),0===r||(1===r?vp(t,e,i,s,o):((0===n?a?Cp:mp:a?wp:bp)(t,e,i,s,r),t.close()))}(h,t,e,i,s,r,n,a);var l=this.getShape("trackStroke");l.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),l.isStroked&&vp(l,t,e,i,a)}};Object.assign(Mp.prototype,Ep),t.register("roundRectanleProgress",(function(t,e,i,s,r,n,a,o){var h=new Mp(this.scene,t,e,i,s,r,n,a,o);return this.scene.add.existing(h),h})),P(window,"RexPlugins.UI.RoundRectangleProgress",Mp);var _p=function(t,e,i,s,r,n,a){void 0===a&&(a="round"),function(t,e){t.save(),t.beginPath();var i=e[0];t.moveTo(i.x,i.y);for(var s=1,r=e.length;s0&&(n.save(),_p(0,n,this.trackPoints,void 0,this.trackStrokeColor,this.trackStrokeThickness),n.restore())},Lp=function(t,e,i,s,r,n){void 0===n&&(n=[]),n.length=4;for(var a=0;a<4;a++)n[a]||(n[a]={});var o;return r>=0?((o=n[0]).x=t+r,o.y=e,(o=n[1]).x=i+r,o.y=e,(o=n[2]).x=i,o.y=s,(o=n[3]).x=t,o.y=s):((o=n[0]).x=t,o.y=e,(o=n[1]).x=i,o.y=e,(o=n[2]).x=i-r,o.y=s,(o=n[3]).x=t-r,o.y=s),n};const Bp=Phaser.Utils.Objects.GetValue,Ip=Phaser.Utils.Objects.IsPlainObject;class Dp extends(Gu($t)){constructor(t,e,i,s,r,n,a,o){Ip(e)?(e=Bp(o=e,"x",0),i=Bp(o,"y",0),s=Bp(o,"width",2),r=Bp(o,"height",2),n=Bp(o,"barColor",void 0),a=Bp(o,"value",0)):Ip(s)?(s=Bp(o=s,"width",2),r=Bp(o,"height",2),n=Bp(o,"barColor",void 0),a=Bp(o,"value",0)):Ip(n)&&(n=Bp(o=n,"barColor",void 0),a=Bp(o,"value",0)),super(t,e,i,s,r,Bp(o,"resolution",1)),this.type="rexLineProgressCanvas",this.trackPoints=[],this.barPoints=[],this.bootProgressBase(o),this.setTrackColor(Bp(o,"trackColor",void 0)),this.setBarColor(n,Bp(o,"barColor2",void 0),Bp(o,"isHorizontalGradient",void 0)),this.setTrackStroke(Bp(o,"trackStrokeThickness",2),Bp(o,"trackStrokeColor",void 0)),this.setSkewX(Bp(o,"skewX",0)),this.setRTL(Bp(o,"rtl",!1)),this.setValue(a)}get trackColor(){return this._trackColor}set trackColor(t){t=qt(t,this.canvas,this.context),this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){t=qt(t,this.canvas,this.context),this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){t=qt(t,this.canvas,this.context),this.dirty=this.dirty||this._barColor!=t,this._barColor=t}get barColor2(){return this._barColor2}set barColor2(t){t=qt(t,this.canvas,this.context),this.dirty=this.dirty||this._barColor2!=t,this._barColor2=t}get isHorizontalGradient(){return this._isHorizontalGradient}set isHorizontalGradient(t){this.dirty|=this._isHorizontalGradient!=t,this._isHorizontalGradient=t}setBarColor(t,e,i){return void 0===i&&(i=!0),this.barColor=t,this.barColor2=e,this.isHorizontalGradient=i,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}updateTexture(){return super.updateTexture((function(){this.clear(),Rp.call(this)}),this),this}}t.register("circularProgressCanvas",(function(t,e,i,s,r,n,a){var o=new Dp(this.scene,t,e,i,s,r,n,a);return this.scene.add.existing(o),o})),P(window,"RexPlugins.UI.LineProgressCanvas",Dp),Phaser.Math.Wrap;const jp=Phaser.Math.Linear;var Ap=function(){var t,e,i,s,r,n,a=this.getShape("triangle"),o=this.padding,h=this.width-o.right,l=0+o.left,d=this.height-o.bottom,c=0+o.top,u=(l+h)/2,p=(c+d)/2,g={0:{a:{x:l,y:c},b:{x:h,y:p},c:{x:l,y:d}},1:{a:{x:l,y:c},b:{x:u,y:d},c:{x:h,y:c}},2:{a:{x:h,y:c},b:{x:l,y:p},c:{x:h,y:d}},3:{a:{x:l,y:d},b:{x:u,y:c},c:{x:h,y:d}}};if(void 0===this.previousDirection){var v=g[this.direction],f=v.a,m=v.b,y=v.c;t=f.x,e=f.y,i=m.x,s=m.y,r=y.x,n=y.y}else{var b=g[this.previousDirection],x=g[this.direction],C=this.easeDirectionProgress;t=jp(b.a.x,x.a.x,C),e=jp(b.a.y,x.a.y,C),i=jp(b.b.x,x.b.x,C),s=jp(b.b.y,x.b.y,C),r=jp(b.c.x,x.c.x,C),n=jp(b.c.y,x.c.y,C)}a.startAt(t,e).lineTo(i,s).lineTo(r,n),this.arrowOnly?a.end():a.close()};const zp=(0,Phaser.Math.DegToRad)(120);var Fp=function(t){t=this.getShape("triangle");var e=this.width/2,i=this.height/2,s=Math.min(e,i)*this.radius,r=this.verticeRotation;t.startAt(e+s*Math.cos(r+zp),i+s*Math.sin(r+zp)).lineTo(e+s*Math.cos(r),i+s*Math.sin(r)).lineTo(e+s*Math.cos(r-zp),i+s*Math.sin(r-zp)),this.arrowOnly?t.end():t.close()},Yp={buildShapes(){this.addShape((new Kc).setName("triangle"))},updateShapes(){var t=this.getShape("triangle");this.arrowOnly?t.fillStyle().lineStyle(this.lineWidth,this.strokeColor,this.strokeAlpha):t.fillStyle(this.fillColor,this.fillAlpha).lineStyle(this.lineWidth,this.strokeColor,this.strokeAlpha),0===this.shapeMode?Ap.call(this):Fp.call(this)}},Xp={setEaseDuration(t){return void 0===t&&(t=0),this.easeDuration=t,this},playEaseDirectionation(){return void 0===this.easeDirectionProgressTask&&(this.easeDirectionProgressTask=new su(this,{eventEmitter:null})),this.easeDirectionProgressTask.restart({key:"easeDirectionProgress",from:0,to:1,duration:this.easeDuration}),this},stopEaseDirection(){return void 0===this.easeDirectionProgressTask||this.easeDirectionProgressTask.stop(),this}};const Wp=Phaser.Utils.Objects.GetValue,Vp=Phaser.Utils.Objects.IsPlainObject,Gp=Phaser.Math.DegToRad,Hp=Phaser.Math.RadToDeg;class Up extends fc{constructor(t,e,i,s,r,n,a){var o,h,l,d,c,u,p,g;if(Vp(e)){var v=e;e=v.x,i=v.y,s=v.width,r=v.height,n=v.color,a=v.alpha,o=v.strokeColor,h=v.strokeAlpha,l=v.strokeWidth,d=v.arrowOnly,c=v.direction,u=v.easeDuration,p=v.padding,g=v.radius}void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=s),void 0===d&&(d=!1),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),void 0===g&&(g=void 0),super(t,e,i,s,r),this.type="rexTriangle",this.setFillStyle(n,a),void 0!==o&&void 0===l&&(l=2),this.setStrokeStyle(l,o,h),this.setArrowOnly(d),this.setDirection(c,u),this.setPadding(p),this.setRadius(g),this.buildShapes()}get arrowOnly(){return this._arrowOnly}set arrowOnly(t){this.dirty=this.dirty||this._arrowOnly!=t,this._arrowOnly=t}setArrowOnly(t){return void 0===t&&(t=!0),this.arrowOnly=t,this}get direction(){return this._direction}set direction(t){t=$p(t),this._direction!==t&&(this.easeDuration>0&&void 0!==this._direction?this.previousDirection=this._direction:this.previousDirection=void 0,this._direction=t,this.verticeAngle=90*t,this.dirty=!0,void 0!==this.previousDirection?this.playEaseDirectionation():this.stopEaseDirection())}setDirection(t,e){return void 0!==e&&this.setEaseDuration(e),this.direction=t,this}toggleDirection(t){return this.setDirection(this.direction+2,t),this}get easeDirectionProgress(){return this._easeDirectionProgress}set easeDirectionProgress(t){this._easeDirectionProgress!==t&&(this._easeDirectionProgress=t,this.dirty=!0)}setPadding(t,e,i,s){if("object"==typeof t){var r=t,n=Wp(r,"x",null);null!==n?(t=n,i=n):(t=Wp(r,"left",0),i=Wp(r,"right",t));var a=Wp(r,"y",null);null!==a?(e=a,s=a):(e=Wp(r,"top",0),s=Wp(r,"bottom",e))}else void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=t),void 0===s&&(s=e);return void 0===this.padding&&(this.padding={}),this.dirty=this.dirty||this.padding.left!=t||this.padding.top!=e||this.padding.right!=i||this.padding.bottom!=s,this.padding.left=t,this.padding.top=e,this.padding.right=i,this.padding.bottom=s,this.setRadius(),this}get radius(){return this._radius}set radius(t){this.dirty=this.dirty||this._radius!=t,this._radius=t}setRadius(t){return this.radius=t,this.shapeMode=null==t?0:1,this}get verticeRotation(){return this._verticeRotation}set verticeRotation(t){this.dirty=this.dirty||this._verticeRotation!=t,this._verticeRotation=t}setVerticeRotation(t){return this.verticeRotation=t,this}get verticeAngle(){return Hp(this.verticeRotation)}set verticeAngle(t){this.verticeRotation=Gp(t)}setVerticeAngle(t){return this.verticeAngle=t,this}}const Np={right:0,down:1,left:2,up:3};var $p=function(t){return"string"==typeof t&&(t=Np[t]),t%=4};Object.assign(Up.prototype,Yp,Xp),t.register("triangle",(function(t,e,i,s,r,n){var a=new Up(this.scene,t,e,i,s,r,n);return this.scene.add.existing(a),a})),P(window,"RexPlugins.UI.Triangle",Up),F();const Kp=Phaser.GameObjects.Zone,Jp=Phaser.Utils.Array.Add,qp=Phaser.Utils.Array.Remove;let Zp=class extends Kp{constructor(t,e,i,s,r){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),super(t,e,i,s,r),this.children=[]}destroy(t){if(this.scene&&!this.ignoreDestroy){if(t)for(var e,i=this.children.length-1;i>=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return Jp(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return qp(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;irg(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;erg(t).x,getChildLocalY:t=>rg(t).y};const xg=Phaser.Math.DegToRad;var Cg={updateChildRotation(t){var e=rg(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=rg(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return rg(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return rg(t).rotation=xg(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=rg(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>rg(t).rotation},kg={updateChildScale(t){var e=rg(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=rg(t),i=e.parent;return e.scaleX=yg(t.scaleX,i.scaleX),e.scaleY=yg(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=rg(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=rg(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>rg(t).scaleX,getChildLocalScaleY:t=>rg(t).scaleY},wg={updateChildVisible(t){var e=rg(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=rg(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),rg(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),rg(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=rg(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>rg(t).visible},Sg={updateChildAlpha(t){var e=rg(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=rg(t),i=e.parent;return e.alpha=yg(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return rg(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=rg(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>rg(t).alpha},Pg={updateChildActive(t){var e=rg(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return rg(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),rg(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=rg(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>rg(t).active},Tg={updateChildScrollFactor(t){var e=rg(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},Og={updateCameraFilter(t){var e=rg(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},Mg={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(t){void 0===t&&(t=!1);var e=this;return this._mask=null,this.setChildMaskVisible(this),this.children.forEach((function(t){t.clearMask&&t.clearMask(!1),t.hasOwnProperty("isRexContainerLite")||e.setChildMaskVisible(t)})),t&&this.mask&&this.mask.destroy(),this}},Eg=function(t){return t.filter((function(t){return!!t.displayList||!!t.parentContainer||void 0}))},_g={setDepth(t,e){if(this.depth=t,!e&&this.children)for(var i=this.getAllChildren(),s=0,r=i.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},Rg=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const Bg=Phaser.Utils.Array;var Ig={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Nv=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const $v=/(\S+)\[(\d+)\]/i;var Kv={getInnerPadding(t){return Ts(this.space,t)},setInnerPadding(t,e){return Os(this.space,t,e),this},getOuterPadding(t){return Ts(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Os(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Ts(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Os(this.getSizerConfig(t).padding,e,i),this}},Jv=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},qv=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Zv=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Qv=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},tf=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},ef=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},sf={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},rf=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var fm={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Ra(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},mm={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=h),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=h),this.transitOutCallback=t,this}},ym={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},bm={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},xm={};Object.assign(xm,fm,mm,ym,bm);const Cm=Phaser.Utils.Objects.GetValue;class km extends Ba{constructor(t,e){super(t,e),this.setTransitInTime(Cm(e,"duration.in",200)),this.setTransitOutTime(Cm(e,"duration.out",200)),this.setTransitInCallback(Cm(e,"transitIn")),this.setTransitOutCallback(Cm(e,"transitOut")),this.oneShotMode=Cm(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new vm(this,{eventEmitter:!1,initState:Cm(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(km.prototype,xm);const wm=Phaser.GameObjects.Rectangle;class Sm extends wm{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new _d(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Pm=Phaser.Utils.Objects.GetValue;class Tm extends Ba{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Pm(t,"hitAreaMode",0)),this.setEnable(Pm(t,"enable",!0)),this.setStopMode(Pm(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Om[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Om={default:0,fullWindow:1};const Mm=Phaser.Utils.Objects.GetValue;class Em extends Sm{constructor(t,e){super(t,Mm(e,"color",0),Mm(e,"alpha",.8)),this.touchEventStop=new Tm(this,{hitAreaMode:1})}}var _m={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,bf(t,e)},scaleDown(t,e){xf(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,_f(t,e)},fadeOut(t,e){Rf(t,e,!1)}},Rm=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,_f(t,e,t.alpha)},Lm=function(t,e){Rf(t,e,!1)},Bm=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!Gn(t,!0).contains(e,i)||r&&!r(t,e,i))};const Im=Phaser.Utils.Objects.GetValue;let Dm=class extends km{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=jm.popUp),null==e.transitOut&&(e.transitOut=jm.scaleDown),e.destroy=Im(e,"destroy",!0),super(t,e);var i=Im(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Em(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Im(i,"transitIn",Rm)),this.setCoverTransitOutCallback(Im(i,"transitOut",Lm)));var s=Im(e,"touchOutsideClose",!1),r=Im(e,"duration.hold",-1),n=Im(e,"timeOutClose",r>=0),a=Im(e,"anyTouchClose",!1);Im(e,"manualClose",!1)&&(s=!1,a=!1,n=!1),a&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),a?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Im(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Bm(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=jm[t]),t){case jm.popUp:t=_m.popUp;break;case jm.fadeIn:t=_m.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=jm[t]),t){case jm.scaleDown:t=_m.scaleDown;break;case jm.fadeOut:t=_m.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const jm={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Am=function(t,e){var i=new Dm(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i},zm=function(t,e){t.emit("modal.requestClose",e)},Fm=function(t){return t&&"function"==typeof t},Ym={modal(t,e){return Fm(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=Am(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return zm(this,t),this}},Xm=function(t,e,i,s,r){Fm(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},Wm={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return Xm.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return Xm.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return Xm.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return Xm.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return Xm.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return Xm.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return Xm.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return Xm.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return Xm.call(this,"shutdown",t,e,i,s),this}},Vm=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=Gm),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},Gm={},Hm=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,a=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return a?Bm(t,e.x,e.y,i,s):!!(r=Vm(e,n,!0))&&Bm(t,r.x,r.y,i,s);for(var o=t.scene.input.manager,h=o.pointersTotal,l=o.pointers,d=0;d=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const ry={press:0,pointerdown:0,release:1,pointerup:1};var ny={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new sy(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class ay extends gm{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const oy=Phaser.Utils.Objects.GetValue;class hy extends Ba{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new ay,this.parent.setInteractive(oy(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(oy(t,"enable",!0)),this.setCooldown(oy(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var ly={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&Hm(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new hy(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new hy(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},dy={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},cy=function(t,e,i,s){if("parent"===t){for(var r,n=0,a=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Oy,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===My&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Oy,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Ey,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&Hm(t,s,e,i)}}const Oy=0,My=1,Ey="IDLE",_y=Phaser.Utils.Objects.GetValue,Ry=Phaser.Math.Distance.Between;class Ly extends Ty{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=By},eventEmitter:!1};this.setRecongizedStateObject(new gm(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(_y(t,"time",250)),this.setTapInterval(_y(t,"tapInterval",200)),this.setDragThreshold(_y(t,"threshold",9)),this.setTapOffset(_y(t,"tapOffset",10));var e=_y(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(_y(t,"maxTaps",void 0)),this.setMinTaps(_y(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case By:this.state=Iy;break;case Iy:var t=this.lastPointer;Ry(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=Dy,this.state=Iy);break;case Dy:this.state=Iy}}onDragEnd(){this.state===Iy&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=Dy))}onDrag(){this.state!==By&&this.pointer.getDistance()>this.dragThreshold&&(this.state=By)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Iy){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=By):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=Dy:this.state=By)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Dy&&(this.state=By)}get isTapped(){return this.state===Dy}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const By="IDLE",Iy="BEGIN",Dy="RECOGNIZED",jy=Phaser.Utils.Objects.GetValue;class Ay extends Ty{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=zy},eventEmitter:!1};this.setRecongizedStateObject(new gm(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(jy(t,"threshold",9)),this.setHoldTime(jy(t,"time",251)),this}onDragStart(){this.state=Fy,0===this.holdTime&&(this.state=Yy)}onDragEnd(){this.state=zy}onDrag(){this.state!==zy&&this.pointer.getDistance()>this.dragThreshold&&(this.state=zy)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===Fy&&t-this.pointer.downTime>=this.holdTime&&(this.state=Yy)}get isPressed(){return this.state===Yy}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const zy="IDLE",Fy="BEGIN",Yy="RECOGNIZED",Xy=Phaser.Utils.Objects.GetValue;class Wy extends Ty{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{},BEGIN:{enter:function(){var t=i.pointer;i.startX=t.x,i.startY=t.y,i.startWorldX=t.worldX,i.startWorldY=t.worldY}},RECOGNIZED:{enter:function(){i.emit("panstart",i,i.gameObject,i.lastPointer)},exit:function(){var t=i.lastPointer;i.endX=t.x,i.endY=t.y;var e=Vm(t,i.pointerCamera,!0);i.endWorldX=e.x,i.endWorldY=e.y,i.emit("panend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=Vy},eventEmitter:!1};this.setRecongizedStateObject(new gm(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Xy(t,"threshold",10)),this}onDragStart(){this.state=Gy,0===this.dragThreshold&&(this.state=Hy)}onDragEnd(){this.state=Vy}onDrag(){switch(this.state){case Gy:if(this.pointer.getDistance()>=this.dragThreshold){this.state=Hy,this.dx=0,this.dy=0,this.dWorldX=0,this.dWorldY=0;var t=this.pointer;this.x=t.x,this.y=t.y,this.worldX=t.worldX,this.worldY=t.worldY}break;case Hy:var e=this.pointerCamera,i=this.pointer.position,s=this.pointer.prevPosition;this.dx=i.x-s.x,this.dy=i.y-s.y,this.dWorldX=this.dx/e.zoom,this.dWorldY=this.dy/e.zoom,t=this.pointer,this.x=t.x,this.y=t.y;var r=Vm(t,e,!0);this.worldX=r.x,this.worldY=r.y,this.emit("pan",this,this.gameObject,this.lastPointer)}}get isPanned(){return this.state===Hy}setDragThreshold(t){return this.dragThreshold=t,this}}const Vy="IDLE",Gy="BEGIN",Hy="RECOGNIZED",Uy=Phaser.Math.Distance.Between,Ny=Phaser.Math.Angle.Between;var $y={getDt:function(){return oc(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Uy(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Ny(e.x,e.y,t.x,t.y)}},Ky={"up&down":0,"left&right":1,"4dir":2,"8dir":3},Jy={};const qy=Phaser.Utils.Objects.GetValue,Zy=Phaser.Math.RadToDeg;class Qy extends Ty{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=tb},eventEmitter:!1};this.setRecongizedStateObject(new gm(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(qy(t,"threshold",10)),this.setVelocityThreshold(qy(t,"velocityThreshold",1e3)),this.setDirectionMode(qy(t,"dir","8dir")),this}onDragStart(){this.state=eb}onDragEnd(){this.state=tb}onDrag(){this.state===eb&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=ib))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===ib&&(this.state=tb)}get isSwiped(){return this.state===ib}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=Ky[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=Jy),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(Zy(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(Qy.prototype,$y);const tb="IDLE",eb="BEGIN",ib="RECOGNIZED",sb=Phaser.Utils.Objects.GetValue,rb=Phaser.Utils.Array.SpliceOne,nb=Phaser.Math.Distance.Between,ab=Phaser.Math.Angle.Between;class ob{constructor(t,e){var i=Ra(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(sb(e,"inputConfig",void 0)),this.setEventEmitter(sb(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(sb(t,"enable",!0)),this.bounds=sb(t,"bounds",void 0),this.tracerState=lb,this.pointers.length=0,q(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,q(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case lb:this.tracerState=db,this.onDrag1Start();break;case db:this.tracerState=cb,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],rb(this.pointers,e),this.tracerState){case db:this.tracerState=lb,this.onDrag1End();break;case cb:this.tracerState=db,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case db:this.onDrag1();break;case cb:this.onDrag2()}}}dragCancel(){return this.tracerState===cb&&this.onDrag2End(),this.pointers.length=0,q(this.movedState),this.tracerState=lb,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==cb)return 0;var t=this.pointers[0],e=this.pointers[1];return nb(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==cb)return 0;var t=this.pointers[0],e=this.pointers[1];return ab(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;hb.x=e.x-i.x,hb.y=e.y-i.y}else hb.x=0,hb.y=0;return hb}get centerX(){if(this.tracerState!==cb)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==cb)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==cb)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==cb)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=ub,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&Hm(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&Hm(t,s,e,i)}}Object.assign(ob.prototype,dn);var hb={};const lb=0,db=1,cb=2,ub="IDLE",pb=Phaser.Utils.Objects.GetValue;class gb extends ob{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.prevDistance=void 0,i.scaleFactor=1}},BEGIN:{},RECOGNIZED:{enter:function(){i.emit("pinchstart",i)},exit:function(){i.emit("pinchend",i)}}},init:function(){this.state=vb},eventEmitter:!1};this.setRecongizedStateObject(new gm(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(pb(t,"threshold",0)),this}onDrag2Start(){this.scaleFactor=1,this.prevDistance=this.distanceBetween,this.state=fb,0===this.dragThreshold&&(this.state=mb)}onDrag2End(){this.state=vb}onDrag2(){switch(this.state){case fb:if(this.pointers[0].getDistance()>=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=this.distanceBetween;this.scaleFactor=t/this.prevDistance,this.prevDistance=t,this.state=mb}break;case mb:t=this.distanceBetween,this.scaleFactor=t/this.prevDistance,this.emit("pinch",this),this.prevDistance=t}}get isPinched(){return this.state===mb}setDragThreshold(t){return this.dragThreshold=t,this}}const vb="IDLE",fb="BEGIN",mb="RECOGNIZED",yb=Phaser.Math.RotateAround;var bb=function(t,e,i,s){return yb(t,e,i,s),t.rotation+=s,t},xb={};const Cb=Phaser.Utils.Objects.GetValue,kb=Phaser.Math.Angle.WrapDegrees,wb=Phaser.Math.Angle.ShortestBetween,Sb=Phaser.Math.RadToDeg,Pb=Phaser.Math.DegToRad;class Tb extends ob{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.prevAngle=void 0,i.angle=0}},BEGIN:{},RECOGNIZED:{enter:function(){i.emit("rotatestart",i)},exit:function(){i.emit("rotateend",i)}}},init:function(){this.state=Mb},eventEmitter:!1};this.setRecongizedStateObject(new gm(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Cb(t,"threshold",0)),this}onDrag2Start(){this.prevAngle=kb(Sb(this.angleBetween)),this.state=Eb,0===this.dragThreshold&&(this.state=_b)}onDrag2End(){this.state=Mb}onDrag2(){switch(this.state){case Eb:if(this.pointers[0].getDistance()>=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=kb(Sb(this.angleBetween));this.angle=wb(this.prevAngle,t),this.prevAngle=t,this.state=_b}break;case _b:t=kb(Sb(this.angleBetween)),this.angle=wb(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===_b}get rotation(){return Pb(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}var Ob={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=xb),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,a=r.y,o=this.rotation;if(Array.isArray(t))for(var h=t,l=0,d=h.length;l0&&(r=!0,void 0===n&&(n=0),void 0===a&&(a=0)),(u=this.getSizerConfig(t)).align=i,u.padding=Iv(s),$b(r)?(u.expandWidth=Kb(r,"width",!1),u.expandHeight=Kb(r,"height",!1)):(u.expandWidth=r,u.expandHeight=r),t.isRexSizer||(u.expandWidth&&(t.minWidth=void 0===n?zn(t):n),u.expandHeight&&(t.minHeight=void 0===a?Fn(t):a)),u.alignOffsetX=o,u.alignOffsetY=h,u.alignOffsetOriginX=d,u.alignOffsetOriginY=c,u.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,p&&this.addChildrenMap(e,t),this}};const Qb=Qg.prototype.clear;var tx=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),Qb.call(this,t),i)for(var s,r=0,n=e.length;r0&&(Ub.width=e.aspectRatio,Ub.height=1,Nb.width=l,Nb.height=d,l=(c=Wb(Ub,Nb,"FIT",!0)).width,d=c.height),t.isRexSizer?(t.runLayout(this,l,d),Hb(t,this)):of(t,l,d),s=u+i.left*this.scaleX,n=g-(i.left+i.right)*this.scaleX,r=p+i.top*this.scaleY,a=v-(i.top+i.bottom)*this.scaleY,void 0===l&&(l=zn(t)),void 0===d&&(d=Fn(t)),o=(e.alignOffsetX+e.alignOffsetOriginX*l)*this.scaleX,h=(e.alignOffsetY+e.alignOffsetOriginY*d)*this.scaleY,Zm.call(this,t,s,r,n,a,e.align,o,h))}};Object.assign(ix,Zb,ex);var sx=function(t,e){if(Array.isArray(t))return t.indexOf(e);for(var i in t)if(t[i]===e)return i;return null};const rx=Phaser.Utils.Objects.IsPlainObject,nx=Phaser.Utils.Objects.GetValue;class ax extends Xb{constructor(t,e,i,s,r,n){rx(e)?(e=nx(n=e,"x",0),i=nx(n,"y",0),s=nx(n,"width",void 0),r=nx(n,"height",void 0)):rx(s)&&(s=nx(n=s,"width",void 0),r=nx(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexOverlapSizer",this.sizerChildren={},this.addChildrenMap("items",this.sizerChildren)}childToKey(t){if("string"!=typeof t)return sx(this.sizerChildren,t);var e=t;return this.sizerChildren.hasOwnPropery(e)?e:null}}Object.assign(ax.prototype,ix);var ox=Phaser.Math.Distance.Between,hx=function(t,e,i){var s=t.width/2;return ox(s,s,e,i)<=s};const lx=Phaser.Math.Angle.Between,dx=Phaser.Math.Angle.Normalize;var cx=function(t,e,i){if(this.enable&&t.isDown){var s=this.sizerChildren.knob;if(hx(s,e,i)){var r=s.width/2,n=s.startAngle,a=lx(r,r,e,i),o=s.anticlockwise?n-a:a-n,h=dx(o)/(2*Math.PI);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-h)<.1?this.value=h:this.easeValueTo(h)}}},ux=function(){this.sizerChildren.knob.on("pointerdown",cx,this).on("pointermove",cx,this).setInteractive()};const px=Phaser.Math.Angle.Between,gx=Phaser.Math.Angle.Wrap;var vx=function(t,e,i){if(this.enable&&!this.panPointer){var s=this.sizerChildren.knob;hx(s,e,i)&&yx.call(this,t)}},fx=function(t,e,i){if(this.enable&&t.isDown){var s=this.sizerChildren.knob;switch(this.panState){case Cx:hx(s,e,i)&&yx.call(this,t);break;case kx:hx(s,e,i)?xx.call(this):bx.call(this)}}},mx=function(t,e,i){this.enable&&this.panPointer===t&&bx.call(this)},yx=function(t){this.panPointer=t,this.panState=kx},bx=function(){this.panPointer=void 0,this.panState=Cx},xx=function(){var t=this.panPointer.prevPosition,e=this.panPointer.position,i=this.sizerChildren.knob,s=px(i.x,i.y,t.x,t.y),r=px(i.x,i.y,e.x,e.y),n=i.anticlockwise?s-r:r-s,a=gx(n)/(2*Math.PI);this.stopEaseValue(),this.value+=a};const Cx=0,kx=1;var wx=function(){this.sizerChildren.knob.on("pointerdown",vx,this).on("pointermove",fx,this).on("pointerup",mx,this).setInteractive(),this.panPointer=void 0,this.panState=Cx},Sx=function(t){return void 0===t&&(t=this.value),this.textFormatCallbackScope?this.textFormatCallback(t):this.textFormatCallback.call(this.textFormatCallbackScope,t)},Px={setTextFormatCallback:function(t,e){return this.textFormatCallback=t,this.textFormatCallbackScope=e,this},getFormatText:Sx,updateText:function(t){var e=this.sizerChildren.text;return e&&this.textFormatCallback&&(e.setText(Sx.call(this,t)),e.layout&&e.layout()),this}};const Tx=Phaser.Utils.Objects.GetValue,Ox=Phaser.Math.Snap.To;class Mx extends(Gu(ax)){constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexKnob",this.bootProgressBase(e);var i=Tx(e,"background",void 0),s=Tx(e,"text",void 0);i&&this.addBackground(i),s&&(e.textColor=void 0,e.textStrokeColor=void 0,this.setTextFormatCallback(Tx(e,"textFormatCallback",void 0),Tx(e,"textFormatCallbackScope",void 0)),e.textFormatCallback=void 0,e.textFormatCallbackScope=void 0);var r=new hp(t,e);r.setDepth(Tx(e,"knobDepth",0)),r._value=-1,t.add.existing(r),this.add(r,"knob"),s&&(this.add(s,"text","center",0,!1),t.children.moveBelow(r,s)),this.addChildrenMap("background",i),this.addChildrenMap("knob",r),this.addChildrenMap("text",s),this.setEnable(Tx(e,"enable",void 0)),this.setGap(Tx(e,"gap",void 0)),this.setValue(Tx(e,"value",0),Tx(e,"min",void 0),Tx(e,"max",void 0));var n=Tx(e,"input",0);switch("string"==typeof n&&(n=Ex[n]),n){case 0:wx.call(this);break;case 1:ux.call(this)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setGap(t){return this.gap=t,this}get value(){return this.sizerChildren.knob.value}set value(t){void 0!==this.gap&&(t=Ox(t,this.gap));var e=this.value;this.sizerChildren.knob.value=t;var i=this.value;e!==i&&(this.updateText(),this.eventEmitter.emit("valuechange",i,e,this.eventEmitter))}}const Ex={pan:0,drag:0,click:1,none:-1};Object.assign(Mx.prototype,Px),t.register("knob",(function(t){var e=new Mx(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.Knob",Mx);const _x={arc:Sc,circle:Pc,curve:class extends kc{constructor(t){super(),this.setCurve(t),this.setIterations(32)}get curve(){return this._curve}set curve(t){this.dirty=this.dirty||this._curve!==t,this._curve=t}setCurve(t){return this.curve=t,this}get iterations(){return this._iterations}set iterations(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t}setIterations(t){return this.iterations=t,this}updateData(){this.pathData.length=0;for(var t=this.curve.getPoints(this.iterations),e=0,i=t.length;ethis.value)for(var d=0;dthis.value&&(t+=1));for(var r=this.getShapes(),n=0,a=r.length;n0?d.pop().setTexture(u,O):r(c,u,O),h&&c.add.existing(T),l){var M=b+k*P+a*k,E=x+w*S+o*w;T.setOrigin(a,o).setPosition(M,E).setScale(v,f).setRotation(m),vk(T,b,x,m)}C.push(T)}return C}(t,e,i,s),a=0,o=n.length;a0&&(a=this.getChildLocalScaleX(s),a/=s.biasScale,this.setChildLocalScale(s,a)),r.biasScale&&(a=this.getChildLocalScaleX(r),a/=r.biasScale,this.setChildLocalScale(r,a))),e?t.call(e,i,s,r,n):t(i,s,r,n),this.scaleMode&&(s.biasScale>0&&(a=this.getChildLocalScaleX(s),a*=s.biasScale,this.setChildLocalScale(s,a)),r.biasScale&&(a=this.getChildLocalScaleX(r),a*=r.biasScale,this.setChildLocalScale(r,a))))};Object.assign(Pk.prototype,yk);const Ok={fit:1,FIT:1,envelop:2,ENVELOP:2};t.register("transitionImage",(function(t,e,i,s,r){var n=new Pk(this.scene,t,e,i,s,r);return this.scene.add.existing(n),n})),P(window,"RexPlugins.UI.TransitionImage",Pk);const Mk=Phaser.Renderer.WebGL.Pipelines.PostFXPipeline,Ek=Phaser.Utils.Objects.GetValue,_k=Phaser.Math.Clamp;class Rk extends Mk{constructor(t){super({name:"rexDissolvePostFx",game:t,renderTarget:!0,fragShader:"#ifdef GL_FRAGMENT_PRECISION_HIGH\n#define highmedp highp\n#else\n#define highmedp mediump\n#endif\nprecision highmedp float;\n// Scene buffer\nuniform sampler2D uMainSampler;\nuniform sampler2D uMainSampler2;\n\nuniform int resizeMode;\nuniform float progress;\nuniform float fromRatio;\nuniform float toRatio;\nvarying vec2 outFragCoord;\n// Effect parameters\nuniform float noiseX;\nuniform float noiseY;\nuniform float noiseZ;\nuniform float fromEdgeStart;\nuniform float fromEdgeWidth;\nuniform float toEdgeStart;\nuniform float toEdgeWidth;\n\nvec3 mod289(vec3 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }\nvec4 mod289(vec4 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }\nvec4 permute(vec4 x) { return mod289(((x*34.0)+1.0)*x); }\nvec4 taylorInvSqrt(vec4 r) { return 1.79284291400159 - 0.85373472095314 * r; }\nvec3 fade(vec3 t) { return t*t*t*(t*(t*6.0-15.0)+10.0); }\nfloat Perlin(vec3 P) {\n vec3 i0 = mod289(floor(P)), i1 = mod289(i0 + vec3(1.0));\n vec3 f0 = fract(P), f1 = f0 - vec3(1.0), f = fade(f0);\n vec4 ix = vec4(i0.x, i1.x, i0.x, i1.x), iy = vec4(i0.yy, i1.yy);\n vec4 iz0 = i0.zzzz, iz1 = i1.zzzz;\n vec4 ixy = permute(permute(ix) + iy), ixy0 = permute(ixy + iz0), ixy1 = permute(ixy + iz1);\n vec4 gx0 = ixy0 * (1.0 / 7.0), gy0 = fract(floor(gx0) * (1.0 / 7.0)) - 0.5;\n vec4 gx1 = ixy1 * (1.0 / 7.0), gy1 = fract(floor(gx1) * (1.0 / 7.0)) - 0.5;\n gx0 = fract(gx0); gx1 = fract(gx1);\n vec4 gz0 = vec4(0.5) - abs(gx0) - abs(gy0), sz0 = step(gz0, vec4(0.0));\n vec4 gz1 = vec4(0.5) - abs(gx1) - abs(gy1), sz1 = step(gz1, vec4(0.0));\n gx0 -= sz0 * (step(0.0, gx0) - 0.5); gy0 -= sz0 * (step(0.0, gy0) - 0.5);\n gx1 -= sz1 * (step(0.0, gx1) - 0.5); gy1 -= sz1 * (step(0.0, gy1) - 0.5);\n vec3 g0 = vec3(gx0.x,gy0.x,gz0.x), g1 = vec3(gx0.y,gy0.y,gz0.y),\n g2 = vec3(gx0.z,gy0.z,gz0.z), g3 = vec3(gx0.w,gy0.w,gz0.w),\n g4 = vec3(gx1.x,gy1.x,gz1.x), g5 = vec3(gx1.y,gy1.y,gz1.y),\n g6 = vec3(gx1.z,gy1.z,gz1.z), g7 = vec3(gx1.w,gy1.w,gz1.w);\n vec4 norm0 = taylorInvSqrt(vec4(dot(g0,g0), dot(g2,g2), dot(g1,g1), dot(g3,g3)));\n vec4 norm1 = taylorInvSqrt(vec4(dot(g4,g4), dot(g6,g6), dot(g5,g5), dot(g7,g7)));\n g0 *= norm0.x; g2 *= norm0.y; g1 *= norm0.z; g3 *= norm0.w;\n g4 *= norm1.x; g6 *= norm1.y; g5 *= norm1.z; g7 *= norm1.w;\n vec4 nz = mix(vec4(dot(g0, vec3(f0.x, f0.y, f0.z)), dot(g1, vec3(f1.x, f0.y, f0.z)),\n dot(g2, vec3(f0.x, f1.y, f0.z)), dot(g3, vec3(f1.x, f1.y, f0.z))),\n vec4(dot(g4, vec3(f0.x, f0.y, f1.z)), dot(g5, vec3(f1.x, f0.y, f1.z)),\n dot(g6, vec3(f0.x, f1.y, f1.z)), dot(g7, vec3(f1.x, f1.y, f1.z))), f.z);\n return 2.2 * mix(mix(nz.x,nz.z,f.y), mix(nz.y,nz.w,f.y), f.x);\n}\nfloat Perlin(vec2 P) { return Perlin(vec3(P, 0.0)); }\n\n\nvec4 getFromColor (vec2 uv) {\n return texture2D(uMainSampler, uv);\n}\n\nvec4 getToColor (vec2 uv) {\n if (resizeMode == 2) {\n // cover\n return texture2D(uMainSampler2, 0.5 + (vec2(uv.x, 1.0 - uv.y) - 0.5) * vec2(min(fromRatio / toRatio, 1.0), min((toRatio / fromRatio), 1.0)));\n } else if (resizeMode == 1) {\n // contain\n return texture2D(uMainSampler2, 0.5 + (vec2(uv.x, 1.0 - uv.y) - 0.5) * vec2(max(fromRatio / toRatio, 1.0), max((toRatio / fromRatio), 1.0)));\n } else {\n // stretch\n return texture2D(uMainSampler2, vec2(uv.x, 1.0 - uv.y));\n }\n}\n\nvec4 transition (vec2 uv) { \n vec4 colorFront = getFromColor(uv);\n vec4 colorTo = getToColor(uv);\n\n float noise = (Perlin(vec3(uv.x * noiseX, uv.y * noiseY, noiseZ)) + 1.0) / 2.0\n * (1.0 - (fromEdgeStart + fromEdgeWidth + toEdgeStart + toEdgeWidth))\n + (fromEdgeStart + fromEdgeWidth + toEdgeStart + toEdgeWidth) * 0.5;\n vec4 colorResult = colorFront * smoothstep(progress - (fromEdgeStart + fromEdgeWidth), progress - fromEdgeStart, noise)\n + colorTo * smoothstep((1.0 - progress) - (toEdgeStart + toEdgeWidth), (1.0 - progress) - toEdgeStart, (1.0 - noise));\n return colorResult;\n}\n\nvoid main () {\n vec2 uv = outFragCoord;\n gl_FragColor = transition(uv);\n}\n"}),this._progress=0,this.toFrame=null,this.targetTexture=null,this.resizeMode=1,this.toRatio=1,this.noiseX=0,this.noiseY=0,this.noiseZ=0,this.fromEdgeStart=.01,this.fromEdgeWidth=.05,this.toEdgeStart=.01,this.toEdgeWidth=.05}resetFromJSON(t){return this.setProgress(Ek(t,"progress",0)),this.setTransitionTargetTexture(Ek(t,"toTexture","__DEFAULT"),Ek(t,"toFrame",void 0),Ek(t,"resizeMode",1)),this.setNoise(Ek(t,"noiseX",void 0),Ek(t,"noiseY",void 0),Ek(t,"noiseZ",void 0)),this.setFromEdge(Ek(t,"fromEdgeStart",.01),Ek(t,"fromEdgeWidth",.05)),this.setToEdge(Ek(t,"toEdgeStart",.01),Ek(t,"toEdgeWidth",.05)),this}onBoot(){}onPreRender(){this.set1f("progress",this.progress),this.set1i("resizeMode",this.resizeMode),this.set1f("noiseX",this.noiseX),this.set1f("noiseY",this.noiseY),this.set1f("noiseZ",this.noiseZ),this.set1f("fromEdgeStart",this.fromEdgeStart),this.set1f("fromEdgeWidth",this.fromEdgeWidth),this.set1f("toEdgeStart",this.toEdgeStart),this.set1f("toEdgeWidth",this.toEdgeWidth)}onDraw(t){this.set1f("fromRatio",t.width/t.height),this.set1f("toRatio",this.toRatio),this.set1i("uMainSampler2",1),this.bindTexture(this.targetTexture,1),this.bindAndDraw(t)}get progress(){return this._progress}set progress(t){this._progress=_k(t,0,1)}setProgress(t){return this.progress=t,this}setTransitionTargetTexture(t,e,i){void 0===t&&(t="__DEFAULT");var s=this.game.textures.getFrame(t,e);return s||(s=this.game.textures.getFrame("__DEFAULT")),this.toRatio=s.width/s.height,this.toFrame=s,this.targetTexture=s.glTexture,void 0!==i&&(this.resizeMode=i),this}setResizeMode(t){return"string"==typeof t&&(t=Lk[t]),this.resizeMode=t,this}setNoise(t,e,i){return void 0===t&&(t=4+6*Math.random()),void 0===e&&(e=4+6*Math.random()),void 0===i&&(i=10*Math.random()),this.noiseX=t,this.noiseY=e,this.noiseZ=i,this}setFromEdge(t,e){return this.fromEdgeStart=t,this.fromEdgeWidth=e,this}setToEdge(t,e){return this.toEdgeStart=t,this.toEdgeWidth=e,this}}var Lk={stretch:0,contain:1,cover:2};const Bk=Phaser.Utils.Array.SpliceOne,Ik=.1,Dk=[function(t){t.addTransitionMode("slideAwayRight",{ease:"Linear",dir:"out",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=e.width*s;t.setChildLocalPosition(e,r,0)},onComplete:function(t,e,i,s){t.setChildLocalPosition(e,0,0)}}).addTransitionMode("slideAwayLeft",{ease:"Linear",dir:"out",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=e.width*-s;t.setChildLocalPosition(e,r,0)},onComplete:function(t,e,i,s){t.setChildLocalPosition(e,0,0)}}).addTransitionMode("slideAwayDown",{ease:"Linear",dir:"out",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=e.height*s;t.setChildLocalPosition(e,0,r)},onComplete:function(t,e,i,s){t.setChildLocalPosition(e,0,0)}}).addTransitionMode("slideAwayUp",{ease:"Linear",dir:"out",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=e.height*-s;t.setChildLocalPosition(e,0,r)},onComplete:function(t,e,i,s){t.setChildLocalPosition(e,0,0)}})},function(t){t.addTransitionMode("slideRight",{ease:"Linear",dir:"in",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=i.width*(s-1);t.setChildLocalPosition(i,r,0)},onComplete:function(t,e,i,s){t.setChildLocalPosition(i,0,0)}}).addTransitionMode("slideLeft",{ease:"Linear",dir:"in",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=i.width*(1-s);t.setChildLocalPosition(i,r,0)},onComplete:function(t,e,i,s){t.setChildLocalPosition(i,0,0)}}).addTransitionMode("slideDown",{ease:"Linear",dir:"in",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=i.height*(s-1);t.setChildLocalPosition(i,0,r)},onComplete:function(t,e,i,s){t.setChildLocalPosition(i,0,0)}}).addTransitionMode("slideUp",{ease:"Linear",dir:"in",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=i.height*(1-s);t.setChildLocalPosition(i,0,r)},onComplete:function(t,e,i,s){t.setChildLocalPosition(i,0,0)}})},function(t){t.addTransitionMode("pushRight",{ease:"Linear",dir:"out",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=e.width*s;t.setChildLocalPosition(e,r,0),r=i.width*(s-1),t.setChildLocalPosition(i,r,0)},onComplete:function(t,e,i,s){t.setChildLocalPosition(e,0,0),t.setChildLocalPosition(i,0,0)}}).addTransitionMode("pushLeft",{ease:"Linear",dir:"out",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=e.width*-s;t.setChildLocalPosition(e,r,0),r=i.width*(1-s),t.setChildLocalPosition(i,r,0)},onComplete:function(t,e,i,s){t.setChildLocalPosition(e,0,0),t.setChildLocalPosition(i,0,0)}}).addTransitionMode("pushDown",{ease:"Linear",dir:"out",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=e.height*s;t.setChildLocalPosition(e,0,r),r=i.height*(s-1),t.setChildLocalPosition(i,0,r)},onComplete:function(t,e,i,s){t.setChildLocalPosition(e,0,0),t.setChildLocalPosition(i,0,0)}}).addTransitionMode("pushUp",{ease:"Linear",dir:"out",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=e.height*-s;t.setChildLocalPosition(e,0,r),r=i.height*(1-s),t.setChildLocalPosition(i,0,r)},onComplete:function(t,e,i,s){t.setChildLocalPosition(e,0,0),t.setChildLocalPosition(i,0,0)}})},function(t){t.addTransitionMode("zoomOut",{ease:"Linear",dir:"out",mask:!1,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=1-s;t.setChildLocalScale(e,r,r)},onComplete:function(t,e,i,s){t.setChildLocalScale(e,1,1)}}).addTransitionMode("zoomIn",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=s;t.setChildLocalScale(i,r,r)},onComplete:function(t,e,i,s){t.setChildLocalScale(i,1,1)}}).addTransitionMode("zoomInOut",{ease:"Linear",dir:"out",mask:!1,onStart:function(t,e,i,s){i.tint=0},onProgress:function(t,e,i,s){var r;s<.5?(r=1-Po(s),t.setChildLocalScale(e,r,r)):(e.visible&&t.setChildVisible(e,!1),r=1-Po(s),t.setChildLocalScale(i,r,r))},onComplete:function(t,e,i,s){t.setChildLocalScale(e,1,1),t.setChildVisible(e,!0),e.tint=16777215,t.setChildLocalScale(i,1,1),t.setChildVisible(i,!0),i.tint=16777215}})},function(t){t.addTransitionMode("fade",{ease:"Linear",dir:"out",mask:!1,onStart:function(t,e,i,s){i.tint=0},onProgress:function(t,e,i,s){var r;s<.5?(s=Po(s),r=Math.floor(255*(1-s)),e.tint=(r<<16)+(r<<8)+r):(e.visible&&t.setChildVisible(e,!1),s=Po(s),r=Math.floor(255*(1-s)),i.tint=(r<<16)+(r<<8)+r)},onComplete:function(t,e,i,s){t.setChildVisible(e,!0),e.tint=16777215,t.setChildVisible(i,!0),i.tint=16777215}}).addTransitionMode("crossFade",{ease:"Linear",dir:"out",mask:!1,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){t.setChildLocalAlpha(e,1-s),t.setChildLocalAlpha(i,s)},onComplete:function(t,e,i,s){t.setChildLocalAlpha(e,1)}})},function(t){var e,i=(e=t.scene,new Hx(e,{type:"Graphics",create:[{name:"rect",type:"rectangle"}],update:function(){this.getShape("rect").fillStyle(16777215).setSize(this.width*this.value,this.height*this.value).setCenterPosition(this.centerX,this.centerY)}}));t.once("destroy",(function(){i.destroy()})).addTransitionMode("irisOut",{ease:"Linear",dir:"out",mask:i,onStart:function(t,e,i,s){t.setCurrentImageMaskEnable(!0,!0)},onProgress:function(t,e,i,s){t.maskGameObject.setValue(s)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1)}}).addTransitionMode("irisIn",{ease:"Linear",dir:"in",mask:i,onStart:function(t,e,i,s){t.setNextImageMaskEnable(!0,!0)},onProgress:function(t,e,i,s){t.maskGameObject.setValue(1-s)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1)}}).addTransitionMode("irisInOut",{ease:"Linear",dir:"out",mask:i,onStart:function(t,e,i,s){i.tint=0,t.setCurrentImageMaskEnable(!0),t.setNextImageMaskEnable(!0)},onProgress:function(t,e,i,s){var r;s<.5?(s=Po(s),r=Math.floor(255*(1-s)),t.maskGameObject.setValue(1-s),e.tint=(r<<16)+(r<<8)+r):(e.visible&&t.setChildVisible(e,!1),s=Po(s),r=Math.floor(255*(1-s)),t.maskGameObject.setValue(1-s),i.tint=(r<<16)+(r<<8)+r)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1),t.setChildVisible(e,!0),e.tint=16777215,t.setChildVisible(i,!0),i.tint=16777215}})},function(t){var e,i=(e=t.scene,new Hx(e,{type:"Graphics",create:[{name:"pie",type:"arc"}],update:function(){var t=2*Math.max(this.width,this.height),e=90*this.value;this.getShape("pie").fillStyle(16777215).setCenterPosition(this.centerX,0).setRadius(t).setAngle(90-e,90+e).setPie()}}));t.once("destroy",(function(){i.destroy()})).addTransitionMode("pieOut",{ease:"Linear",dir:"out",mask:i,onStart:function(t,e,i,s){t.setCurrentImageMaskEnable(!0,!0)},onProgress:function(t,e,i,s){t.maskGameObject.setValue(s)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1)}}).addTransitionMode("pieIn",{ease:"Linear",dir:"in",mask:i,onStart:function(t,e,i,s){t.setNextImageMaskEnable(!0,!0)},onProgress:function(t,e,i,s){t.maskGameObject.setValue(1-s)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1)}}).addTransitionMode("pieInOut",{ease:"Linear",dir:"out",mask:i,onStart:function(t,e,i,s){i.tint=0,t.setCurrentImageMaskEnable(!0),t.setNextImageMaskEnable(!0)},onProgress:function(t,e,i,s){var r;s<.5?(s=Po(s),r=Math.floor(255*(1-s)),t.maskGameObject.setValue(1-s),e.tint=(r<<16)+(r<<8)+r):(e.visible&&t.setChildVisible(e,!1),s=Po(s),r=Math.floor(255*(1-s)),t.maskGameObject.setValue(1-s),i.tint=(r<<16)+(r<<8)+r)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1),t.setChildVisible(e,!0),e.tint=16777215,t.setChildVisible(i,!0),i.tint=16777215}})},function(t){var e,i=(e=t.scene,new Hx(e,{type:"Graphics",create:[{name:"rect",type:"rectangle"}],update:function(){var t=this.getShape("rect").fillStyle(16777215),e=1-this.value;switch(this.wipeMode){case"right":t.setSize(this.width*e,this.height).setTopLeftPosition(this.width-t.width,0);break;case"left":t.setSize(this.width*e,this.height).setTopLeftPosition(0,0);break;case"down":t.setSize(this.width,this.height*e).setTopLeftPosition(0,this.height-t.height);break;case"up":t.setSize(this.width,this.height*e).setTopLeftPosition(0,0)}}}));t.once("destroy",(function(){i.destroy()})).addTransitionMode("wipeRight",{ease:"Linear",dir:"out",mask:i,onStart:function(t,e,i,s){t.setCurrentImageMaskEnable(!0),t.maskGameObject.wipeMode="right"},onProgress:function(t,e,i,s){t.maskGameObject.setValue(s)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1)}}).addTransitionMode("wipeLeft",{ease:"Linear",dir:"out",mask:i,onStart:function(t,e,i,s){t.setCurrentImageMaskEnable(!0),t.maskGameObject.wipeMode="left"},onProgress:function(t,e,i,s){t.maskGameObject.setValue(s)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1)}}).addTransitionMode("wipeDown",{ease:"Linear",dir:"out",mask:i,onStart:function(t,e,i,s){t.setCurrentImageMaskEnable(!0),t.maskGameObject.wipeMode="down"},onProgress:function(t,e,i,s){t.maskGameObject.setValue(s)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1)}}).addTransitionMode("wipeUp",{ease:"Linear",dir:"out",mask:i,onStart:function(t,e,i,s){t.setCurrentImageMaskEnable(!0),t.maskGameObject.wipeMode="up"},onProgress:function(t,e,i,s){t.maskGameObject.setValue(s)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1)}})},function(t){var e=function(t,e){var i=new Hx(t,{type:"Graphics",create:{rectangle:e},update:function(){for(var t=this.getShapes(),i=this.width/e,s=0;s=0;s--)(a=r[s])instanceof e&&(a.destroy(),Bk(r,s));else{s=0;for(var r,n=(r=t.postPipelines).length;s0}(e,Rk),delete e.effect}})},function(t){t.addTransitionMode("revealRight",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(Ik,0,0)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}}).addTransitionMode("revealLeft",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(Ik,1,0)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}}).addTransitionMode("revealDown",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(Ik,0,1)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}}).addTransitionMode("revealUp",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(Ik,1,1)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}})}];class jk extends Pk{constructor(t,e,i,s,r,n){super(t,e,i,s,r,n);for(var a=0,o=Dk.length;at.dropEnable}),this.on("drop",(function(t,e){this._files=e.dataTransfer.files;var i=this._files;if(i&&this.filters)for(var s in this.filters){for(var r=this.filters[s],n=[],a=0,o=i.length;a0&&this.emit(`drop.${s}`,n)}}),this)}get files(){return this._files}}Object.assign(xw.prototype,vw),t.register("fileDropZone",(function(t){var e=new xw(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.FileDropZone",xw);const Cw=Phaser.Math.Wrap;var kw=function(t,e){if(this.hasRatioFitChild){var i,s,r;0===this.orientation?i=e-(this.getInnerPadding("top")+this.getInnerPadding("bottom"))*this.scaleY:(this.getInnerPadding("left"),this.getInnerPadding("right"),this.scaleX);for(var n=this.sizerChildren,a=0,o=n.length;a(i=0===this.orientation?Math.abs(h.left-t):Math.abs(h.top-e))&&(n=i,r=a)}return h=s[s.length-1],n>(i=0===this.orientation?Math.abs(h.right-t):Math.abs(h.bottom-e))&&(n=i,r=a+1),r};const Tw=Phaser.Utils.Objects.IsPlainObject,Ow=Phaser.Utils.Objects.GetValue,Mw=Phaser.Display.Align.CENTER,Ew={min:0,full:-1};var _w=function(t,e,i,s,r,n,a,o,h,l){var d,c,u,p;jv.call(this,t);var g=t.isRexSpace,v=typeof e;if(null===e)return this;if("number"===v);else if("string"===v)e=Ew[e];else if(Tw(e)){var f;e=Ow(f=e,"proportion",void 0),i=Ow(f,"align",Mw),s=Ow(f,"padding",0),r=Ow(f,"expand",!1),n=Ow(f,"key",void 0),a=Ow(f,"index",void 0),t.isRexSizer||(o=Ow(f,"minWidth",void 0),h=Ow(f,"minHeight",void 0)),l=Ow(f,"fitRatio",0),d=Ow(f,"offsetX",0),c=Ow(f,"offsetY",0),u=Ow(f,"offsetOriginX",0),p=Ow(f,"offsetOriginY",0)}return"string"==typeof i&&(i=iv[i]),void 0===e&&(e=g?1:0),void 0===i&&(i=Mw),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===o&&(g?o=0:t.isRexSizer||(o=t._minWidth)),void 0===h&&(g?h=0:t.isRexSizer||(h=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=zn(t)/Fn(t)),void 0===d&&(d=0),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),(f=this.getSizerConfig(t)).proportion=e,f.align=i,f.padding=Iv(s),f.expand=r,f.fitRatio=0===e?l:0,f.alignOffsetX=d,f.alignOffsetY=c,f.alignOffsetOriginX=u,f.alignOffsetOriginY=p,void 0===a||a>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(a,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===o?zn(t):o:t.minHeight=void 0===h?Fn(t):h),r&&(0===this.orientation?t.minHeight=h:t.minWidth=o)),void 0!==n&&this.addChildrenMap(n,t),this},Rw={add:_w,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),_w.call(this,new Sw(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,o){return Tw(i)&&(i.index=t),_w.call(this,e,i,s,r,n,a,t,o),this},insertAtPosition(t,e,i,s,r,n,a,o,h){var l=Pw.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,o,h),this}};const Lw=Phaser.Utils.Array.Remove;var Bw={remove(t,e){return this.getParentSizer(t)!==this||(Lw(this.sizerChildren,t),Vv.call(this,t,e)),this},removeAll(t){for(var e=this.sizerChildren.length-1;e>=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,tx.call(this,t),this}},Iw={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=iv[e]),this.getSizerConfig(t).align=e,this}},Dw={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},jw={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},Aw={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},zw={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,o=this.sizerChildren,h=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=o.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?h=!0:n=0)):n=0,h||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,a+=n)));else for(d=0,c=o.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?h=!0:n=0)):n=0,h||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,a+=n)))}return h?void 0:a+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,a=s.padding;i=n-(a.left+a.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,a=s.padding;i=n-(a.top+a.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(of(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,rf.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,o,h,l,d,c,u=this.sizerChildren,p=this.innerLeft,g=this.innerTop,v=this.innerWidth,f=this.innerHeight,m=p,y=g,b=this.startChildIndex,x=0,C=u.length;x0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Qv.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||qv.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&kw.call(this,t,void 0),Zv.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||tf.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&kw.call(this,void 0,t),ef.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],a=n&&n.isRexSpace;return"center"===t?a||this.insertSpace(r+1):a&&this.remove(n,!0),this}};Object.assign(zw,Rw,Bw,Iw,Dw,jw,Aw);var Fw=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i};const Yw=Phaser.Utils.Objects.IsPlainObject,Xw=Phaser.Utils.Objects.GetValue;class Ww extends Xb{constructor(t,e,i,s,r,n,a){Yw(e)?(e=Xw(a=e,"x",0),i=Xw(a,"y",0),s=Xw(a,"width",void 0),r=Xw(a,"height",void 0),n=Xw(a,"orientation",0)):Yw(s)?(s=Xw(a=s,"width",void 0),r=Xw(a,"height",void 0),n=Xw(a,"orientation",0)):Yw(n)&&(n=Xw(a=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,a),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Xw(a,"space.item",0)),this.setStartChildIndex(Xw(a,"startChildIndex",0)),this.setRTL(Xw(a,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=Pp(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=Fw.call(this)),this._childrenProportion}}Object.assign(Ww.prototype,zw);var Vw=function(t,e,i){if(t){var s=null==e,r=null==i;return s&&r||(s||(t.displayWidth=e),r||(t.displayHeight=i),s&&(t.scaleX=t.scaleY),r&&(t.scaleY=t.scaleX)),t}},Gw={appendText:Ei,resetDisplayContent:function(t){void 0===t?t={}:"string"==typeof t&&(t={text:t});var e=t.text||"";this.setText(e);var i=this.childrenMap.icon;if(i){t.icon?this.show(i):this.hide(i);var s=t.iconSize;s&&(this.setChildDisplaySize(i,s,s),void 0!==this.iconWidth&&this.setIconSize(s)),!0!==t.icon&&this.setIconTexture(t.icon,t.iconFrame)}var r=this.childrenMap.action;if(r){t.action?this.show(r):this.hide(r);var n=t.actionSize;n&&(this.setChildDisplaySize(r,n,n),void 0!==this.actionWidth&&this.setActionSize(n)),!0!==t.action&&this.setActionTexture(t.action,t.actionFrame)}return this}};class Hw extends Ww{get text(){var t=this.childrenMap.text;return t?t.text:""}set text(t){var e=this.childrenMap.text;e&&e.setText(t)}setText(t){return this.text=t,this}setIconTexture(t,e){var i=this.childrenMap.icon;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.iconWidth&&void 0!==this.iconHeight&&(Vw(i,this.iconWidth,this.iconHeight),this.resetChildScaleState(i)),this):this}setTexture(t,e){return this.setIconTexture(t,e),this}setIconSize(t,e){return void 0===e&&(e=t),this.iconWidth=t,this.iconHeight=e,this}get texture(){var t=this.childrenMap.icon;if(t)return t.texture}get frame(){var t=this.childrenMap.icon;if(t)return t.frame}setActionTexture(t,e){var i=this.childrenMap.action;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.actionWidth&&void 0!==this.actionHeight&&(Vw(i,this.actionWidth,this.actionHeight),this.resetChildScaleState(i)),this):this}get actionTexture(){var t=this.childrenMap.action;if(t)return t.texture}get actionFrame(){var t=this.childrenMap.action;if(t)return t.frame}setActionSize(t,e){return void 0===e&&(e=t),this.actionWidth=t,this.actionHeight=e,this}preLayout(){var t=this.childrenMap.icon;t&&void 0!==this.iconWidth&&void 0!==this.iconHeight&&Vw(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&Vw(e,this.actionWidth,this.actionHeight),super.preLayout()}postLayout(t,e,i){var s=this.childrenMap.iconMask;s&&(s.setPosition(),this.resetChildPositionState(s));var r=this.childrenMap.actionMask;return r&&(r.setPosition(),this.resetChildPositionState(r)),super.postLayout(t,e,i),this}resize(t,e){super.resize(t,e);var i=this.childrenMap.iconMask;i&&i.resize();var s=this.childrenMap.actionMask;return s&&s.resize(),this}}Object.assign(Hw.prototype,Gw);var Uw=function(t,e,i,s){var r=new lk(e,i,s);if(t&&!t.isRexSizer){var n=r.createGeometryMask();t.setMask(n),this.once("destroy",(function(){t.setMask(),n.destroy()}))}return this.pin(r),r};const Nw=Phaser.GameObjects.Text;var $w=function(t){return t instanceof Nw};const Kw=Phaser.GameObjects.BitmapText;var Jw=function(t){return t instanceof Kw},qw=function(t){return Jw(t)?2:$w(t)?0:1},Zw=function(t,e){for(var i=[],s=t.split("\n"),r=e.style,n=r.wordWrapWidth,a=r.hasOwnProperty("wrapMode")?r.wrapMode:3,o=e.context,h=0,l=s.length;h0&&r.push(h.join("")),r},tS=function(t,e){switch(qw(t)){case 0:switch("string"==typeof e&&(e=Ie[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=Zw;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Ie[e]||0),t.style.wrapMode=e}},eS=function(t,e){return void 0===e&&(e=0),t._minWidth=e,t.runWidthWrap=function(t){return t instanceof ln}(t)?function(t){return function(e){return t.setFixedSize(e,0).runWordWrap(),t.minHeight=t.height,t}}(t):Jw(t)?function(t){return function(e){return t.setMaxWidth(e),t.minHeight=t.height,t}}(t):function(t){return function(e){var i=t.padding,s=e-(i.left+i.right)*t.scaleX,r=t.style;return $w(t)?(r.wordWrapWidth=s,r.maxLines=0):(0===r.wrapMode&&(r.wrapMode=1),r.wrapWidth=s,r.maxLines=0),r.fixedWidth=e,r.fixedHeight=0,t.updateText(),t.minHeight=t.height,t}}(t),t};const iS=65535;var sS=function(t,e,i){if(null==e)return t;if(0===e)return aS(t,0,i),t;var s=t.text.length;if(0===s)return aS(t,e,i),t;var r=Math.floor(1.5*e/s);void 0!==i&&r>i&&(r=Math.floor(i));for(var n={},a=nS(t,r,e,i,n),o=0;o<=iS&&0!==a;o++){if((r+=a)<0){r=0;break}a=nS(t,r,e,i,n)}return o===iS&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),aS(t,e,i),t},rS=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},nS=function(t,e,i,s,r){var n,a=rS(t,e,r),o=rS(t,e+1,r);if(void 0!==s)if(a.height<=s&&o.height>s)n=0;else{if(a.height>s)return-1;n=Math.floor(s-a.height)}if(a.width<=i&&o.width>i)return 0;if(a.width>i)return-1;var h=Math.floor(i-a.width);return void 0===n?h:Math.min(h,n)},aS=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const oS=Phaser.Utils.Objects.GetValue;var hS=function(t,e){"number"==typeof e&&(e={minWidth:e});var i=oS(e,"minWidth",0),s=oS(e,"minHeight",0),r=oS(e,"fitHeight",!1);return t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return sS(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),sS(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t}),t};const lS=Phaser.Utils.Objects.GetValue;class dS extends Hw{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=lS(e,"background",void 0),r=lS(e,"icon",void 0),n=lS(e,"iconMask",void 0),a=lS(e,"text",void 0),o=lS(e,"action",void 0),h=lS(e,"actionMask",void 0),l=lS(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(a||o)&&(i={right:lS(e,"space.icon",0),top:lS(e,"space.iconTop",0),bottom:lS(e,"space.iconBottom",0),left:lS(e,"space.iconLeft",0)}):(a||o)&&(i={bottom:lS(e,"space.icon",0),left:lS(e,"space.iconLeft",0),right:lS(e,"space.iconRight",0),top:lS(e,"space.iconTop",0)});var d=lS(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=Uw.call(this,r,r,1)),!d){var c=lS(e,"iconSize",void 0);this.setIconSize(lS(e,"iconWidth",c),lS(e,"iconHeight",c))}}if(a){var u=lS(e,"wrapText",!1),p=lS(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),tS(a,u),e.expandTextWidth=!0,eS(a)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,hS(a,{fitHeight:!0}));var g,v,f=lS(e,"space.text",0),m=lS(e,"expandTextWidth",!1),y=lS(e,"expandTextHeight",!1);0===this.orientation?(g=m?1:0,o&&(i={right:f}),v=y):(g=y?1:0,o&&(i={bottom:f}),v=m),this.add(a,{proportion:g,expand:v,padding:i})}if(o&&(i=0===this.orientation?{top:lS(e,"space.actionTop",0),bottom:lS(e,"space.actionBottom",0),right:lS(e,"space.actionRight",0)}:{left:lS(e,"space.actionLeft",0),right:lS(e,"space.actionRight",0),bottom:lS(e,"space.actionBottom",0)},d=lS(e,"squareFitAction",!1)?1:0,this.add(o,{proportion:0,padding:i,fitRatio:d}),h&&(h=Uw.call(this,o,o,1)),!d)){var b=lS(e,"actionSize");this.setActionSize(lS(e,"actionWidth",b),lS(e,"actionHeight",b))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",a),this.addChildrenMap("action",o),this.addChildrenMap("actionMask",h)}}const cS=Phaser.Utils.Objects.GetValue;var uS=function(t,e){var i=cS(e,"canvas"),s=cS(i,"width",128),r=cS(i,"height",128),n=new Ru(t,0,0,s,r);t.add.existing(n);var a=cS(i,"key"),o=cS(i,"frame"),h=cS(i,"fill");return void 0!==h?n.fill(h):void 0!==a&&n.loadTexture(a,o),n.setTexture=n.loadTexture.bind(n),n};const pS=Phaser.Utils.Objects.GetValue;var gS=function(t,e){var i=pS(e,"clickTarget",this);return"string"==typeof i&&(i=t.getElement(i)),i};const vS=Phaser.Utils.Objects.GetValue,fS={accept:"image/*",multiple:!1};var mS=function(t,e){if(0!==e.length){var i=t.childrenMap.icon,s=i.image,r=e[0];return s.loadFromFilePromise(r).then((function(){return i.scaleImage(),t.emit("select",r,t),Promise.resolve(r)}))}},yS={async openPromise(){var t=this;return rw(this.scene.game,fS).then((function(e){return mS(t,e.files)}))},open(){return this.openPromise(),this},setClickOpenEnable(t){return void 0===t&&(t=!0),this.clickBehavior&&this.clickBehavior.setEnable(t),this.fileChooser&&this.fileChooser.setOpenEnable(t),this}},bS={getFileName:function(t){if(!t)return null;var e=t.name;return e.substr(0,e.lastIndexOf("."))},saveTexture:function(t){return this.childrenMap.canvas.generateTexture(t),this}};Object.assign(bS,yS);const xS=Phaser.Utils.Objects.GetValue;class CS extends dS{constructor(t,e){var i=function(t,e){var i=new Xk(t,{scaleUp:cS(e,"scaleUpIcon",!1),background:cS(e,"iconBackground"),image:uS(t,e)});return t.add.existing(i),i}(t,e);e.icon=i,super(t,e),this.type="rexImageFileInputLabel";var s=this.iconWidth,r=this.iconWidth;void 0!==s&&void 0!==r&&i.resize(s,r),this.clickTarget=gS(this,e),this.clickTarget&&(xS(e,"domButton",!0)?this.fileChooser=function(t){var e=t.scene,i=new cw(e,fS);return e.add.existing(i),t.pin(i),i.on("change",(function(){mS(t,i.files)})),i}(this):this.clickBehavior=function(t,e){var i=gS(t,e);if(i){var s=vS(e,"click"),r=new cu(i,s);return r.on("click",t.open,t),r}}(this,e)),this.addChildrenMap("canvas",i.image),this.addChildrenMap("iconBackground",i.background),this.addChildrenMap("fileChooser",this.fileChooser)}postLayout(t,e,i){this.fileChooser&&(this.fileChooser.syncTo(this.clickTarget),this.resetChildState(this.fileChooser)),super.postLayout(t,e,i)}}Object.assign(CS.prototype,bS),t.register("imageInputLabel",(function(t){var e=new CS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ImageInputLabel",CS);let kS=class extends Ba{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(oe(t,e))return t[e];var i=t.parent;return oe(i,e)?i[e]:void 0}set(t,e,i){return oe(t,e)?t[e]=i:oe(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.texture.key}set key(t){this.parent.setTexture(t,this.frame)}get frame(){return this.parent.frame.name}set frame(t){this.parent.setFrame(t)}get scale(){return this.parent.scaleX}set scale(t){this.parent.setScale(t)}};const wS=Phaser.Utils.Objects.GetValue;class SS extends Ba{constructor(t,e){super(t,e),this.style=wS(e,"style",this);var i=wS(e,"propertiesMap");this.activeStyle=PS(e,"active",i),this.hoverStyle=PS(e,"hover",i),this.disableStyle=PS(e,"disable",i),this.onModifyStyle=wS(e,"onModifyStyle")}getStyle(t){return Dd(this.style,t)}modifyStyle(t){for(var e in t)this.style[e]=t[e];return this.onModifyStyle&&this.onModifyStyle(this.parent,t),this}applyStyle(t){if(t){var e=this.getStyle(t);return jd(e,t)?void 0:(this.modifyStyle(t),e)}}setActiveState(t){return TS.call(this,"active",t),this}setHoverState(t){return TS.call(this,"hover",t),this}setDisableState(t){return TS.call(this,"disable",t),this}}var PS=function(t,e,i){var s=Bd(t,e);if(i)for(var r in s)i.hasOwnProperty(r)&&(s[i[r]]=s[r],delete s[r]);return s},TS=function(t,e){void 0===e&&(e=!0);var i=`${t}State`,s=`${t}Style`,r=`${t}StyleSave`;this[i]!==e&&(this[i]=e,e?this[r]=this.applyStyle(this[s]):(this.applyStyle(this[r]),this[r]=void 0))},OS={addStyleManager(t){return this.styleManager=new SS(this,t),this},setActiveState(t){return this.styleManager.setActiveState(t),this},setHoverState(t){return this.styleManager.setHoverState(t),this},setDisableState(t){return this.styleManager.setDisableState(t),this}};const MS=Phaser.GameObjects.Image,ES=Phaser.Utils.Objects.GetValue;class _S extends MS{constructor(t,e){void 0===e&&(e={}),super(t,ES(e,"x",0),ES(e,"y",0),ES(e,"key",""),ES(e,"frame",void 0)),this.type="rexStatesImage";var i=ES(e,"effects",!0);i&&En(this,i),this.style=new kS(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(_S.prototype,OS),t.register("statesImage",(function(t){var e=new _S(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesImage",_S);class RS extends At{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesRoundRectangleShape",e.style=this,e.propertiesMap=LS,this.addStyleManager(e),delete e.style,delete e.propertiesMap}}const LS={color:"fillColor",alpha:"fillAlpha",strokeWidth:"lineWidth"};Object.assign(RS.prototype,OS),t.register("statesRoundRectangle",(function(t){var e=new RS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesRoundRectangle",RS);let BS=class extends Ba{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(oe(t,e))return t[e];var i=t.parent;return oe(i,e)?i[e]:void 0}set(t,e,i){return oe(t,e)?t[e]=i:oe(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.texture.key}set key(t){this.key!==t&&this.parent.setTexture(t,this.frame)}get frame(){return this.parent.frame.name}set frame(t){this.frame!==t&&this.parent.setFrame(t)}};const IS=Phaser.GameObjects.NineSlice,DS=Phaser.Utils.Objects.GetValue;class jS extends IS{constructor(t,e){void 0===e&&(e={}),super(t,DS(e,"x",0),DS(e,"y",0),DS(e,"key",null),DS(e,"frame",null),DS(e,"width",0),DS(e,"height",0),DS(e,"leftWidth",0),DS(e,"rightWidth",0),DS(e,"topHeight",0),DS(e,"bottomHeight",0)),this.type="rexStatesNineSlice";var i=DS(e,"effects",!0);i&&En(this,i),this.style=new BS(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(jS.prototype,OS),t.register("statesNineSlice",(function(t){var e=new jS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesNineSlice",jS);let AS=class extends Ba{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(oe(t,e))return t[e];var i=t.parent;return oe(i,e)?i[e]:void 0}set(t,e,i){return oe(t,e)?t[e]=i:oe(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}};const zS=Phaser.Utils.Objects.GetValue;class FS extends k{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=zS(e,"effects",!0);i&&En(this,i),this.style=new AS(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(FS.prototype,OS),t.register("statesNinePatch",(function(t){var e=new FS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesNinePatch",FS);const YS=Phaser.GameObjects.Text,XS=Phaser.Utils.Objects.GetValue;class WS extends YS{constructor(t,e){void 0===e&&(e={}),super(t,XS(e,"x",0),XS(e,"y",0),XS(e,"text",""),e),this.type="rexStatesText",e.style=this.style,e.onModifyStyle=function(t,e){var i=e.hasOwnProperty("fontStyle")||e.hasOwnProperty("fontSize")||e.hasOwnProperty("fontFamily");t.style.update(i)},this.addStyleManager(e),delete e.style}}Object.assign(WS.prototype,OS),t.register("statesText",(function(t){var e=new WS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesText",WS);class VS extends Ba{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(oe(t,e))return t[e];var i=t.parent;return oe(i,e)?i[e]:void 0}set(t,e,i){return oe(t,e)?t[e]=i:oe(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.texture.key}set key(t){this.parent.setTexture(t,this.frame)}get fontSize(){return this.parent.fontSize}set fontSize(t){this.parent.setFontSize(t)}get tint(){return this.parent.tintTopLeft}set tint(t){this.parent.setTint(t)}get letterSpacing(){return this.parent.letterSpacing}set letterSpacing(t){this.parent.setLetterSpacing(t)}get lineSpacing(){return this.parent.lineSpacing}set lineSpacing(t){this.parent.setLineSpacing(t)}}const GS=Phaser.GameObjects.BitmapText,HS=Phaser.Utils.Objects.GetValue;class US extends GS{constructor(t,e){void 0===e&&(e={});var i=HS(e,"x",0),s=HS(e,"y",0),r=HS(e,"font",""),n=HS(e,"fontSize",!1),a=HS(e,"align",0),o=HS(e,"tint");super(t,i,s,r,"",n,a),this.type="rexStatesBitmapText",void 0!==o&&this.setTint(o);var h=HS(e,"effects",!0);h&&En(this,h),this.style=new VS(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(US.prototype,OS),t.register("statesBitmapText",(function(t){var e=new US(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesBitmapText",US);class NS extends pp{constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("value")||(e.value=0),e.hasOwnProperty("hover.bar")||(e["hover.bar"]=!0),e.hasOwnProperty("easeDuration")||(e.easeDuration=200),e.hasOwnProperty("ease")||(e.ease="Quad"),P(e,"easeValue.duration",e.easeDuration),P(e,"easeValue.ease",e.ease),super(t,e),this.type="rexStatesBarRectangleShape",this.barState=!1,e.style=this,e.propertiesMap=$S,this.addStyleManager(e),delete e.style,delete e.propertiesMap}get bar(){return this.barState}set bar(t){t=!!t,this.barState!==t&&(this.barState=t,this.easeValueTo(this.barState?1:0))}}const $S={color:"trackColor",strokeColor:"trackStrokeColor",strokeWidth:"trackStrokeThickness"};Object.assign(NS.prototype,OS),t.register("statesBarRectangle",(function(t){var e=new NS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesBarRectangle",NS);var KS=function(t,e){void 0===e&&(e={}),void 0===e.options&&(e.options={});var i=e.options;i.responsive=!1,i.maintainAspectRatio=!1,i.hasOwnProperty("devicePixelRatio")||(i.devicePixelRatio=1);var s=!1;void 0===i.animation?i.animation={}:!1===i.animation&&(s=!0,i.animation={});var r=i.animation;s&&(r.duration=0);var n=r.onProgress;r.onProgress=function(e){n&&n(e),t.needRedraw()};var a=r.onComplete;return r.onComplete=function(e){a&&a(e),t.needRedraw()},e};let JS=class extends Ru{constructor(t,e,i,s,r,n){super(t,e,i,s,r),this.type="rexChart",this.chart=void 0,void 0!==n&&this.setChart(n)}destroy(t){this.scene&&(this.chart&&(this.chart.destroy(),this.chart=void 0),super.destroy(t))}resize(t,e){if(t===this.width&&e===this.height)return this;if(super.resize(t,e),this.chart){var i=this.chart;i.height=this.canvas.height,i.width=this.canvas.width,i.aspectRatio=i.height?i.width/i.height:null,i.update()}return this}};var qS={setChart:function(t){return window.Chart?(this.chart&&this.chart.destroy(),this.chart=new Chart(this.context,KS(this,t)),this):(console.error("Can not find chartjs! Load chartjs in preload stage.\nscene.load.script('chartjs', 'https://cdnjs.cloudflare.com/ajax/libs/Chart.js/3.8.0/Chart.min.js');"),this)},getChartDataset:function(t){if(void 0!==this.chart){if("string"!=typeof t)return this.chart.data.datasets[t];for(var e,i=this.chart.data.datasets,s=0,r=i.length;s=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return nP(this.sizerChildren,null),tx.call(this,t),this}},oP={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)nP(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},cP={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,o=this.sizerChildren,h=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Qv.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,nP(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)nP(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},pP=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const gP=Phaser.Utils.Objects.IsPlainObject,vP=Phaser.Utils.Objects.GetValue;class fP extends Xb{constructor(t,e,i,s,r,n,a,o,h,l){gP(e)?(e=vP(l=e,"x",0),i=vP(l,"y",0),s=vP(l,"width",void 0),r=vP(l,"height",void 0),n=vP(l,"column",l.col||0),a=vP(l,"row",0),o=vP(l,"columnProportions",0),h=vP(l,"rowProportions",0)):gP(s)?(s=vP(l=s,"width",void 0),r=vP(l,"height",void 0),n=vP(l,"column",l.col||0),a=vP(l,"row",0),o=vP(l,"columnProportions",0),h=vP(l,"rowProportions",0)):gP(n)?(n=vP(l=n,"column",l.col||0),a=vP(l,"row",0),o=vP(l,"columnProportions",0),h=vP(l,"rowProportions",0)):gP(o)&&(o=vP(l=o,"columnProportions",0),h=vP(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(vP(l,"createCellContainerCallback")),this.setIndentLeft(vP(l,"space.indentLeftOdd",0),vP(l,"space.indentLeftEven",0)),this.setIndentTop(vP(l,"space.indentTopOdd",0),vP(l,"space.indentTopEven",0)),this.resetGrid(n,a,o,h,vP(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=uP.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=pP.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(fP.prototype,cP),t.register("gridSizer",(function(t,e,i,s,r,n,a,o,h){var l=new fP(this.scene,t,e,i,s,r,n,a,o,h);return this.scene.add.existing(l),l})),P(window,"RexPlugins.UI.GridSizer",fP);var mP=function(t,e,i,s){return e/t<=i?e/(s-1):0},yP=function(t){var e,i,s,r,n,a={lines:[],width:0,height:0},o=this.sizerChildren,h=0,l=a.lines,d=void 0;if(0===this.orientation){for(var c=0,u=o.length;co.height/2)){r>(h=bP(o.left,o.centerY,t,e))&&(r=h,s=n);var h,l=i[n+1];l&&l.y===o.y||r>(h=bP(o.right,o.centerY,t,e))&&(r=h,s=n+1)}}return s};const CP=Phaser.Utils.Objects.IsPlainObject,kP=Phaser.Utils.Objects.GetValue,wP=Phaser.Display.Align.CENTER;var SP=function(t,e,i,s){return"\n"===t?(this.addNewLine(),this):(jv.call(this,t),CP(e)&&(e=kP(h=e,"padding",0),i=kP(h,"key",void 0),s=kP(h,"index",void 0),r=kP(h,"offsetX",0),n=kP(h,"offsetY",0),a=kP(h,"offsetOriginX",0),o=kP(h,"offsetOriginY",0)),void 0===e&&(e=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=0),void 0===o&&(o=0),(h=this.getSizerConfig(t)).align=wP,h.padding=Iv(e),h.alignOffsetX=r,h.alignOffsetY=n,h.alignOffsetOriginX=a,h.alignOffsetOriginY=o,void 0===s||s>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(s,0,t),void 0!==i&&this.addChildrenMap(i,t),this);var r,n,a,o,h},PP={add(t,e,i){if(Um(t))for(var s=t,r=0,n=s.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,tx.call(this,t),this}},MP={getChildrenWidth:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=0===this.orientation&&t?this.maxChildWidth:this.rexSizer.resolved?this.wrapResult.width:void 0)?e+(this.space.left+this.space.right)*this.scaleX:void 0);var e},getChildrenHeight:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=1===this.orientation&&t?this.maxChildHeight:this.rexSizer.resolved?this.wrapResult.height:void 0)?e+(this.space.top+this.space.bottom)*this.scaleY:void 0);var e},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const yT=Phaser.Utils.Objects.GetValue,bT=Phaser.Math.Distance.Between;class xT extends Ba{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=yT(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(yT(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(yT(t,"enable",!0)),this.holdThreshold=yT(t,"holdThreshold",50),this.pointerOutReleaseEnable=yT(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return oc(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:bT(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!Hm(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!Hm(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const CT=Phaser.Utils.Objects.GetValue;class kT{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(CT(t,"value",0)),this.setSpeed(CT(t,"speed",0)),this.setAcceleration(CT(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class wT{constructor(){this.value,this.dir,this.movement=new kT}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const OT={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},MT=Phaser.Utils.Objects.GetValue;class ET extends Ba{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=MT(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(MT(e,"speed",.1)),this.setEnable(MT(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(MT(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||Hm(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const _T=Phaser.Utils.Objects.GetValue;var RT=function(t,e,i,s){var r,n,a="Y"===(i=i.toUpperCase()),o=2===t.scrollMode,h=t.childrenMap.child,l=`slider${i}`;if(r=o||s.hasOwnProperty(l)?_T(s,l,void 0):_T(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=a?1:0,n=function(t,e){void 0===e&&(e={});var i=Ge(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new fT(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r),n.tickLength=_T(r,"tickLength",void 0);var p=_T(r,"position",0);"string"==typeof p&&(p=LT[p]);var g,v,f=_T(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=_T(s,"space.slider",void 0))&&(o?f=0:g=_T(s,"space.child",0)),v=void 0===g?"number"==typeof f:"number"==typeof g,a?0===p?(d=2,c=1,u=void 0===g?v?{left:f}:f:{left:_T(g,"right",g)}):(d=0,c=1,u=void 0===g?v?{right:f}:f:{right:_T(g,"left",g)}):0===p?(d=1,c=2,u=void 0===g?v?{top:f}:f:{top:_T(g,"bottom",g)}):(d=1,c=0,u=void 0===g?v?{bottom:f}:f:{bottom:_T(g,"top",g)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=_T(r,"hideUnscrollableSlider",!1),t[`disableUnscrollableDrag${i}`]=_T(r,"disableUnscrollableDrag",!1),t[`adaptThumb${i}SizeMode`]=_T(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=_T(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`disableUnscrollableDrag${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=_T(s,"scrollDetectionMode");"string"==typeof b&&(b=BT[b]);var x=`scroller${i}`;(m=o||s.hasOwnProperty(x)?_T(s,x,!0):_T(s,"scroller",!0))&&h&&(!0===m&&(m={}),m.orientation=a?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new TT(h,m),h.isRexContainerLite&&h.sendChildToBack(h));var C,k,w,S,P,T=_T(s,o?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);T&&h&&(void 0!==b&&(T.focus=1===b?2:0),C=new ET(h,T)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,C),o&&!a||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.disableUnscrollableDrag=t[`disableUnscrollableDrag${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",C)),n&&(o?(k=a?"t":"s",S=`scroll${i}`):(k="t",S="scroll"),n.on("valuechange",(function(e){t[k]=e,t.emit(S,t)}))),y&&(o?(w=`childO${i}`,S=`scroll${i}`):(w="childOY",S="scroll"),y.on("valuechange",(function(e){t[w]=e,t.emit(S,t)}))),C&&(P=o?`addChildO${i}`:"addChildOY",C.on("scroll",(function(e){t[P](-e,!0)})))};const LT={right:0,left:1,bottom:0,top:1},BT={gameObject:0,rectBounds:1},IT=Phaser.Utils.Objects.GetValue;var DT=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=IT(e,"width"),a=IT(e,"height");n||IT(e,"child.expandWidth",!0)||(s[1]=0),a||IT(e,"child.expandHeight",!0)||(r[1]=0);var o=new fP(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=XP(i,"child"),r=XP(s,"gameObject",void 0);if(r){var n=XP(i,"space.child",0);t.childMargin={};var a=t.childMargin,o={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:a.top=0,a.bottom=0,a.left=0,a.right=0;break;default:a.top=n,a.bottom=n,a.left=n,a.right=n}else switch(t.scrollMode){case 0:a.top=XP(n,"top",0),a.bottom=XP(n,"bottom",0),o.left=XP(n,"left",0),o.right=XP(n,"right",0);break;case 1:a.top=XP(n,"left",0),a.bottom=XP(n,"right",0),o.top=XP(n,"top",0),o.bottom=XP(n,"bottom",0);break;default:a.top=XP(n,"top",0),a.bottom=XP(n,"bottom",0),a.left=XP(n,"left",0),a.right=XP(n,"right",0)}e.add(r,{column:1,row:1,align:XP(s,"align","center"),padding:o,expand:{width:XP(s,"expandWidth",!0),height:XP(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,o,e),t.scrollMode){case 0:RT(t,o,"y",e);break;case 1:RT(t,o,"x",e);break;default:RT(t,o,"y",e),RT(t,o,"x",e)}return o},jT=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}i*="Y"===t?this.scaleY:this.scaleX,s&&s.setBounds(e,i),r&&(r.setEnable(e!==i),r.tickLength&&r.setTick(r.tickLength,e,i))},AT=function(t){switch(this.scrollMode){case 0:case 1:(i=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(i,this.isOverflow),(r=this.childrenMap.scroller)&&this.disableUnscrollableDrag&&r.setEnable(this.isOverflow);break;default:var e=this[`isOverflow${t=t.toUpperCase()}`],i=this.childrenMap[`slider${t}`],s=this[`hideUnscrollableSlider${t}`];i&&s&&this.setChildVisible(i,e);var r=this.childrenMap.scroller,n=this[`disableUnscrollableDrag${t}`];r&&n&&r.setEnable(e)}},zT=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(o=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=o.childrenMap.track,s=o.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&n0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n")}return i},HT=function(t){return(t-this.textLineSpacing)/(this.textLineHeight+this.textLineSpacing)},UT=function(t){return t*(this.textLineHeight+this.textLineSpacing)-this.textLineSpacing},NT=function(t){var e,i=t+this.visibleLinesCount+1;switch(this.textObjectType){case 0:case 2:e=this.lines.slice(t,i).join("\n");break;case 1:var s=this.lines.getLineStartIndex(t),r=this.lines.getLineEndIndex(i-1);e=this.lines.getSliceTagText(s,r,!0)}return e},$T=function(t,e){switch(qw(t)){case 0:var i=(r=t.style).wordWrapWidth,s=r.wordWrapCallback;r.wordWrapWidth=0,r.wordWrapCallback=void 0,t.setText(e),r.wordWrapWidth=i,r.wordWrapCallback=s;break;case 1:var r,n=(r=t.style).wrapMode;r.wrapMode=0,t.setText(e),r.wrapMode=n;break;case 2:var a=t._maxWidth;t._maxWidth=0,t.setText(e),t._maxWidth=a}},KT=function(){var t=this.textObject.rexSizer;this.textObject.y+=t.offsetY-t.preOffsetY,t.preOffsetY=t.offsetY,this.resetChildPositionState(this.textObject),this.textCropEnable&&JT.call(this)},JT=function(){if(this.textObject.setCrop){var t,e,i=this.textObject.rexSizer.offsetY;i<=0?(t=-i,e=this.height):(t=0,e=this.height-i),this.textObject.setCrop(0,t,this.width,e)}},qT=function(t,e,i){if(i+=this.textLineHeight+this.textLineSpacing,this.textObjectWidth!==e||this._textObjectRealHeight!==i){switch(this.textObjectWidth=e,this._textObjectRealHeight=i,this.textObjectType){case 0:case 1:t.setFixedSize(e,i);var s=t.style,r=Math.max(e,0);0===this.textObjectType?s.wordWrapWidth=r:(0===s.wrapMode&&(s.wrapMode=1),s.wrapWidth=r);break;case 2:t.setMaxWidth(e)}this.setText()}},ZT={setText:function(t){return void 0!==t&&(this.text=t),this.lines=GT(this.textObject,this.text,this.lines),this.linesCount=this.lines.length,this._textHeight=void 0,this._textVisibleHeight=void 0,this.updateTextObject(),this},updateTextObject:function(){var t=Math.max(Math.floor(HT.call(this,-this.textOY)),0),e=UT.call(this,t)+this.textOY,i=NT.call(this,t);return $T(this.textObject,i),this.textObject.rexSizer.offsetY=e,KT.call(this),this},preLayout:function(){return this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,rf.call(this),this},layoutChildren:function(){var t,e,i,s,r,n,a,o=this.left,h=this.top;(t=this.textObject).rexSizer.hidden||(s=o+(i=(e=t.rexSizer).padding).left*this.scaleX,r=h+i.top*this.scaleY,n=this.width*this.scaleX-(i.left+i.right)*this.scaleX,a=this.height*this.scaleY-(i.top+i.bottom)*this.scaleY,qT.call(this,t,n,a),Tv(t,s,r,n,a,e.align),e.preOffsetY=0,KT.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const QT=Phaser.Utils.Objects.IsPlainObject,tO=Phaser.Utils.Objects.GetValue,eO=Phaser.Display.Align.TOP_LEFT;class iO extends Xb{constructor(t,e,i,s,r,n){QT(e)?(e=tO(n=e,"x",0),i=tO(n,"y",0),s=tO(n,"width",void 0),r=tO(n,"height",void 0)):QT(s)&&(s=tO(n=s,"width",void 0),r=tO(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexTextBlock",this.textObject=void 0,this.linesCount=0,this.textMask=void 0,this.textObjectType=void 0,this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,this._textObjectRealHeight=0,this.lines=void 0,this.text=tO(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode(tO(n,"clampTextOY",!0)),this.alwaysScrollable=tO(n,"alwaysScrollable",!1);var a=tO(n,"background",void 0),o=tO(n,"text",void 0);void 0===o&&(o=sO(t)),this.textCropEnable=tO(n,"textCrop",!!o.setCrop);var h=tO(n,"textMask",!this.textCropEnable);a&&this.addBackground(a),this.add(o),this.sizerChildren=[o];var l=this.getSizerConfig(o);l.align=eO,l.padding=Iv(0),l.expand=!0,this.textObject=o,this.textObjectType=qw(o),l.preOffsetY=0,l.offsetY=0,h&&(this.textMask=Uw.call(this,this.textObject,this)),this.addChildrenMap("background",a),this.addChildrenMap("text",o)}destroy(t){if(this.scene&&!this.ignoreDestroy){if(this.textObject=void 0,this.textMask=void 0,this.lines){switch(this.textObjectType){case 0:case 2:this.lines.length=0;break;case 1:this.lines.destroy()}this.lines=void 0}super.destroy(t)}}setClampMode(t){return void 0===t&&(t=!0),this.clampTextOY=t,this}get textLineHeight(){if(void 0===this._textLineHeight){var t;switch(this.textObjectType){case 0:case 1:var e=this.textObject.style;t=e.metrics.fontSize+e.strokeThickness;break;case 2:var i=this.textObject.fontSize/this.textObject.fontData.size;t=this.textObject.fontData.lineHeight*i}this._textLineHeight=t}return this._textLineHeight}get textLineSpacing(){if(void 0===this._textLineSpacing){var t;switch(this.textObjectType){case 0:case 1:t=this.textObject.lineSpacing;break;case 2:t=0}this._textLineSpacing=t}return this._textLineSpacing}get visibleLinesCount(){return void 0===this._visibleLinesCount&&(this._visibleLinesCount=Math.floor(HT.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=UT.call(this,this.linesCount)),this._textHeight}get textObjectHeight(){return this._textObjectRealHeight-(this.textLineHeight+this.textLineSpacing)}get textVisibleHeight(){if(void 0===this._textVisibleHeight){var t=this.textHeight-this.textObjectHeight;!this.alwaysScrollable&&t<0&&(t=0),this._textVisibleHeight=t}return this._textVisibleHeight}textOYExceedTop(t){return void 0===t&&(t=this.textOY),t>this.topTextOY}textOYExeceedBottom(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:s?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}setTextOY(t){return this.textOY=t,this}set t(t){this.textOY=-this.textVisibleHeight*t}get t(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t}setTextOYByPercentage(t){return this.t=t,this}}var sO=function(t){return t.add.text(0,0,"")};Object.assign(iO.prototype,ZT);var rO={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},nO={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const aO=Phaser.Utils.Objects.GetValue;class oO extends WT{constructor(t,e){void 0===e&&(e={});var i=aO(e,"text",void 0),s=aO(e,"textWidth",void 0),r=aO(e,"textHeight",void 0),n=aO(e,"textCrop",!!i.setCrop),a=aO(e,"textMask",!n),o=aO(e,"content",""),h=new iO(t,{width:s,height:r,text:i,textMask:a,textCrop:n&&!a,content:o,clampTextOY:aO(e,"clampChildOY",!1),alwaysScrollable:aO(e,"alwaysScrollable",!1)});t.add.existing(h),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textObjectHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.textHeight}})}(h),e.scrollMode=0,e.type="rexTextArea",e.child={gameObject:h,expandWidth:void 0===s,expandHeight:void 0===r};var l=aO(e,"space",void 0);l&&(l.child=aO(l,"text",0)),super(t,e),this.addChildrenMap("text",i)}get text(){return this.childrenMap.child.text}get lineHeight(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.textHeight}}Object.assign(oO.prototype,rO,nO);const hO=Phaser.Utils.Objects.GetValue;var lO=function(t,e,s){e=e?i(e):{};var r=hO(s,"background",AP),n=hO(s,"text",dO),a=hO(s,"track",AP),o=hO(s,"thumb",AP);r?e.background=r(t,e.background):delete e.background,n?e.text=n(t,e.text):delete e.text;var h=e.slider;!1!==h&&null!==h&&(void 0===h&&(h={}),a?h.track=a(t,h.track):delete h.track,o?h.thumb=o(t,h.thumb):delete h.thumb,e.slider=h);var l=new oO(t,e);return t.add.existing(l),l},dO=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("key")&&(i="bitmaptext",e.font=e.key)),i){case"bitmaptext":case"bitmap":s=new US(t,e);break;case"bbcodetext":case"bbcode":s=new cs(t,0,0,"",e);break;case"label":s=new gO(t,e);break;case"textarea":s=lO(t,e);break;default:s=new WS(t,e)}return jP(s,e),t.add.existing(s),s},cO=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("leftWidth")?i="nineSlice":(e.hasOwnProperty("color")||e.hasOwnProperty("strokeColor"))&&(i="roundRectangle")),i){case"nineSlice":s=e.hasOwnProperty("stretchMode")?new FS(t,e):new jS(t,e);break;case"roundRectangle":s=new RS(t,e);break;default:s=new _S(t,e)}return jP(s,e),t.add.existing(s),s};const uO=Phaser.Utils.Objects.GetValue;var pO=function(t,e,s){e=e?i(e):{};var r=uO(s,"background",AP),n=uO(s,"text",dO),a=uO(s,"icon",cO),o=uO(s,"action",cO);return null!==e.background&&r?e.background=r(t,e.background):delete e.background,null!==e.text&&n?e.text=n(t,e.text):delete e.text,null!==e.icon&&a?e.icon=a(t,e.icon):delete e.icon,null!==e.action&&o?e.action=o(t,e.action):delete e.action,e};class gO extends dS{constructor(t,e,i){super(t,e=pO(t,e,i)),this.type="rexSimpleLabel"}setActiveState(t){return vO(this.getChildren(),"setActiveState",t),this}setHoverState(t){return vO(this.getChildren(),"setHoverState",t),this}setDisableState(t){return vO(this.getChildren(),"setDisableState",t),this}}var vO=function(t,e,i){for(var s=0,r=t.length;sthis.maxExp&&(t=this.maxExp),void 0===e&&(e=this.getLevel(t)),this._exp=t,this._level=e,this._requiredExp=this.getRequiredExpToNextLevel(e,t),this}get exp(){return this._exp}set exp(t){if(this.hasMaxLevel&&t>this.maxExp&&(t=this.maxExp),tthis.maxLevel?this.exp=this.maxExp:this.exp=this.getExp(t)}get requiredExp(){return this._requiredExp}getExp(t){return void 0===t?this._exp:this.isLevelMapFunction?this.levelTable(t):(this.hasMaxLevel&&t>this.maxLevel&&(t=this.maxLevel),this.levelTable[t])}getLevel(t,e){if(void 0===t)return this._level;for(void 0===e&&(e=0);;){var i=this.getExp(e+1);if(i>t)break;if(e++,this.hasMaxLevel&&i===this.maxExp)break}return e}getRequiredExpToNextLevel(t,e){return void 0===t&&(t=this.level),void 0===e&&(e=this.exp),this.getExp(t+1)-e}checkLevel(t,e){return e>=this.getExp(t)&&e=0;n--)s=BO(t[n],e,i);else for(var n=0,a=t.length;ns?1:it)return this;for(var e=this.commands;;){var i=e[this.index],s=i[1];if(Um(s)||(s=jc(zO,i,1)),BO(s,this.scope),this.emit("runcommand",s,this.scope),this.index>=e.length-1)return this.nextTime=0,this.complete(),this;if(this.index++,this.nextTime=this.getNextDt(this.nextTime),this.nextTime>t)return this}}complete(){this.clock.stop(),this.state=2,this.emit("complete",this.parent,this)}getNextDt(t){var e=this.commands[this.index][0];return 1===this.timeUnit&&(e*=1e3),1===this.dtMode&&(e+=t),e}setDtMode(t){return"string"==typeof t&&(t=YO[t]),this.dtMode=t,this}setTimeUnit(t){return"string"==typeof t&&(t=FO[t]),this.timeUnit=t,this}}var zO=[];const FO={ms:0,s:1,sec:1},YO={abs:0,absolute:0,inc:1,increment:1};var XO=function(t,e,i,s,r){var n=(i-e)/(r-s)*this.totalEaseDuration,a=i===r?t+1:t;this.player.append(0,this.setEaseValueDuration,n).append(0,this.easeValueTo,i,s,r).append(0,this.emit,"levelup.start",t,e,i,this).append(n,h).append(0,this.emit,"levelup.end",a,e,i,this),this.player.isPlaying||this.player.start()},WO={setExpTable(t){return this.levelCounter.setTable(t),this},resetExp(t){return this.levelCounter.resetExp(t),this.setValue(this.exp,this.getExp(this.level),this.getExp(this.level+1)),this},getExp(t){return this.levelCounter.getExp(t)},getLevel(t,e){return this.levelCounter.getLevel(t,e)},getRequiredExpToNextLevel(t,e){return this.levelCounter.getRequiredExpToNextLevel(t,e)},gainExp(t){return this.levelCounter.gainExp(t),this},setExp(t){return this.levelCounter.setExp(t),this},setLevel(t){return this.levelCounter.setLevel(t),this}};const VO=Phaser.Utils.Objects.GetValue;class GO extends RO{constructor(t,e){super(t,e),this.type="rexExpBar",this.setTotalEaseDuration(VO(e,"easeDuration",1e3)),this.levelCounter=new LO(VO(e,"levelCounter")),this.player=new AO(this,{scope:this,dtMode:1}),this.levelCounter.on("levelup",XO,this),this.player.on("complete",(function(){this.player.clear(),this.emit("levelup.complete",this.level,this)}),this),this.setValue(this.exp,this.getExp(this.level),this.getExp(this.level+1))}destroy(t){this.scene&&!this.ignoreDestroy&&(this.levelCounter.destroy(),this.levelCounter=void 0,this.player.destroy(),this.player=void 0,super.destroy(t))}get exp(){return this.levelCounter.exp}set exp(t){this.levelCounter.exp=t}get level(){return this.levelCounter.level}set level(t){this.levelCounter.level=t}get requiredExp(){return this.levelCounter.requiredExp}setTotalEaseDuration(t){return this.totalEaseDuration=t,this}}Object.assign(GO.prototype,WO),t.register("expBar",(function(t){var e=new GO(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ExpBar",GO);const HO=Ww.prototype.add,UO=Ww.prototype.addSpace;var NO=function(t){var e=!t.isRexSpace,i=!e||this.buttonsExpand?1:0;if(0===this.sizerChildren.length)if(e){!this.buttonsExpand&&("right"===this.buttonsAlign||"center"===this.buttonsAlign||"bottom"===this.buttonsAlign)&&UO.call(this),HO.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&UO.call(this),this.hasTailSpace=s}else HO.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;HO.call(this,t,{index:r,proportion:i,expand:!0})}else HO.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},$O={addButton(t){if(Um(t))for(var e=t,i=0,s=e.length;i=0;i--)qO.call(this,e[i],t);return this}},QO=function(t,e,i){if(t){var s=this.setValueCallback,r=this.setValueCallbackScope;s&&(r?s.call(r,t,e,i):s(t,e,i)),this.fireEvent("button.statechange",t,e,i)}},tM=function(t){var e=this;t._selected=void 0,Object.defineProperty(t,"selected",{get:function(){return t._selected},set:function(i){if(t._selected!==i){var s=t._selected;t._selected=i,QO.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},eM={add(t){return this.buttons.push(t),t._click||(t._click=new cu(t,this.clickConfig),t._click.on("click",(function(t,e,i,s){this.fireEvent("button.click",e,i,s)}),this).on("enable",(function(t,e){this.fireEvent("button.enable",e)}),this).on("disable",(function(t,e){this.fireEvent("button.disable",e)}),this).on("over",(function(t,e,i,s){this.fireEvent("button.over",e,i,s)}),this).on("out",(function(t,e,i,s){this.fireEvent("button.out",e,i,s)}),this).on("down",(function(t,e,i,s){this.fireEvent("button.down",e,i,s)}),this).on("up",(function(t,e,i,s){this.fireEvent("button.up",e,i,s)}),this),t.isRexContainerLite&&t.sendChildToBack(t)),this.buttonsType&&(void 0===t.name&&console.error(`${this.parent.constructor.name}: Option button miss value`),tM.call(this,t)),this},addMultiple(t){for(var e=0,i=t.length;e0},setButtonEnable(t,e){var i=this.buttons;if(void 0===t||"boolean"==typeof t){e=t;for(var s=0,r=i.length;s=0;i--)mM.call(this,e[i],t);return this}};const bM=Phaser.Utils.Objects.GetValue;class xM extends fP{constructor(t,e){void 0===e&&(e={});var i=bM(e,"row",0),s=bM(e,"column",e.col||0),r=bM(e,"createCellContainerCallback"),n=bM(e,"buttons",void 0),a=bM(e,"expand",!0),o=a?1:0;if(r&&(e.createCellContainerCallback=void 0),void 0!==n){i=Math.max(i,n.length);for(var h=0,l=n.length;hr&&CM.addNewLine(this)}else for(n=0,a=t.length;n=0;i--)TM.call(this,e[i],t);return this}};const MM=Phaser.Utils.Objects.GetValue;class EM extends BP{constructor(t,e){void 0===e&&(e={});var i=e.space;"number"==typeof i&&(e.space={item:i,line:i}),super(t,e),this.type="rexFixWidthButtons",this.buttonGroup=new hM({parent:this,eventEmitter:MM(e,"eventEmitter",this),groupName:MM(e,"groupName",void 0),clickConfig:MM(e,"click",void 0)}).setButtonsType(e);var s=MM(e,"background",void 0),r=MM(e,"buttons",void 0);this.buttonsAlign=MM(e,"align",void 0),s&&this.addBackground(s),r&&this.addButtons(r),this.addChildrenMap("background",s),this.addChildrenMap("buttons",this.buttonGroup.buttons)}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.buttonGroup.destroy(),this.buttonGroup=void 0)}get buttons(){return this.buttonGroup.buttons}get groupName(){return this.buttonGroup.groupName}set groupName(t){this.buttonGroup.groupName=t}get eventEmitter(){return this.buttonGroup.eventEmitter}}Object.assign(EM.prototype,wM,OM,oM,dM),t.register("fixWidthButtons",(function(t){var e=new EM(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.FixWidthButtons",EM);var _M={setAccept(t){return this.childrenMap.fileChooser.setAccept(t),this},setMultiple(t){return this.childrenMap.fileChooser.setMultiple(t),this},loadFile(t,e,i,s,r){return this.childrenMap.fileChooser.loadFile(t,e,i,s,r),this},loadFilePromise(t,e,i,s){return this.childrenMap.fileChooser.loadFilePromise(t,e,i,s)}};const RM=Phaser.Utils.Objects.GetValue;class LM extends dS{constructor(t,e){super(t,e),this.type="rexFileSelectorButton";var i=new cw(t);t.add.existing(i),this.addBackground(i),this.addChildrenMap("fileChooser",i),this.setAccept(RM(e,"accept","")),this.setMultiple(RM(e,"multiple",!1)),i.on("change",(function(t){var e=t.files;0!==e.length&&(e=Array.from(e),this.emit("select",e,this))}),this)}get files(){return this.childrenMap.fileChooser.files}}Object.assign(LM.prototype,_M),t.register("fileSelectorButton",(function(t){var e=new LM(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.FileSelectorButton",LM);var BM={getChoice(t){var e=this.childrenMap.choicesSizer;return e?e.getButton(t):void 0},getAction(t){return this.childrenMap.actionsSizer.getButton(t)},getToolbar(t){return this.childrenMap.toolbarSizer.getButton(t)},getLeftToolbar(t){return this.childrenMap.leftToolbarSizer.getButton(t)},setChoiceEnable(t,e){var i=this.childrenMap.choicesSizer;return i&&i.setButtonEnable(t,e),this},setActionEnable(t,e){return this.childrenMap.actionsSizer.setButtonEnable(t,e),this},setToolbarEnable(t,e){return this.childrenMap.toolbarSizer.setButtonEnable(t,e),this},setLeftToolbarEnable(t,e){return this.childrenMap.leftToolbarSizer.setButtonEnable(t,e),this},toggleChoiceEnable(t){var e=this.childrenMap.choicesSizer;return e&&e.toggleButtonEnable(t),this},toggleActionEnable(t){return this.childrenMap.actionsSizer.toggleButtonEnable(t),this},toggleToolbarEnable(t){return this.childrenMap.toolbarSizer.toggleButtonEnable(t),this},toggleLeftToolbarEnable(t){return this.childrenMap.leftToolbarSizer.toggleButtonEnable(t),this},getChoiceEnable(t){var e=this.childrenMap.choicesSizer;return!!e&&e.getButtonEnable(t)},getActionEnable(t){return this.childrenMap.actionsSizer.getButtonEnable(t)},getToolbarEnable(t){return this.childrenMap.toolbarSizer.getButtonEnable(t)},getLeftToolbarEnable(t){return this.childrenMap.leftToolbarSizer.getButtonEnable(t)},emitChoiceClick(t){var e=this.childrenMap.choicesSizer;return e&&e.emitButtonClick(t),this},emitActionClick(t){return this.childrenMap.actionsSizer.emitButtonClick(t),this},emitToolbarClick(t){return this.childrenMap.toolbarSizer.emitButtonClick(t),this},emitLeftToolbarClick(t){return this.childrenMap.leftToolbarSizer.emitButtonClick(t),this},showChoice(t){var e=this.childrenMap.choicesSizer;return e&&e.showButton(t),this},showAction(t){return this.childrenMap.actionsSizer.showButton(t),this},showToolbar(t){return this.childrenMap.toolbarSizer.showButton(t),this},showLeftToolbar(t){return this.childrenMap.leftToolbarSizer.showButton(t),this},hideChoice(t){var e=this.childrenMap.choicesSizer;return e&&e.hideButton(t),this},hideAction(t){return this.childrenMap.actionsSizer.hideButton(t),this},hideToolbar(t){return this.childrenMap.toolbarSizer.hideButton(t),this},hideLeftToolbar(t){return this.childrenMap.leftToolbarSizer.hideButton(t),this},addChoice(t){var e=this.childrenMap.choicesSizer;return e&&e.addButton(t),this},addAction(t){return this.childrenMap.actionsSizer.addButton(t),this},addToolbar(t){return this.childrenMap.toolbarSizer.addButton(t),this},addLeftToolbar(t){return this.childrenMap.leftToolbarSizer.addButton(t),this},removeChoice(t,e){var i=this.childrenMap.choicesSizer;return i&&i.removeButton(t,e),this},removeAction(t,e){return this.childrenMap.actionsSizer.removeButton(t,e),this},removeToolbar(t,e){return this.childrenMap.toolbarSizer.removeButton(t,e),this},removeLeftToolbar(t,e){return this.childrenMap.leftToolbarSizer.removeButton(t,e),this},clearChoices(t){var e=this.childrenMap.choicesSizer;return e&&e.clearButtons(t),this},clearActions(t){return this.childrenMap.actionsSizer.clearButtons(t),this},clearToolbar(t){return this.childrenMap.toolbarSizer.clearButtons(t),this},clearLeftToolbar(t){return this.childrenMap.leftToolbarSizer.clearButtons(t),this},forEachChoice(t,e){var i=this.childrenMap.choicesSizer;return i&&i.forEachButtton(t,e),this},forEachAction(t,e){return this.childrenMap.actionsSizer.forEachButtton(t,e),this},forEachToolbar(t,e){return this.childrenMap.toolbarSizer.forEachButtton(t,e),this},forEachLeftToolbar(t,e){return this.childrenMap.leftToolbarSizer.forEachButtton(t,e),this},setAllButtonsEnable(t){return void 0===t&&(t=!0),this.childrenMap.toolbarSizer&&this.setToolbarEnable(t),this.childrenMap.leftToolbarSizer&&this.setLeftToolbarEnable(t),this.childrenMap.actionsSizer&&this.setActionEnable(t),this.childrenMap.choicesSizer&&this.setChoiceEnable(t),this},getChoicesButtonStates(){var t=this.childrenMap.choicesSizer;return t?t.getAllButtonsState():{}},getChoicesButtonState(t){var e=this.childrenMap.choicesSizer;return void 0===t?e?e.getAllButtonsState():{}:!!e&&e.getButtonState(t)},setChoicesButtonState(t,e){var i=this.childrenMap.choicesSizer;return i&&i.setButtonState(t,e),this},clearChoicesButtonStates(){var t=this.childrenMap.choicesSizer;return t&&t.clearAllButtonsState(),this},getChoicesSelectedButtonName(){var t=this.childrenMap.choicesSizer;return t?t.getSelectedButtonName():""},setChoicesSelectedButtonName(t){var e=this.childrenMap.choicesSizer;return e&&e.setSelectedButtonName(t),this},hasAnyChoice(){var t=this.childrenMap.choicesSizer;return!!t&&t.hasAnyButton()},hasAnyAction(){var t=this.childrenMap.actionsSizer;return!!t&&t.hasAnyButton()},hasAnyToolbar(){var t=this.childrenMap.toolbarSizer;return!!t&&t.hasAnyButton()},hasAnyLeftToolbar(){var t=this.childrenMap.leftToolbarSizer;return!!t&&t.hasAnyButton()}},IM={onCreateModalBehavior(t){t.on("button.click",(function(e,i,s,r,n){var a=!1;switch(i){case"actions":a=!0;break;case"choices":t.hasAnyAction()||(a=!0)}if(a){var o={index:s,text:e.text,button:e,dialog:t};switch(t.buttonsType){case"radio":o.value=t.getChoicesSelectedButtonName();break;case"checkboxes":o.value=t.getChoicesButtonStates();break;default:o.value=void 0}t.modalClose(o)}}))},modal(t,e){return t&&!1===t.defaultBehavior?this.onCreateModalBehavior=!1:delete this.onCreateModalBehavior,Ym.modal.call(this,t,e),this}},DM={};Object.assign(DM,BM,IM);const jM=Phaser.Utils.Objects.GetValue;class AM extends Ww{constructor(t,e){void 0===e&&(e={}),e.orientation=1,super(t,e),this.type="rexDialog",this.eventEmitter=jM(e,"eventEmitter",this);var i,s,r,n,a=jM(e,"background",void 0),o=jM(e,"title",void 0),h=jM(e,"toolbar",void 0),l=jM(e,"toolbarBackground",void 0),d=jM(e,"leftToolbar",void 0),c=jM(e,"leftToolbarBackground",void 0),u=jM(e,"content",void 0),p=jM(e,"description",void 0),g=jM(e,"choices",void 0),v=jM(e,"choicesBackground",void 0),f=jM(e,"actions",void 0),m=jM(e,"actionsBackground",void 0),y=jM(e,"click",void 0);if(a&&this.addBackground(a),h&&(r=new uM(t,{groupName:"toolbar",background:l,buttons:h,orientation:0,space:{item:jM(e,"space.toolbarItem",0)},click:y,eventEmitter:this.eventEmitter}),t.add.existing(r)),d&&(n=new uM(t,{groupName:"leftToolbar",background:c,buttons:d,orientation:0,space:{item:jM(e,"space.leftToolbarItem",0)},click:y,eventEmitter:this.eventEmitter}),t.add.existing(n)),o||h||d){var b,x=!!o&&jM(e,"expand.title",!0),C=jM(e,"align.title","center"),k=!(o&&!x&&"center"===C||!o&&(h||d));b=k?new Ww(t,{orientation:0}):new ax(t),t.add.existing(b);var w=!!k||{height:!0};if(n&&b.add(n,{align:"left",expand:w}),o){k&&!x&&"right"===C&&b.addSpace();var S={left:jM(e,"space.titleLeft",0),right:jM(e,"space.titleRight",0)},P=x?1:0;b.add(o,{align:C,proportion:P,expand:w,padding:S}),k&&!x&&"left"===C&&b.addSpace()}r&&(k&&!o&&b.addSpace(),b.add(r,{align:"right",expand:w})),(u||p||g||f)&&(S={bottom:jM(e,"space.title",0),top:jM(e,"space.titleTop",0)}),P=jM(e,"proportion.title",0),this.add(b,{padding:S,proportion:P,expand:!0})}if(u){var T=jM(e,"align.content","center"),O=jM(e,"space.content",0),M=(S={left:jM(e,"space.contentLeft",0),right:jM(e,"space.contentRight",0),bottom:p||g||f?O:0},P=jM(e,"proportion.content",0),jM(e,"expand.content",!0));this.add(u,{align:T,padding:S,proportion:P,expand:M})}if(p){T=jM(e,"align.description","center");var E=jM(e,"space.description",0);S={left:jM(e,"space.descriptionLeft",0),right:jM(e,"space.descriptionRight",0),bottom:g||f?E:0},P=jM(e,"proportion.description",0),M=jM(e,"expand.description",!0),this.add(p,{align:T,padding:S,proportion:P,expand:M})}if(g){var _=jM(e,"choicesType","").split("-"),R=zM(_,"wrap")?EM:zM(_,"grid")?xM:uM,L=zM(_,"radio")?"radio":zM(_,"checkboxes")?"checkboxes":void 0,B={left:jM(e,"space.choicesBackgroundLeft",0),right:jM(e,"space.choicesBackgroundRight",0),top:jM(e,"space.choicesBackgroundTop",0),bottom:jM(e,"space.choicesBackgroundBottom",0)},I=jM(e,"space.choice",0);R===uM?B.item=I:R===EM?(B.item=I,B.line=jM(e,"space.choiceLine",I)):(B.column=jM(e,"space.choiceColumn",I),B.row=jM(e,"space.choiceRow",I));var D={width:jM(e,"choicesWidth",void 0),height:jM(e,"choicesHeight",void 0),groupName:"choices",buttonsType:L,background:v,buttons:g,space:B,click:y,eventEmitter:this.eventEmitter,setValueCallback:jM(e,"choicesSetValueCallback",void 0),setValueCallbackScope:jM(e,"choicesSetValueCallbackScope",void 0)};R===uM&&(D.orientation=zM(_,"x")?0:1),i=new R(t,D),t.add.existing(i);var j=jM(e,"space.choices",0);S={left:jM(e,"space.choicesLeft",0),right:jM(e,"space.choicesRight",0),bottom:f?j:0},T=jM(e,"align.choices","center"),P=jM(e,"proportion.choices",0),M=jM(e,"expand.choices",!0),this.add(i,{align:T,padding:S,proportion:P,expand:M}),this.buttonsType=L}f&&(s=new uM(t,{groupName:"actions",background:m,buttons:f,orientation:0,space:{item:jM(e,"space.action",0)},expand:jM(e,"expand.actions",!1),align:jM(e,"align.actions","center"),click:y,eventEmitter:this.eventEmitter}),t.add.existing(s),S={left:jM(e,"space.actionsLeft",0),right:jM(e,"space.actionsRight",0),bottom:jM(e,"space.actionsBottom",0)},P=jM(e,"proportion.action",0),this.add(s,{align:"center",padding:S,proportion:P,expand:!0})),YM(this,"click"),YM(this,"over"),YM(this,"out"),YM(this,"enable"),YM(this,"disable"),this.addChildrenMap("background",a),this.addChildrenMap("title",o),this.addChildrenMap("toolbar",h),this.addChildrenMap("leftToolbar",d),this.addChildrenMap("content",u),this.addChildrenMap("description",p),this.addChildrenMap("choices",i?i.buttons:void 0),this.addChildrenMap("actions",s?s.buttons:void 0),this.addChildrenMap("choicesSizer",i),this.addChildrenMap("actionsSizer",s),this.addChildrenMap("toolbarSizer",r),this.addChildrenMap("leftToolbarSizer",n)}}var zM=function(t,e){return-1!==t.indexOf(e)},FM={actions:"action",choices:"choice",toolbar:"toolbar",leftToolbar:"leftToolbar"},YM=function(t,e){t.on(`button.${e}`,(function(i,s,r,n,a){FM.hasOwnProperty(s)&&t.emit(`${FM[s]}.${e}`,i,r,n,a)}))};Object.assign(AM.prototype,DM),t.register("dialog",(function(t){var e=new AM(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.Dialog",AM);var XM=function(t,e,i){var s=new gO(t,e,i);return t.add.existing(s),s},WM=function(t){var e=this.childrenMap.title;null===(t=t.title)?e.hide():(e.show(),e.resetDisplayContent(t))},VM=function(t){var e=this.childrenMap.content;if(null===(t=t.content))e.hide();else if(e.show(),e.resetDisplayContent)e.resetDisplayContent(t);else{var i=t||"";e.setText(i)}},GM=function(t){var e=this.childrenMap.actions;if(e){var i=t.buttons;if(i){for(var s=this.scene,r=this.defaultActionConfig,n=this.defaultActionButtonCreator,a=0,o=i.length;a=0&&t=0&&i0&&s)){if(0===n)return 2===e&&(i+=1),i;if(1===e){var a=i;(s=(i+=1)>=0&&i=this.colCount?null:e*this.colCount+t}rowIndexToHeight(t,e){if(this.defaultCellHeightMode)return(e-t+1)*this.defaultCellHeight;for(var i=0,s=t;s<=e;s++)i+=this.getRowHeight(s);return i}colIndexToWidth(t,e){return(e-t+1)*this.defaultCellWidth}getRowHeight(t){var e=this.colCount;if(e<=1)return this.getCellHeight(this.colRowToCellIndex(0,t));for(var i,s=0,r=0;ri,n=tthis.leftTableOX,n=tt?this.removeCells(t,e-t):this.insertNewCells(e,t-e)),this},insertNewCells:function(t,e){return"object"==typeof t&&(t=t.index),void 0===e&&(e=1),e<=0||(t=ZE(t,0,this.cellsCount),this.table.insertNewCells(t,e)),this},removeCells:function(t,e){if("object"==typeof t&&(t=t.index),void 0===e&&(e=1),t<0&&(e+=t,t=0),e<=0)return this;if(t>this.cellsCount)return this;for(var i,s=t,r=t+e;sthis.topChildOY}childOYExeceedBottom(t){return void 0===t&&(t=this.childOY),tthis.leftChildOX}childOXExeceedRight(t){return void 0===t&&(t=this.childOX),tthis.childHeight?t=0:s?t=e:r&&(t=i)),this._childOY!==t&&(this._childOY=t,this.resetChildPosition()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}get childOX(){return this._childOX}set childOX(t){var e=this.leftChildOX,i=this.rightChildOX,s=this.childOXExceedLeft(t),r=this.childOXExeceedRight(t);this.clampChildOX&&(this.childVisibleWidth>this.childWidth?t=0:s?t=e:r&&(t=i)),this._childOX!==t&&(this._childOX=t,this.resetChildPosition()),s&&(this.execeedLeftState||this.emit("execeedleft",this,t,e)),this.execeedLeftState=s,r&&(this.execeedRightState||this.emit("execeedright",this,t,i)),this.execeedRightState=r}setChildOY(t){return this.childOY=t,this}setChildOX(t){return this.childOX=t,this}set t(t){this.childOY=-this.visibleHeight*t}get t(){var t=this.visibleHeight;return 0===t?0:this.childOY/-t}set s(t){this.childOX=-this.visibleWidth*t}get s(){var t=this.visibleWidth;return 0===t?0:this.childOX/-t}setChildOYByPercentage(t){return this.t=t,this}setChildOXByPercentage(t){return this.s=t,this}}Object.assign(H_.prototype,X_);const U_=["top","bottom","centerY","center"],N_=["left","right","centerX","center"];var $_=function(t,e,i){var s,r="Y"===(e=e.toUpperCase()),n=this.childrenMap.child;if(r){if(i)for(var a=0,o=U_.length;a=0?0:Math.abs(l)<=Math.abs(d)?l:d}}else{if(i)for(a=0,o=N_.length;a=0?0:Math.abs(c)<=Math.abs(u)?c:u}}switch(this.scrollMode){case 0:case 1:this.childOY+=s;break;default:this[`childO${e}`]+=s}};const K_=Phaser.Utils.Objects.GetValue;class J_ extends WT{constructor(t,e){void 0===e&&(e={});var i=FP(e),s=K_(e,"panel",void 0);void 0===s&&(s={}),s.scrollMode=i,s.clampChildOY=K_(e,"clampChildOY",!1),s.clampChildOX=K_(e,"clampChildOX",!1);var r,n,a=new H_(t,s);switch(t.add.existing(a),i){case 0:r=K_(e,"expand.panel",!0),n=!0;break;case 1:r=!0,n=K_(e,"expand.panel",!0);break;default:r=!0,n=!0}e.type="rexScrollablePanel",e.child={gameObject:a,expandWidth:r,expandHeight:n,align:K_(e,"align.panel","center")};var o=K_(e,"space",void 0);o&&(o.child=K_(o,"panel",0)),super(t,e),this.addChildrenMap("panel",a.child),this.addChildrenMap("panelLayer",a.maskLayer),this.addChildrenMap("mask",a.maskGameObject),this.addChildrenMap("scrollableBlock",a)}setChildrenInteractive(t){return void 0===t&&(t={}),t.hasOwnProperty("eventEmitter")||(t.eventEmitter=this),t.hasOwnProperty("targets")||(t.targets=[this.childrenMap.panel]),zb(this.childrenMap.child,t),this}}var q_={scrollToChild:function(t,e){if(!this.hasChild(t))return this;switch(this.scrollMode){case 0:$_.call(this,t,"y",e);break;case 1:$_.call(this,t,"x",e);break;default:$_.call(this,t,"y",e),$_.call(this,t,"x",e)}return this}};Object.assign(J_.prototype,q_);const Z_=Phaser.Utils.Objects.GetValue;var Q_=function(){var t,e=this.scene,i=this.listCreateBackgroundCallback;i&&(t=i.call(this,e),e.add.existing(t));var s=[],r=this.listCreateButtonCallback;if(r)for(var n=this.options,a=0,o=n.length;a0||this.listMaxHeight>0)){if(s=tR(e,u,this.listWrapEnable),this.listMaxHeight>0&&(s.layout(),s.height<=this.listMaxHeight&&(d=s)),!d){0===c&&(c=this.listMaxHeight);var p=eR(e,this.listCreateSliderTrackCallback),g=eR(e,this.listCreateSliderThumbCallback);d=new J_(e,{height:c,scrollMode:0,panel:{child:s,mask:{padding:1}},slider:{track:p,thumb:g,adaptThumbSize:this.listSliderAdaptThumbSizeEnable},scrollDetectionMode:1,scroller:this.listScrollerConfig,mouseWheelScroller:this.listMouseWheelScrollerConfig,space:{panel:Z_(this.listSpace,"panel",0)}}),e.add.existing(d)}}else u.height=c,s=tR(e,u,this.listWrapEnable),d=s;return t&&d.addBackground(t,"background"),this.listDraggable&&d.setDraggable(!0),d!==s&&s.on("button.over",(function(t,e,i,s){d.emit("button.over",t,e,i,s)})).on("button.out",(function(t,e,i,s){d.emit("button.out",t,e,i,s)})).on("button.click",(function(t,e,i,s){d.emit("button.click",t,e,i,s)})),d},tR=function(t,e,i){var s;return i?(e.orientation="x",s=new EM(t,e)):(e.orientation="y",s=new uM(t,e)),t.add.existing(s),s},eR=function(t,e,i){var s;return e&&(s=e.call(i,t),t.add.existing(s)),s};const iR=Phaser.Utils.Objects.GetValue;var sR=function(t,e){var i=iR(e,"expandDirection",void 0);"string"==typeof i&&(i=rR[i]);var s,r,n,a,o,h,l,d=(n="alignTargetX",Md(s=e,r="alignTarget")?J(s,r):n&&Md(s,n)?J(s,n):a&&Md(s,a)?J(s,a):o),c=iR(e,"alignTargetY",d),u=iR(e,"alignOffsetX",0),p=iR(e,"alignOffsetY",0),g=iR(e,"alignSide","").includes("right"),v=iR(e,"bounds"),f=0===i,m=!(f||1===i),y=g?1:0,b=f||m?0:1;t.setOrigin(y,b),h=g?d.getTopRight().x:d.getTopLeft().x,l=c.getBottomLeft().y,t.setPosition(h+u,l+p);var x=v;x||(x=ha(t.scene)),m&&t.getBottomLeft().y>x.bottom&&(l=c.getTopLeft().y,t.setOrigin(0,1).setPosition(h+u,l+p))};const rR={down:0,up:1},nR=Phaser.Utils.Objects.GetValue;class aR extends km{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=function(t,e){bf(t,e,"y","Cubic")}),null==e.transitOut&&(e.transitOut=function(t,e){!function(t,e,i,s,r){void 0===s&&(s="Linear");var n={mode:0};switch(i){case 0:case"x":n.end={x:0};break;case 1:case"y":n.end={y:0};break;default:n.end=0}n.duration=e,n.ease=s,void 0===r?r=new mf(t,n):r.resetFromJSON(n),r.restart()}(t,e,"y","Linear")}),e.manualClose=!0,e.clickOutsideClose=!0,e.destroy=!0,super(t,e),sR(t,e),t.isRexSizer&&t.layout();var i=nR(e,"touchOutsideClose",!1),s=nR(e,"anyTouchClose",!1);s&&(i=!1),s?this.once("open",this.anyTouchClose,this):i&&this.once("open",this.touchOutsideClose,this),this.requestOpen()}shutdown(t){this.isShutdown||(this.scene.input.off("pointerup",this.touchCloseCallback,this),super.shutdown(t))}touchOutsideClose(){return this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Bm(this.parent,t.worldX,t.worldY)||this.requestClose()}onOpen(){this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.parent,this),super.onClose()}}var oR={focusNextButton(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;return t=void 0===e?0:(e+1)%this.listPanel.getButtons().length,this.emitButtonOver(t),this},focusPrevButton(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;if(void 0===e)t=0;else{var i=this.listPanel.getButtons().length;t=(e-1+i)%i}return this.emitButtonOver(t),this}},hR={openListPanel:function(){if(this.listPanel)return this;if(0===this.options.length)return this;var t,e=Q_.call(this);e.on("button.over",(function(t,i,s,r){this.currentOverIndex=i,this.listOnButtonOver&&this.listOnButtonOver.call(this,t,i,s,r),this.emit("button.over",this,e,t,i,s,r)}),this).on("button.out",(function(t,i,s,r){this.currentOverIndex===i&&(this.currentOverIndex=void 0),this.listOnButtonOut&&this.listOnButtonOut.call(this,t,i,s,r),this.emit("button.out",this,e,t,i,s,r)}),this),t=this.listAlignMode&&"label"!==this.listAlignMode?this.getElement(this.listAlignMode):this;var i=new aR(e,{duration:{in:this.listEaseInDuration,out:this.listEaseOutDuration},transitIn:this.listTransitInCallback,transitOut:this.listTransitOutCallback,expandDirection:this.listExpandDirection,alignTargetX:t,alignTargetY:this,alignSide:this.listAlignSide,bounds:this.listBounds}).on("open",(function(){e.on("button.click",(function(t,i,s,r){this.listOnButtonClick&&this.listOnButtonClick.call(this,t,i,s,r),this.emit("button.click",this,e,t,i,s,r),this.dropDownBehavior.requestClose()}),this),this.emit("list.open",this,e)}),this).on("close",(function(){this.listPanel=void 0,this.dropDownBehavior=void 0,this.emit("list.close",this)}),this);return e.onClickOutside((function(){i.requestClose()})),this.listPanel=e,this.dropDownBehavior=i,this.pin(e),this},closeListPanel:function(){return this.dropDownBehavior?(this.dropDownBehavior.requestClose(),this.currentOverIndex=void 0,this):this},toggleListPanel:function(){return this.listPanel?this.closeListPanel():this.openListPanel(),this},emitButtonClick:function(t){if(void 0===t&&(t=this.currentOverIndex),void 0===t)return this;var e=this.listPanel,i=e?e.getButton(t):this.options[t];return this.listOnButtonClick&&this.listOnButtonClick.call(this,i,t),this.emit("button.click",this,e,i,t),this},emitButtonOver:function(t){var e=this.listPanel;return e?(e.emitButtonOver(t),this):this}};Object.assign(hR,F_,oR);const lR=Phaser.Utils.Objects.GetValue;class dR extends dS{constructor(t,e){super(t,e),this.type="rexDropDownList",this.timer=void 0,this.listPanel=void 0,this.currentOverIndex=void 0,this.setOptions(lR(e,"options"));var i=lR(e,"list");this.setWrapEnable(lR(i,"wrap",!1)),this.setCreateButtonCallback(lR(i,"createButtonCallback")),this.setCreateListBackgroundCallback(lR(i,"createBackgroundCallback")),this.setCreateListSliderTrackCallback(lR(i,"createTrackCallback")),this.setCreateListSliderThumbCallback(lR(i,"createThumbCallback")),this.setListSliderAdaptThumbSizeEnable(lR(i,"sliderAdaptThumbSize",!1)),this.setListScrollerConfig(lR(i,"scroller")),this.setListMouseWheelScrollerConfig(lR(i,"mouseWheelScroller")),this.setButtonClickCallback(lR(i,"onButtonClick")),this.setButtonOverCallback(lR(i,"onButtonOver")),this.setButtonOutCallback(lR(i,"onButtonOut")),this.setListExpandDirection(lR(i,"expandDirection")),this.setListEaseInDuration(lR(i,"easeIn",500)),this.setListEaseOutDuration(lR(i,"easeOut",100)),this.setListTransitInCallback(lR(i,"transitIn")),this.settListTransitOutCallback(lR(i,"transitOut")),this.setListMaxHeight(lR(i,"maxHeight",0)),this.setListSize(lR(i,"width"),lR(i,"height",0)),this.setListAlignmentMode(lR(i,"alignParent","text")),this.setListAlignmentSide(lR(i,"alignSide","")),this.setListBounds(lR(i,"bounds")),this.setListSpace(lR(i,"space")),this.setListDraggable(lR(i,"draggable",!1)),this.setValueChangeCallback(lR(e,"setValueCallback"),lR(e,"setValueCallbackScope")),this.setValue(lR(e,"value")),this.onClick(this.toggleListPanel,this)}destroy(t){this.scene&&!this.ignoreDestroy&&(this.listPanel&&(this.listPanel.destroy(t),this.listPanel=void 0),super.destroy(t))}get isOpened(){return!!this.listPanel}setOptions(t){return void 0===t&&(t=[]),this.options=t,this}setValueChangeCallback(t,e){return this.valueChangeCallback=t,this.valueChangeCallbackScope=e,this}setValue(t){return this.value=t,this}get value(){return this._value}set value(t){if(this._value!==t){var e=this._value;this._value=t;var i=this.valueChangeCallback,s=this.valueChangeCallbackScope;i&&(s?i.call(s,this,t,e):i(this,t,e)),this.emit("valuechange",this,t,e)}}}Object.assign(dR.prototype,hR),t.register("dropDownList",(function(t){var e=new dR(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.DropDownList",dR);var cR=function(t,e,s){void 0===s&&(s={});var r=(e=e?i(e):{}).label||e.button,n=e.button||e.label;delete e.label,delete e.button;var a=s.label||s.button||s,o=s.button||s.label||s,h=pO(t,r,a);h.list=e.list||{},h.list.createButtonCallback=function(t,e){var i=XM(t,n,o).resetDisplayContent(e);return e.hasOwnProperty("value")&&(i.value=e.value),i};var l=e.track;l&&(h.list.createTrackCallback=function(t){return AP(t,l)},delete e.track);var d=e.thumb;return d&&(h.list.createThumbCallback=function(t){return AP(t,d)},delete e.thumb),h.list.onButtonOver=function(t,e,i,s){t.setHoverState&&t.setHoverState(!0)},h.list.onButtonOut=function(t,e,i,s){t.setHoverState&&t.setHoverState(!1)},h};class uR extends dR{constructor(t,e,i){super(t,e=cR(t,e,i)),this.type="rexSimpleDropDownList"}setOptions(t){void 0===t&&(t=[]);for(var e=0,i=t.length;e0?Math.ceil(s/this.pageLinesCount):1;for(var r=0;r0?t+i:this.totalLinesCount}var s;switch(e>this.totalLinesCount&&(e=this.totalLinesCount),this.textObjectType){case 0:case 2:s=this.lines.slice(t,e).join("\n");break;case 1:var r=this.lines.getLineStartIndex(t),n=this.lines.getLineEndIndex(e-1);((s=this.lines.getSliceTagText(r,n,!0)).match(/\n/g)||[]).length>e-t-1&&(s=s.substring(0,s.length-1))}return s}};Object.assign(mR,pR,vR,fR);const yR=Phaser.Utils.Objects.GetValue;Phaser.Math.Clamp;class bR extends Ba{constructor(t,e){super(t,{eventEmitter:!1}),this.textObjectType=qw(this.parent),this.pageStartIndexes=[],this.lines=GT(this.parent,""),this.sections=[],this.resetFromJSON(e)}resetFromJSON(t){this.setMaxLines(yR(t,"maxLines",void 0)),this.setPageBreak(yR(t,"pageBreak","\f\n")),this.setText(yR(t,"text","")),this.startLineIndex=yR(t,"start",-1),this.endLineIndex=yR(t,"end",void 0);var e=yR(t,"page");return void 0===e?this.resetIndex():this.setPageIndex(e),this}toJSON(){return{maxLines:this.maxLines,text:this.content,start:this.startLineIndex,end:this.endLineIndex,page:this.pageIndex,pageBreak:this.pageBreak}}shutdown(t){if(!this.isShutdown){switch(this.textObjectType){case 0:case 2:this.lines.length=0;break;case 1:this.lines.destroy()}this.pageStartIndexes.length=0,this.sections.length=0,this.lines=void 0,this.pageStartIndexes=void 0,this.sections=void 0,super.shutdown(t)}}setMaxLines(t){return this.maxLines=t,this}setPageBreak(t){return this.pageBreak=t,this}get pageCount(){return this.pageStartIndexes.length}get lastPageIndex(){return this.pageCount-1}get isFirstPage(){return this.pageIndex<=0}get isLastPage(){return this.pageIndex>=this.pageCount-1}get totalLinesCount(){return this.lines?this.lines.length:0}get pageLinesCount(){if(void 0!==this.maxLines)return this.maxLines;var t;switch(this.textObjectType){case 0:case 1:var e=this.parent.style.maxLines;t=e>0?e:Math.floor(function(t){var e,i,s;switch(qw(t)){case 0:case 1:e=t.height-t.padding.top-t.padding.bottom,i=t.lineSpacing,s=t.style.metrics.fontSize+t.style.strokeThickness;break;case 2:e=t.height,i=0;var r=t.fontSize/t.fontData.size;s=t.fontData.lineHeight*r}return(e-i)/(s+i)}(this.parent));break;case 2:t=this.totalLinesCount}return t}get isFirstLine(){return this.startLineIndex<=0}get isLastLine(){return this.endLineIndex===this.totalLinesCount}get content(){return this.sections.join(this.pageBreak)}}Object.assign(bR.prototype,mR);var xR={setText(t){this.setTextCallback&&(t=this.setTextCallbackScope?this.setTextCallback.call(this.setTextCallbackScope,t,this.isLastChar,this.insertIndex):this.setTextCallback(t,this.isLastChar,this.insertIndex)),this.textWrapEnable?$T(this.parent,t):this.parent.setText(t)},appendText(t){var e=this.text.concat(ze(t));return this.isTyping?this.setTypingContent(e):this.start(e,void 0,this.textLength),this}},CR=function(t,e){return t.getPlainText&&(e=t.getPlainText(e)),e},kR=function(t,e){for(var i=void 0,s=0;s0?wR(n,t,a=(o=i)-d,o):"";var c,u=e-d;u>0?(o=(a=0)+u,this.insertIndex=o,c=wR(n,t,a,o)):(c="",this.insertIndex=0),r=c+l}return this.insertChar=r.charAt(this.insertIndex-1),r},PR={start:function(t,e,i,s){return void 0!==t&&this.setTypingContent(t),void 0!==e&&(this.speed=e),void 0===i&&(i=0),this.typingIndex=i+1,0===this.speed?this.stop(!0):(this.setText(""),this.startTimer(s)),this},startFromLine:function(t,e,i,s,r){var n;if(e>0){void 0===s&&(s=0);var a=CR(this.parent,t);n=kR(a,e)+s}return this.start(t,i,n,r)},stop:function(t){if(this.getTimer()&&this.freeTimer(),t){for(;!this.isLastChar;)SR.call(this,this.text,this.typingIndex,this.textLength,this.typeMode),this.emit("typechar",this.insertChar),this.typingIndex++;this.setText(this.text),this.emit("type"),this.emit("complete",this,this.parent)}return this},pause:function(){var t=this.getTimer();return t&&(t.paused=!0),this},resumeTyping:function(){var t=this.getTimer();return t&&(t.paused=!1),this}};Object.assign(PR,xR);const TR=Phaser.Utils.Objects.GetFastValue,OR=Phaser.Utils.Objects.GetValue;class MR extends Ba{constructor(t,e){super(t,e),this.timer=null,this.resetFromJSON(e)}resetFromJSON(t){this.setTextWrapEnable(OR(t,"wrap",!1)),this.setTypeMode(OR(t,"typeMode",0)),this.setTypingSpeed(OR(t,"speed",333)),this.setTextCallback=TR(t,"setTextCallback",null),this.setTextCallbackScope=TR(t,"setTextCallbackScope",null),this.setTypingContent(TR(t,"text","")),this.typingIndex=TR(t,"typingIndex",0),this.insertIndex=null,this.insertChar=null;var e=TR(t,"elapsed",null);return null!==e&&this.start(void 0,void 0,this.typingIndex,e),this}shutdown(t){this.isShutdown||(this.freeTimer(),super.shutdown(t))}setTypeMode(t){return"string"==typeof t&&(t=ER[t]),this.typeMode=t,this}setTypeSpeed(t){return this.speed=t,this}setTypingSpeed(t){return this.speed=t,this}setTextWrapEnable(t){return void 0===t&&(t=!0),this.textWrapEnable=t,this}set text(t){var e=ze(t);this.textWrapEnable&&(e=function(t,e){switch(qw(t)){case 0:t.style.syncFont(t.canvas,t.context),e=t.runWordWrap(e);break;case 1:e=t.getText(e,void 0,void 0,!0);break;case 2:e=t.setText(e).getTextBounds().wrappedText}return e}(this.parent,e)),this._text=e}get text(){return this._text}get isTyping(){return null!==this.getTimer()}get isLastChar(){return this.typingIndex===this.textLength}setTypingContent(t){return this.text=t,this.textLength=CR(this.parent,this.text).length,this}onTyping(){var t=SR.call(this,this.text,this.typingIndex,this.textLength,this.typeMode);this.setText(t),this.emit("typechar",this.insertChar),this.emit("type"),this.isLastChar?(this.freeTimer(),this.scene.sys.events.once("preupdate",(function(){this.emit("complete",this,this.parent)}),this)):(this.timer.delay=this.speed,this.typingIndex++)}startTimer(t){var e;return this.timer&&this.freeTimer(),void 0===t?e=0:(this.speed,e=t),this.timer=this.scene.time.addEvent({delay:1e-4,startAt:e,loop:!0,callback:this.onTyping,callbackScope:this}),this}getTimer(){return this.timer}freeTimer(){return this.timer&&(this.timer.remove(),this.timer=null),this}setText(t){this.setTextCallback&&(t=this.setTextCallbackScope?this.setTextCallback.call(this.setTextCallbackScope,t,this.isLastChar,this.insertIndex):this.setTextCallback(t,this.isLastChar,this.insertIndex)),this.textWrapEnable?$T(this.parent,t):this.parent.setText(t)}}const ER={"left-to-right":0,"right-to-left":1,"middle-to-sides":2,"sides-to-middle":3};Object.assign(MR.prototype,PR);const _R=Phaser.Utils.Objects.GetValue,RR={page:0,line:1};class LR extends(function(t,e){return void 0===e&&(e="rexTextBox"),class extends t{constructor(t,i){super(t,i),this.type=e,this.isRunning=!1,this._isPageEnd=!1;var s=this.childrenMap.text,r=_R(i,"expandTextWidth",!1),n=_R(i,"expandTextHeight",!1);if(r||n){var a=qw(s);switch(a){case 0:case 1:if(s.resize=function(t,e){var i=r?t:0,a=n?e:0;s.setFixedSize(i,a),i>0&&s.setWordWrapWidth(i)},1===a){var o=s.style;0===o.wrapMode&&(o.wrapMode=1)}}r&&(s._minWidth=0),n&&(s._minHeight=0)}this.setTypingMode(_R(i,"typingMode","page")),this.page=new bR(s,_R(i,"page",void 0)),this.typing=new MR(s,_R(i,"typing",i.type)),this.typing.on("complete",this.onTypingComplete,this).on("type",this.onType,this).on("typechar",this.onTypeChar,this),this.textWidthSave=s.width,this.textHeightSave=s.height}setTypingMode(t){return"string"==typeof t&&(t=RR[t]),this.typingMode=t,this}start(t,e){return void 0!==e&&this.setTypingSpeed(e),this.isRunning=!0,this.page.setText(t),this.emit("start"),0===this.typingMode?this.typeNextPage():this.typeNextLine(),this}more(t,e){if(void 0!==e&&this.setTypingSpeed(e),!this.isRunning){if(this.isRunning=!0,this.page.appendText(t),this.emit("start"),0===this.typingMode){this._isPageEnd=!1;var i=this.page.getPage(),s=this.typing.textLength;this.typing.start(i,void 0,s)}return this}this.page.appendText(t),this.typing.appendText(t)}typeNextPage(){if(!this.isRunning)return this;if(this.isLastPage)this.emit("complete");else{this._isPageEnd=!1;var t=this.page.getNextPage();this.typing.start(t)}return this}typeNextLine(){if(!this.isRunning)return this;if(this.isLastLine)this.isRunning=!1,this.emit("pageend"),this.emit("complete");else{var t,e=this.page.getPageOfNextLine();t=this.isFirstLine?0:this.page.pageLinesCount-1,this.typing.startFromLine(e,t)}}pause(){return this.isRunning?(this.isTyping&&(this.typing.pause(),this.emit("pause")),this):this}resume(){return this.isRunning?(this.isTyping||(this.emit("resume"),this.typing.resume()),this):this}stop(t){return this.isRunning?(this.typing.stop(t),this):this}showLastPage(){return this.isRunning?(this.typing.stop(),0===this.typingMode?this.page.showLastPage():this.page.showLastLine(),this.emit("type"),this.onTypingComplete(),this):this}setTypeSpeed(t){return this.typing.setTypingSpeed(t),this}setTypingSpeed(t){return this.typing.setTypingSpeed(t),this}get isTyping(){return this.typing.isTyping}get isPageEnd(){return this._isPageEnd}get isLastPage(){return this.page.isLastPage}get isFirstPage(){return this.page.isFirstPage}get pageCount(){return this.page.pageCount}get pageIndex(){return this.page.pageIndex}get isLastLine(){return this.page.isLastLine}get isFirstLine(){return this.page.isFirstLine}get lineCound(){return this.page.totalLinesCount}get startLineIndex(){return this.page.startLineIndex}get endLineIndex(){return this.page.endLineIndex}get typingSpeed(){return this.typing.speed}onType(){var t=this.childrenMap.text;this.textWidthSave===t.width&&this.textHeightSave===t.height||(this.textWidthSave=t.width,this.textHeightSave=t.height,this.getTopmostSizer().layout()),this.emit("type")}onTypeChar(t){this.emit("typechar",t)}onTypingComplete(){if(0===this.typingMode){this._isPageEnd=!0;var t=this.isLastPage;this.isRunning=!t,this.emit("pageend"),t&&this.emit("complete")}else this.typeNextLine()}}}(xO)){constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("layoutMode")||(e.layoutMode=1),super(t,e)}}t.register("textBox",(function(t){var e=new LR(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.TextBox",LR);class BR extends LR{constructor(t,e,i){super(t,e=kO(t,e,i))}}t.register("simpleTextBox",(function(t){var e=new BR(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.SimpleTextBox",BR);const IR=Phaser.Utils.Objects.GetValue;class DR extends Ww{constructor(t,e){super(t,e),this.type="rexNumberBar";var i,s,r,n=IR(e,"background",void 0),a=IR(e,"icon",void 0),o=IR(e,"iconMask",void 0),h=IR(e,"slider",void 0),l=IR(e,"text",void 0),d=IR(e,"space.icon",0),c=IR(e,"space.slider",0);(n&&this.addBackground(n),a&&(0===this.orientation?(h||l)&&(s={right:d}):(h||l)&&(s={bottom:d}),this.add(a,{proportion:0,align:"center",padding:s}),o&&(o=Uw.call(this,a,a,1))),h)&&(h.orientation=this.orientation,h.eventEmitter=this,h.value=null,h.hasOwnProperty("input")||(h.input=-1),i=new uT(t,h),t.add.existing(i),0===this.orientation?l&&(s={right:c}):l&&(s={bottom:c}),r=0===this.orientation?void 0===IR(h,"width",void 0)?1:0:void 0===IR(h,"height",void 0)?1:0,this.add(i,{proportion:r,align:"center",padding:s}));l&&this.add(l),this.addChildrenMap("background",n),this.addChildrenMap("icon",a),this.addChildrenMap("iconMask",o),this.addChildrenMap("slider",i),this.addChildrenMap("text",l);var u=IR(e,"valuechangeCallback",null);if(null!==u){var p=IR(e,"valuechangeCallbackScope",void 0);this.on("valuechange",u,p)}this.setEnable(IR(e,"enable",void 0)),this.setValue(IR(e,"value",0))}get enable(){return!!this.childrenMap.slider&&this.childrenMap.slider.enable}set enable(t){this.childrenMap.slider&&this.childrenMap.slider.setEnable(t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get value(){return this.childrenMap.slider?this.childrenMap.slider.value:0}set value(t){this.childrenMap.slider&&(this.childrenMap.slider.value=t)}setValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setValue(t,e,i),this}addValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.addValue(t,e,i),this}getValue(t,e){return this.childrenMap.slider?this.childrenMap.slider.getValue(t,e):0}easeValueTo(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.easeValueTo(t,e,i),this}stopEaseValue(){return this.childrenMap.slider&&this.childrenMap.slider.stopEaseValue(),this}setEaseValueDuration(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueDuration(t),this}setEaseValueFunction(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueFunction(t),this}get text(){var t=this.childrenMap.text;return void 0===t?"":t.text?t.text:t.getData("text")}set text(t){var e=this.childrenMap.text;void 0!==e&&(e.setText?e.setText(t):e.setData("text",t))}setText(t){return this.text=t,this}}t.register("numberBar",(function(t){var e=new DR(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.NumberBar",DR),t.register("scrollBar",(function(t){var e=new fT(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ScrollBar",fT);const jR=Phaser.Utils.Objects.GetValue,AR={leftTop:"left-top",centerTop:"center-top",rightTop:"right-top",leftCenter:"left-center",center:"center",rightCenter:"right-center",leftBottom:"left-bottom",centerBottom:"center-bottom",rightBottom:"right-bottom"};class zR extends ax{constructor(t,e){super(t,e),this.type="rexBadge";var i=jR(e,"background",void 0);i&&this.addBackground(i),this.addChildrenMap("background",i);var s=jR(e,"main",void 0);for(var r in s&&this.add(s,{key:"main",align:"center",expand:!1}),this.addChildrenMap("main",s),AR){var n=jR(e,r,void 0);n&&(this.add(n,{key:r,align:AR[r],expand:!1}),this.addChildrenMap(r,n))}}}t.register("badgeLabel",(function(t){var e=new zR(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.BadgeLabel",zR);const FR=ax.prototype.add;var YR=function(t,e,i,s,r,n,a,o,h){return t.setVisible(!1),FR.call(this,t,e,i,s,r,n,a,o,h),this},XR={add:YR,addPage:YR};const WR=Qg.prototype.setChildVisible;var VR={getPage:function(t){return void 0===t?null:this.sizerChildren.hasOwnProperty(t)?this.sizerChildren[t]:null},swapPage:function(t,e){this._previousKey=this._currentKey;var i=this.previousPage;i&&(0===this.swapMode?(WR.call(this,i,!1),this.emit("pageinvisible",i,this._previousKey,this)):i.destroy()),t&&!this.sizerChildren.hasOwnProperty(t)&&this.emit("createpage",t,this),this._currentKey=t;var s=this.currentPage;return s&&(WR.call(this,s,!0),this.emit("pagevisible",s,this._currentKey,this),void 0===e&&(e=this.fadeInDuration),e>0&&s.setAlpha(0).fadeIn(e,1)),this},hasPage:function(t){return this.sizerChildren.hasOwnProperty(t)}};Object.assign(VR,XR);const GR=Phaser.Utils.Objects.GetValue;class HR extends ax{constructor(t,e){super(t,e),this.type="rexPages",this.childrenMap=this.sizerChildren,this._previousKey=void 0,this._currentKey=void 0,this.setSwapMode(GR(e,"swapMode",0)),this.setFadeInDuration(GR(e,"fadeIn",0))}setSwapMode(t){return"string"==typeof t&&(t=UR[t]),this.swapMode=t,this}setFadeInDuration(t){return this.fadeInDuration=t,this}get previousKey(){return this._previousKey}get currentKey(){return this._currentKey}set currentKey(t){this.swapPage(t)}get currentPage(){return this.getPage(this.currentKey)}get previousPage(){return this.getPage(this.previousKey)}get keys(){return Object.keys(this.sizerChildren)}}Object.assign(HR.prototype,VR);const UR={invisible:0,destroy:1};t.register("pages",(function(t){var e=new HR(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.Pages",HR);const NR=Phaser.GameObjects.Mesh;class $R extends NR{get tint(){return 0===this.vertices.length?16777215:this.vertices[0].color}forceUpdate(){return this.dirtyCache[10]=1,this}}const KR=Phaser.Math.Vector3,JR=Phaser.Math.Matrix4;var qR=new KR,ZR=new KR,QR=new JR;const tL=Phaser.Utils.Objects.IsPlainObject,eL=Phaser.Utils.Objects.GetValue,iL=Phaser.Geom.Mesh.GenerateGridVerts,sL=Phaser.Math.RadToDeg,rL=Phaser.Math.DegToRad,nL=1+1/Math.sin(rL(45));let aL=class extends $R{constructor(t,e,i,s,r,n){tL(e)&&(e=eL(n=e,"x",0),i=eL(n,"y",0),s=eL(n,"key",null),r=eL(n,"frame",null)),super(t,e,i,s,r),this.type="rexPerspectiveImage",this.setSizeToFrame(),this.resetPerspective(),this.panZ(nL),this.hideCCW=eL(n,"hideCCW",!0);var a=eL(n,"gridWidth",0),o=eL(n,"gridHeight",a);this.resetVerts(a,o),this.prevFrame=this.frame}preUpdate(t,e){this.prevFrame!==this.frame&&(this.prevFrame=this.frame,this.syncSize()),super.preUpdate(t,e)}get originX(){return.5}get originY(){return.5}resetPerspective(){return this.setPerspective(this.width,this.height,45),this}resetVerts(t,e){if(void 0!==t&&(this.gridWidth=t),void 0!==e&&(this.gridHeight=e),this.clear(),this.dirtyCache[9]=-1,0===this.width||0===this.height)return this;var i=this.frame.cutWidth,s=this.frame.cutHeight;0===this.gridWidth?t=Math.max(i/8,32):e=this.gridWidth,e=0===this.gridHeight?Math.max(s/8,32):this.gridHeight,iL({mesh:this,width:i/this.height,height:s/this.height,widthSegments:Math.ceil(i/t),heightSegments:Math.ceil(s/e)});var r=this.transformInfo;return r&&this.transformVerts(r.x,r.y,r.z,r.rotateX,r.rotateY,r.rotateZ),this}syncSize(){return this.setSizeToFrame(),this.resetPerspective(),this.resetVerts(),this}get rotationX(){return this.modelRotation.x}set rotationX(t){this.modelRotation.x=t}get angleX(){return sL(this.rotationX)}set angleX(t){this.rotationX=rL(t)}get rotationY(){return this.modelRotation.y}set rotationY(t){this.modelRotation.y=t}get angleY(){return sL(this.rotationY)}set angleY(t){this.rotationY=rL(t)}get rotationZ(){return this.modelRotation.z}set rotationZ(t){this.modelRotation.z=t}get angleZ(){return sL(this.rotationZ)}set angleZ(t){this.rotationZ=rL(t)}transformVerts(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=0),this.transformInfo||(this.transformInfo={}),this.transformInfo.x=t,this.transformInfo.y=e,this.transformInfo.rotateX=s,this.transformInfo.rotateY=r,this.transformInfo.rotateZ=n,function(t,e,i,s,r,n,a){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=0),qR.set(e,i,s),ZR.set(r,n,a),QR.fromRotationXYTranslation(ZR,qR,!0);for(var o=0,h=t.vertices.length;o=0;i--)this.removePage(e[i].name,t);return this}},UL={top:1,left:3,right:5,bottom:7},NL={top:"bottom",left:"right",right:"left",bottom:"top"},$L={setTabsPadding(t,e){return this.childrenMap.tabs.setOuterPadding(t,e),this},getTabsPadding(t){return this.childrenMap.tabs.getOuterPadding(t)}},KL={getPageKey:function(t){var e=this.getElement("tabs.buttons");if(!(t>=e.length))return e[t].name},getPageIndex:function(t){for(var e=this.getElement("tabs.buttons"),i=0,s=e.length;i=a.y)continue;break;case 2:if(n.x<=a.x)continue;break;case 3:if(n.x>=a.x)continue}JB.call(r,s,a.x,a.y)}}(t,s,r,i),t.transitInCallback(e,i,t)},QB={showMessage(t){var e=function(t,e,i){var s=e(t.scene,i,t);if($B.call(s,(function(){t.removeMessage(s)})),t.displayTime){var r=t.transitInTime+t.displayTime+10;KB.call(s,r,(function(){t.removeMessage(s)}))}return s}(this,this.createMessageLabelCallback,t);return ZB(this,e,this.transitInTime),this},removeMessage(t){if(this.getParentSizer(t)!==this)return this;if(!t.__isDestroying){t.__isDestroying=!0;var e=this.transitOutTime;return this.transitOutCallback(t,e,this),KB.call(t,e+10,(function(){delete t.__isDestroying,t.destroy()})),this}},removeAllMessages(){for(var t=this.childrenMap.items,e=0,i=t.length;e0&&{height:this.colorComponentsHeight,formatLabel:this.colorComponentsFormatLabelConfig,inputText:this.colorComponentsInputTextConfig,space:this.colorComponentsSpace};var a=new $I(t,{width:s,height:n,background:e,space:this.colorPickerSpace,hPalette:{position:this.colorPickerHPalettePosition},colorComponents:r,value:this.value});return t.add.existing(a),a},JI={openColorPicker:function(){if(!this.colorPicker){var t=KI.call(this).layout(),e=new aR(t,{duration:{in:this.colorPickerEaseInDuration,out:this.colorPickerEaseOutDuration},transitIn:this.colorPickerTransitInCallback,transitOut:this.colorPickerTransitOutCallback,expandDirection:this.colorPickerExpandDirection,alignTargetX:this,alignTargetY:this,bounds:this.colorPickerBounds,touchOutsideClose:!0}).on("open",(function(){t.on("valuechange",(function(t){this.setValue(t)}),this)}),this).on("close",(function(){this.colorPicker=void 0,this.dropDownBehavior=void 0}),this);return this.colorPicker=t,this.dropDownBehavior=e,this.pin(t),this}}};Object.assign(JI,mI);const qI=Phaser.Utils.Objects.GetValue;class ZI extends fI{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexColorInput",e.hasOwnProperty("colorPicker")||(e.colorPicker={background:{color:0}});var i=e.colorPicker,s=!1!==i&&null!==i;if(s){var r;this.setColorPickerSize(qI(i,"width",160),qI(i,"height",170));var n=qI(i,"background");r=n?function(t){return AP(t,n)}:qI(i,"createBackgroundCallback"),this.setCreateColorPickerBackgroundCallback(r),this.setColorPickerHPalettePosition(qI(i,"hPalettePosition",0)),this.setColorPickerExpandDirection(qI(i,"expandDirection")),this.setColorPickerEaseInDuration(qI(i,"easeIn",200)),this.setColorPickerEaseOutDuration(qI(i,"easeOut",200)),this.setColorPickerTransitInCallback(qI(i,"transitIn")),this.setColorPickerTransitOutCallback(qI(i,"transitOut")),this.setColorPickerBounds(qI(i,"bounds"));var a=qI(i,"space");void 0===a&&(a={left:10,right:10,top:10,bottom:10,item:8}),this.setColorPickerSpace(a)}var o=e.colorComponents;if(s&&!1!==o&&null!==o){this.setColorComponentsHeight(qI(o,"height",30)),this.setColorComponentsFormatLabelConfig(qI(o,"formatLabel"));var h=qI(o,"inputText");h||(h=qI(e,"inputText")),this.setColorComponentsInputTextConfig(h);var l=qI(o,"space");void 0===l&&(l={item:8}),this.setColorComponentsSpace(l)}var d=this.childrenMap.swatch;d&&s&&this.onClick(d,this.openColorPicker,this)}}Object.assign(ZI.prototype,JI),t.register("colorInput",(function(t){var e=new ZI(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ColorInput",ZI),t.register("colorInputLite",(function(t){var e=new fI(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ColorInputBase",fI),t.register("colorPicker",(function(t){var e=new FI(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ColorPicker",FI),t.register("colorComponents",(function(t){var e=new UI(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ColorComponents",UI);var QI=function(t){for(var e,i=t.scene.input,s=i.manager,r=s.pointersTotal,n=s.pointers,a=0;a0&&c0&&u0&&b0&&x * @copyright 2019 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */var wD=function(t,e){var i=Ge(t);for(var s in e)i.hasOwnProperty(s)||(i[s]=e[s]);return i},SD=function(t,e,i){return jP(t,wD(e,i))},PD={setBindingTarget(t){return this.childrenMap.child.setBindingTarget(t),this}},TD={getMaxInputRowTitleWidth(){return this.childrenMap.child.getMaxInputRowTitleWidth()+this.getInnerPadding("left")},setInputRowTitleWidth(t){return t-=this.getInnerPadding("left"),this.childrenMap.child.setInputRowTitleWidth(t),this}};class OD extends rB{constructor(t,e){void 0===e&&(e={}),e.orientation=1,super(t,e),this.type="rexTweaker.Folder"}setTitle(t){return this.childrenMap.title.setTitle(t),this}}Object.assign(OD.prototype,PD,TD);const MD=Phaser.Utils.Objects.GetValue,ED=Phaser.Utils.Objects.GetValue;var _D={setBindingTarget(t){for(var e=this.childrenMap.pages.children,i=0,s=e.length;i0,setInputRowTitleWidth(t){return this}};const VD=Phaser.Utils.Objects.GetValue;class GD extends Xw{constructor(t,e){void 0===e&&(e={}),e.orientation="y",super(t,e),this.type="rexTweaker.Wrap";var i=VD(e,"background",void 0),s=VD(e,"title",void 0);i&&this.addBackground(i),s&&this.add(s,{expand:!0,space:{bottom:VD(e,"space.title",0)}});var r=VD(e,"child",void 0);this.add(r,{expand:!0}),this.addChildrenMap("title",s),this.addChildrenMap("child",r)}setTitle(t){var e=this.childrenMap.title;return t.title||t.icon?e.show().setTitle(t):e.hide(),this}}Object.assign(GD.prototype,XD,WD);const HD=Phaser.Utils.Objects.GetValue,UD=Phaser.Utils.Objects.GetValue;var ND={setBindingTarget(t){return this.childrenMap.panel.setBindingTarget(t),this}},$D={getMaxInputRowTitleWidth(){return this.childrenMap.panel.getMaxInputRowTitleWidth()+this.getInnerPadding("left")},setInputRowTitleWidth(t){return t-=this.getInnerPadding("left"),this.childrenMap.panel.setInputRowTitleWidth(t),this}};class KD extends K_{constructor(t,e){super(t,e),this.type="rexTweaker.Scrollable"}setTitle(t){var e=this.childrenMap.header;return t.title||t.icon?e.show().setTitle(t):e.hide(),this}}Object.assign(KD.prototype,ND,$D);const JD=Phaser.Utils.Objects.GetValue,qD=Phaser.Utils.Objects.GetValue,ZD=Phaser.Utils.Objects.GetValue;var QD={setupBinding(){return this.childrenMap.inputField.on("valuechange",(function(t){this.autoUpdateEnable&&this.setTargetValue(t)}),this),this},setAutoUpdateEnable(t){return void 0===t&&(t=!0),this.autoUpdateEnable=t,this},setBindingTarget(t,e){this.bindingTarget=t,void 0!==e&&this.setBindingTargetKey(e),this.syncTargetValue();var i=this.childrenMap.inputField;return i.onBindTarget&&i.onBindTarget(t,e),this},setBindingTargetKey(t){return this.bindTargetKey=t,this},setValueCallbacks(t){return this.onGetValue=ZD(t,"onGetValue"),this.onSetValue=ZD(t,"onSetValue"),this},getTargetValue(){if(this.bindingTarget)return null!=this.bindTargetKey?this.bindingTarget[this.bindTargetKey]:this.onGetValue?this.onGetValue(this.bindingTarget):void 0},setTargetValue(t){return this.bindingTarget?null!=this.bindTargetKey?(this.bindingTarget[this.bindTargetKey]=t,this):(this.onSetValue&&this.onSetValue(this.bindingTarget,t),this):this},syncTargetValue(){if(!this.bindingTarget)return this;var t=this.childrenMap.inputField;return t.syncValue&&t.syncValue(this.getTargetValue()),this}},tj={startMonitorTarget(){return this.isMonitoring||(this.isMonitoring=!0,this.scene.events.on("postupdate",this.onMonitorTarget,this)),this},stopMonitorTarget(){return this.isMonitoring?(this.isMonitoring=!1,this.scene.events.off("postupdate",this.onMonitorTarget,this),this):this},onMonitorTarget(){if(this.bindingTarget){var t=this.getTargetValue(),e=this.childrenMap.inputField;e.value!==t&&e.syncValue(t)}}},ej={getMinTitleWidth(){var t=this.childrenMap.title;if(!t||0!==t.orientation)return 0;var e=t.rexSizer.padding;return this.getChildWidth(this.childrenMap.title)+(e.left+e.right)*t.scaleX+this.getInnerPadding("left")},setMinTitleWidth(t){var e=this.childrenMap.title;if(!e||0!==e.orientation)return this;var i=e.rexSizer.padding;return t-=(i.left+i.right)*e.scaleX,e.minWidth=t,this}};const ij=Phaser.Utils.Objects.GetValue;class sj extends Xw{constructor(t,e){super(t,e),this.type="rexTweaker.InputRow",this.bindingTarget=void 0,this.bindTargetKey=void 0,this.autoUpdateEnable=!0;var i,s=e.inputTitle,r=e.inputField,n=e.background,a=ij(e,"proportion.title",0),o=ij(e,"space.title",0);i=0===this.orientation?{right:o}:{bottom:o},this.add(s,{proportion:a,expand:!0,padding:i});var h=r.defaultProportion;void 0===h&&(h=e.defaultExpandWidth?1:0),a=ij(e,"proportion.inputField",h),this.add(r,{proportion:a,expand:!0}),n&&this.addBackground(n),this.addChildrenMap("title",s),this.addChildrenMap("inputField",r),this.addChildrenMap("background",n),this.setupBinding()}destroy(t){this.scene&&!this.ignoreDestroy&&(this.stopMonitorTarget(),super.destroy(t))}setTitle(t){return this.childrenMap.title.setTitle(t),this}preLayout(){var t=this.childrenMap.title;t&&(t.minWidth=0),super.preLayout()}}Object.assign(sj.prototype,QD,tj,ej);var rj=function(t,e,i){var s=new CD(t,i);return t.add.existing(s),s},nj=function(t){return void 0===t&&(t=Xw),class extends t{get bindingTarget(){return this.getParentSizer().bindingTarget}get bindingKey(){return this.getParentSizer().bindTargetKey}get value(){return this._value}get root(){return this.getParentSizer().getParentSizer().root}onBindTarget(t,e){this.onBindTargetCallback&&this.onBindTargetCallback(this,t,e)}validate(t){return!(!this.syncValueFlag&&this.validateCallback)||this.validateCallback(t,this._value,this.bindingTarget,this.bindingKey)}getFotmatText(t){return t=this.textFormatCallback?this.textFormatCallback(t):t.toString()}set value(t){if(this._value!==t&&(this.validate(t)||(t=this._value),this.filterValueCallback&&(t=this.filterValueCallback(this,t)),this.displayValueCallback&&this.displayValueCallback(this,t),this._value!==t)){var e=this._value;if(this._value=t,!this.syncValueFlag){var i=this.bindingTarget,s=this.bindingKey;this.emit("valuechange",t,e,i,s),this.root.emit("valuechange",t,e,i,s)}}}getValue(){return this.value}setValue(t){return this.value=t,this}syncValue(t){return this.syncValueFlag=!0,this.value=t,this.syncValueFlag=!1,this}setup(t,e){return void 0===e&&(e=!1),(e||t.hasOwnProperty("format"))&&this.setTextFormatCallback(t.format),(e||t.hasOwnProperty("onValidate"))&&this.setValidateCallback(t.onValidate),this.setupCallback&&this.setupCallback(this,t,e),this}setSetupCallback(t){return this.setupCallback=t,this}setFilterValueCallback(t){return this.filterValueCallback=t,this}setDisplayValueCallback(t){return this.displayValueCallback=t,this}setOnBindTargetCallback(t){return this.onBindTargetCallback=t,this}setTextFormatCallback(t){return this.textFormatCallback=t,this}setValidateCallback(t){return this.validateCallback=t,this}}},aj=function(t,e,i){for(var s,r=this.inputHandlers,n=0,a=r.length;n0?0:1,0===n.minWidth&&n.setMinWidth(this.itemWidth)),0===n.minHeight&&n.setMinHeight(this.itemHeight),this.add(n,{proportion:r,expand:!0})),i.onValueChange&&n.childrenMap.inputField.on("valuechange",i.onValueChange),n.setAutoUpdateEnable(i.autoUpdate),n.setBindingTarget(t,e),i.monitor&&n.startMonitorTarget(),i.key&&this.root.addChildrenMap(i.key,n),this):(console.error(`[Tweaker] Can't add Input\n title: ${i.title}\n view: ${i.view}\n`),this)},addButtons:function(t){void 0===t&&(t={});var e=this.scene,i=t.bindingTarget;delete t.bindingTarget;var s=uj(this.styles,"inputRow")||{},r=cj(e,t,s);return this.add(r,{expand:!0}),i&&r.setBindingTarget(i),t.key&&this.root.addChildrenMap(t.key,r),this},addButton:function(t){return void 0===t&&(t={}),t.buttons=[{label:t.label,callback:t.callback}],delete t.label,delete t.callback,this.addButtons(t),this},addSeparator:function(t){void 0===t&&(t={});var e=function(t,e,i){return jP(t,wD(e,i))}(this.scene,t,pj(this.styles,"separator"));return this.add(e,{expand:!0}),this},addRows:function(t,e,s){return"boolean"==typeof e&&(s=e,e=void 0),void 0===s&&(s=!0),gj(this,i(t),e,s),this},setBindingTarget:function(t){for(var e=this.sizerChildren,i=0,s=e.length;it.hasOwnProperty("view")?"string"===t.view:"string"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.TextInput";var s=e.inputText,r=cE(i,s);t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))}},bj={name:"TextAreaInput",accept:t=>!!t.hasOwnProperty("view")&&"textarea"===t.view,build(t,e){var s=t.scene;this.type="rexTweaker.TextAreaInput";var r=e.inputTextArea;void 0===r&&(r={}),r.hasOwnProperty("text")||(r.text=e.inputText),r.hasOwnProperty("slider")||(r.slider=e.slider);var n=function(t,e,s){void 0===s&&(s=!0),s?e=e?i(e):{}:e||(e={});var r=new DB(t,e);return t.add.existing(r),r}(s,r);t.add(n,{proportion:1,expand:!0,key:"inputText"}),n.on("close",(function(){t.setValue(n.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))},onBindTarget(t){t.childrenMap.inputText.scrollToTop()}},xj={name:"NumberInput",accept:t=>t.hasOwnProperty("view")?"number"===t.view:"number"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.NumberInput";var s=e.inputNumber||e.inputText,r=cE(i,s).setNumberInput();t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly),t.isFloatType=!e.int},filterValue:(t,e)=>t.isFloatType?e:Math.floor(e),displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))}};const Cj=Phaser.Utils.Objects.GetValue,kj=Phaser.Math.Linear,wj=Phaser.Math.Snap.Floor;var Sj={name:"RangeInput",accept:t=>t.hasOwnProperty("view")?"range"===t.view:"number"==typeof t.value&&t.hasOwnProperty("min")&&t.hasOwnProperty("max"),build(t,e){var i=t.scene;t.type="rexTweaker.RangeInput";var s=e.slider,r=0===t.orientation?"track.height":"track.width",n=Cj(s,r),a=function(t,e){var i=new cT(t,e);return t.add.existing(i),i}(i,s),o=e.defaultExpandWidth?2:0,h=Cj(e,"proportion.range.slider",o),l=void 0===n;t.add(a,{proportion:h,expand:l,key:"slider"});var d=e.inputNumber||e.inputText,c=cE(i,d).setNumberInput();o=e.defaultExpandWidth?1:0,h=Cj(e,"proportion.range.inputText",o),t.add(c,{proportion:h,expand:!0,key:"inputText"}),c.on("close",(function(){t.setValue(c.value)})),a.on("valuechange",(function(){var e=kj(t.minValue,t.maxValue,a.value);t.step&&(e=wj(e,t.step,t.minValue)),t.setValue(e)}))},setup(t,e,i){(i||e.hasOwnProperty("max"))&&function(t,e,i,s){t.minValue=e,t.maxValue=i,t.step=s,t.childrenMap.slider.setGap(s,e,i)}(t,e.min,e.max,e.step),(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.slider.setValue(e,t.minValue,t.maxValue),t.childrenMap.inputText.setText("").setText(t.getFotmatText(e))}},Pj=function(t,e){var i=new cM(t,e);return t.add.existing(i),i};const Tj=Phaser.Utils.Objects.GetValue;var Oj={name:"RangeInput",accept:t=>!!t.hasOwnProperty("view")&&"incdec"===t.view,build(t,e){var s=t.scene;t.type="rexTweaker.IncDecInput";var r=Tj(e,"incDec")||{},n={text:null,action:null},a=Pj(s,{expand:!1}),o=e.defaultExpandWidth?1:0;t.add(a,{proportion:o,expand:!0});var h=e.inputNumber||e.inputText,l=cE(s,h).setNumberInput();l.on("close",(function(){t.setValue(l.value)}));var d=Object.assign(i(n),r.incButton||{}),c=YM(s,d),u=Object.assign(i(n),r.decButton||{}),p=YM(s,u);a.addButton(c),a.addButton(p);var g=r.inputTextIndex||0;a.insert(g,l,{proportion:1,expand:!0}),t.step=1,t.minValue=void 0,t.maxValue=void 0,a.on("button.click",(function(e,i,s,r){var n=t.value;0===i?n+=t.step:n-=t.step,void 0!==t.maxValue&&n>t.maxValue&&(n=t.maxValue),void 0!==t.minValue&&n!!t.hasOwnProperty("view")&&"color"===t.view,build(t,e){var s=t.scene;t.type="rexTweaker.ColorInput";var r=e.colorInput;void 0===r&&(r={}),r.hasOwnProperty("inputText")||(r.inputText=e.inputText);var n=function(t,e,s){void 0===s&&(s=!0),s?e=e?i(e):{}:e||(e={});var r=new qI(t,e);return t.add.existing(r),r}(s,r);t.add(n,{proportion:1,expand:!0,key:"colorInput"}),n.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.colorInput.setValue(e)}},Ej={name:"CheckboxInput",accept:t=>t.hasOwnProperty("view")?"boolean"===t.view:"boolean"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.CheckboxInput";var s=e.checkbox,r=function(t,e){var i=new gu(t,e);return t.add.existing(i),i}(i,s),n=s.size;void 0!==n&&r.setSize(n,n);var a=void 0!==n?0:1;t.add(r,{proportion:0,expand:!1,fitRatio:a,key:"checkbox"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.checkbox.setValue(e)}},_j={name:"ToggleSwitchInput",accept:t=>!!t.hasOwnProperty("view")&&"toggleSwitch"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.ToggleSwitchInput";var s=e.toggleSwitch,r=function(t,e){var i=new Mu(t,e);return t.add.existing(i),i}(i,s),n=s.size;void 0!==n&&r.setSize(n,n);var a=void 0!==n?0:1;t.addSpace().add(r,{proportion:0,expand:!1,fitRatio:a,key:"toggleSwitch"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.toggleSwitch.setValue(e)}},Rj=function(t,e){for(var i=0,s=t.length;it.hasOwnProperty("view")?"list"===t.view:t.hasOwnProperty("options"),build(t,e){var i=t.scene;t.type="rexTweaker.ListInput";var s=function(t,e){e=dR(t,e);var i=new lR(t,e);return t.add.existing(i),i}(i,e.list);t.add(s,{proportion:1,expand:!0,key:"list"}),s.on("button.click",(function(e,i,s,r,n,a){t.setValue(s.value)}))},setup(t,e,i){(i||e.hasOwnProperty("options"))&&function(t,e){t.childrenMap.list.setOptions(e)}(t,e.options)},displayValue(t,e){var i=t.childrenMap.list,s=function(t,e){var i=Rj(t,e);if(null!=i)return t[i]}(i.options,e);i.resetDisplayContent(s).setMinSize(i.width,i.height).layout().setMinSize(0,0)}};const Bj=Phaser.Utils.Objects.GetValue;var Ij={name:"ButtonsInput",accept:t=>!!t.hasOwnProperty("view")&&"buttons"===t.view,build(t,e){var s=t.scene;t.type="rexTweaker.ButtonsInput";var r=e.button?i(e.button):{},n=Bj(r,"expand",!0);n&&(r.align="center"),delete r.expand;var a=Pj(s,{expand:n});a.buttonConfig=r,t.add(a,{proportion:1,expand:!0,key:"list"}),a.on("button.click",(function(e,i,s,r){var n=a.options[i];n&&(t._selectedIndex=i,t.setValue(n.value),t._selectedIndex=void 0)}))},setup(t,e,i){(i||e.hasOwnProperty("options"))&&function(t,e){var i=t.childrenMap.list;i.options=e;var s=t.scene,r=i.buttonConfig;i.clearButtons(!0);for(var n=0,a=e.length;nr?n:-n),d.localY=u+(c>s?a:-a)}};const nA=Phaser.Utils.Objects.IsPlainObject,aA=Phaser.Utils.Objects.GetValue,oA=Phaser.Math.DegToRad,hA=Phaser.Math.RadToDeg;class lA extends sA{constructor(t,e,i,s,r){if(nA(e)){var n=e;e=aA(n,"x",0),i=aA(n,"y",0),s=aA(n,"key",null),r=aA(n,"frame",null)}super(t,e,i,s,r),this.type="rexSkewmage",this._skewX=0,this._skewY=0}get skewX(){return this._skewX}set skewX(t){this._skewX=t,rA(this,this._skewX,this._skewY)}get skewXDeg(){return hA(this._skewX)}set skewXDeg(t){this.skewX=oA(t)}get skewY(){return this._skewY}set skewY(t){this._skewY=t,rA(this,this._skewX,this._skewY)}get skewYDeg(){return hA(this._skewY)}set skewYDeg(t){this.skewY=oA(t)}setSkewX(t){return this.skewX=t,this}setSkewY(t){return this.skewY=t,this}setSkew(t,e){return void 0===e&&(e=t),this.skewX=t,this.skewY=e,this}setSkewXDeg(t){return this.skewXDeg=t,this}setSkewYDeg(t){return this.skewYDeg=t,this}setSkewDeg(t,e){return void 0===e&&(e=t),this.skewXDeg=t,this.skewYDeg=e,this}}const dA=Phaser.Utils.Objects.IsPlainObject,cA=Phaser.Utils.Objects.GetValue;class uA extends lA{constructor(t,e,i,s,r){if(dA(e)){var n=e;e=cA(n,"x",0),i=cA(n,"y",0),s=cA(n,"width",32),r=cA(n,"height",32)}super(t,e,i,oL(t,s,r),null),this.type="rexSkewRenderTexture",this.rt=this.texture}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.rt.destroy(),this.rt=null)}}class pA extends(LL(uA)){get skewState(){return this.isRunning}}t.register("skew",(function(t,e){return new pA(t,e)})),P(window,"RexPlugins.UI.Skew",pA),t.register("anchor",(function(t,e){return new uf(t,e)})),P(window,"RexPlugins.UI.Anchor",uf),t.register("textTyping",(function(t,e){return new OR(t,e)})),P(window,"RexPlugins.UI.TextTyping",OR),t.register("textPage",(function(t,e){return new yR(t,e)})),P(window,"RexPlugins.UI.TextPage",yR);var gA=void 0;const vA=Phaser.Utils.Objects.GetValue,fA=Phaser.Utils.Objects.Clone;var mA=function(t){return t.hasOwnProperty("align")?t.align:t.hasOwnProperty("halign")?t.halign:"left"};const yA=Phaser.Utils.Objects.GetValue,bA=Phaser.Utils.Objects.Merge;var xA={open:function(t,e){var i;void 0===t&&(t={}),t=bA(t,this.openConfig),(i=this)!==gA&&(void 0!==gA&&gA.close(),gA=i),zm(t)&&(e=t,t=void 0);var s=yA(t,"inputType",void 0);void 0===s&&(s=yA(t,"type","text")),void 0===e&&(e=yA(t,"onClose",void 0));var r=yA(t,"onOpen",void 0),n=yA(t,"onTextChanged",void 0);return this.inputText=function(t,e){void 0===e&&(e={}),e=fA(e);var i=t.scene,s=t.style,r=vA(e,"backgroundColor",s.backgroundColor);null===r&&(r="transparent"),e.text=vA(e,"text",t.text),e.fontFamily=vA(e,"fontFamily",s.fontFamily),e.fontSize=vA(e,"fontSize",s.fontSize),e.color=vA(e,"color",s.color),e.backgroundColor=r,e.direction=vA(e,"rtl",s.rtl)?"rtl":"ltr",e.align=vA(e,"align",mA(s)),"rtl"===e.direction&&Nw(t)&&(e.align="right");var n=t.padding;n.left>0&&(e.paddingLeft=`${n.left}px`),n.right>0&&(e.paddingRight=`${n.right}px`),s.backgroundCornerRadius&&(e.borderRadius=vA(e,"borderRadius",`${s.backgroundCornerRadius}px`));var a=new Jk(i,t.x,t.y,vA(e,"width",t.width),vA(e,"height",t.height),e);a.setScale(t.scaleX,t.scaleY).setOrigin(t.originX,t.originY).setScrollFactor(t.scrollFactorX,t.scrollFactorY);var o=t.parentContainer;return o?o.add(a):i.add.existing(a),a}(this.parent,t).on("textchange",(function(t){var e=t.text;n?n(this.parent,e):this.parent.text=e}),this).setFocus(),this.parent.setVisible(!1),this.onClose=e,yA(t,"enterClose","textarea"!==s)&&this.scene.input.keyboard.once("keydown-ENTER",this.close,this),this.delayCall=function(t,e,i){return t.time.delayedCall(0,e,[],i)}(this.scene,(function(){this.scene.input.once("pointerdown",this.close,this),r&&r(this.parent),this.emit("open",this.parent)}),this),this},close:function(){return this===gA&&(gA=void 0),this.parent.setVisible(!0),this.inputText&&(this.inputText.destroy(),this.inputText=void 0),this.delayCall&&(this.delayCall.remove(),this.delayCall=void 0),this.scene.input.keyboard.off("keydown-ENTER",this.close,this),this.scene.input.off("pointerdown",this.close,this),this.onClose&&this.onClose(this.parent),this.emit("close",this.parent),this}};const CA=Phaser.Utils.Objects.GetValue;class kA extends Ba{constructor(t,e){super(t),this.inputText=void 0,this.onClose=void 0,this.delayCall=void 0,this.setOpenConfig(e),CA(e,"clickEnable",!0)&&t.on("pointerdown",(function(){this.open()}),this).setInteractive()}shutdown(t){this.isShutdown||(this.close(),super.shutdown(t))}setOpenConfig(t){return void 0===t&&(t={}),this.openConfig=t,this}get isOpened(){return void 0!==this.inputText}get text(){return this.isOpened?this.inputText.text:this.parent.text}}Object.assign(kA.prototype,xA),t.register("textEdit",(function(t,e){return new kA(t,e)})),P(window,"RexPlugins.UI.TextEdit",kA),t.register("layerManager",(function(t){return new Ea(this.scene,t)})),P(window,"RexPlugins.UI.LayerManager",Ea);class wA extends Phaser.Plugins.ScenePlugin{constructor(e,i){super(e,i),this.add=new t(e)}boot(){this.scene.events.on("destroy",this.destroy,this)}destroy(){this.add.destroy(),super.destroy()}isInTouching(t,e,i,s){return!!t.visible&&Gm(t,e,i,s)}get viewport(){return ha(this.scene,this.scene.cameras.main,!0)}}var SA={getParentSizer:Qp,getTopmostSizer:tg,removeFromParent:vE,hide:nm,show:rm,isShown:am,confirmAction:rE,edit:function(t,e,i){return t._edit||(t._edit=new kA(t,{clickEnable:!1})),t._edit.open(e,i),t._edit},wrapExpandText:tS,fontSizeExpandText:oS,fontSizeResize:iS,setFontSizeToFitWidth:iS,waitEvent:al,waitComplete:ol,delayPromise:Qk,setChildrenInteractive:Ab,fadeIn:Ef,fadeOutDestroy:_f,easeMoveTo:Yf,easeMoveFrom:Xf,modal:jm,modalPromise:function(t,e){var i=jm(t,e);return new Promise((function(t,e){i.once("close",(function(e){t(e)}))}))},modalClose:Am,requestDrag:ZI,openFileChooser:sw};return Object.assign(wA.prototype,SA),wA},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rexuiplugin=e(); + */var SD=function(t,e){var i=Ge(t);for(var s in e)i.hasOwnProperty(s)||(i[s]=e[s]);return i},PD=function(t,e,i){return AP(t,SD(e,i))},TD={setBindingTarget(t){return this.childrenMap.child.setBindingTarget(t),this}},OD={getMaxInputRowTitleWidth(){return this.childrenMap.child.getMaxInputRowTitleWidth()+this.getInnerPadding("left")},setInputRowTitleWidth(t){return t-=this.getInnerPadding("left"),this.childrenMap.child.setInputRowTitleWidth(t),this}};class MD extends nB{constructor(t,e){void 0===e&&(e={}),e.orientation=1,super(t,e),this.type="rexTweaker.Folder"}setTitle(t){return this.childrenMap.title.setTitle(t),this}}Object.assign(MD.prototype,TD,OD);const ED=Phaser.Utils.Objects.GetValue,_D=Phaser.Utils.Objects.GetValue;var RD={setBindingTarget(t){for(var e=this.childrenMap.pages.children,i=0,s=e.length;i0,setInputRowTitleWidth(t){return this}};const GD=Phaser.Utils.Objects.GetValue;class HD extends Ww{constructor(t,e){void 0===e&&(e={}),e.orientation="y",super(t,e),this.type="rexTweaker.Wrap";var i=GD(e,"background",void 0),s=GD(e,"title",void 0);i&&this.addBackground(i),s&&this.add(s,{expand:!0,space:{bottom:GD(e,"space.title",0)}});var r=GD(e,"child",void 0);this.add(r,{expand:!0}),this.addChildrenMap("title",s),this.addChildrenMap("child",r)}setTitle(t){var e=this.childrenMap.title;return t.title||t.icon?e.show().setTitle(t):e.hide(),this}}Object.assign(HD.prototype,WD,VD);const UD=Phaser.Utils.Objects.GetValue,ND=Phaser.Utils.Objects.GetValue;var $D={setBindingTarget(t){return this.childrenMap.panel.setBindingTarget(t),this}},KD={getMaxInputRowTitleWidth(){return this.childrenMap.panel.getMaxInputRowTitleWidth()+this.getInnerPadding("left")},setInputRowTitleWidth(t){return t-=this.getInnerPadding("left"),this.childrenMap.panel.setInputRowTitleWidth(t),this}};class JD extends J_{constructor(t,e){super(t,e),this.type="rexTweaker.Scrollable"}setTitle(t){var e=this.childrenMap.header;return t.title||t.icon?e.show().setTitle(t):e.hide(),this}}Object.assign(JD.prototype,$D,KD);const qD=Phaser.Utils.Objects.GetValue,ZD=Phaser.Utils.Objects.GetValue,QD=Phaser.Utils.Objects.GetValue;var tj={setupBinding(){return this.childrenMap.inputField.on("valuechange",(function(t){this.autoUpdateEnable&&this.setTargetValue(t)}),this),this},setAutoUpdateEnable(t){return void 0===t&&(t=!0),this.autoUpdateEnable=t,this},setBindingTarget(t,e){this.bindingTarget=t,void 0!==e&&this.setBindingTargetKey(e),this.syncTargetValue();var i=this.childrenMap.inputField;return i.onBindTarget&&i.onBindTarget(t,e),this},setBindingTargetKey(t){return this.bindTargetKey=t,this},setValueCallbacks(t){return this.onGetValue=QD(t,"onGetValue"),this.onSetValue=QD(t,"onSetValue"),this},getTargetValue(){if(this.bindingTarget)return null!=this.bindTargetKey?this.bindingTarget[this.bindTargetKey]:this.onGetValue?this.onGetValue(this.bindingTarget):void 0},setTargetValue(t){return this.bindingTarget?null!=this.bindTargetKey?(this.bindingTarget[this.bindTargetKey]=t,this):(this.onSetValue&&this.onSetValue(this.bindingTarget,t),this):this},syncTargetValue(){if(!this.bindingTarget)return this;var t=this.childrenMap.inputField;return t.syncValue&&t.syncValue(this.getTargetValue()),this}},ej={startMonitorTarget(){return this.isMonitoring||(this.isMonitoring=!0,this.scene.events.on("postupdate",this.onMonitorTarget,this)),this},stopMonitorTarget(){return this.isMonitoring?(this.isMonitoring=!1,this.scene.events.off("postupdate",this.onMonitorTarget,this),this):this},onMonitorTarget(){if(this.bindingTarget){var t=this.getTargetValue(),e=this.childrenMap.inputField;e.value!==t&&e.syncValue(t)}}},ij={getMinTitleWidth(){var t=this.childrenMap.title;if(!t||0!==t.orientation)return 0;var e=t.rexSizer.padding;return this.getChildWidth(this.childrenMap.title)+(e.left+e.right)*t.scaleX+this.getInnerPadding("left")},setMinTitleWidth(t){var e=this.childrenMap.title;if(!e||0!==e.orientation)return this;var i=e.rexSizer.padding;return t-=(i.left+i.right)*e.scaleX,e.minWidth=t,this}};const sj=Phaser.Utils.Objects.GetValue;class rj extends Ww{constructor(t,e){super(t,e),this.type="rexTweaker.InputRow",this.bindingTarget=void 0,this.bindTargetKey=void 0,this.autoUpdateEnable=!0;var i,s=e.inputTitle,r=e.inputField,n=e.background,a=sj(e,"proportion.title",0),o=sj(e,"space.title",0);i=0===this.orientation?{right:o}:{bottom:o},this.add(s,{proportion:a,expand:!0,padding:i});var h=r.defaultProportion;void 0===h&&(h=e.defaultExpandWidth?1:0),a=sj(e,"proportion.inputField",h),this.add(r,{proportion:a,expand:!0}),n&&this.addBackground(n),this.addChildrenMap("title",s),this.addChildrenMap("inputField",r),this.addChildrenMap("background",n),this.setupBinding()}destroy(t){this.scene&&!this.ignoreDestroy&&(this.stopMonitorTarget(),super.destroy(t))}setTitle(t){return this.childrenMap.title.setTitle(t),this}preLayout(){var t=this.childrenMap.title;t&&(t.minWidth=0),super.preLayout()}}Object.assign(rj.prototype,tj,ej,ij);var nj=function(t,e,i){var s=new kD(t,i);return t.add.existing(s),s},aj=function(t){return void 0===t&&(t=Ww),class extends t{get bindingTarget(){return this.getParentSizer().bindingTarget}get bindingKey(){return this.getParentSizer().bindTargetKey}get value(){return this._value}get root(){return this.getParentSizer().getParentSizer().root}onBindTarget(t,e){this.onBindTargetCallback&&this.onBindTargetCallback(this,t,e)}validate(t){return!(!this.syncValueFlag&&this.validateCallback)||this.validateCallback(t,this._value,this.bindingTarget,this.bindingKey)}getFotmatText(t){return t=this.textFormatCallback?this.textFormatCallback(t):t.toString()}set value(t){if(this._value!==t&&(this.validate(t)||(t=this._value),this.filterValueCallback&&(t=this.filterValueCallback(this,t)),this.displayValueCallback&&this.displayValueCallback(this,t),this._value!==t)){var e=this._value;if(this._value=t,!this.syncValueFlag){var i=this.bindingTarget,s=this.bindingKey;this.emit("valuechange",t,e,i,s),this.root.emit("valuechange",t,e,i,s)}}}getValue(){return this.value}setValue(t){return this.value=t,this}syncValue(t){return this.syncValueFlag=!0,this.value=t,this.syncValueFlag=!1,this}setup(t,e){return void 0===e&&(e=!1),(e||t.hasOwnProperty("format"))&&this.setTextFormatCallback(t.format),(e||t.hasOwnProperty("onValidate"))&&this.setValidateCallback(t.onValidate),this.setupCallback&&this.setupCallback(this,t,e),this}setSetupCallback(t){return this.setupCallback=t,this}setFilterValueCallback(t){return this.filterValueCallback=t,this}setDisplayValueCallback(t){return this.displayValueCallback=t,this}setOnBindTargetCallback(t){return this.onBindTargetCallback=t,this}setTextFormatCallback(t){return this.textFormatCallback=t,this}setValidateCallback(t){return this.validateCallback=t,this}}},oj=function(t,e,i){for(var s,r=this.inputHandlers,n=0,a=r.length;n0?0:1,0===n.minWidth&&n.setMinWidth(this.itemWidth)),0===n.minHeight&&n.setMinHeight(this.itemHeight),this.add(n,{proportion:r,expand:!0})),i.onValueChange&&n.childrenMap.inputField.on("valuechange",i.onValueChange),n.setAutoUpdateEnable(i.autoUpdate),n.setBindingTarget(t,e),i.monitor&&n.startMonitorTarget(),i.key&&this.root.addChildrenMap(i.key,n),this):(console.error(`[Tweaker] Can't add Input\n title: ${i.title}\n view: ${i.view}\n`),this)},addButtons:function(t){void 0===t&&(t={});var e=this.scene,i=t.bindingTarget;delete t.bindingTarget;var s=pj(this.styles,"inputRow")||{},r=uj(e,t,s);return this.add(r,{expand:!0}),i&&r.setBindingTarget(i),t.key&&this.root.addChildrenMap(t.key,r),this},addButton:function(t){return void 0===t&&(t={}),t.buttons=[{label:t.label,callback:t.callback}],delete t.label,delete t.callback,this.addButtons(t),this},addSeparator:function(t){void 0===t&&(t={});var e=function(t,e,i){return AP(t,SD(e,i))}(this.scene,t,gj(this.styles,"separator"));return this.add(e,{expand:!0}),this},addRows:function(t,e,s){return"boolean"==typeof e&&(s=e,e=void 0),void 0===s&&(s=!0),vj(this,i(t),e,s),this},setBindingTarget:function(t){for(var e=this.sizerChildren,i=0,s=e.length;it.hasOwnProperty("view")?"string"===t.view:"string"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.TextInput";var s=e.inputText,r=uE(i,s);t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))}},xj={name:"TextAreaInput",accept:t=>!!t.hasOwnProperty("view")&&"textarea"===t.view,build(t,e){var s=t.scene;this.type="rexTweaker.TextAreaInput";var r=e.inputTextArea;void 0===r&&(r={}),r.hasOwnProperty("text")||(r.text=e.inputText),r.hasOwnProperty("slider")||(r.slider=e.slider);var n=function(t,e,s){void 0===s&&(s=!0),s?e=e?i(e):{}:e||(e={});var r=new jB(t,e);return t.add.existing(r),r}(s,r);t.add(n,{proportion:1,expand:!0,key:"inputText"}),n.on("close",(function(){t.setValue(n.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))},onBindTarget(t){t.childrenMap.inputText.scrollToTop()}},Cj={name:"NumberInput",accept:t=>t.hasOwnProperty("view")?"number"===t.view:"number"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.NumberInput";var s=e.inputNumber||e.inputText,r=uE(i,s).setNumberInput();t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly),t.isFloatType=!e.int},filterValue:(t,e)=>t.isFloatType?e:Math.floor(e),displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))}};const kj=Phaser.Utils.Objects.GetValue,wj=Phaser.Math.Linear,Sj=Phaser.Math.Snap.Floor;var Pj={name:"RangeInput",accept:t=>t.hasOwnProperty("view")?"range"===t.view:"number"==typeof t.value&&t.hasOwnProperty("min")&&t.hasOwnProperty("max"),build(t,e){var i=t.scene;t.type="rexTweaker.RangeInput";var s=e.slider,r=0===t.orientation?"track.height":"track.width",n=kj(s,r),a=function(t,e){var i=new uT(t,e);return t.add.existing(i),i}(i,s),o=e.defaultExpandWidth?2:0,h=kj(e,"proportion.range.slider",o),l=void 0===n;t.add(a,{proportion:h,expand:l,key:"slider"});var d=e.inputNumber||e.inputText,c=uE(i,d).setNumberInput();o=e.defaultExpandWidth?1:0,h=kj(e,"proportion.range.inputText",o),t.add(c,{proportion:h,expand:!0,key:"inputText"}),c.on("close",(function(){t.setValue(c.value)})),a.on("valuechange",(function(){var e=wj(t.minValue,t.maxValue,a.value);t.step&&(e=Sj(e,t.step,t.minValue)),t.setValue(e)}))},setup(t,e,i){(i||e.hasOwnProperty("max"))&&function(t,e,i,s){t.minValue=e,t.maxValue=i,t.step=s,t.childrenMap.slider.setGap(s,e,i)}(t,e.min,e.max,e.step),(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.slider.setValue(e,t.minValue,t.maxValue),t.childrenMap.inputText.setText("").setText(t.getFotmatText(e))}},Tj=function(t,e){var i=new uM(t,e);return t.add.existing(i),i};const Oj=Phaser.Utils.Objects.GetValue;var Mj={name:"RangeInput",accept:t=>!!t.hasOwnProperty("view")&&"incdec"===t.view,build(t,e){var s=t.scene;t.type="rexTweaker.IncDecInput";var r=Oj(e,"incDec")||{},n={text:null,action:null},a=Tj(s,{expand:!1}),o=e.defaultExpandWidth?1:0;t.add(a,{proportion:o,expand:!0});var h=e.inputNumber||e.inputText,l=uE(s,h).setNumberInput();l.on("close",(function(){t.setValue(l.value)}));var d=Object.assign(i(n),r.incButton||{}),c=XM(s,d),u=Object.assign(i(n),r.decButton||{}),p=XM(s,u);a.addButton(c),a.addButton(p);var g=r.inputTextIndex||0;a.insert(g,l,{proportion:1,expand:!0}),t.step=1,t.minValue=void 0,t.maxValue=void 0,a.on("button.click",(function(e,i,s,r){var n=t.value;0===i?n+=t.step:n-=t.step,void 0!==t.maxValue&&n>t.maxValue&&(n=t.maxValue),void 0!==t.minValue&&n!!t.hasOwnProperty("view")&&"color"===t.view,build(t,e){var s=t.scene;t.type="rexTweaker.ColorInput";var r=e.colorInput;void 0===r&&(r={}),r.hasOwnProperty("inputText")||(r.inputText=e.inputText);var n=function(t,e,s){void 0===s&&(s=!0),s?e=e?i(e):{}:e||(e={});var r=new ZI(t,e);return t.add.existing(r),r}(s,r);t.add(n,{proportion:1,expand:!0,key:"colorInput"}),n.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.colorInput.setValue(e)}},_j={name:"CheckboxInput",accept:t=>t.hasOwnProperty("view")?"boolean"===t.view:"boolean"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.CheckboxInput";var s=e.checkbox,r=function(t,e){var i=new vu(t,e);return t.add.existing(i),i}(i,s),n=s.size;void 0!==n&&r.setSize(n,n);var a=void 0!==n?0:1;t.add(r,{proportion:0,expand:!1,fitRatio:a,key:"checkbox"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.checkbox.setValue(e)}},Rj={name:"ToggleSwitchInput",accept:t=>!!t.hasOwnProperty("view")&&"toggleSwitch"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.ToggleSwitchInput";var s=e.toggleSwitch,r=function(t,e){var i=new Eu(t,e);return t.add.existing(i),i}(i,s),n=s.size;void 0!==n&&r.setSize(n,n);var a=void 0!==n?0:1;t.addSpace().add(r,{proportion:0,expand:!1,fitRatio:a,key:"toggleSwitch"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.toggleSwitch.setValue(e)}},Lj=function(t,e){for(var i=0,s=t.length;it.hasOwnProperty("view")?"list"===t.view:t.hasOwnProperty("options"),build(t,e){var i=t.scene;t.type="rexTweaker.ListInput";var s=function(t,e){e=cR(t,e);var i=new dR(t,e);return t.add.existing(i),i}(i,e.list);t.add(s,{proportion:1,expand:!0,key:"list"}),s.on("button.click",(function(e,i,s,r,n,a){t.setValue(s.value)}))},setup(t,e,i){(i||e.hasOwnProperty("options"))&&function(t,e){t.childrenMap.list.setOptions(e)}(t,e.options)},displayValue(t,e){var i=t.childrenMap.list,s=function(t,e){var i=Lj(t,e);if(null!=i)return t[i]}(i.options,e);i.resetDisplayContent(s).setMinSize(i.width,i.height).layout().setMinSize(0,0)}};const Ij=Phaser.Utils.Objects.GetValue;var Dj={name:"ButtonsInput",accept:t=>!!t.hasOwnProperty("view")&&"buttons"===t.view,build(t,e){var s=t.scene;t.type="rexTweaker.ButtonsInput";var r=e.button?i(e.button):{},n=Ij(r,"expand",!0);n&&(r.align="center"),delete r.expand;var a=Tj(s,{expand:n});a.buttonConfig=r,t.add(a,{proportion:1,expand:!0,key:"list"}),a.on("button.click",(function(e,i,s,r){var n=a.options[i];n&&(t._selectedIndex=i,t.setValue(n.value),t._selectedIndex=void 0)}))},setup(t,e,i){(i||e.hasOwnProperty("options"))&&function(t,e){var i=t.childrenMap.list;i.options=e;var s=t.scene,r=i.buttonConfig;i.clearButtons(!0);for(var n=0,a=e.length;nr?n:-n),d.localY=u+(c>s?a:-a)}};const aA=Phaser.Utils.Objects.IsPlainObject,oA=Phaser.Utils.Objects.GetValue,hA=Phaser.Math.DegToRad,lA=Phaser.Math.RadToDeg;class dA extends rA{constructor(t,e,i,s,r){if(aA(e)){var n=e;e=oA(n,"x",0),i=oA(n,"y",0),s=oA(n,"key",null),r=oA(n,"frame",null)}super(t,e,i,s,r),this.type="rexSkewmage",this._skewX=0,this._skewY=0}get skewX(){return this._skewX}set skewX(t){this._skewX=t,nA(this,this._skewX,this._skewY)}get skewXDeg(){return lA(this._skewX)}set skewXDeg(t){this.skewX=hA(t)}get skewY(){return this._skewY}set skewY(t){this._skewY=t,nA(this,this._skewX,this._skewY)}get skewYDeg(){return lA(this._skewY)}set skewYDeg(t){this.skewY=hA(t)}setSkewX(t){return this.skewX=t,this}setSkewY(t){return this.skewY=t,this}setSkew(t,e){return void 0===e&&(e=t),this.skewX=t,this.skewY=e,this}setSkewXDeg(t){return this.skewXDeg=t,this}setSkewYDeg(t){return this.skewYDeg=t,this}setSkewDeg(t,e){return void 0===e&&(e=t),this.skewXDeg=t,this.skewYDeg=e,this}}const cA=Phaser.Utils.Objects.IsPlainObject,uA=Phaser.Utils.Objects.GetValue;class pA extends dA{constructor(t,e,i,s,r){if(cA(e)){var n=e;e=uA(n,"x",0),i=uA(n,"y",0),s=uA(n,"width",32),r=uA(n,"height",32)}super(t,e,i,hL(t,s,r),null),this.type="rexSkewRenderTexture",this.rt=this.texture}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.rt.destroy(),this.rt=null)}}class gA extends(BL(pA)){get skewState(){return this.isRunning}}t.register("skew",(function(t,e){return new gA(t,e)})),P(window,"RexPlugins.UI.Skew",gA),t.register("anchor",(function(t,e){return new pf(t,e)})),P(window,"RexPlugins.UI.Anchor",pf),t.register("textTyping",(function(t,e){return new MR(t,e)})),P(window,"RexPlugins.UI.TextTyping",MR),t.register("textPage",(function(t,e){return new bR(t,e)})),P(window,"RexPlugins.UI.TextPage",bR);var vA=void 0;const fA=Phaser.Utils.Objects.GetValue,mA=Phaser.Utils.Objects.Clone;var yA=function(t){return t.hasOwnProperty("align")?t.align:t.hasOwnProperty("halign")?t.halign:"left"};const bA=Phaser.Utils.Objects.GetValue,xA=Phaser.Utils.Objects.Merge;var CA={open:function(t,e){var i;void 0===t&&(t={}),t=xA(t,this.openConfig),(i=this)!==vA&&(void 0!==vA&&vA.close(),vA=i),Fm(t)&&(e=t,t=void 0);var s=bA(t,"inputType",void 0);void 0===s&&(s=bA(t,"type","text")),void 0===e&&(e=bA(t,"onClose",void 0));var r=bA(t,"onOpen",void 0),n=bA(t,"onTextChanged",void 0);return this.inputText=function(t,e){void 0===e&&(e={}),e=mA(e);var i=t.scene,s=t.style,r=fA(e,"backgroundColor",s.backgroundColor);null===r&&(r="transparent"),e.text=fA(e,"text",t.text),e.fontFamily=fA(e,"fontFamily",s.fontFamily),e.fontSize=fA(e,"fontSize",s.fontSize),e.color=fA(e,"color",s.color),e.backgroundColor=r,e.direction=fA(e,"rtl",s.rtl)?"rtl":"ltr",e.align=fA(e,"align",yA(s)),"rtl"===e.direction&&$w(t)&&(e.align="right");var n=t.padding;n.left>0&&(e.paddingLeft=`${n.left}px`),n.right>0&&(e.paddingRight=`${n.right}px`),s.backgroundCornerRadius&&(e.borderRadius=fA(e,"borderRadius",`${s.backgroundCornerRadius}px`));var a=new qk(i,t.x,t.y,fA(e,"width",t.width),fA(e,"height",t.height),e);a.setScale(t.scaleX,t.scaleY).setOrigin(t.originX,t.originY).setScrollFactor(t.scrollFactorX,t.scrollFactorY);var o=t.parentContainer;return o?o.add(a):i.add.existing(a),a}(this.parent,t).on("textchange",(function(t){var e=t.text;n?n(this.parent,e):this.parent.text=e}),this).setFocus(),this.parent.setVisible(!1),this.onClose=e,bA(t,"enterClose","textarea"!==s)&&this.scene.input.keyboard.once("keydown-ENTER",this.close,this),this.delayCall=function(t,e,i){return t.time.delayedCall(0,e,[],i)}(this.scene,(function(){this.scene.input.once("pointerdown",this.close,this),r&&r(this.parent),this.emit("open",this.parent)}),this),this},close:function(){return this===vA&&(vA=void 0),this.parent.setVisible(!0),this.inputText&&(this.inputText.destroy(),this.inputText=void 0),this.delayCall&&(this.delayCall.remove(),this.delayCall=void 0),this.scene.input.keyboard.off("keydown-ENTER",this.close,this),this.scene.input.off("pointerdown",this.close,this),this.onClose&&this.onClose(this.parent),this.emit("close",this.parent),this}};const kA=Phaser.Utils.Objects.GetValue;class wA extends Ba{constructor(t,e){super(t),this.inputText=void 0,this.onClose=void 0,this.delayCall=void 0,this.setOpenConfig(e),kA(e,"clickEnable",!0)&&t.on("pointerdown",(function(){this.open()}),this).setInteractive()}shutdown(t){this.isShutdown||(this.close(),super.shutdown(t))}setOpenConfig(t){return void 0===t&&(t={}),this.openConfig=t,this}get isOpened(){return void 0!==this.inputText}get text(){return this.isOpened?this.inputText.text:this.parent.text}}Object.assign(wA.prototype,CA),t.register("textEdit",(function(t,e){return new wA(t,e)})),P(window,"RexPlugins.UI.TextEdit",wA),t.register("layerManager",(function(t){return new Ea(this.scene,t)})),P(window,"RexPlugins.UI.LayerManager",Ea);class SA extends Phaser.Plugins.ScenePlugin{constructor(e,i){super(e,i),this.add=new t(e)}boot(){this.scene.events.on("destroy",this.destroy,this)}destroy(){this.add.destroy(),super.destroy()}isInTouching(t,e,i,s){return!!t.visible&&Hm(t,e,i,s)}get viewport(){return ha(this.scene,this.scene.cameras.main,!0)}}var PA={getParentSizer:tg,getTopmostSizer:eg,removeFromParent:fE,hide:am,show:nm,isShown:om,confirmAction:nE,edit:function(t,e,i){return t._edit||(t._edit=new wA(t,{clickEnable:!1})),t._edit.open(e,i),t._edit},wrapExpandText:eS,fontSizeExpandText:hS,fontSizeResize:sS,setFontSizeToFitWidth:sS,waitEvent:al,waitComplete:ol,delayPromise:tw,setChildrenInteractive:zb,fadeIn:_f,fadeOutDestroy:Rf,easeMoveTo:Xf,easeMoveFrom:Wf,modal:Am,modalPromise:function(t,e){var i=Am(t,e);return new Promise((function(t,e){i.once("close",(function(e){t(e)}))}))},modalClose:zm,requestDrag:QI,openFileChooser:rw};return Object.assign(SA.prototype,PA),SA},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rexuiplugin=e(); diff --git a/plugin-list.js b/plugin-list.js index bf4d37c6f5..25e7d844af 100644 --- a/plugin-list.js +++ b/plugin-list.js @@ -16,6 +16,7 @@ module.exports = { 'gridtableplugin': './plugins/gridtable-plugin.js', 'roundrectangleplugin': './plugins/roundrectangle-plugin.js', 'quadshapeplugin': './plugins/quadshape-plugin.js', + 'lineshapeplugin': './plugins/lineshape-plugin.js', 'customshapesplugin': './plugins/customshapes-plugin.js', 'circularprogressplugin': './plugins/circularprogress-plugin.js', 'lineprogressplugin': './plugins/lineprogress-plugin.js',